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