com.norconex.jef.suite
Class JobSuite

java.lang.Object
  extended by com.norconex.jef.suite.JobSuite

public final class JobSuite
extends Object

A job suite is an amalgamation of jobs, represented as a single executable unit. It can be seen as of one big job made of several sub-jobs. Configurations applied to a suite affects all jobs associated with the suite. All jobs making up a suite must have unique identifiers.

Author:
Pascal Essiembre

Constructor Summary
JobSuite(IJob job)
          Creates a new job suite using a FileLogManager and a JobProgressPropertiesFileSerializer.
JobSuite(IJob job, IJobProgressSerializer progressSerializer)
          Creates a new job suite using a FileLogManager.
JobSuite(IJob job, IJobProgressSerializer progressSerializer, ILogManager logManager)
          Creates a new job suite.
JobSuite(IJob job, IJobProgressSerializer progressSerializer, ILogManager logManager, IJobSuiteStopRequestHandler stopRequestAdviser)
          Creates a new job suite.
JobSuite(IJob job, ILogManager logManager)
          Creates a new job suite using a JobProgressPropertiesFileSerializer.
 
Method Summary
 void accept(IJobSuiteVisitor visitor)
          Accepts a job suite visitor.
 void accept(IJobSuiteVisitor visitor, Class<IJob> jobFilterClass)
          Accepts a job suite visitor, filtering jobs and job progresses to those of the same type as the specified job class instance.
 void addErrorHandler(IErrorHandler handler)
          Adds an error handler.
 void addJobProgressListener(IJobProgressListener listener)
          Adds a job progress listener.
 void addSuiteLifeCycleListener(ISuiteLifeCycleListener listener)
          Adds a suite life cycle listener.
 void addSuiteStopRequestListener(ISuiteStopRequestListener listener)
          Adds a job progress listener.
static String getDefaultWorkDir()
          Gets the default path to the JEF working directory for file-system related operations.
 IErrorHandler[] getErrorHandlers()
          Gets all error handlers.
 IJob getJob(String jobId)
          Gets the job instance matching the given job identifier.
 IJobContext getJobContext(IJob job)
           
 IJobContext getJobContext(String jobId)
           
 String[] getJobIds()
          Gets all job identifiers in order provided by the suite hierarchy.
 IJobStatus getJobProgress(IJob job)
          Gets the job progress associated with one of the suite's job.
 IJobStatus getJobProgress(String jobId)
          Gets the job progress associated with one of the suite's job.
 IJobProgressListener[] getJobProgressListeners()
          Gets all job progress listeners.
 IJobProgressSerializer getJobProgressSerializer()
          Gets the job progress serializer.
 ILogManager getLogManager()
          Gets the Log4J log manager.
 String getNamespace()
          Gets the namespace (unique identifier) associated with this suite.
 IJob getRootJob()
          Gets the suite root job.
 IJobSuiteStopRequestHandler getStopRequestHandler()
           
 ISuiteLifeCycleListener[] getSuiteLifeCycleListeners()
          Gets all suite life cycle listeners.
 IJobStatus.Status getSuiteStatus()
          Gets the job suite status.
 ISuiteStopRequestListener[] getSuiteStopRequestListeners()
          Gets all job progress listeners.
 void removeErrorHandler(IErrorHandler handler)
          Removes an error handler.
 void removeJobProgressListener(IJobProgressListener listener)
          Removes a job progress listener.
 void removeSuiteLifeCycleListener(ISuiteLifeCycleListener listener)
          Removes a suite life cycle listener.
 void removeSuiteStopRequestListener(ISuiteStopRequestListener listener)
          Removes a job progress listener.
 void stop()
          Stops this job suite.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobSuite

public JobSuite(IJob job)
Creates a new job suite using a FileLogManager and a JobProgressPropertiesFileSerializer.

Parameters:
job - root job for the suite

JobSuite

public JobSuite(IJob job,
                IJobProgressSerializer progressSerializer)
Creates a new job suite using a FileLogManager.

Parameters:
job - root job for the suite
progressSerializer - job progress serializer

JobSuite

public JobSuite(IJob job,
                ILogManager logManager)
Creates a new job suite using a JobProgressPropertiesFileSerializer.

Parameters:
job - root job for the suite
logManager - Log4J log manager
Since:
1.1.1

JobSuite

public JobSuite(IJob job,
                IJobProgressSerializer progressSerializer,
                ILogManager logManager)
Creates a new job suite.

Parameters:
job - root job for the suite
progressSerializer - job progress serializer
logManager - Log4J log manager

JobSuite

public JobSuite(IJob job,
                IJobProgressSerializer progressSerializer,
                ILogManager logManager,
                IJobSuiteStopRequestHandler stopRequestAdviser)
