]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.impl/src/org/simantics/db/impl/internal/RandomAccessValueSupport.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / internal / RandomAccessValueSupport.java
1 package org.simantics.db.impl.internal;
2
3 import java.util.Collection;
4
5 import org.simantics.db.ExternalValueSupport;
6 import org.simantics.db.Resource;
7 import org.simantics.db.Session;
8 import org.simantics.utils.datastructures.Pair;
9
10 /**
11  * A database {@link Session} service for registering and retrieving random
12  * access binary instances related to a session.
13  * 
14  * <p>
15  * This service is internal to the implementation and must not be used
16  * elsewhere.
17  * </p>
18  * 
19  * @author Tuukka Lehtonen
20  * 
21  * @see ExternalValueSupport
22  */
23 public interface RandomAccessValueSupport {
24
25         /**
26          * Registers the specified value with the specified resource.
27          * 
28          * @param resource
29          * @param data
30          * @throws IllegalStateException
31          *             if a previous registration already exists for the specified
32          *             resource
33          */
34         void put(Resource resource, ResourceData data);
35
36         /**
37          * @param Resource
38          * @return currently registered value attached to the specified resource
39          */
40         ResourceData get(Resource resource);
41
42         /**
43          * @return currently registered entries
44          */
45         Collection<Pair<Resource, ResourceData>> entries();
46
47         /**
48          * Removes all value registrations from this registry.
49          * 
50          * @return the set of previously registered values
51          */
52         Collection<Pair<Resource, ResourceData>> removeAll();
53
54 }