Interface Job


  • @ProviderType
    public interface Job
    A job Property Types In general all scalar types and all serializable classes are supported as property types. However, in order for deseralizing classes these must be exported. Serializable classes are not searchable in the query either. Due to the above mentioned potential problems, it is advisable to not use custom classes as job properties, but rather use out of the box supported types in combination with collections. A resource provider might convert numbers to a different type, JCR is well-known for this behavior as it only supports long but neither integer nor short. Therefore if you are dealing with numbers, use the getProperty(String, Class) method to get the correct type instead of directly casting it.
    Since:
    1.2
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Job.JobState
      The current job state.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PROPERTY_FINISHED_DATE
      This property contains the finished date once a job is marked as finished.
      static java.lang.String PROPERTY_JOB_CREATED
      This property is set by the job handling and contains a calendar object specifying the date and time when this job has been created.
      static java.lang.String PROPERTY_JOB_CREATED_INSTANCE
      This property is set by the job handling and contains the Sling instance ID of the instance where this job has been created.
      static java.lang.String PROPERTY_JOB_DESCRIPTION
      This is an optional property containing a human readable description for the job
      static java.lang.String PROPERTY_JOB_PROGRESS_ETA
      This property contains the optional ETA for a job.
      static java.lang.String PROPERTY_JOB_PROGRESS_LOG
      This property contains the optional output log of a job consumer.
      static java.lang.String PROPERTY_JOB_PROGRESS_STEP
      This property contains optional progress information about a job, the number of completed steps.
      static java.lang.String PROPERTY_JOB_PROGRESS_STEPS
      This property contains optional progress information about a job, the number of steps the job consumer will perform.
      static java.lang.String PROPERTY_JOB_QUEUE_NAME
      The name of the job queue processing this job.
      static java.lang.String PROPERTY_JOB_RETRIES
      The property to track the retry maximum retry count for jobs.
      static java.lang.String PROPERTY_JOB_RETRY_COUNT
      The property to track the retry count for jobs.
      static java.lang.String PROPERTY_JOB_RETRY_DELAY
      The property to set a retry delay.
      static java.lang.String PROPERTY_JOB_STARTED_TIME
      This property is set by the job handling and contains a calendar object specifying the date and time when this job has been started.
      static java.lang.String PROPERTY_JOB_TARGET_INSTANCE
      This property is set by the job handling and contains the Sling instance ID of the instance where this job should be processed.
      static java.lang.String PROPERTY_JOB_TITLE
      This is an optional property containing a human readable title for the job
      static java.lang.String PROPERTY_RESULT_MESSAGE
      This property contains the optional result message of a job consumer.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Calendar getCreated()
      This property is set by the job handling and contains a calendar object specifying the date and time when this job has been created.
      java.lang.String getCreatedInstance()
      This property is set by the job handling and contains the Sling instance ID of the instance where this job has been created.
      java.util.Calendar getFinishedDate()
      If the job is cancelled or succeeded, this method will return the finish date.
      int getFinishedProgressStep()
      If the job is in processing, return the optional information about the finished steps.
      java.lang.String getId()
      Unique job ID.
      Job.JobState getJobState()
      Get the job state
      int getNumberOfRetries()
      The property to track the retry maximum retry count for jobs.
      java.util.Calendar getProcessingStarted()
      This property is set by the job handling and contains a calendar object specifying the date and time when this job has been started.
      java.util.Calendar getProgressETA()
      If the job is in processing, return the optional ETA for this job.
      java.lang.String[] getProgressLog()
      This method returns the optional progress log from the last job processing.
      int getProgressStepCount()
      If the job is in processing, return the optional progress step count if available.
      java.lang.Object getProperty​(java.lang.String name)
      Get the value of a property.
      <T> T getProperty​(java.lang.String name, java.lang.Class<T> type)
      Get a named property and convert it into the given type.
      <T> T getProperty​(java.lang.String name, T defaultValue)
      Get a named property and convert it into the given type.
      java.util.Set<java.lang.String> getPropertyNames()
      Get all property names.
      java.lang.String getQueueName()
      The name of the job queue processing this job.
      java.lang.String getResultMessage()
      This method returns the message from the last job processing, regardless whether the processing failed, succeeded or was cancelled.
      int getRetryCount()
      On first execution the value of this property is zero.
      java.lang.String getTargetInstance()
      This property is set by the job handling and contains the Sling instance ID of the instance where this job should be processed.
      java.lang.String getTopic()
      The job topic.
    • Field Detail

      • PROPERTY_JOB_QUEUE_NAME

        static final java.lang.String PROPERTY_JOB_QUEUE_NAME
        The name of the job queue processing this job. This property is set by the job handling when the job is processed. If this property is set by the client creating the job it's value is ignored
        See Also:
        Constant Field Values
      • PROPERTY_JOB_RETRY_COUNT

        static final java.lang.String PROPERTY_JOB_RETRY_COUNT
        The property to track the retry count for jobs. Value is of type Integer. On first execution the value of this property is zero. This property is managed by the job handling. If this property is set by the client creating the job it's value is ignored
        See Also:
        Constant Field Values
      • PROPERTY_JOB_RETRIES

        static final java.lang.String PROPERTY_JOB_RETRIES
        The property to track the retry maximum retry count for jobs. Value is of type Integer. This property is managed by the job handling. If this property is set by the client creating the job it's value is ignored
        See Also:
        Constant Field Values
      • PROPERTY_JOB_CREATED

        static final java.lang.String PROPERTY_JOB_CREATED
        This property is set by the job handling and contains a calendar object specifying the date and time when this job has been created. If this property is set by the client creating the job it's value is ignored
        See Also:
        Constant Field Values
      • PROPERTY_JOB_CREATED_INSTANCE

        static final java.lang.String PROPERTY_JOB_CREATED_INSTANCE
        This property is set by the job handling and contains the Sling instance ID of the instance where this job has been created.
        See Also:
        Constant Field Values
      • PROPERTY_JOB_TARGET_INSTANCE

        static final java.lang.String PROPERTY_JOB_TARGET_INSTANCE
        This property is set by the job handling and contains the Sling instance ID of the instance where this job should be processed.
        See Also:
        Constant Field Values
      • PROPERTY_JOB_STARTED_TIME

        static final java.lang.String PROPERTY_JOB_STARTED_TIME
        This property is set by the job handling and contains a calendar object specifying the date and time when this job has been started. This property is only set if the job is currently in processing If this property is set by the client creating the job it's value is ignored
        See Also:
        Constant Field Values
      • PROPERTY_JOB_RETRY_DELAY

        static final java.lang.String PROPERTY_JOB_RETRY_DELAY
        The property to set a retry delay. Value is of type Long and specifies milliseconds. This property can be used to override the retry delay from the queue configuration. But it should only be used very rarely as the queue configuration should be the one in charge.
        See Also:
        Constant Field Values
      • PROPERTY_JOB_PROGRESS_LOG

        static final java.lang.String PROPERTY_JOB_PROGRESS_LOG
        This property contains the optional output log of a job consumer. The value of this property is a string array. This property is read-only and can't be specified when the job is created.
        Since:
        1.3
        See Also:
        Constant Field Values
      • PROPERTY_JOB_PROGRESS_ETA

        static final java.lang.String PROPERTY_JOB_PROGRESS_ETA
        This property contains the optional ETA for a job. The value of this property is a Calendar object. This property is read-only and can't be specified when the job is created.
        Since:
        1.3
        See Also:
        Constant Field Values
      • PROPERTY_JOB_PROGRESS_STEPS

        static final java.lang.String PROPERTY_JOB_PROGRESS_STEPS
        This property contains optional progress information about a job, the number of steps the job consumer will perform. Each step is assumed to consume roughly the same amount if time. The value of this property is an integer. This property is read-only and can't be specified when the job is created.
        Since:
        1.3
        See Also:
        Constant Field Values
      • PROPERTY_JOB_PROGRESS_STEP

        static final java.lang.String PROPERTY_JOB_PROGRESS_STEP
        This property contains optional progress information about a job, the number of completed steps. The value of this property is an integer. This property is read-only and can't be specified when the job is created.
        Since:
        1.3
        See Also:
        Constant Field Values
      • PROPERTY_RESULT_MESSAGE

        static final java.lang.String PROPERTY_RESULT_MESSAGE
        This property contains the optional result message of a job consumer. The value of this property is a string. This property is read-only and can't be specified when the job is created.
        Since:
        1.3
        See Also:
        Constant Field Values
      • PROPERTY_FINISHED_DATE

        static final java.lang.String PROPERTY_FINISHED_DATE
        This property contains the finished date once a job is marked as finished. The value of this property is a Calendar object. This property is read-only and can't be specified when the job is created.
        Since:
        1.3
        See Also:
        Constant Field Values
      • PROPERTY_JOB_TITLE

        static final java.lang.String PROPERTY_JOB_TITLE
        This is an optional property containing a human readable title for the job
        Since:
        1.3
        See Also:
        Constant Field Values
      • PROPERTY_JOB_DESCRIPTION

        static final java.lang.String PROPERTY_JOB_DESCRIPTION
        This is an optional property containing a human readable description for the job
        Since:
        1.3
        See Also:
        Constant Field Values
    • Method Detail

      • getTopic

        java.lang.String getTopic()
        The job topic.
        Returns:
        The job topic
      • getId

        java.lang.String getId()
        Unique job ID.
        Returns:
        The unique job ID.
      • getProperty

        java.lang.Object getProperty​(java.lang.String name)
        Get the value of a property.
        Parameters:
        name - The property name
        Returns:
        The value of the property or null
      • getPropertyNames

        java.util.Set<java.lang.String> getPropertyNames()
        Get all property names.
        Returns:
        A set of property names.
      • getProperty

        <T> T getProperty​(java.lang.String name,
                          java.lang.Class<T> type)
        Get a named property and convert it into the given type. This method does not support conversion into a primitive type or an array of a primitive type. It should return null in this case.
        Type Parameters:
        T - The class of the type
        Parameters:
        name - The name of the property
        type - The class of the type
        Returns:
        Return named value converted to type T or null if non existing or can't be converted.
      • getProperty

        <T> T getProperty​(java.lang.String name,
                          T defaultValue)
        Get a named property and convert it into the given type. This method does not support conversion into a primitive type or an array of a primitive type. It should return the default value in this case.
        Type Parameters:
        T - The class of the type
        Parameters:
        name - The name of the property
        defaultValue - The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this is null any existing property is not converted.
        Returns:
        Return named value converted to type T or the default value if non existing or can't be converted.
      • getRetryCount

        int getRetryCount()
        On first execution the value of this property is zero. This property is managed by the job handling.
        Returns:
        The retry count.
      • getNumberOfRetries

        int getNumberOfRetries()
        The property to track the retry maximum retry count for jobs. This property is managed by the job handling.
        Returns:
        The number of retries.
      • getQueueName

        java.lang.String getQueueName()
        The name of the job queue processing this job. This property is set by the job handling when the job is processed.
        Returns:
        The queue name or null
      • getTargetInstance

        java.lang.String getTargetInstance()
        This property is set by the job handling and contains the Sling instance ID of the instance where this job should be processed.
        Returns:
        The sling ID or null
      • getProcessingStarted

        java.util.Calendar getProcessingStarted()
        This property is set by the job handling and contains a calendar object specifying the date and time when this job has been started. This property is only set if the job is currently in processing
        Returns:
        The time the processing started or null.
      • getCreated

        java.util.Calendar getCreated()
        This property is set by the job handling and contains a calendar object specifying the date and time when this job has been created.
        Returns:
        The time the job was created.
      • getCreatedInstance

        java.lang.String getCreatedInstance()
        This property is set by the job handling and contains the Sling instance ID of the instance where this job has been created.
        Returns:
        The instance id the job was created on
      • getJobState

        Job.JobState getJobState()
        Get the job state
        Returns:
        The job state.
        Since:
        1.3
      • getFinishedDate

        java.util.Calendar getFinishedDate()
        If the job is cancelled or succeeded, this method will return the finish date.
        Returns:
        The finish date or null
        Since:
        1.3
      • getResultMessage

        java.lang.String getResultMessage()
        This method returns the message from the last job processing, regardless whether the processing failed, succeeded or was cancelled. The message is optional and can be set by a job consumer.
        Returns:
        The result message or null
        Since:
        1.3
      • getProgressLog

        java.lang.String[] getProgressLog()
        This method returns the optional progress log from the last job processing. The log is optional and can be set by a job consumer.
        Returns:
        The log or null
        Since:
        1.3
      • getProgressStepCount

        int getProgressStepCount()
        If the job is in processing, return the optional progress step count if available. The progress information is optional and can be set by a job consumer.
        Returns:
        The progress step count or -1.
        Since:
        1.3
      • getFinishedProgressStep

        int getFinishedProgressStep()
        If the job is in processing, return the optional information about the finished steps. This progress information is optional and can be set by a job consumer. In combination with getProgressStepCount() this can be used to calculate a progress bar.
        Returns:
        The number of the finished progress step or 0
        Since:
        1.3
      • getProgressETA

        java.util.Calendar getProgressETA()
        If the job is in processing, return the optional ETA for this job. The progress information is optional and can be set by a job consumer.
        Returns:
        The estimated ETA or null
        Since:
        1.3