]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db;\r
13 \r
14 import org.simantics.db.exception.DatabaseException;\r
15 import org.simantics.db.request.ReadInterface;\r
16 import org.simantics.db.request.WriteInterface;\r
17 \r
18 /**\r
19  * \r
20  * For initiating requests in synchronous manner. The possible requests are\r
21  * <ul>\r
22  * <li>{@link ReadInterface} for computing a single result\r
23  * <li>{@link WriteInterface} for making a modification into the database\r
24  * </ul>\r
25  * <p>\r
26  * Some standard implementations of ReadInterface and WriteInterface include\r
27  * <ul>\r
28  * <li>{@link ResourceRead} which is identified by a single resource\r
29  * <li>{@link ResourceRead2} which is identified by a pair of resources\r
30  * <li>{@link UnaryRead} which is identifier by a single object\r
31  * <li>{@link BinaryRead} which is identifier by a pair of objects\r
32  * <li>{@link UniqueRead} which is unique (not equal to anything but itself)\r
33  * <li>{@link ReadRequest} which does not report a result\r
34  * <li>{@link WriteRequest} for writing\r
35  * </ul>\r
36  * <p>\r
37  * The standard RequestProcessors are\r
38  * <ul>\r
39  * <li>{@link ReadGraph} for performing requests during other requests\r
40  * <li>{@link Session} for initiating a transactions for performing requests\r
41  * <li>{@link MergingGraphRequestProcessor} for merging several requests in a\r
42  * single transaction\r
43  * </ul>\r
44  * \r
45  * Database services (see e.g. {@link Session}) are available from implemented\r
46  * {@link ServiceLocator}. For an asynchronous counterpart with the same\r
47  * functionality as RequestProcessor see {@link AsyncRequestProcessor}\r
48  * \r
49  * <p>\r
50  * <b>IMPORTANT:</b>A client invoking any of the <code>sync</code>\r
51  * -methods in this interface must not assume that the request is performed\r
52  * within the same thread that performed the <code>syncRequest</code>\r
53  * invocation. This is an implementation-specific matter.\r
54  * \r
55  * @version 1.5\r
56  * @author Antti Villberg\r
57  * @see ReadInterface\r
58  * @see WriteInterface\r
59  * @see ReadGraph\r
60  * @see Session\r
61  * @see MergingGraphRequestProcessor\r
62  * @see AsyncRequestProcessor\r
63  */\r
64 public interface RequestProcessor extends AsyncRequestProcessor, RequestProcessorSpecific {\r
65 \r
66     <T> T sync(ReadInterface<T> r) throws DatabaseException;\r
67     <T> T sync(WriteInterface<T> r) throws DatabaseException;\r
68     \r
69 }\r