com.norconex.jef
Class AbstractJobGroup

java.lang.Object
  extended by com.norconex.jef.AbstractJobGroup
All Implemented Interfaces:
IJob, IJobGroup
Direct Known Subclasses:
AsyncJobGroup, SyncJobGroup

public abstract class AbstractJobGroup
extends Object
implements IJobGroup

Base implementation for job groups. The group progress is an average of all job progress it contains, on a factor of 100.

Author:
Pascal Essiembre

Constructor Summary
AbstractJobGroup(String id, IJob... jobs)
          Constructor.
AbstractJobGroup(String id, String description, IJob... jobs)
          Constructor.
 
Method Summary
 IJobContext createJobContext()
          Contextual information about the job to run.
 String getId()
          Gets the job unique identifier.
 IJob[] getJobs()
          Gets all jobs part of this group.
protected  void registerGroupProgressMonitoring(JobProgress groupProgress, JobSuite suite)
          Registers a monitoring process so that individual job progress part of this group gets reflected on the group overall progress.
 void stop(IJobStatus progress, JobSuite suite)
          Stops this job.
protected  void unregisterGroupProgressMonitoring(JobSuite suite)
          Unregisters the monitoring process associated with the given job suite.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.norconex.jef.IJob
execute
 

Constructor Detail

AbstractJobGroup

public AbstractJobGroup(String id,
                        IJob... jobs)
Constructor.

Parameters:
id - job unique identifier
jobs - jobs to be run by the group

AbstractJobGroup

public AbstractJobGroup(String id,
                        String description,
                        IJob... jobs)
Constructor.

Parameters:
id - job unique identifier
jobs - jobs to be run by the group
description - job description
Method Detail

getJobs

public final IJob[] getJobs()
Description copied from interface: IJobGroup
Gets all jobs part of this group.

Specified by:
getJobs in interface IJobGroup
Returns:
jobs in the group

getId

public final String getId()
Description copied from interface: IJob
Gets the job unique identifier.

Specified by:
getId in interface IJob
Returns:
job unique identifier

createJobContext

public IJobContext createJobContext()
Description copied from interface: IJob
Contextual information about the job to run. Cannot be null.

Specified by:
createJobContext in interface IJob
Returns:
job context

registerGroupProgressMonitoring

protected final void registerGroupProgressMonitoring(JobProgress groupProgress,
                                                     JobSuite suite)
Registers a monitoring process so that individual job progress part of this group gets reflected on the group overall progress.

Parameters:
groupProgress - job progress for this group
suite - suite for which we are tracking job progress

unregisterGroupProgressMonitoring

protected final void unregisterGroupProgressMonitoring(JobSuite suite)
Unregisters the monitoring process associated with the given job suite.

Parameters:
suite - suite on which we were monitoring job progress

stop

public void stop(IJobStatus progress,
                 JobSuite suite)
Description copied from interface: IJob
Stops this job. Implementors are responsible for terminating the execution of this job. The progress and other contextual information can be set, but the "status" should not be overwritten, as the framework will take care of assigning it.

Specified by:
stop in interface IJob
Parameters:
progress - current job progress
suite - job suite this job is part of


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