]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.management/src/org/simantics/db/management/ISessionContext.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.management / src / org / simantics / db / management / ISessionContext.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 import java.util.concurrent.TimeoutException;\r
15 \r
16 import org.simantics.db.Session;\r
17 import org.simantics.utils.datastructures.disposable.IDisposable;\r
18 import org.simantics.utils.datastructures.hints.IHintContext;\r
19 \r
20 /**\r
21  * A container for a database session. Also hosts a hint context that can be\r
22  * used to carry arbitrary values around. A server activation can be attached to\r
23  * an ISessionContext for information value only - ISessionContext will never\r
24  * dispose or do anything else with it.\r
25  * \r
26  * <p>\r
27  * Disposal of an ISessionContext closes the session contained by this context.\r
28  * Further use of this context is prohibited.\r
29  * </p>\r
30  * \r
31  * @author Tuukka Lehtonen\r
32  */\r
33 public interface ISessionContext extends IDisposable, IHintContext {\r
34 \r
35     void close() throws IllegalStateException, InterruptedException, TimeoutException;\r
36 \r
37 //    /**\r
38 //     * @return the socket address this session is connected to\r
39 //     */\r
40 //    IServerAddress getAddress();\r
41 \r
42     /**\r
43      * @return the database session contained by this context\r
44      * @throws IllegalStateException if this context has been disposed\r
45      */\r
46     Session getSession();\r
47 \r
48     /**\r
49      * @return the database session contained by this context or\r
50      *         <code>null</code> if session context has already been disposed.\r
51      */\r
52     Session peekSession();\r
53 \r
54 }\r