]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.management/src/org/simantics/db/management/SingleSessionContextProviderSource.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.management / src / org / simantics / db / management / SingleSessionContextProviderSource.java
1 /*******************************************************************************\r
2  * Copyright (c) 2013 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  * @author Kalle Kondelin\r
16  */\r
17 public class SingleSessionContextProviderSource implements ISessionContextProviderSource {\r
18 \r
19         ISessionContextProvider provider;\r
20 \r
21         public SingleSessionContextProviderSource(ISessionContextProvider provider) {\r
22                 this.provider = provider;\r
23         }\r
24 \r
25         @Override\r
26         public ISessionContextProvider remove(Object context) {\r
27                 throw new java.lang.UnsupportedOperationException();\r
28         }\r
29 \r
30         @Override\r
31         public void put(Object context, ISessionContextProvider provider) {\r
32                 throw new java.lang.UnsupportedOperationException();\r
33         }\r
34 \r
35         @Override\r
36         public ISessionContextProvider[] getAll() {\r
37                 return new ISessionContextProvider[] { provider };\r
38         }\r
39 \r
40         @Override\r
41         public ISessionContextProvider getActive() {\r
42                 return provider;\r
43         }\r
44 \r
45         @Override\r
46         public ISessionContextProvider get(Object context) {\r
47                 return provider;\r
48         }\r
49 \r
50 }\r