]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/internal/RandomAccessValueSupport.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / internal / RandomAccessValueSupport.java
diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/internal/RandomAccessValueSupport.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/internal/RandomAccessValueSupport.java
new file mode 100644 (file)
index 0000000..a865558
--- /dev/null
@@ -0,0 +1,54 @@
+package org.simantics.db.impl.internal;\r
+\r
+import java.util.Collection;\r
+\r
+import org.simantics.db.ExternalValueSupport;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.Session;\r
+import org.simantics.utils.datastructures.Pair;\r
+\r
+/**\r
+ * A database {@link Session} service for registering and retrieving random\r
+ * access binary instances related to a session.\r
+ * \r
+ * <p>\r
+ * This service is internal to the implementation and must not be used\r
+ * elsewhere.\r
+ * </p>\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ * \r
+ * @see ExternalValueSupport\r
+ */\r
+public interface RandomAccessValueSupport {\r
+\r
+       /**\r
+        * Registers the specified value with the specified resource.\r
+        * \r
+        * @param resource\r
+        * @param data\r
+        * @throws IllegalStateException\r
+        *             if a previous registration already exists for the specified\r
+        *             resource\r
+        */\r
+       void put(Resource resource, ResourceData data);\r
+\r
+       /**\r
+        * @param Resource\r
+        * @return currently registered value attached to the specified resource\r
+        */\r
+       ResourceData get(Resource resource);\r
+\r
+       /**\r
+        * @return currently registered entries\r
+        */\r
+       Collection<Pair<Resource, ResourceData>> entries();\r
+\r
+       /**\r
+        * Removes all value registrations from this registry.\r
+        * \r
+        * @return the set of previously registered values\r
+        */\r
+       Collection<Pair<Resource, ResourceData>> removeAll();\r
+\r
+}\r