]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / RequestProcessor.java
diff --git a/bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java b/bundles/org.simantics.db/src/org/simantics/db/RequestProcessor.java
new file mode 100644 (file)
index 0000000..1fb7ae3
--- /dev/null
@@ -0,0 +1,69 @@
+/*******************************************************************************\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