]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.management/src/org/simantics/db/management/ISessionContextProviderSource.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.management / src / org / simantics / db / management / ISessionContextProviderSource.java
diff --git a/bundles/org.simantics.db.management/src/org/simantics/db/management/ISessionContextProviderSource.java b/bundles/org.simantics.db.management/src/org/simantics/db/management/ISessionContextProviderSource.java
new file mode 100644 (file)
index 0000000..6c03378
--- /dev/null
@@ -0,0 +1,62 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db.management;\r
+\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public interface ISessionContextProviderSource {\r
+\r
+    /**\r
+     * @param context the context object of the requested ISessionContextProvider\r
+     * @return <code>null</code> if there is no provider for the specified context\r
+     */\r
+    ISessionContextProvider get(Object context);\r
+\r
+    /**\r
+     * @return the currently active session context provider. Must always return\r
+     *         a valid provider.\r
+     */\r
+    ISessionContextProvider getActive();\r
+\r
+    /**\r
+     * @return all currently existing session context providers \r
+     */\r
+    ISessionContextProvider[] getAll();\r
+\r
+    /**\r
+     * Used for manually installing ISessionContextProvider for a specified\r
+     * context handle object.\r
+     * \r
+     * @param context the context handle to associate the session context\r
+     *        provider to. This same argument needs to be used with\r
+     *        {@link #get(Object)} when retrieving your session context\r
+     *        provider.\r
+     * @param provider the session context provider to associate with the\r
+     *        specified context\r
+     */\r
+    void put(Object context, ISessionContextProvider provider);\r
+\r
+    /**\r
+     * Used for manually removing an (context, provider) association from this\r
+     * source. Only associations created with\r
+     * {@link #put(Object, ISessionContextProvider)} can be removed with this\r
+     * method.\r
+     * \r
+     * @param context the context handle to associate the session context\r
+     *        provider to.\r
+     * @return the dissociated session context provider\r
+     */\r
+    ISessionContextProvider remove(Object context);\r
+    \r
+}\r