Creates a new job suite.

Parameters:
job - root job for the suite
progressSerializer - job progress serializer
logManager - Log4J log manager
Method Detail

getSuiteStatus

public IJobStatus.Status getSuiteStatus()
Gets the job suite status. This is equivalent of getting the status on the root job for this suite.

Returns:
suite status

getRootJob

public IJob getRootJob()
Gets the suite root job.

Returns:
suite root job

getJobContext

public IJobContext getJobContext(String jobId)

getJobContext

public IJobContext getJobContext(IJob job)

getJobIds

public String[] getJobIds()
Gets all job identifiers in order provided by the suite hierarchy.

Returns:
job unique identifiers

getStopRequestHandler

public IJobSuiteStopRequestHandler getStopRequestHandler()

getNamespace

public String getNamespace()
Gets the namespace (unique identifier) associated with this suite. This is the job id of the root job.

Returns:
namespace

addJobProgressListener

public void addJobProgressListener(IJobProgressListener listener)
Adds a job progress listener.

Parameters:
listener - job progress listener to add

removeJobProgressListener

public void removeJobProgressListener(IJobProgressListener listener)
Removes a job progress listener.

Parameters:
listener - job progress listener to remove

getJobProgressListeners

public IJobProgressListener[] getJobProgressListeners()
Gets all job progress listeners.

Returns:
all job progress listeners

addSuiteStopRequestListener

public void addSuiteStopRequestListener(ISuiteStopRequestListener listener)
Adds a job progress listener.

Parameters:
listener - job progress listener to add

removeSuiteStopRequestListener

public void removeSuiteStopRequestListener(ISuiteStopRequestListener listener)
Removes a job progress listener.

Parameters:
listener - job progress listener to remove

getSuiteStopRequestListeners

public ISuiteStopRequestListener[] getSuiteStopRequestListeners()
Gets all job progress listeners.

Returns:
all job progress listeners

addSuiteLifeCycleListener

public void addSuiteLifeCycleListener(ISuiteLifeCycleListener listener)
Adds a suite life cycle listener.

Parameters:
listener - suite life cycle listener to add

removeSuiteLifeCycleListener

public void removeSuiteLifeCycleListener(ISuiteLifeCycleListener listener)
Removes a suite life cycle listener.

Parameters:
listener - suite life cycle listener to remove

getSuiteLifeCycleListeners

public ISuiteLifeCycleListener[] getSuiteLifeCycleListeners()
Gets all suite life cycle listeners.

Returns:
all suite life cycle listeners

addErrorHandler

public void addErrorHandler(IErrorHandler handler)
Adds an error handler.

Parameters:
handler - error handler to add

removeErrorHandler

public void removeErrorHandler(IErrorHandler handler)
Removes an error handler.

Parameters:
handler - error handler to remove

getErrorHandlers

public IErrorHandler[] getErrorHandlers()
Gets all error handlers.

Returns:
all error handlers

getJobProgressSerializer

public IJobProgressSerializer getJobProgressSerializer()
Gets the job progress serializer.

Returns:
job progress serializer

getLogManager

public ILogManager getLogManager()
Gets the Log4J log manager.

Returns:
Log4J log manager

getJobProgress

public IJobStatus getJobProgress(IJob job)
Gets the job progress associated with one of the suite's job.

Parameters:
job - the job for which to get its progress
Returns:
a job progress
Since:
1.1

getJobProgress

public IJobStatus getJobProgress(String jobId)
Gets the job progress associated with one of the suite's job.

Parameters:
jobId - the job identifier of the job for which to get progress
Returns:
a job progress
Since:
1.1

getJob

public IJob getJob(String jobId)
Gets the job instance matching the given job identifier.

Parameters:
jobId - unique job identifier
Returns:
a job
Since:
1.1

stop

public void stop()
Stops this job suite.

Since:
2.0

accept

public void accept(IJobSuiteVisitor visitor)
Accepts a job suite visitor.

Parameters:
visitor - job suite visitor
Since:
1.1

accept

public void accept(IJobSuiteVisitor visitor,
                   Class<IJob> jobFilterClass)
Accepts a job suite visitor, filtering jobs and job progresses to those of the same type as the specified job class instance.

Parameters:
visitor - job suite visitor
jobFilterClass - type to filter jobs and job progresses
Since:
1.1

getDefaultWorkDir

public static String getDefaultWorkDir()
Gets the default path to the JEF working directory for file-system related operations. The path is determined in one of the following way (in order):

Returns:
path to default working directory


Copyright © 2007-2013 Norconex Inc.. All Rights Reserved.