]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/service/ManagementSupport.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / service / ManagementSupport.java
index d7e933895732d87b3649564b64d7491ae9e16d9d..9bea0c4198f6b623a27dae50f608040bfef0ed1f 100644 (file)
-/*******************************************************************************\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 java.util.Collection;\r
-\r
-import org.simantics.db.ChangeSet;\r
-import org.simantics.db.ChangeSetIdentifier;\r
-import org.simantics.db.Metadata;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-public interface ManagementSupport {\r
-\r
-    /**\r
-     * Get change sets from server.\r
-     * IMPORTANT WARNING:\r
-     * Due to implementation deficiencies the returned collections\r
-     * changesStatements and changesValues do not implement the collection\r
-     * interface. All you can do is to iterate the collections.\r
-     * Also note that the current interface does not offer a way to access\r
-     * the changed values. (The implementation does not even store the changed\r
-     * values. The used implementation for change set is ClientChangesImpl\r
-     * because it's backed to disk and change set can be large. ClientChangeSetImpl\r
-     * would offer a better implementation of collections but is not suitable for\r
-     * large change sets.)\r
-     *\r
-     * @param graph to ensure that we have a read transaction.\r
-     * @return ChangeSets for given inclusive range [from, to].\r
-     * @throws DatabaseException\r
-     */\r
-    public Collection<ChangeSet> fetchChangeSets(ReadGraph graph, long from, long to)\r
-            throws DatabaseException;\r
-\r
-    /**\r
-     * Get information about change sets in server.\r
-     *\r
-     * @return ChangeSetIdentifiers for given inclusive range [from, to].\r
-     * @throws DatabaseException\r
-     */\r
-    Collection<ChangeSetIdentifier> getChangeSetIdentifiers(long from, long to)\r
-            throws DatabaseException;\r
-\r
-    /**\r
-     * Get information about change sets in server.\r
-     *\r
-     * @return Metadata objects for given change set for the inclusive range\r
-     *         [from, to].\r
-     * @throws DatabaseException\r
-     */\r
-    <T> Collection<T> getMetadata(long from, long to, Class<? extends Metadata> dataClass)\r
-            throws DatabaseException;\r
-\r
-    /**\r
-     * Get meta information about changes sets in server. This was implemented\r
-     * before the {@link #getMetadata(long, long, Class)} and was left for\r
-     * backward compatibility. Prefer {@link #getMetadata(long, long, Class)}.\r
-     *\r
-     * @return Metadata objects for given change set for the inclusive range\r
-     *         [from, to].\r
-     * @throws DatabaseException\r
-     */\r
-    <T> Collection<T> getMetadata(ReadGraph graph, long from, long to, Class<? extends Metadata> dataClass)\r
-            throws DatabaseException;\r
-\r
-    /**\r
-     * Create and save to file selected revision in server.\r
-     * @return\r
-     * @throws DatabaseException\r
-     */\r
-    void dumpRevision(long changeSetId)\r
-            throws DatabaseException;\r
-\r
-    /**\r
-     * Save change sets to file up to selected revision in server.\r
-     * @return\r
-     * @throws DatabaseException\r
-     */\r
-    void dumpChangeSets(long changeSetId)\r
-            throws DatabaseException;\r
-\r
-    /**\r
-     * Get head revision id.\r
-     * @return last revision id.\r
-     * @throws DatabaseException\r
-     */\r
-    long getHeadRevisionId()  throws DatabaseException;\r
-\r
-    /**\r
-     * Get first revision id that is or will be available when next revision is created.\r
-     *\r
-     * @return first revision id.\r
-     * @throws DatabaseException\r
-     */\r
-    long getFirstRevisionId() throws DatabaseException;\r
-\r
-    interface ChangeSetListener {\r
-        void onChanged(long headChangeSetId);\r
-    }\r
-    void subscribe(ChangeSetListener changeSetListener);\r
-    void cancel(ChangeSetListener changeSetListener);\r
-\r
-    /**\r
-     * Get information about change sets in server. This was implemented before\r
-     * {@link #getChangeSetIdentifiers(long, long)} and was left for backward\r
-     * compatibility. Prefer {@link #getChangeSetIdentifiers(long, long)}.\r
-     * This will be removed soon.\r
-     *\r
-     * @return ChangeSetIdentifiers for given inclusive range [from, to].\r
-     * @throws DatabaseException\r
-     */\r
-    @Deprecated\r
-    Collection<ChangeSetIdentifier> getChangeSets(long from, long to)\r
-            throws DatabaseException;\r
-\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 java.util.Collection;
+
+import org.simantics.db.ChangeSet;
+import org.simantics.db.ChangeSetIdentifier;
+import org.simantics.db.Metadata;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+
+public interface ManagementSupport {
+
+    /**
+     * Get change sets from server.
+     * IMPORTANT WARNING:
+     * Due to implementation deficiencies the returned collections
+     * changesStatements and changesValues do not implement the collection
+     * interface. All you can do is to iterate the collections.
+     * Also note that the current interface does not offer a way to access
+     * the changed values. (The implementation does not even store the changed
+     * values. The used implementation for change set is ClientChangesImpl
+     * because it's backed to disk and change set can be large. ClientChangeSetImpl
+     * would offer a better implementation of collections but is not suitable for
+     * large change sets.)
+     *
+     * @param graph to ensure that we have a read transaction.
+     * @return ChangeSets for given inclusive range [from, to].
+     * @throws DatabaseException
+     */
+    public Collection<ChangeSet> fetchChangeSets(ReadGraph graph, long from, long to)
+            throws DatabaseException;
+
+    /**
+     * Get information about change sets in server.
+     *
+     * @return ChangeSetIdentifiers for given inclusive range [from, to].
+     * @throws DatabaseException
+     */
+    Collection<ChangeSetIdentifier> getChangeSetIdentifiers(long from, long to)
+            throws DatabaseException;
+
+    /**
+     * Get information about change sets in server.
+     *
+     * @return Metadata objects for given change set for the inclusive range
+     *         [from, to].
+     * @throws DatabaseException
+     */
+    <T> Collection<T> getMetadata(long from, long to, Class<? extends Metadata> dataClass)
+            throws DatabaseException;
+
+    /**
+     * Get meta information about changes sets in server. This was implemented
+     * before the {@link #getMetadata(long, long, Class)} and was left for
+     * backward compatibility. Prefer {@link #getMetadata(long, long, Class)}.
+     *
+     * @return Metadata objects for given change set for the inclusive range
+     *         [from, to].
+     * @throws DatabaseException
+     */
+    <T> Collection<T> getMetadata(ReadGraph graph, long from, long to, Class<? extends Metadata> dataClass)
+            throws DatabaseException;
+
+    /**
+     * Create and save to file selected revision in server.
+     * @return
+     * @throws DatabaseException
+     */
+    void dumpRevision(long changeSetId)
+            throws DatabaseException;
+
+    /**
+     * Save change sets to file up to selected revision in server.
+     * @return
+     * @throws DatabaseException
+     */
+    void dumpChangeSets(long changeSetId)
+            throws DatabaseException;
+
+    /**
+     * Get head revision id.
+     * @return last revision id.
+     * @throws DatabaseException
+     */
+    long getHeadRevisionId()  throws DatabaseException;
+
+    /**
+     * Get first revision id that is or will be available when next revision is created.
+     *
+     * @return first revision id.
+     * @throws DatabaseException
+     */
+    long getFirstRevisionId() throws DatabaseException;
+
+    interface ChangeSetListener {
+        void onChanged(long headChangeSetId);
+    }
+    void subscribe(ChangeSetListener changeSetListener);
+    void cancel(ChangeSetListener changeSetListener);
+
+    /**
+     * Get information about change sets in server. This was implemented before
+     * {@link #getChangeSetIdentifiers(long, long)} and was left for backward
+     * compatibility. Prefer {@link #getChangeSetIdentifiers(long, long)}.
+     * This will be removed soon.
+     *
+     * @return ChangeSetIdentifiers for given inclusive range [from, to].
+     * @throws DatabaseException
+     */
+    @Deprecated
+    Collection<ChangeSetIdentifier> getChangeSets(long from, long to)
+            throws DatabaseException;
+
+}