Author: cziegeler
Date: Fri Sep 27 15:47:49 2013
New Revision: 1526963

URL: http://svn.apache.org/r1526963
Log:
SLING-3028 :  Support for progress tracking of jobs 

Modified:
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobConsumerManager.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobHandler.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerConfiguration.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutor.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobState.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobStatus.java
    
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobConsumerManager.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobConsumerManager.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobConsumerManager.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobConsumerManager.java
 Fri Sep 27 15:47:49 2013
@@ -439,7 +439,7 @@ public class JobConsumerManager {
 
                         @Override
                         public void ok() {
-                            this.check(JobStatus.OK);
+                            this.check(JobStatus.SUCCEEDED);
                         }
 
                         @Override
@@ -449,7 +449,7 @@ public class JobConsumerManager {
 
                         @Override
                         public void cancel() {
-                            this.check(JobStatus.CANCEL);
+                            this.check(JobStatus.CANCELLED);
                         }
                     };
             ((JobImpl)job).setProperty(JobConsumer.PROPERTY_JOB_ASYNC_HANDLER, 
asyncHandler);
@@ -459,9 +459,9 @@ public class JobConsumerManager {
             } else if ( result == JobResult.FAILED) {
                 return JobStatus.FAILED;
             } else if ( result == JobResult.OK) {
-                return JobStatus.OK;
+                return JobStatus.SUCCEEDED;
             }
-            return JobStatus.CANCEL;
+            return JobStatus.CANCELLED;
         }
     }
 }

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobHandler.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobHandler.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobHandler.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobHandler.java
 Fri Sep 27 15:47:49 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.sling.event.impl.jobs;
 
+import org.apache.sling.event.jobs.consumer.JobState;
+
 
 /**
  * This object adds actions to a {@link JobImpl}.
@@ -45,10 +47,19 @@ public class JobHandler {
         return this.jobManager.start(this);
     }
 
-    public void finished() {
-        this.jobManager.finished(this);
+    /**
+     * Finish the processing of the job
+     * @param state The state of processing
+     */
+    public void finished(final JobState state) {
+        // for now we just keep cancelled jobs
+        this.jobManager.finished(this, state, state != JobState.SUCCEEDED);
     }
 
+    /**
+     * Reschedule the job
+     * @return <code>true</code> if rescheduling was successful, 
<code>false</code> otherwise.
+     */
     public boolean reschedule() {
         return this.jobManager.reschedule(this);
     }

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
 Fri Sep 27 15:47:49 2013
