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