Package com.polarion.platform.jobs.spi
Class GenericJobUnitFactory
java.lang.Object
com.polarion.platform.jobs.spi.GenericJobUnitFactory
- All Implemented Interfaces:
IJobUnitFactory
Simple and easy-to-reuse implementation of
IJobUnitFactory.
Returns hidden job descriptor (see IJobDescriptor.isHidden())
from getJobDescriptor(IJobUnit).
- Version:
- $Revision$ $Date$
- Author:
- Stepan Roh, Polarion Software
-
Constructor Summary
ConstructorsConstructorDescriptionGenericJobUnitFactory(String jobFactoryName, String jobLabel, Class jobUnitClass) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateJobUnit(String name) Create job unit with given name.getJobDescriptor(IJobUnit jobUnit) Job descriptor.getName()Job factory name.
-
Constructor Details
-
GenericJobUnitFactory
Constructor.- Parameters:
jobFactoryName- job factory name (seegetName())jobLabel- job label (seeIJobDescriptor.getLabel())jobUnitClass- job unit class (implementingIJobUnit)- Throws:
IllegalArgumentException- if jobName isnullIllegalArgumentException- if jobLabel isnullIllegalArgumentException- if jobUnitClass isnullIllegalArgumentException- if jobUnitClass does not implementIJobUnit
-
-
Method Details
-
createJobUnit
Description copied from interface:IJobUnitFactoryCreate job unit with given name.Given label will be returned from
IJobUnit.getName().- Specified by:
createJobUnitin interfaceIJobUnitFactory- Parameters:
name- job name- Returns:
- created job unit (not
null) - Throws:
GenericJobException- if for some reason creation fails
-
getJobDescriptor
Description copied from interface:IJobUnitFactoryJob descriptor.May return dynamic job descriptor if and only if given job unit is not
null. It is not required to provide dynamic descriptor even though user wants it, however if user has given some job unit, descriptor must return it fromIJobDescriptor.getJobUnit().- Specified by:
getJobDescriptorin interfaceIJobUnitFactory- Parameters:
jobUnit- job unit used for dynamic configuration changes (may benull)- Returns:
- job descriptor (not
null)
-
getName
Description copied from interface:IJobUnitFactoryJob factory name.Something like job unit class name (but shorter), normally used for
IJobUnitRepository.getJobUnitFactory(String).- Specified by:
getNamein interfaceIJobUnitFactory- Returns:
- name (not
null)
-