[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/config/xml XMLJobConfig.java,1.2,
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-08 00:31:17
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17000 Modified Files: XMLJobConfig.java XMLJobConfigFactory.java XMLJobControllerConfig.java Log Message: no message Index: XMLJobConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLJobConfig.java 7 Mar 2006 23:33:23 -0000 1.2 --- XMLJobConfig.java 8 Mar 2006 00:31:12 -0000 1.3 *************** *** 11,19 **** package org.jmonks.batchserver.framework.config.xml; import org.jmonks.batchserver.framework.config.JobConfig; import org.w3c.dom.Element; /** ! * XMLJobConfig provides the implementation of JobConfig * @author Suresh Pragada * @since 1.0 --- 11,40 ---- package org.jmonks.batchserver.framework.config.xml; + import org.jmonks.batchserver.framework.common.ErrorCode; + import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; import org.w3c.dom.Element; + import org.w3c.dom.NodeList; /** ! * <p> ! * XMLJobConfig provides the implementation of JobConfig by reading the ! * job configuration from XML DOM element <job-config> configured in the ! * job configuration file. This reads and represents the following piece of XML ! * block from job configuration file. ! * <br><br> ! * <pre> ! * <job-config job-name="process_file_xyz"> ! * <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController" ! * job-controller-config-class-name="org.jmonks.batchserver.framework.config.BasicJobControllerConfig"> ! * <basic-job-processor basic-job-processor-class-name="com.mycompany.batch.processfilexyz.XyzProcessor"> ! * <property key="basic-job-processor-key1">processor-value1</property> ! * </basic-job-processor> ! * <property key="basic-job-controller-restart">true</property> ! * </job-controller> ! * </job-config> ! * </pre> ! * </p> ! * * @author Suresh Pragada * @since 1.0 *************** *** 22,31 **** public class XMLJobConfig extends JobConfig { ! /** Creates a new instance of XMLJobConfig */ XMLJobConfig(Element jobConfigElement) { ! /** ! * Load the configuration properties ! */ } --- 43,73 ---- public class XMLJobConfig extends JobConfig { ! /** ! * Element name that identifies the job configuration. ! */ ! public static final String JOB_CONFIG_ELEMENT_NAME = "job-config"; ! /** ! * Attribute name that identifies the job name. ! */ ! public static final String JOB_NAME_ATTRIBUTE_NAME = "job-name"; ! /** ! * Loads the job name and controller configuration into the job configuration object. ! * ! * @param jobConfigElement XML DOM Element that represents the <job-confg> ! * element in batch job configuration file. ! * ! * @throws ConfigurationException If more than one job controllers are found in job configuration. ! */ XMLJobConfig(Element jobConfigElement) { ! this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); ! NodeList controllerConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobControllerConfig.JOB_CONTROLLER_CONFIG_ELEMENT_NAME); ! if(controllerConfigNodeList.getLength()==1) ! { ! Element controllerConfigElement=(Element)controllerConfigNodeList.item(0); ! this.jobControllerConfig=XMLJobControllerConfig.getJobControllerConfig(controllerConfigElement); ! } ! else ! throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_JOB_CONTROLLER_CONFIGS); } Index: XMLJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobControllerConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLJobControllerConfig.java 3 Mar 2006 04:19:57 -0000 1.1 --- XMLJobControllerConfig.java 8 Mar 2006 00:31:12 -0000 1.2 *************** *** 20,23 **** --- 20,28 ---- public abstract class XMLJobControllerConfig extends JobControllerConfig { + /** + * Element name that identifies the job controller configuration. + */ + public static final String JOB_CONTROLLER_CONFIG_ELEMENT_NAME = "job-controller"; + public static JobControllerConfig getJobControllerConfig(Element controllerConfigElement) { Index: XMLJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfigFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLJobConfigFactory.java 7 Mar 2006 23:33:23 -0000 1.2 --- XMLJobConfigFactory.java 8 Mar 2006 00:31:12 -0000 1.3 *************** *** 64,75 **** private static final String PROPERTY_JOB_CONFIG_FILE_CLASSPATH_LOCATION = "job-config-file-classpath-location"; /** - * Element name that identifies the job configuration. - */ - private static final String JOB_CONFIG_ELEMENT_NAME = "job-config"; - /** - * Attribute name that identifies the job name. - */ - private static final String JOB_NAME_ATTRIBUTE_NAME = "job-name"; - /** * Property map holds the properites required by this factory. */ --- 64,67 ---- *************** *** 165,173 **** throw new IllegalArgumentException("jobName cannot be null."); ! NodeList jobConfigNodeList=this.batchConfigElement.getElementsByTagName(XMLJobConfigFactory.JOB_CONFIG_ELEMENT_NAME); for(int i=0;i<jobConfigNodeList.getLength();i++) { Element jobConfigElement=(Element)jobConfigNodeList.item(i); ! String elementJobName=jobConfigElement.getAttribute(XMLJobConfigFactory.JOB_NAME_ATTRIBUTE_NAME); if(jobName.equals(elementJobName)) { --- 157,165 ---- throw new IllegalArgumentException("jobName cannot be null."); ! NodeList jobConfigNodeList=this.batchConfigElement.getElementsByTagName(XMLJobConfig.JOB_CONFIG_ELEMENT_NAME); for(int i=0;i<jobConfigNodeList.getLength();i++) { Element jobConfigElement=(Element)jobConfigNodeList.item(i); ! String elementJobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); if(jobName.equals(elementJobName)) { |