KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > service > engine > GenericEngine


1 /*
2  * $Id: GenericEngine.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001, 2002 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */

25 package org.ofbiz.service.engine;
26
27 import java.util.Map JavaDoc;
28
29 import org.ofbiz.service.GenericRequester;
30 import org.ofbiz.service.GenericServiceException;
31 import org.ofbiz.service.ModelService;
32
33 /**
34  * Generic Engine Interface
35  *
36  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
37  * @author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones</a>
38  * @version $Rev: 5462 $
39  * @since 2.0
40  */

41 public interface GenericEngine {
42
43     public static final int ASYNC_MODE = 22;
44     public static final int SYNC_MODE = 21;
45
46     /**
47      * Run the service synchronously and return the result.
48      *
49      * @param localName Name of the LocalDispatcher.
50      * @param modelService Service model object.
51      * @param context Map of name, value pairs composing the context.
52      * @return Map of name, value pairs composing the result.
53      * @throws GenericServiceException
54      */

55     public Map JavaDoc runSync(String JavaDoc localName, ModelService modelService, Map JavaDoc context) throws GenericServiceException;
56
57     /**
58      * Run the service synchronously and IGNORE the result.
59      *
60      * @param localName Name of the LocalDispatcher.
61      * @param modelService Service model object.
62      * @param context Map of name, value pairs composing the context.
63      * @throws GenericServiceException
64      */

65     public void runSyncIgnore(String JavaDoc localName, ModelService modelService, Map JavaDoc context) throws GenericServiceException;
66
67     /**
68      * Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
69      *
70      * @param localName Name of the LocalDispatcher.
71      * @param modelService Service model object.
72      * @param context Map of name, value pairs composing the context.
73      * @param requester Object implementing GenericRequester interface which will receive the result.
74      * @param persist True for store/run; False for run.
75      * @throws GenericServiceException
76      */

77     public void runAsync(String JavaDoc localName, ModelService modelService, Map JavaDoc context, GenericRequester requester, boolean persist)
78         throws GenericServiceException;
79
80     /**
81      * Run the service asynchronously and IGNORE the result.
82      *
83      * @param localName Name of the LocalDispatcher.
84      * @param modelService Service model object.
85      * @param context Map of name, value pairs composing the context.
86      * @param persist True for store/run; False for run.
87      * @throws GenericServiceException
88      */

89     public void runAsync(String JavaDoc localName, ModelService modelService, Map JavaDoc context, boolean persist) throws GenericServiceException;
90
91     /**
92      * Send the service callbacks
93      * @param modelService Service model object
94      * @param context Map of name, value pairs composing the context
95      * @param cbObj Object to return to callback (Throwable or Map)
96      * @param mode Service mode (sync or async)
97      * @throws GenericServiceException
98      */

99     public void sendCallbacks(ModelService modelService, Map JavaDoc context, Object JavaDoc cbObj, int mode) throws GenericServiceException;
100 }
101
102
Popular Tags