svn commit: r482807 - in /incubator/ofbiz/trunk/framework: service/src/org/ofbiz/service/ service/src/org/ofbiz/service/job/ webapp/src/org/ofbiz/webapp/event/ webtools/webapp/webtools/service/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r482807 - in /incubator/ofbiz/trunk/framework: service/src/org/ofbiz/service/ service/src/org/ofbiz/service/job/ webapp/src/org/ofbiz/webapp/event/ webtools/webapp/webtools/service/

jleroux@apache.org
Author: jleroux
Date: Tue Dec  5 14:20:39 2006
New Revision: 482807

URL: http://svn.apache.org/viewvc?view=rev&rev=482807
Log:
A patch from Peter Goron :"Allow user to give a name to the job he is scheduling" (https://issues.apache.org/jira/browse/OFBIZ-519)


Modified:
    incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java
    incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java
    incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
    incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
    incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml

Modified: incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java?view=diff&rev=482807&r1=482806&r2=482807
==============================================================================
--- incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java (original)
+++ incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericAbstractDispatcher.java Tue Dec  5 14:20:39 2006
@@ -45,8 +45,15 @@
      * @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.lang.String, java.util.Map, long, int, int, int, long, int)
      */
     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);
+    }
+    
+    /**
+     * @see org.ofbiz.service.LocalDispatcher#schedule(java.lang.String, java.lang.String, java.lang.String, java.util.Map, long, int, int, int, long, int)
+     */
+    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 {
         try {
-            getJobManager().schedule(poolName, serviceName, context, startTime, frequency, interval, count, endTime, maxRetry);
+            getJobManager().schedule(jobName, poolName, serviceName, context, startTime, frequency, interval, count, endTime, maxRetry);
                 
             if (Debug.verboseOn()) {
                 Debug.logVerbose("[LocalDispatcher.schedule] : Current time : " + (new Date()).getTime(), module);

Modified: incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java?view=diff&rev=482807&r1=482806&r2=482807
==============================================================================
--- incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java (original)
+++ incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/LocalDispatcher.java Tue Dec  5 14:20:39 2006
@@ -179,6 +179,24 @@
      */
     public void schedule(String poolName, String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws GenericServiceException;
 
+    /**
+     * Schedule a service to run asynchronously at a specific start time.
+     * @param jobName Name of the job
+     * @param poolName Name of the service pool to send to.
+     * @param serviceName Name of the service to invoke.
+     * @param context The name/value pairs composing the context.
+     * @param startTime The time to run this service.
+     * @param frequency The frequency of the recurrence (RecurrenceRule.DAILY, etc).
+     * @param interval The interval of the frequency recurrence.
+     * @param count The number of times to repeat.
+     * @param endTime The time in milliseconds the service should expire
+     * @param maxRetry The number of times we should retry on failure
+     * @throws ServiceAuthException
+     * @throws ServiceValidationException
+     * @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;
+
 
     /**
      * Schedule a service to run asynchronously at a specific start time.

Modified: incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?view=diff&rev=482807&r1=482806&r2=482807
==============================================================================
--- incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java (original)
+++ incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Tue Dec  5 14:20:39 2006
@@ -309,11 +309,12 @@
      *@param endTime The time in milliseconds the service should expire
      */
     public void schedule(String poolName, String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime) throws JobManagerException {
-        schedule(null, serviceName, context, startTime, frequency, interval, count, endTime, -1);
+        schedule(null, null, serviceName, context, startTime, frequency, interval, count, endTime, -1);
     }
 
     /**
      * Schedule a job to start at a specific time with specific recurrence info
+     *@param jobName The name of the job
      *@param poolName The name of the pool to run the service from
      *@param serviceName The name of the service to invoke
      *@param context The context for the service
@@ -324,7 +325,7 @@
      *@param endTime The time in milliseconds the service should expire
      *@param maxRetry The max number of retries on failure (-1 for no max)
      */
-    public void schedule(String poolName, String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws JobManagerException {
+    public void schedule(String jobName, String poolName, String serviceName, Map context, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws JobManagerException {
         if (delegator == null) {
             Debug.logWarning("No delegator referenced; cannot schedule job.", module);
             return;
@@ -347,7 +348,7 @@
         }
 
         // schedule the job
-        schedule(poolName, serviceName, dataId, startTime, frequency, interval, count, endTime, maxRetry);
+        schedule(jobName, poolName, serviceName, dataId, startTime, frequency, interval, count, endTime, maxRetry);
     }
 
     /**
@@ -358,11 +359,12 @@
      *@param startTime The time in milliseconds the service should run
      */
     public void schedule(String poolName, String serviceName, String dataId, long startTime) throws JobManagerException {
-        schedule(poolName, serviceName, dataId, startTime, -1, 0, 1, 0, -1);
+        schedule(null, poolName, serviceName, dataId, startTime, -1, 0, 1, 0, -1);
     }
 
     /**
      * Schedule a job to start at a specific time with specific recurrence info
+     *@param jobName The name of the job
      *@param poolName The name of the pool to run the service from
      *@param serviceName The name of the service to invoke
      *@param dataId The persisted context (RuntimeData.runtimeDataId)
@@ -373,7 +375,7 @@
      *@param endTime The time in milliseconds the service should expire
      *@param maxRetry The max number of retries on failure (-1 for no max)
      */
-    public void schedule(String poolName, String serviceName, String dataId, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws JobManagerException {
+    public void schedule(String jobName, String poolName, String serviceName, String dataId, long startTime, int frequency, int interval, int count, long endTime, int maxRetry) throws JobManagerException {
         if (delegator == null) {
             Debug.logWarning("No delegator referenced; cannot schedule job.", module);
             return;
@@ -391,7 +393,9 @@
         }
 
         // set the persisted fields
-        String jobName = new String(new Long((new Date().getTime())).toString());
+        if (UtilValidate.isEmpty(jobName)) {
+            jobName = new String(new Long((new Date().getTime())).toString());
+        }
         String jobId = delegator.getNextSeqId("JobSandbox").toString();
         Map jFields = UtilMisc.toMap("jobId", jobId, "jobName", jobName, "runTime", new java.sql.Timestamp(startTime),
                 "serviceName", serviceName, "recurrenceInfoId", infoId, "runtimeDataId", dataId);

Modified: incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java?view=diff&rev=482807&r1=482806&r2=482807
==============================================================================
--- incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java (original)
+++ incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java Tue Dec  5 14:20:39 2006
@@ -199,6 +199,7 @@
         
         Map params = UtilHttp.getParameterMap(request);
         // get the schedule parameters
+        String jobName = (String) params.remove("JOB_NAME");
         String serviceName = (String) params.remove("SERVICE_NAME");
         String poolName = (String) params.remove("POOL_NAME");
         String serviceTime = (String) params.remove("SERVICE_TIME");
@@ -396,7 +397,7 @@
                       
         // schedule service
         try {
-            dispatcher.schedule(poolName, serviceName, serviceContext, startTime, frequency, interval, count, endTime, maxRetry);
+            dispatcher.schedule(jobName, poolName, serviceName, serviceContext, startTime, frequency, interval, count, endTime, maxRetry);
         } catch (GenericServiceException e) {
             String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.service_dispatcher_exception", locale);
             request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg + e.getMessage());

Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml?view=diff&rev=482807&r1=482806&r2=482807
==============================================================================
--- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml (original)
+++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml Tue Dec  5 14:20:39 2006
@@ -19,6 +19,7 @@
         xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
 
     <form name="scheduleJob" type="single" target="setServiceParameters" title="" default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+        <field name="JOB_NAME" title="${uiLabelMap.WebtoolsJob}"><text/></field>
         <field name="SERVICE_NAME" title="${uiLabelMap.WebtoolsService}"><text/></field>
         <field name="POOL_NAME" title="${uiLabelMap.WebtoolsPool}"><text/></field>
         <field name="SERVICE_TIME" title="${uiLabelMap.CommonStartDateTime}"><date-time/></field>