X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Finternal%2FRandomAccessValueSupport.java;fp=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Finternal%2FRandomAccessValueSupport.java;h=a86555827710fddaa454529937dea85173495158;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git 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 index 000000000..a86555827 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/internal/RandomAccessValueSupport.java @@ -0,0 +1,54 @@ +package org.simantics.db.impl.internal; + +import java.util.Collection; + +import org.simantics.db.ExternalValueSupport; +import org.simantics.db.Resource; +import org.simantics.db.Session; +import org.simantics.utils.datastructures.Pair; + +/** + * A database {@link Session} service for registering and retrieving random + * access binary instances related to a session. + * + *

+ * This service is internal to the implementation and must not be used + * elsewhere. + *

+ * + * @author Tuukka Lehtonen + * + * @see ExternalValueSupport + */ +public interface RandomAccessValueSupport { + + /** + * Registers the specified value with the specified resource. + * + * @param resource + * @param data + * @throws IllegalStateException + * if a previous registration already exists for the specified + * resource + */ + void put(Resource resource, ResourceData data); + + /** + * @param Resource + * @return currently registered value attached to the specified resource + */ + ResourceData get(Resource resource); + + /** + * @return currently registered entries + */ + Collection> entries(); + + /** + * Removes all value registrations from this registry. + * + * @return the set of previously registered values + */ + Collection> removeAll(); + +}