]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
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.procedure.AsyncListener;\r
15 import org.simantics.db.procedure.AsyncProcedure;\r
16 import org.simantics.db.procedure.Listener;\r
17 import org.simantics.db.procedure.Procedure;\r
18 import org.simantics.db.procedure.SyncListener;\r
19 import org.simantics.db.procedure.SyncProcedure;\r
20 import org.simantics.db.request.AsyncMultiRead;\r
21 import org.simantics.db.request.AsyncRead;\r
22 import org.simantics.db.request.MultiRead;\r
23 import org.simantics.db.request.Read;\r
24 import org.simantics.db.request.ReadInterface;\r
25 import org.simantics.db.request.Write;\r
26 import org.simantics.db.request.WriteInterface;\r
27 import org.simantics.db.request.WriteOnly;\r
28 \r
29 /**\r
30  * \r
31  * For initiating requests in asynchronous manner. The possible requests are\r
32  * <ul>\r
33  * <li>{@link Read} for computing a single result synchronously\r
34  * <li>{@link AsyncRead} for computing a single result asynchronously\r
35  * <li>{@link MultiRead} for computing a collection of results synchronously\r
36  * <li>{@link AsyncMultiRead} for computing a collection of results\r
37  * asynchronously\r
38  * <li>{@link Write} for reading and writing synchronously\r
39  * <li>{@link WriteOnly} for writing synchronously\r
40  * </ul>\r
41  * <p>\r
42  * The standard AsyncRequestProcessors are\r
43  * <ul>\r
44  * <li>{@link AsyncReadGraph} for performing requests during other requests\r
45  * <li>{@link Session} for initiating a transactions for performing requests\r
46  * <li>{@link MergingGraphRequestProcessor} for merging several requests in a\r
47  * single transaction\r
48  * </ul>\r
49  * \r
50  * Database services (see e.g. {@link Session}) are available from implemented\r
51  * {@link ServiceLocator}. For a synchronous counterpart with the same\r
52  * functionality as AsyncRequestProcessor see {@link RequestProcessor}\r
53  * \r
54  * @version 0.7\r
55  * @author Antti Villberg\r
56  * @see Read\r
57  * @see AsyncRead\r
58  * @see MultiRead\r
59  * @see AsyncMultiRead\r
60  * @see Write\r
61  * @see WriteOnly\r
62  * @see AsyncReadGraph\r
63  * @see Session\r
64  * @see MergingGraphRequestProcessor\r
65  * @see RequestProcessor\r
66  */\r
67 public interface AsyncRequestProcessor extends ServiceLocator, AsyncRequestProcessorSpecific {\r
68 \r
69         Resource getRootLibrary();\r
70         \r
71     /**\r
72      * @return the {@link Session} for which this processor is based on.\r
73      */\r
74     Session getSession();\r
75     \r
76     <T> void async(ReadInterface<T> r, Procedure<T> procedure);\r
77     <T> void async(ReadInterface<T> r, AsyncProcedure<T> procedure);\r
78     <T> void async(ReadInterface<T> r, SyncProcedure<T> procedure);\r
79     <T> void async(ReadInterface<T> r, Listener<T> procedure);\r
80     <T> void async(ReadInterface<T> r, AsyncListener<T> procedure);\r
81     <T> void async(ReadInterface<T> r, SyncListener<T> procedure);\r
82     \r
83     <T> void async(WriteInterface<T> r);\r
84     <T> void async(WriteInterface<T> r, Procedure<T> procedure);\r
85     \r
86     Object getModificationCounter();\r
87     \r
88 }\r