]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java
Merge "Multiple reader thread support for db client"
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / RequestProcessor.java
index 1fb7ae3a128c442b1d6006eb06463915632e0b10..5e818cb995c32408a9f04377c0b0885767d95513 100644 (file)
@@ -1,69 +1,82 @@
-/*******************************************************************************\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.exception.DatabaseException;\r
-import org.simantics.db.request.ReadInterface;\r
-import org.simantics.db.request.WriteInterface;\r
-\r
-/**\r
- * \r
- * For initiating requests in synchronous manner. The possible requests are\r
- * <ul>\r
- * <li>{@link ReadInterface} for computing a single result\r
- * <li>{@link WriteInterface} for making a modification into the database\r
- * </ul>\r
- * <p>\r
- * Some standard implementations of ReadInterface and WriteInterface include\r
- * <ul>\r
- * <li>{@link ResourceRead} which is identified by a single resource\r
- * <li>{@link ResourceRead2} which is identified by a pair of resources\r
- * <li>{@link UnaryRead} which is identifier by a single object\r
- * <li>{@link BinaryRead} which is identifier by a pair of objects\r
- * <li>{@link UniqueRead} which is unique (not equal to anything but itself)\r
- * <li>{@link ReadRequest} which does not report a result\r
- * <li>{@link WriteRequest} for writing\r
- * </ul>\r
- * <p>\r
- * The standard RequestProcessors are\r
- * <ul>\r
- * <li>{@link ReadGraph} 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 an asynchronous counterpart with the same\r
- * functionality as RequestProcessor see {@link AsyncRequestProcessor}\r
- * \r
- * <p>\r
- * <b>IMPORTANT:</b>A client invoking any of the <code>sync</code>\r
- * -methods in this interface must not assume that the request is performed\r
- * within the same thread that performed the <code>syncRequest</code>\r
- * invocation. This is an implementation-specific matter.\r
- * \r
- * @version 1.5\r
- * @author Antti Villberg\r
- * @see ReadInterface\r
- * @see WriteInterface\r
- * @see ReadGraph\r
- * @see Session\r
- * @see MergingGraphRequestProcessor\r
- * @see AsyncRequestProcessor\r
- */\r
-public interface RequestProcessor extends AsyncRequestProcessor, RequestProcessorSpecific {\r
-\r
-    <T> T sync(ReadInterface<T> r) throws DatabaseException;\r
-    <T> T sync(WriteInterface<T> r) throws DatabaseException;\r
-    \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2018 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;
+
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.procedure.Procedure;
+import org.simantics.db.request.ReadInterface;
+import org.simantics.db.request.WriteInterface;
+
+/**
+ * 
+ * For initiating requests in synchronous manner. The possible requests are
+ * <ul>
+ * <li>{@link ReadInterface} for computing a single result
+ * <li>{@link WriteInterface} for making a modification into the database
+ * </ul>
+ * <p>
+ * Some standard implementations of ReadInterface and WriteInterface include
+ * <ul>
+ * <li>{@link ResourceRead} which is identified by a single resource
+ * <li>{@link ResourceRead2} which is identified by a pair of resources
+ * <li>{@link UnaryRead} which is identifier by a single object
+ * <li>{@link BinaryRead} which is identifier by a pair of objects
+ * <li>{@link UniqueRead} which is unique (not equal to anything but itself)
+ * <li>{@link ReadRequest} which does not report a result
+ * <li>{@link WriteRequest} for writing
+ * </ul>
+ * <p>
+ * The standard RequestProcessors are
+ * <ul>
+ * <li>{@link ReadGraph} for performing requests during other requests
+ * <li>{@link Session} for initiating a transactions for performing requests
+ * <li>{@link MergingGraphRequestProcessor} for merging several requests in a
+ * single transaction
+ * </ul>
+ * 
+ * Database services (see e.g. {@link Session}) are available from implemented
+ * {@link ServiceLocator}. For an asynchronous counterpart with the same
+ * functionality as RequestProcessor see {@link AsyncRequestProcessor}
+ * 
+ * <p>
+ * <b>IMPORTANT:</b>A client invoking any of the <code>sync</code>
+ * -methods in this interface must not assume that the request is performed
+ * within the same thread that performed the <code>syncRequest</code>
+ * invocation. This is an implementation-specific matter.
+ * 
+ * @version 1.5
+ * @author Antti Villberg
+ * @see ReadInterface
+ * @see WriteInterface
+ * @see ReadGraph
+ * @see Session
+ * @see MergingGraphRequestProcessor
+ * @see AsyncRequestProcessor
+ */
+public interface RequestProcessor extends RequestProcessorSpecific, ServiceLocator {
+
+    Resource getRootLibrary();
+
+    /**
+     * @return the {@link Session} for which this processor is based on.
+     */
+    Session getSession();
+
+    <T> T sync(ReadInterface<T> r) throws DatabaseException;
+    <T> T sync(WriteInterface<T> r) throws DatabaseException;
+
+    <T> void async(WriteInterface<T> r);
+    <T> void async(WriteInterface<T> r, Procedure<T> procedure);
+
+    Object getModificationCounter();
+
+}