org.jmonks.batch.framework.config
Class JobConfigFactory

java.lang.Object
  extended byorg.jmonks.batch.framework.config.JobConfigFactory
Direct Known Subclasses:
DBJobConfigFactory, XMLJobConfigFactory

public abstract class JobConfigFactory
extends java.lang.Object

JobConfigFactory returns the factory class instance which in turn returns the job configuration objects from the designated factory. This class determines the factory needs to be returned is based on the configFactoryClassName defined JobConfigFactoryConfig object passed as input parameter.

This will get the following XML block from framework configuration as JobConfigFactoryConfig object.

     <job-config-factory-config job-config-factory-class-name="org.jmonks.batch.framework.config.xml.XMLJobConfigFactory">
       <property key="job-config-file-absolute-location">/batchserver/config/batch-config.xml</property>
   </job-config-factory-config>
 

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Constructor Summary
JobConfigFactory()
           
 
Method Summary
abstract  JobConfig getJobConfig(java.lang.String jobName)
          Returns the requested JobConfig object from the defined factory.
static JobConfigFactory getJobConfigFactory(FrameworkConfig.JobConfigFactoryConfig factoryConfig)
          This factory method will return the appropriate job configuration factory based on the input values in JobConfigFactoryConfig object.
protected abstract  void init(java.util.Map configFactoryProps)
          Method to initialize the factory using properies defined for this factory in framework configuration file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobConfigFactory

public JobConfigFactory()
Method Detail

getJobConfigFactory

public static JobConfigFactory getJobConfigFactory(FrameworkConfig.JobConfigFactoryConfig factoryConfig)
This factory method will return the appropriate job configuration factory based on the input values in JobConfigFactoryConfig object. This looks for the factory class name in the given object, instantiates and return that factory.

Parameters:
factoryConfig - Job configuration factory config object contains the details need to create the factory.
Returns:
Returns the approproated JobConfigFactory object.
Throws:
ConfigurationException - If defined factory class is not a valid Job config factory and if any required properties are missing for the factory.
java.lang.IllegalArgumentException - If input factory configuration is null.

getJobConfig

public abstract JobConfig getJobConfig(java.lang.String jobName)
Returns the requested JobConfig object from the defined factory. If requested job configuration is not found in that factory, it returns null.

Parameters:
jobName - Name of the job whose configuration is needed.
Returns:
Returns the requested Job Configuration object if found, null otherwise.

init

protected abstract void init(java.util.Map configFactoryProps)
Method to initialize the factory using properies defined for this factory in framework configuration file. All the properties defined for this configuration factory will be passed as map to this method as soon as the factory is instantiated.

Parameters:
configFactoryProps - Map consists of all the properties defined for this factory.
Throws:
ConfigurationException - If required properties by the factory are missing.