]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/AsyncRequestProcessor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / AsyncRequestProcessor.java
diff --git a/bundles/org.simantics.db/src/org/simantics/db/AsyncRequestProcessor.java b/bundles/org.simantics.db/src/org/simantics/db/AsyncRequestProcessor.java
new file mode 100644 (file)
index 0000000..e1707d9
--- /dev/null
@@ -0,0 +1,88 @@
+/*******************************************************************************\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;\r
+\r
+import org.simantics.db.procedure.AsyncListener;\r
+import org.simantics.db.procedure.AsyncProcedure;\r
+import org.simantics.db.procedure.Listener;\r
+import org.simantics.db.procedure.Procedure;\r
+import org.simantics.db.procedure.SyncListener;\r
+import org.simantics.db.procedure.SyncProcedure;\r
+import org.simantics.db.request.AsyncMultiRead;\r
+import org.simantics.db.request.AsyncRead;\r
+import org.simantics.db.request.MultiRead;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.db.request.ReadInterface;\r
+import org.simantics.db.request.Write;\r
+import org.simantics.db.request.WriteInterface;\r
+import org.simantics.db.request.WriteOnly;\r
+\r
+/**\r
+ * \r
+ * For initiating requests in asynchronous manner. The possible requests are\r
+ * <ul>\r
+ * <li>{@link Read} for computing a single result synchronously\r
+ * <li>{@link AsyncRead} for computing a single result asynchronously\r
+ * <li>{@link MultiRead} for computing a collection of results synchronously\r
+ * <li>{@link AsyncMultiRead} for computing a collection of results\r
+ * asynchronously\r
+ * <li>{@link Write} for reading and writing synchronously\r
+ * <li>{@link WriteOnly} for writing synchronously\r
+ * </ul>\r
+ * <p>\r
+ * The standard AsyncRequestProcessors are\r
+ * <ul>\r
+ * <li>{@link AsyncReadGraph} for performing requests during other requests\r
+ * <li>{@link Session} for initiating a transactions for performing requests\r
+ * <li>{@link MergingGraphRequestProcessor} for merging several requests in a\r
+ * single transaction\r
+ * </ul>\r
+ * \r
+ * Database services (see e.g. {@link Session}) are available from implemented\r
+ * {@link ServiceLocator}. For a synchronous counterpart with the same\r
+ * functionality as AsyncRequestProcessor see {@link RequestProcessor}\r
+ * \r
+ * @version 0.7\r
+ * @author Antti Villberg\r
+ * @see Read\r
+ * @see AsyncRead\r
+ * @see MultiRead\r
+ * @see AsyncMultiRead\r
+ * @see Write\r
+ * @see WriteOnly\r
+ * @see AsyncReadGraph\r
+ * @see Session\r
+ * @see MergingGraphRequestProcessor\r
+ * @see RequestProcessor\r
+ */\r
+public interface AsyncRequestProcessor extends ServiceLocator, AsyncRequestProcessorSpecific {\r
+\r
+       Resource getRootLibrary();\r
+       \r
+    /**\r
+     * @return the {@link Session} for which this processor is based on.\r
+     */\r
+    Session getSession();\r
+    \r
+    <T> void async(ReadInterface<T> r, Procedure<T> procedure);\r
+    <T> void async(ReadInterface<T> r, AsyncProcedure<T> procedure);\r
+    <T> void async(ReadInterface<T> r, SyncProcedure<T> procedure);\r
+    <T> void async(ReadInterface<T> r, Listener<T> procedure);\r
+    <T> void async(ReadInterface<T> r, AsyncListener<T> procedure);\r
+    <T> void async(ReadInterface<T> r, SyncListener<T> procedure);\r
+    \r
+    <T> void async(WriteInterface<T> r);\r
+    <T> void async(WriteInterface<T> r, Procedure<T> procedure);\r
+    \r
+    Object getModificationCounter();\r
+    \r
+}\r