@@ -61,6 +61,9 @@ public class JobImpl implements Job {
     /** Property for final message. */
     public static final String PROPERTY_MESSAGE = "slingevent:message";
 
+    /** Property for finished jobs. */
+    public static final String PROPERTY_FINISHED = "slingevent:finished";
+
     private final ValueMap properties;
 
     private final String topic;

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerConfiguration.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerConfiguration.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerConfiguration.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerConfiguration.java
 Fri Sep 27 15:47:49 2013
@@ -78,6 +78,10 @@ public class JobManagerConfiguration {
 
     private boolean disabledDistribution;
 
+    private String storedCancelledJobsPath;
+
+    private String storedSuccessfulJobsPath;
+
     public JobManagerConfiguration(final Map<String, Object> props) {
         this.update(props);
         this.jobsBasePathWithSlash = 
PropertiesUtil.toString(props.get(CONFIG_PROPERTY_REPOSITORY_PATH),
@@ -95,6 +99,8 @@ public class JobManagerConfiguration {
         this.previousVersionAnonPath = this.jobsBasePathWithSlash + "anon";
         this.previousVersionIdentifiedPath = this.jobsBasePathWithSlash + 
"identified";
 
+        this.storedCancelledJobsPath = this.jobsBasePathWithSlash + 
"cancelled";
+        this.storedSuccessfulJobsPath = this.jobsBasePathWithSlash + 
"finished";
     }
 
     /**
@@ -219,4 +225,25 @@ public class JobManagerConfiguration {
     public boolean disableDistribution() {
         return this.disabledDistribution;
     }
+
+    public String getStoragePath(final JobImpl finishedJob, final boolean 
isSuccess) {
+        final String topicName = (finishedJob.isBridgedEvent() ? 
JobImpl.PROPERTY_BRIDGED_EVENT : finishedJob.getTopic().replace('/', '.'));
+        final StringBuilder sb = new StringBuilder();
+        if ( isSuccess ) {
+            sb.append(this.storedSuccessfulJobsPath);
+        } else {
+            sb.append(this.storedCancelledJobsPath);
+        }
+        sb.append('/');
+        sb.append(topicName);
+        sb.append('/');
+        sb.append(finishedJob.getId());
+
+        return sb.toString();
+
+    }
+
+    public boolean isStoragePath(final String path) {
+        return path.startsWith(this.storedCancelledJobsPath) || 
path.startsWith(this.storedSuccessfulJobsPath);
+    }
 }

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
 Fri Sep 27 15:47:49 2013
@@ -78,6 +78,7 @@ import org.apache.sling.event.jobs.Queue
 import org.apache.sling.event.jobs.Statistics;
 import org.apache.sling.event.jobs.TopicStatistics;
 import org.apache.sling.event.jobs.consumer.JobExecutor;
+import org.apache.sling.event.jobs.consumer.JobState;
 import org.apache.sling.event.jobs.jmx.QueuesMBean;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;
@@ -964,6 +965,9 @@ public class JobManagerImpl
                 buf.append(ISO9075.encode(Job.PROPERTY_JOB_STARTED_TIME));
                 buf.append(")");
             }
+            buf.append(" and not(@");
+            buf.append(ISO9075.encode(JobImpl.PROPERTY_FINISHED));
+            buf.append(")");
             if ( templates != null && templates.length > 0 ) {
                 buf.append(" and (");
                 int index = 0;
@@ -1022,21 +1026,47 @@ public class JobManagerImpl
         return result;
     }
 
-    public void finished(final JobHandler info) {
+    /**
+     * Finish a job
+     * @param info  The job handler
+     * @param state The state of the processing
+     */
+    public void finished(final JobHandler handler, final JobState state, final 
boolean keepJobInHistory) {
+        final boolean isSuccess = (state == JobState.SUCCEEDED);
         ResourceResolver resolver = null;
         try {
             resolver = 
this.resourceResolverFactory.getAdministrativeResourceResolver(null);
-            final Resource jobResource = 
resolver.getResource(info.getJob().getResourcePath());
+            final Resource jobResource = 
resolver.getResource(handler.getJob().getResourcePath());
             if ( jobResource != null ) {
                 try {
+                    String newPath = null;
+                    if ( keepJobInHistory ) {
+                        final ValueMap vm = 
ResourceHelper.getValueMap(jobResource);
+                        newPath = 
this.configuration.getStoragePath(handler.getJob(), isSuccess);
+                        final Map<String, Object> props = new HashMap<String, 
Object>(vm);
+                        props.put(JobImpl.PROPERTY_FINISHED, isSuccess);
+
+                        ResourceHelper.getOrCreateResource(resolver, newPath, 
props);
+                    }
                     resolver.delete(jobResource);
                     resolver.commit();
+
+                    if ( keepJobInHistory && logger.isDebugEnabled() ) {
+                        if ( isSuccess ) {
+                            logger.debug("Kept successful job {} at {}", 
Utility.toString(handler.getJob()), newPath);
+                        } else {
+                            logger.debug("Moved cancelled job {} to {}", 
Utility.toString(handler.getJob()), newPath);
+                        }
+                    }
                 } catch ( final PersistenceException pe ) {
-                    // ignore
+                    this.ignoreException(pe);
+                } catch (final InstantiationException ie) {
+                    // something happened with the resource in the meantime
+                    this.ignoreException(ie);
                 }
             }
-        } catch ( final LoginException ignore ) {
-            // ignore
+        } catch (final LoginException ignore) {
+            this.ignoreException(ignore);
         } finally {
             if ( resolver != null ) {
                 resolver.close();
@@ -1356,10 +1386,16 @@ public class JobManagerImpl
         }
     }
 
+    /**
+     * Get the current capabilities
+     */
     public TopologyCapabilities getTopologyCapabilities() {
         return this.topologyCapabilities;
     }
 
+    /**
+     * Update the property of a job in the resource tree
+     */
     public void updateProperty(final JobImpl job, final String propName) {
         ResourceResolver resolver = null;
         try {
@@ -1380,4 +1416,13 @@ public class JobManagerImpl
             }
         }
     }
+
+    /**
+     * @see 
org.apache.sling.event.jobs.JobManager#stopJobById(java.lang.String)
+     */
+    @Override
+    public void stopJobById(final String jobId) {
+        // not implemented yet
+
+    }
 }

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
 Fri Sep 27 15:47:49 2013
@@ -45,6 +45,7 @@ import org.apache.sling.event.jobs.Queue
 import org.apache.sling.event.jobs.Statistics;
 import org.apache.sling.event.jobs.consumer.JobExecutionContext;
 import org.apache.sling.event.jobs.consumer.JobExecutor;
+import org.apache.sling.event.jobs.consumer.JobState;
 import org.apache.sling.event.jobs.consumer.JobStatus;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;
@@ -297,16 +298,20 @@ public abstract class AbstractJobQueue
         return ack != null;
     }
 
-    private boolean handleReschedule(final JobHandler jobEvent, final 
JobStatus result) {
-        boolean reschedule = false;
+    private static final class RescheduleInfo {
+        public boolean reschedule = false;
+        public long    processingTime;
+    }
+
+    private RescheduleInfo handleReschedule(final JobHandler jobEvent, final 
JobStatus result) {
+        final RescheduleInfo info = new RescheduleInfo();
         switch ( result.getState() ) {
-            case OK : // job is finished
+            case SUCCEEDED : // job is finished
                 if ( this.logger.isDebugEnabled() ) {
                     this.logger.debug("Finished job {}", 
Utility.toString(jobEvent.getJob()));
                 }
-                final long processingTime = System.currentTimeMillis() - 
jobEvent.started;
-                this.finishedJob(processingTime);
-                Utility.sendNotification(this.eventAdmin, 
JobUtil.TOPIC_JOB_FINISHED, jobEvent.getJob(), processingTime);
+                info.processingTime = System.currentTimeMillis() - 
jobEvent.started;
+                this.finishedJob(info.processingTime);
                 break;
             case FAILED : // check if we exceeded the number of retries
                 int retries = (Integer) 
jobEvent.getJob().getProperty(Job.PROPERTY_JOB_RETRIES);
@@ -314,14 +319,12 @@ public abstract class AbstractJobQueue
 
                 retryCount++;
                 if ( retries != -1 && retryCount > retries ) {
-                    reschedule = false;
                     if ( this.logger.isDebugEnabled() ) {
                         this.logger.debug("Cancelled job {}", 
Utility.toString(jobEvent.getJob()));
                     }
                     this.cancelledJob();
-                    Utility.sendNotification(this.eventAdmin, 
JobUtil.TOPIC_JOB_CANCELLED, jobEvent.getJob(), null);
                 } else {
-                    reschedule = true;
+                    info.reschedule = true;
                     // update event with retry count and retries
                     jobEvent.getJob().retry();
                     if ( this.logger.isDebugEnabled() ) {
@@ -329,19 +332,17 @@ public abstract class AbstractJobQueue
                     }
                     this.failedJob();
                     jobEvent.queued = System.currentTimeMillis();
-                    Utility.sendNotification(this.eventAdmin, 
JobUtil.TOPIC_JOB_FAILED, jobEvent.getJob(), null);
                 }
                 break;
-            case CANCEL : // consumer cancelled the job
+            case CANCELLED : // consumer cancelled the job
                 if ( this.logger.isDebugEnabled() ) {
                     this.logger.debug("Cancelled job {}", 
Utility.toString(jobEvent.getJob()));
                 }
                 this.cancelledJob();
-                Utility.sendNotification(this.eventAdmin, 
JobUtil.TOPIC_JOB_CANCELLED, jobEvent.getJob(), null);
                 break;
         }
 
-        return reschedule;
+        return info;
     }
 
     /**
@@ -350,7 +351,7 @@ public abstract class AbstractJobQueue
     @Override
     public boolean finishedJob(final Event job, final boolean 
shouldReschedule) {
         final String location = (String)job.getProperty(JobUtil.JOB_ID);
-        return this.finishedJob(location, shouldReschedule ? JobStatus.FAILED 
: JobStatus.OK, false);
+        return this.finishedJob(location, shouldReschedule ? JobStatus.FAILED 
: JobStatus.SUCCEEDED, false);
     }
 
     private boolean finishedJob(final String jobId,
@@ -367,9 +368,9 @@ public abstract class AbstractJobQueue
         }
 
         // get job handler
-        final JobHandler info;
+        final JobHandler handler;
         synchronized ( this.processsingJobsLists ) {
-            info = this.processsingJobsLists.remove(jobId);
+            handler = this.processsingJobsLists.remove(jobId);
         }
 
         if ( !this.running ) {
@@ -377,7 +378,7 @@ public abstract class AbstractJobQueue
             return false;
         }
 
-        if ( info == null ) {
+        if ( handler == null ) {
             if ( this.logger.isDebugEnabled() ) {
                 this.logger.debug("This job has never been started by this 
queue: {}", jobId);
             }
@@ -385,35 +386,40 @@ public abstract class AbstractJobQueue
         }
 
         // handle the reschedule, a new job might be returned with updated 
reschedule info!
-        final boolean reschedule = this.handleReschedule(info, result);
+        final RescheduleInfo rescheduleInfo = this.handleReschedule(handler, 
result);
 
         // if this is set after the synchronized block we have an error
         final boolean finishSuccessful;
 
-        if ( !reschedule ) {
-            info.finished();
+        if ( !rescheduleInfo.reschedule ) {
+            handler.finished(result.getState());
             finishSuccessful = true;
+            if ( result.getState() == JobState.SUCCEEDED ) {
+                Utility.sendNotification(this.eventAdmin, 
JobUtil.TOPIC_JOB_FINISHED, handler.getJob(), rescheduleInfo.processingTime);
+            } else {
+                Utility.sendNotification(this.eventAdmin, 
JobUtil.TOPIC_JOB_CANCELLED, handler.getJob(), null);
+            }
         } else {
-            finishSuccessful = info.reschedule();
+            finishSuccessful = handler.reschedule();
+            Utility.sendNotification(this.eventAdmin, 
JobUtil.TOPIC_JOB_FAILED, handler.getJob(), null);
         }
 
         if ( !isAsync ) {
-            if ( !finishSuccessful || !reschedule ) {
+            if ( !finishSuccessful || !rescheduleInfo.reschedule ) {
                 checkForNotify(null);
                 return false;
             }
-            checkForNotify(info);
-            return true;
+            checkForNotify(handler);
         } else {
             // async result
-            if ( finishSuccessful && reschedule ) {
-                final JobHandler reprocessHandler = this.reschedule(info);
+            if ( finishSuccessful && rescheduleInfo.reschedule ) {
+                final JobHandler reprocessHandler = this.reschedule(handler);
                 if ( reprocessHandler != null ) {
                     this.put(reprocessHandler);
                 }
             }
-            return true;
         }
+        return true;
     }
 
     private void checkForNotify(final JobHandler info) {
@@ -528,7 +534,7 @@ public abstract class AbstractJobQueue
                                                     break;
                                     }
                                 }
-                                JobStatus result = JobStatus.CANCEL;
+                                JobStatus result = JobStatus.CANCELLED;
                                 final AtomicBoolean isAsync = new 
AtomicBoolean(false);
 
                                 try {
@@ -561,6 +567,11 @@ public abstract class AbstractJobQueue
                                             }
 
                                             @Override
+                                            public boolean isStopped() {
+                                                return false;
+                                            }
+
+                                            @Override
                                             public void 
asyncProcessingFinished(final JobStatus status) {
                                                 synchronized ( lock ) {
                                                     if ( 
isAsync.compareAndSet(true, false) ) {
@@ -581,7 +592,7 @@ public abstract class AbstractJobQueue
                                 } catch (final Throwable t) { //NOSONAR
                                     logger.error("Unhandled error occured in 
job processor " + t.getMessage() + " while processing job " + 
Utility.toString(job), t);
                                     // we don't reschedule if an exception 
occurs
-                                    result = JobStatus.CANCEL;
+                                    result = JobStatus.CANCELLED;
                                 } finally {
                                     currentThread.setPriority(oldPriority);
                                     currentThread.setName(oldName);

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java
 Fri Sep 27 15:47:49 2013
@@ -162,6 +162,12 @@ public interface JobManager {
     Collection<Job> findJobs(QueryType type, String topic, long limit, 
Map<String, Object>... templates);
 
     /**
+     * Stop a job
+     * @since 1.3
+     */
+    void stopJobById(String jobId);
+
+    /**
      * Return all jobs either running or scheduled.
      *
      * @param type Required parameter for the type: either all jobs, only 
queued or only started can be returned.

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java
 Fri Sep 27 15:47:49 2013
@@ -35,6 +35,13 @@ public interface JobExecutionContext {
     void asyncProcessingFinished(final JobStatus status);
 
     /**
+     * If a job is stoppable, it should periodically check this method
+     * and stop processing if the method return <code>true</code>.
+     * @return Whether this job has been stopped from the outside.
+     */
+    boolean isStopped();
+
+    /**
      * Indicate that the job executor is able to report the progress
      * by providing a step count.
      * This method should only be called once, consecutive calls

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutor.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutor.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutor.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutor.java
 Fri Sep 27 15:47:49 2013
@@ -63,10 +63,10 @@ public interface JobExecutor {
     /**
      * Execute the job.
      *
-     * If the job has been processed successfully, {@link JobStatus.OK} should 
be returned.
+     * If the job has been processed successfully, {@link JobStatus.SUCCEEDED} 
should be returned.
      * If the job has not been processed completely, but might be rescheduled 
{@link JobStatus.FAILED}
      * should be returned.
-     * If the job processing failed and should not be rescheduled, {@link 
JobStatus.CANCEL} should
+     * If the job processing failed and should not be rescheduled, {@link 
JobStatus.CANCELLED} should
      * be returned.
      *
      * If the executor decides to process the job asynchronously it should 
return <code>null</code>
@@ -74,7 +74,7 @@ public interface JobExecutor {
      * method.
      *
      * If the processing fails with throwing an exception/throwable, the 
process will not be rescheduled
-     * and treated like the method would have returned {@link 
JobStatus.CANCEL}.
+     * and treated like the method would have returned {@link 
JobStatus.CANCELLED}.
      *
      * Instead of the constants from the JobStatus class, this method can 
return a custom instance containing
      * additional information.

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobState.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobState.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobState.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobState.java
 Fri Sep 27 15:47:49 2013
@@ -24,7 +24,7 @@ package org.apache.sling.event.jobs.cons
  */
 public enum JobState {
 
-    OK,      // processing finished successfully
-    FAILED,  // processing failed, can be retried
-    CANCEL   // processing failed permanently
+    SUCCEEDED,  // processing finished successfully
+    FAILED,     // processing failed, can be retried
+    CANCELLED   // processing failed permanently
 }

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobStatus.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobStatus.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobStatus.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobStatus.java
 Fri Sep 27 15:47:49 2013
@@ -25,14 +25,14 @@ package org.apache.sling.event.jobs.cons
  */
 public final class JobStatus {
 
-    /** Constant for the {@link JobState#OK} status. */
-    public static final JobStatus OK = new JobStatus(JobState.OK, null);
+    /** Constant for the {@link JobState#SUCCEEDED} status. */
+    public static final JobStatus SUCCEEDED = new 
JobStatus(JobState.SUCCEEDED, null);
 
     /** Constant for the {@link JobState#FAILED} status. */
     public static final JobStatus FAILED = new JobStatus(JobState.FAILED, 
null);
 
-    /** Constant for the {@link JobState#CANCEL} status. */
-    public static final JobStatus CANCEL = new JobStatus(JobState.CANCEL, 
null);
+    /** Constant for the {@link JobState#CANCELLED} status. */
+    public static final JobStatus CANCELLED = new 
JobStatus(JobState.CANCELLED, null);
 
     /** The state of the job after processing. */
     private final JobState state;

Modified: 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java?rev=1526963&r1=1526962&r2=1526963&view=diff
==============================================================================
--- 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java
 (original)
+++ 
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java
 Fri Sep 27 15:47:49 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.2.0")
+@Version("1.3.0")
 package org.apache.sling.event.jobs;
 
 import aQute.bnd.annotation.Version;


Reply via email to