-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.db.service;\r
-\r
-import org.simantics.db.SessionManager;\r
-import org.simantics.db.SessionReference;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-public interface LifecycleSupport {\r
-\r
- public enum LifecycleState {\r
- CREATING, ALIVE, CLOSING, CLOSED\r
- }\r
- \r
- public interface LifecycleListener {\r
- void stateChanged(LifecycleState newState);\r
- }\r
- \r
- /**\r
- * Get session reference\r
- * @return session reference\r
- */\r
- SessionReference getSessionReference();\r
-\r
- /**\r
- * @return the SessionManager that created this Session.\r
- */\r
- SessionManager getSessionManager();\r
-\r
- /**\r
- * @return <code>true</code> if session is closed and thus no longer usable\r
- */\r
- boolean isClosing();\r
- boolean isClosed();\r
- \r
- void addListener(LifecycleListener listener);\r
- void removeListener(LifecycleListener listener);\r
-\r
- /**\r
- * Close this database session.\r
- * This should also dispose any Disposable services registered\r
- * into this ServiceLocator.\r
- * \r
- * @param timeout maximum time to wait for prerequisites for close to become true.\r
- * If negative waits indefinitely. If zero polls. Time is given in milliseconds.\r
- * @param force If true close session after timeout even if transactions are still active.\r
- * If false throws TimeoutException if transactions are still active.\r
- * @throws DatabaseException\r
- */\r
- void close(long timeout, boolean force)\r
- throws DatabaseException;\r
-\r
- /**\r
- * Same as close(0, false).\r
- */\r
- void close()\r
- throws DatabaseException;\r
-\r
- /**\r
- * \r
- * @return identifier that can be used to reconnect if the session was\r
- * not closed gracefully. SessionManagerSource.NullSessionId if closed\r
- * gracefully.\r
- */\r
- long getId();\r
-\r
- void ping()\r
- throws DatabaseException;\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.service;
+
+import org.simantics.db.SessionManager;
+import org.simantics.db.SessionReference;
+import org.simantics.db.exception.DatabaseException;
+
+public interface LifecycleSupport {
+
+ public enum LifecycleState {
+ CREATING, ALIVE, CLOSING, CLOSED
+ }
+
+ public interface LifecycleListener {
+ void stateChanged(LifecycleState newState);
+ }
+
+ /**
+ * Get session reference
+ * @return session reference
+ */
+ SessionReference getSessionReference();
+
+ /**
+ * @return the SessionManager that created this Session.
+ */
+ SessionManager getSessionManager();
+
+ /**
+ * @return <code>true</code> if session is closed and thus no longer usable
+ */
+ boolean isClosing();
+ boolean isClosed();
+
+ void addListener(LifecycleListener listener);
+ void removeListener(LifecycleListener listener);
+
+ /**
+ * Close this database session.
+ * This should also dispose any Disposable services registered
+ * into this ServiceLocator.
+ *
+ * @param timeout maximum time to wait for prerequisites for close to become true.
+ * If negative waits indefinitely. If zero polls. Time is given in milliseconds.
+ * @param force If true close session after timeout even if transactions are still active.
+ * If false throws TimeoutException if transactions are still active.
+ * @throws DatabaseException
+ */
+ void close(long timeout, boolean force)
+ throws DatabaseException;
+
+ /**
+ * Same as close(0, false).
+ */
+ void close()
+ throws DatabaseException;
+
+ /**
+ *
+ * @return identifier that can be used to reconnect if the session was
+ * not closed gracefully. SessionManagerSource.NullSessionId if closed
+ * gracefully.
+ */
+ long getId();
+
+ void ping()
+ throws DatabaseException;
+}