org.jmonks.batch.framework.config.xml
Class XMLJobConfigFactory

java.lang.Object
  extended byorg.jmonks.batch.framework.config.JobConfigFactory
      extended byorg.jmonks.batch.framework.config.xml.XMLJobConfigFactory

public class XMLJobConfigFactory
extends JobConfigFactory

XMLJobConfigFactory reads the job configuration from XML file to create the configuration objects needed by the job. This factory looks for few properties in the factory config properties map to identify the source of the XML file. The source of the XML file can be defined as absolute path on the file system or resource on the class path.

Following are the two properties, this factory looks to find the source. If it find these two it will give priority to the physical absolute path location.

property keyproperty value
job-config-file-absolute-location/batchserver/config/batch-config.xml
job-config-file-classpath-locationbatch-config.xml
These properties can be configured using <property> attribute in the <job-config-factory-config> element in the framework configuration file.

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Constructor Summary
XMLJobConfigFactory()
           Do not use this constructor to instantiate XMLJobConfigFactory directly.
 
Method Summary
 JobConfig getJobConfig(java.lang.String jobName)
          Returns the requested job configuration as JobConfig object.
protected  void init(java.util.Map configFactoryProps)
          This method initializes the factory by accepting the required properties from the input map.
 java.lang.String toString()
           Returns the string representation of XMLJobConfigFactory class in the format
{XMLJobConfigFactory [configProperties = value] [element = value]}
 
Methods inherited from class org.jmonks.batch.framework.config.JobConfigFactory
getJobConfigFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLJobConfigFactory

public XMLJobConfigFactory()

Do not use this constructor to instantiate XMLJobConfigFactory directly. Use the factory method getJobConfigFactory in JobConfigFactory class to get the config factory instance. This constructor has been provided to make sure this should be instantiable and accessible to the JobConfigFactory class.

Method Detail

init

protected void init(java.util.Map configFactoryProps)
This method initializes the factory by accepting the required properties from the input map. If it doesnt find any required properties to initialize the factory, throws ConfigurationException with the appropriate error message.

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

getJobConfig

public JobConfig getJobConfig(java.lang.String jobName)
Returns the requested job configuration as JobConfig object. The requested job name should be passed as a parameter. If it does not find the configuration of the requested jobName in the job configuration file, it returns null.

Specified by:
getJobConfig in class JobConfigFactory
Parameters:
jobName - Name of the job.
Returns:
Returns the job config object if found, null, otherwise.
Throws:
java.lang.IllegalArgumentException - If jobName passed as parameter is null.
java.lang.IllegalStateException - If factory is not initialized properly.

toString

public java.lang.String toString()

Returns the string representation of XMLJobConfigFactory class in the format
{XMLJobConfigFactory [configProperties = value] [element = value]}

Returns:
Returns the string representation of XMLJobConfigFactory.