001: /*******************************************************************************
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: *******************************************************************************/package org.ofbiz.service.rmi;
019:
020: import java.util.Map;
021: import java.rmi.Remote;
022: import java.rmi.RemoteException;
023:
024: import org.ofbiz.service.GenericRequester;
025: import org.ofbiz.service.GenericResultWaiter;
026: import org.ofbiz.service.GenericServiceException;
027:
028: /**
029: * Generic Services Remote Dispatcher
030: */
031: public interface RemoteDispatcher extends Remote {
032:
033: /**
034: * Run the service synchronously and return the result.
035: * @param serviceName Name of the service to run.
036: * @param context Map of name, value pairs composing the context.
037: * @return Map of name, value pairs composing the result.
038: * @throws GenericServiceException
039: * @throws RemoteException
040: */
041: public Map runSync(String serviceName, Map context)
042: throws GenericServiceException, RemoteException;
043:
044: /**
045: * Run the service synchronously with a specified timeout 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: * @param transactionTimeout the overriding timeout for the transaction (if we started it).
049: * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start.
050: * @return Map of name, value pairs composing the result.
051: * @throws GenericServiceException
052: */
053: public Map runSync(String serviceName, Map context,
054: int transactionTimeout, boolean requireNewTransaction)
055: throws GenericServiceException, RemoteException;
056:
057: /**
058: * Run the service synchronously and IGNORE the result.
059: * @param serviceName Name of the service to run.
060: * @param context Map of name, value pairs composing the context.
061: * @throws GenericServiceException
062: * @throws RemoteException
063: */
064: public void runSyncIgnore(String serviceName, Map context)
065: throws GenericServiceException, RemoteException;
066:
067: /**
068: * Run the service synchronously with a specified timeout and IGNORE the result.
069: * @param serviceName Name of the service to run.
070: * @param context Map of name, value pairs composing the context.
071: * @param transactionTimeout the overriding timeout for the transaction (if we started it).
072: * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start.
073: * @throws GenericServiceException
074: */
075: public void runSyncIgnore(String serviceName, Map context,
076: int transactionTimeout, boolean requireNewTransaction)
077: throws GenericServiceException, RemoteException;
078:
079: /**
080: * Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
081: * @param serviceName Name of the service to run.
082: * @param context Map of name, value pairs composing the context.
083: * @param requester Object implementing GenericRequester interface which will receive the result.
084: * @param persist True for store/run; False for run.
085: * @param transactionTimeout the overriding timeout for the transaction (if we started it).
086: * @param requireNewTransaction if true we will suspend and create a new transaction so we are sure to start.
087: * @throws GenericServiceException
088: */
089: public void runAsync(String serviceName, Map context,
090: GenericRequester requester, boolean persist,
091: int transactionTimeout, boolean requireNewTransaction)
092: throws GenericServiceException, RemoteException;
093:
094: /**
095: * Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
096: * @param serviceName Name of the service to run.
097: * @param context Map of name, value pairs composing the context.
098: * @param requester Object implementing GenericRequester interface which will receive the result.
099: * @param persist True for store/run; False for run.
100: * @throws GenericServiceException
101: * @throws RemoteException
102: */
103: public void runAsync(String serviceName, Map context,
104: GenericRequester requester, boolean persist)
105: throws GenericServiceException, RemoteException;
106:
107: /**
108: * Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
109: * This method WILL persist the job.
110: * @param serviceName Name of the service to run.
111: * @param context Map of name, value pairs composing the context.
112: * @param requester Object implementing GenericRequester interface which will receive the result.
113: * @throws GenericServiceException
114: * @throws RemoteException
115: */
116: public void runAsync(String serviceName, Map context,
117: GenericRequester requester) throws GenericServiceException,
118: RemoteException;
119:
120: /**
121: * Run the service asynchronously and IGNORE the result.
122: * @param serviceName Name of the service to run.
123: * @param context Map of name, value pairs composing the context.
124: * @param persist True for store/run; False for run.
125: * @throws GenericServiceException
126: * @throws RemoteException
127: */
128: public void runAsync(String serviceName, Map context,
129: boolean persist) throws GenericServiceException,
130: RemoteException;
131:
132: /**
133: * Run the service asynchronously and IGNORE the result. This method WILL persist the job.
134: * @param serviceName Name of the service to run.
135: * @param context Map of name, value pairs composing the context.
136: * @throws GenericServiceException
137: * @throws RemoteException
138: */
139: public void runAsync(String serviceName, Map context)
140: throws GenericServiceException, RemoteException;
141:
142: /**
143: * Run the service asynchronously.
144: * @param serviceName Name of the service to run.
145: * @param context Map of name, value pairs composing the context.
146: * @param persist True for store/run; False for run.
147: * @return A new GenericRequester object.
148: * @throws GenericServiceException
149: * @throws RemoteException
150: */
151: public GenericResultWaiter runAsyncWait(String serviceName,
152: Map context, boolean persist)
153: throws GenericServiceException, RemoteException;
154:
155: /**
156: * Run the service asynchronously. This method WILL persist the job.
157: * @param serviceName Name of the service to run.
158: * @param context Map of name, value pairs composing the context.
159: * @return A new GenericRequester object.
160: * @throws GenericServiceException
161: * @throws RemoteException
162: */
163: public GenericResultWaiter runAsyncWait(String serviceName,
164: Map context) throws GenericServiceException,
165: RemoteException;
166:
167: /**
168: * Schedule a service to run asynchronously at a specific start time.
169: * @param serviceName Name of the service to invoke.
170: * @param context The name/value pairs composing the context.
171: * @param startTime The time to run this service.
172: * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc).
173: * @param interval The interval of the frequency recurrence.
174: * @param count The number of times to repeat.
175: * @param endTime The time in milliseconds the service should expire
176: * @throws GenericServiceException
177: * @throws RemoteException
178: */
179: public void schedule(String serviceName, Map context,
180: long startTime, int frequency, int interval, int count,
181: long endTime) throws GenericServiceException,
182: RemoteException;
183:
184: /**
185: * Schedule a service to run asynchronously at a specific start time.
186: * @param serviceName Name of the service to invoke.
187: * @param context The name/value pairs composing the context.
188: * @param startTime The time to run this service.
189: * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc).
190: * @param interval The interval of the frequency recurrence.
191: * @param count The number of times to repeat.
192: * @throws GenericServiceException
193: * @throws RemoteException
194: */
195: public void schedule(String serviceName, Map context,
196: long startTime, int frequency, int interval, int count)
197: throws GenericServiceException, RemoteException;
198:
199: /**
200: * Schedule a service to run asynchronously at a specific start time.
201: * @param serviceName Name of the service to invoke.
202: * @param context The name/value pairs composing the context.
203: * @param startTime The time to run this service.
204: * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc).
205: * @param interval The interval of the frequency recurrence.
206: * @param endTime The time in milliseconds the service should expire
207: * @throws GenericServiceException
208: * @throws RemoteException
209: */
210: public void schedule(String serviceName, Map context,
211: long startTime, int frequency, int interval, long endTime)
212: throws GenericServiceException, RemoteException;
213:
214: /**
215: * Schedule a service to run asynchronously at a specific start time.
216: * @param serviceName Name of the service to invoke.
217: * @param context The name/value pairs composing the context.
218: * @param startTime The time to run this service.
219: * @throws GenericServiceException
220: * @throws RemoteException
221: */
222: public void schedule(String serviceName, Map context, long startTime)
223: throws GenericServiceException, RemoteException;
224:
225: }
|