Author: doogie Date: Wed Oct 17 21:14:01 2007 New Revision: 585857 URL: http://svn.apache.org/viewvc?rev=585857&view=rev Log: Add varargs variants to framework/service.
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java?rev=585857&r1=585856&r2=585857&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java Wed Oct 17 21:14:01 2007 @@ -50,6 +50,10 @@ public void schedule(String poolName, String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws GenericServiceException { schedule(null, poolName, serviceName, context, startTime, frequency, interval, count, endTime, maxRetry); } + + public void schedule(String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) throws GenericServiceException { + schedule(poolName, serviceName, ServiceUtil.makeContext(context), startTime, frequency, interval, count, endTime, maxRetry); + } /** * @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.lang.String, java.lang.String, java.util.Map, long, int, int, int, long, int) @@ -73,6 +77,10 @@ } } + public void schedule(String jobName, String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) throws GenericServiceException { + schedule(jobName, poolName, serviceName, ServiceUtil.makeContext(context), startTime, frequency, interval, count, endTime, maxRetry); + } + /** * @see org.ofbiz.service.LocalDispatcher#setRollbackService(java.lang.String, java.util.Map, boolean) */ @@ -87,6 +95,10 @@ } } + public void addRollbackService(String serviceName, boolean persist, Object... context) throws GenericServiceException { + addRollbackService(serviceName, ServiceUtil.makeContext(context), persist); + } + /** * @see org.ofbiz.service.LocalDispatcher#setCommitService(java.lang.String, java.util.Map, boolean) */ @@ -101,6 +113,10 @@ } } + public void addCommitService(String serviceName, boolean persist, Object... context) throws GenericServiceException { + addCommitService(serviceName, ServiceUtil.makeContext(context), persist); + } + /** * @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.util.Map, long, int, int, int, long) */ @@ -109,12 +125,20 @@ schedule(null, serviceName, context, startTime, frequency, interval, count, endTime, model.maxRetry); } + public void schedule(String serviceName, long startTime, int frequency, int interval, int count, long endTime, Object... context) throws GenericServiceException { + schedule(serviceName, ServiceUtil.makeContext(context), startTime, frequency, interval, count, endTime); + } + /** * @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.util.Map, long, int, int, int) */ public void schedule(String serviceName, Map context, long startTime, int frequency, int interval, int count) throws GenericServiceException { schedule(serviceName, context, startTime, frequency, interval, count, 0); } + + public void schedule(String serviceName, long startTime, int frequency, int interval, int count, Object... context) throws GenericServiceException { + schedule(serviceName, ServiceUtil.makeContext(context), startTime, frequency, interval, count); + } /** * @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.util.Map, long, int, int, long) @@ -123,11 +147,19 @@ schedule(serviceName, context, startTime, frequency, interval, -1, endTime); } + public void schedule(String serviceName, long startTime, int frequency, int interval, long endTime, Object... context) throws GenericServiceException { + schedule(serviceName, ServiceUtil.makeContext(context), startTime, frequency, interval, endTime); + } + /** * @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.util.Map, long) */ public void schedule(String serviceName, Map context, long startTime) throws GenericServiceException { schedule(serviceName, context, startTime, RecurrenceRule.DAILY, 1, 1); + } + + public void schedule(String serviceName, long startTime, Object... context) throws GenericServiceException { + schedule(serviceName, ServiceUtil.makeContext(context), startTime); } /** Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java?rev=585857&r1=585856&r2=585857&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java Wed Oct 17 21:14:01 2007 @@ -136,6 +136,10 @@ return dispatcher.runSync(this.name, service, context); } + public Map<String, Object> runSync(String serviceName, Object... context) throws ServiceValidationException, GenericServiceException { + return runSync(serviceName, ServiceUtil.makeContext(context)); + } + /** * @see org.ofbiz.service.LocalDispatcher#runSync(java.lang.String, java.util.Map, int, boolean) */ @@ -150,6 +154,10 @@ return dispatcher.runSync(this.name, cloned, context); } + public Map<String, Object> runSync(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + return runSync(serviceName, transactionTimeout, requireNewTransaction, ServiceUtil.makeContext(context)); + } + /** * @see org.ofbiz.service.LocalDispatcher#runSyncIgnore(java.lang.String, java.util.Map) */ @@ -158,6 +166,10 @@ dispatcher.runSyncIgnore(this.name, service, context); } + public void runSyncIgnore(String serviceName, Object... context) throws GenericServiceException { + runSyncIgnore(serviceName, ServiceUtil.makeContext(context)); + } + /** * @see org.ofbiz.service.LocalDispatcher#runSyncIgnore(java.lang.String, java.util.Map) */ @@ -172,6 +184,10 @@ dispatcher.runSyncIgnore(this.name, cloned, context); } + public void runSyncIgnore(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + runSyncIgnore(serviceName, ServiceUtil.makeContext(context), transactionTimeout, requireNewTransaction); + } + /** * @see org.ofbiz.service.LocalDispatcher#runAsync(java.lang.String, java.util.Map, org.ofbiz.service.GenericRequester, boolean, int, boolean) */ @@ -186,6 +202,10 @@ dispatcher.runAsync(this.name, cloned, context, requester, persist); } + public void runAsync(String serviceName, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + runAsync(serviceName, ServiceUtil.makeContext(context), requester, persist, transactionTimeout, requireNewTransaction); + } + /** * @see org.ofbiz.service.LocalDispatcher#runAsync(java.lang.String, java.util.Map, org.ofbiz.service.GenericRequester, boolean) */ @@ -193,6 +213,10 @@ ModelService service = ctx.getModelService(serviceName); dispatcher.runAsync(this.name, service, context, requester, persist); } + + public void runAsync(String serviceName, GenericRequester requester, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + runAsync(serviceName, ServiceUtil.makeContext(context), requester, persist); + } /** * @see org.ofbiz.service.LocalDispatcher#runAsync(java.lang.String, java.util.Map, org.ofbiz.service.GenericRequester) @@ -200,6 +224,10 @@ public void runAsync(String serviceName, Map context, GenericRequester requester) throws ServiceAuthException, ServiceValidationException, GenericServiceException { runAsync(serviceName, context, requester, true); } + + public void runAsync(String serviceName, GenericRequester requester, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + runAsync(serviceName, ServiceUtil.makeContext(context), requester); + } /** * @see org.ofbiz.service.LocalDispatcher#runAsync(java.lang.String, java.util.Map, boolean) @@ -208,6 +236,10 @@ ModelService service = ctx.getModelService(serviceName); dispatcher.runAsync(this.name, service, context, persist); } + + public void runAsync(String serviceName, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + runAsync(serviceName, ServiceUtil.makeContext(context), persist); + } /** * @see org.ofbiz.service.LocalDispatcher#runAsync(java.lang.String, java.util.Map) @@ -215,6 +247,10 @@ public void runAsync(String serviceName, Map context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { runAsync(serviceName, context, true); } + + public void runAsync(String serviceName, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + runAsync(serviceName, ServiceUtil.makeContext(context)); + } /** * @see org.ofbiz.service.LocalDispatcher#runAsyncWait(java.lang.String, java.util.Map, boolean) @@ -224,6 +260,10 @@ this.runAsync(serviceName, context, waiter, persist); return waiter; } + + public GenericResultWaiter runAsyncWait(String serviceName, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + return runAsyncWait(serviceName, ServiceUtil.makeContext(context), persist); + } /** * @see org.ofbiz.service.LocalDispatcher#runAsyncWait(java.lang.String, java.util.Map) @@ -231,5 +271,9 @@ public GenericResultWaiter runAsyncWait(String serviceName, Map context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { return runAsyncWait(serviceName, context, true); } + + public GenericResultWaiter runAsyncWait(String serviceName, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { + return runAsyncWait(serviceName, ServiceUtil.makeContext(context)); + } } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java?rev=585857&r1=585856&r2=585857&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java Wed Oct 17 21:14:01 2007 @@ -40,6 +40,7 @@ * @throws GenericServiceException */ public Map runSync(String serviceName, Map context) throws GenericServiceException; + public Map runSync(String serviceName, Object... context) throws GenericServiceException; /** * Run the service synchronously with a specified timeout and return the result. @@ -53,6 +54,7 @@ * @throws GenericServiceException */ public Map runSync(String serviceName, Map context, int transactionTimeout, boolean requireNewTransaction) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public Map runSync(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service synchronously and IGNORE the result. @@ -63,6 +65,7 @@ * @throws GenericServiceException */ public void runSyncIgnore(String serviceName, Map context) throws GenericServiceException; + public void runSyncIgnore(String serviceName, Object... context) throws GenericServiceException; /** * Run the service synchronously with a specified timeout and IGNORE the result. @@ -75,6 +78,7 @@ * @throws GenericServiceException */ public void runSyncIgnore(String serviceName, Map context, int transactionTimeout, boolean requireNewTransaction) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public void runSyncIgnore(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service asynchronously, passing an instance of GenericRequester that will receive the result. @@ -89,6 +93,7 @@ * @throws GenericServiceException */ public void runAsync(String serviceName, Map context, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public void runAsync(String serviceName, GenericRequester requester, boolean persist, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service asynchronously, passing an instance of GenericRequester that will receive the result. @@ -101,6 +106,7 @@ * @throws GenericServiceException */ public void runAsync(String serviceName, Map context, GenericRequester requester, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public void runAsync(String serviceName, GenericRequester requester, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service asynchronously, passing an instance of GenericRequester that will receive the result. @@ -113,6 +119,7 @@ * @throws GenericServiceException */ public void runAsync(String serviceName, Map context, GenericRequester requester) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public void runAsync(String serviceName, GenericRequester requester, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service asynchronously and IGNORE the result. @@ -124,6 +131,7 @@ * @throws GenericServiceException */ public void runAsync(String serviceName, Map context, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public void runAsync(String serviceName, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service asynchronously and IGNORE the result. This method WILL persist the job. @@ -134,6 +142,7 @@ * @throws GenericServiceException */ public void runAsync(String serviceName, Map context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public void runAsync(String serviceName, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service asynchronously. @@ -146,6 +155,7 @@ * @throws GenericServiceException */ public GenericResultWaiter runAsyncWait(String serviceName, Map context, boolean persist) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public GenericResultWaiter runAsyncWait(String serviceName, boolean persist, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Run the service asynchronously. This method WILL persist the job. @@ -157,6 +167,7 @@ * @throws GenericServiceException */ public GenericResultWaiter runAsyncWait(String serviceName, Map context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; + public GenericResultWaiter runAsyncWait(String serviceName, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException; /** * Register a callback listener on a specific service. @@ -181,6 +192,7 @@ * @throws GenericServiceException */ public void schedule(String poolName, String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws GenericServiceException; + public void schedule(String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) throws GenericServiceException; /** * Schedule a service to run asynchronously at a specific start time. @@ -199,6 +211,7 @@ * @throws GenericServiceException */ public void schedule(String jobName, String poolName, String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws GenericServiceException; + public void schedule(String jobName, String poolName, String serviceName, long startTime, int frequency, int interval, int count, long endTime, int maxRetry, Object... context) throws GenericServiceException; /** @@ -213,6 +226,7 @@ * @throws GenericServiceException */ public void schedule(String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime) throws GenericServiceException; + public void schedule(String serviceName, long startTime, int frequency, int interval, int count, long endTime, Object... context) throws GenericServiceException; /** * Schedule a service to run asynchronously at a specific start time. @@ -225,6 +239,7 @@ * @throws GenericServiceException */ public void schedule(String serviceName, Map context, long startTime, int frequency, int interval, int count) throws GenericServiceException; + public void schedule(String serviceName, long startTime, int frequency, int interval, int count, Object... context) throws GenericServiceException; /** * Schedule a service to run asynchronously at a specific start time. @@ -237,6 +252,7 @@ * @throws GenericServiceException */ public void schedule(String serviceName, Map context, long startTime, int frequency, int interval, long endTime) throws GenericServiceException; + public void schedule(String serviceName, long startTime, int frequency, int interval, long endTime, Object... context) throws GenericServiceException; /** * Schedule a service to run asynchronously at a specific start time. @@ -246,6 +262,7 @@ * @throws GenericServiceException */ public void schedule(String serviceName, Map context, long startTime) throws GenericServiceException; + public void schedule(String serviceName, long startTime, Object... context) throws GenericServiceException; /** @@ -256,6 +273,7 @@ * @throws GenericServiceException */ public void addRollbackService(String serviceName, Map context, boolean persist) throws GenericServiceException; + public void addRollbackService(String serviceName, boolean persist, Object... context) throws GenericServiceException; /** * Adds a commit service to the current TX using the ServiceXaWrapper @@ -265,6 +283,7 @@ * @throws GenericServiceException */ public void addCommitService(String serviceName, Map context, boolean persist) throws GenericServiceException; + public void addCommitService(String serviceName, boolean persist, Object... context) throws GenericServiceException; /** * Gets the JobManager associated with this dispatcher