]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.management;\r
13 \r
14 \r
15 /**\r
16  * @author Tuukka Lehtonen\r
17  */\r
18 public interface ISessionContextProviderSource {\r
19 \r
20     /**\r
21      * @param context the context object of the requested ISessionContextProvider\r
22      * @return <code>null</code> if there is no provider for the specified context\r
23      */\r
24     ISessionContextProvider get(Object context);\r
25 \r
26     /**\r
27      * @return the currently active session context provider. Must always return\r
28      *         a valid provider.\r
29      */\r
30     ISessionContextProvider getActive();\r
31 \r
32     /**\r
33      * @return all currently existing session context providers \r
34      */\r
35     ISessionContextProvider[] getAll();\r
36 \r
37     /**\r
38      * Used for manually installing ISessionContextProvider for a specified\r
39      * context handle object.\r
40      * \r
41      * @param context the context handle to associate the session context\r
42      *        provider to. This same argument needs to be used with\r
43      *        {@link #get(Object)} when retrieving your session context\r
44      *        provider.\r
45      * @param provider the session context provider to associate with the\r
46      *        specified context\r
47      */\r
48     void put(Object context, ISessionContextProvider provider);\r
49 \r
50     /**\r
51      * Used for manually removing an (context, provider) association from this\r
52      * source. Only associations created with\r
53      * {@link #put(Object, ISessionContextProvider)} can be removed with this\r
54      * method.\r
55      * \r
56      * @param context the context handle to associate the session context\r
57      *        provider to.\r
58      * @return the dissociated session context provider\r
59      */\r
60     ISessionContextProvider remove(Object context);\r
61     \r
62 }\r