001: /*
002: * $Id: RemoteDispatcher.java,v 1.2 2003/12/06 23:10:14 ajzeneski Exp $
003: *
004: * Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
005: *
006: * Permission is hereby granted, free of charge, to any person obtaining a
007: * copy of this software and associated documentation files (the "Software"),
008: * to deal in the Software without restriction, including without limitation
009: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
010: * and/or sell copies of the Software, and to permit persons to whom the
011: * Software is furnished to do so, subject to the following conditions:
012: *
013: * The above copyright notice and this permission notice shall be included
014: * in all copies or substantial portions of the Software.
015: *
016: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
017: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
018: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
019: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
020: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
021: * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
022: * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
023: *
024: */
025: package org.ofbiz.service.rmi;
026:
027: import java.util.Map;
028: import java.rmi.Remote;
029: import java.rmi.RemoteException;
030:
031: import org.ofbiz.service.GenericRequester;
032: import org.ofbiz.service.GenericResultWaiter;
033: import org.ofbiz.service.GenericServiceException;
034:
035: /**
036: * Generic Services Remote Dispatcher
037: *
038: * @author <a href="mailto:jaz@ofbiz.org">Andy Zeneski</a>
039: * @version $Revision: 1.2 $
040: * @since 3.0
041: */
042: public interface RemoteDispatcher extends Remote {
043:
044: /**
045: * Run the service synchronously and return the result.
046: * @param serviceName Name of the service to run.
047: * @param context Map of name, value pairs composing the context.
048: * @return Map of name, value pairs composing the result.
049: * @throws GenericServiceException
050: * @throws RemoteException
051: */
052: public Map runSync(String serviceName, Map context)
053: throws GenericServiceException, RemoteException;
054:
055: /**
056: * Run the service synchronously with a specified timeout and return the result.
057: * @param serviceName Name of the service to run.
058: * @param context Map of name, value pairs composing the context.
059: * @param transactionTimeout the overriding timeout for the transaction (if we started it).
060: * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start.
061: * @return Map of name, value pairs composing the result.
062: * @throws GenericServiceException
063: */
064: public Map runSync(String serviceName, Map context,
065: int transactionTimeout, boolean requireNewTransaction)
066: throws GenericServiceException, RemoteException;
067:
068: /**
069: * Run the service synchronously and IGNORE the result.
070: * @param serviceName Name of the service to run.
071: * @param context Map of name, value pairs composing the context.
072: * @throws GenericServiceException
073: * @throws RemoteException
074: */
075: public void runSyncIgnore(String serviceName, Map context)
076: throws GenericServiceException, RemoteException;
077:
078: /**
079: * Run the service synchronously with a specified timeout and IGNORE the result.
080: * @param serviceName Name of the service to run.
081: * @param context Map of name, value pairs composing the context.
082: * @param transactionTimeout the overriding timeout for the transaction (if we started it).
083: * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start.
084: * @throws GenericServiceException
085: */
086: public void runSyncIgnore(String serviceName, Map context,
087: int transactionTimeout, boolean requireNewTransaction)
088: throws GenericServiceException, RemoteException;
089:
090: /**
091: * Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
092: * @param serviceName Name of the service to run.
093: * @param context Map of name, value pairs composing the context.
094: * @param requester Object implementing GenericRequester interface which will receive the result.
095: * @param persist True for store/run; False for run.
096: * @param transactionTimeout the overriding timeout for the transaction (if we started it).
097: * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start.
098: * @throws GenericServiceException
099: */
100: public void runAsync(String serviceName, Map context,
101: GenericRequester requester, boolean persist,
102: int transactionTimeout, boolean requireNewTransaction)
103: throws GenericServiceException, RemoteException;
104:
105: /**
106: * Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
107: * @param serviceName Name of the service to run.
108: * @param context Map of name, value pairs composing the context.
109: * @param requester Object implementing GenericRequester interface which will receive the result.
110: * @param persist True for store/run; False for run.
111: * @throws GenericServiceException
112: * @throws RemoteException
113: */
114: public void runAsync(String serviceName, Map context,
115: GenericRequester requester, boolean persist)
116: throws GenericServiceException, RemoteException;
117:
118: /**
119: * Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
120: * This method WILL persist the job.
121: * @param serviceName Name of the service to run.
122: * @param context Map of name, value pairs composing the context.
123: * @param requester Object implementing GenericRequester interface which will receive the result.
124: * @throws GenericServiceException
125: * @throws RemoteException
126: */
127: public void runAsync(String serviceName, Map context,
128: GenericRequester requester) throws GenericServiceException,
129: RemoteException;
130:
131: /**
132: * Run the service asynchronously and IGNORE the result.
133: * @param serviceName Name of the service to run.
134: * @param context Map of name, value pairs composing the context.
135: * @param persist True for store/run; False for run.
136: * @throws GenericServiceException
137: * @throws RemoteException
138: */
139: public void runAsync(String serviceName, Map context,
140: boolean persist) throws GenericServiceException,
141: RemoteException;
142:
143: /**
144: * Run the service asynchronously and IGNORE the result. This method WILL persist the job.
145: * @param serviceName Name of the service to run.
146: * @param context Map of name, value pairs composing the context.
147: * @throws GenericServiceException
148: * @throws RemoteException
149: */
150: public void runAsync(String serviceName, Map context)
151: throws GenericServiceException, RemoteException;
152:
153: /**
154: * Run the service asynchronously.
155: * @param serviceName Name of the service to run.
156: * @param context Map of name, value pairs composing the context.
157: * @param persist True for store/run; False for run.
158: * @return A new GenericRequester object.
159: * @throws GenericServiceException
160: * @throws RemoteException
161: */
162: public GenericResultWaiter runAsyncWait(String serviceName,
163: Map context, boolean persist)
164: throws GenericServiceException, RemoteException;
165:
166: /**
167: * Run the service asynchronously. This method WILL persist the job.
168: * @param serviceName Name of the service to run.
169: * @param context Map of name, value pairs composing the context.
170: * @return A new GenericRequester object.
171: * @throws GenericServiceException
172: * @throws RemoteException
173: */
174: public GenericResultWaiter runAsyncWait(String serviceName,
175: Map context) throws GenericServiceException,
176: RemoteException;
177:
178: /**
179: * Schedule a service to run asynchronously at a specific start time.
180: * @param serviceName Name of the service to invoke.
181: * @param context The name/value pairs composing the context.
182: * @param startTime The time to run this service.
183: * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc).
184: * @param interval The interval of the frequency recurrence.
185: * @param count The number of times to repeat.
186: * @param endTime The time in milliseconds the service should expire
187: * @throws GenericServiceException
188: * @throws RemoteException
189: */
190: public void schedule(String serviceName, Map context,
191: long startTime, int frequency, int interval, int count,
192: long endTime) throws GenericServiceException,
193: RemoteException;
194:
195: /**
196: * Schedule a service to run asynchronously at a specific start time.
197: * @param serviceName Name of the service to invoke.
198: * @param context The name/value pairs composing the context.
199: * @param startTime The time to run this service.
200: * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc).
201: * @param interval The interval of the frequency recurrence.
202: * @param count The number of times to repeat.
203: * @throws GenericServiceException
204: * @throws RemoteException
205: */
206: public void schedule(String serviceName, Map context,
207: long startTime, int frequency, int interval, int count)
208: throws GenericServiceException, RemoteException;
209:
210: /**
211: * Schedule a service to run asynchronously at a specific start time.
212: * @param serviceName Name of the service to invoke.
213: * @param context The name/value pairs composing the context.
214: * @param startTime The time to run this service.
215: * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc).
216: * @param interval The interval of the frequency recurrence.
217: * @param endTime The time in milliseconds the service should expire
218: * @throws GenericServiceException
219: * @throws RemoteException
220: */
221: public void schedule(String serviceName, Map context,
222: long startTime, int frequency, int interval, long endTime)
223: throws GenericServiceException, RemoteException;
224:
225: /**
226: * Schedule a service to run asynchronously at a specific start time.
227: * @param serviceName Name of the service to invoke.
228: * @param context The name/value pairs composing the context.
229: * @param startTime The time to run this service.
230: * @throws GenericServiceException
231: * @throws RemoteException
232: */
233: public void schedule(String serviceName, Map context, long startTime)
234: throws GenericServiceException, RemoteException;
235:
236: }
|