Class AbstractJobExecutor<Result>

  • All Implemented Interfaces:
    org.apache.sling.event.jobs.consumer.JobExecutor, org.osgi.service.event.EventHandler
    Direct Known Subclasses:
    GroovyJobExecutor, PackageJobExecutor

    public abstract class AbstractJobExecutor<Result>
    extends Object
    implements org.apache.sling.event.jobs.consumer.JobExecutor, org.osgi.service.event.EventHandler
    • Constructor Detail

      • AbstractJobExecutor

        public AbstractJobExecutor()
    • Method Detail

      • getResolverFactory

        @NotNull
        protected abstract @NotNull org.apache.sling.api.resource.ResourceResolverFactory getResolverFactory()
      • getDynamicClassLoaderManager

        @NotNull
        protected abstract @NotNull org.apache.sling.commons.classloader.DynamicClassLoaderManager getDynamicClassLoaderManager()
      • getJobTopic

        protected abstract String getJobTopic()
      • getAuditBasePath

        protected abstract String getAuditBasePath()
      • jobExecutionEnabled

        protected abstract boolean jobExecutionEnabled​(org.apache.sling.event.jobs.Job job)
      • createCallable

        protected abstract Callable<Result> createCallable​(org.apache.sling.event.jobs.Job job,
                                                           org.apache.sling.event.jobs.consumer.JobExecutionContext context,
                                                           org.apache.sling.api.resource.ResourceResolver adminResolver,
                                                           PrintWriter out)
                                                    throws Exception
        The Callable does the job which is prepared by the executor.
        Throws:
        Exception
      • process

        public final org.apache.sling.event.jobs.consumer.JobExecutionResult process​(org.apache.sling.event.jobs.Job job,
                                                                                     org.apache.sling.event.jobs.consumer.JobExecutionContext context)
        Specified by:
        process in interface org.apache.sling.event.jobs.consumer.JobExecutor
      • jobExecutionFinished

        protected void jobExecutionFinished​(org.apache.sling.event.jobs.Job job,
                                            org.apache.sling.event.jobs.consumer.JobExecutionContext context,
                                            org.apache.sling.api.resource.Resource auditResource)
                                     throws IOException
        Can be overwritten to handle some cleanup or logging when job is finished.
        Throws:
        IOException
      • buildAuditPathIntern

        protected String buildAuditPathIntern​(String reference,
                                              Calendar eventJobStartedTime)
      • handleEvent

        public void handleEvent​(org.osgi.service.event.Event event)
        Specified by:
        handleEvent in interface org.osgi.service.event.EventHandler
      • getProperty

        protected <T> T getProperty​(org.apache.sling.event.jobs.Job job,
                                    String name,
                                    T defaultValue)