[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/config/xml XMLBasicJobControllerC
Brought to you by:
suresh_pragada
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21676 Modified Files: XMLBasicJobControllerConfig.java XMLJobConfig.java XMLJobControllerConfig.java XMLPoolJobControllerConfig.java Log Message: no message Index: XMLBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLBasicJobControllerConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLBasicJobControllerConfig.java 3 Mar 2006 04:19:57 -0000 1.1 --- XMLBasicJobControllerConfig.java 8 Mar 2006 05:17:48 -0000 1.2 *************** *** 15,28 **** /** * ! * @author Suresh Pragada */ public class XMLBasicJobControllerConfig extends BasicJobControllerConfig { ! /** Creates a new instance of XMLBasicJobControllerConfig */ XMLBasicJobControllerConfig(Element controllerConfigElement) { } - } --- 15,48 ---- /** + * <p> + * XMLBasicJobControllerConfig loads the XML job controller configuration. This loads + * the following XML block in <job-config> from job configuration file. + * <br><br> + * <pre> + * <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController"> + * <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> + * </pre> + * </p> * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public class XMLBasicJobControllerConfig extends BasicJobControllerConfig { ! /** ! * Loads the XML job controller configuration into XMLBasicJobControllerConfig object. ! * ! * @param controllerConfigElement XML DOM Element represents the <job-controller> element; ! * ! * @throws ConfigurationException If controller class name or job processor name doest not found. ! */ XMLBasicJobControllerConfig(Element controllerConfigElement) { } } Index: XMLPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLPoolJobControllerConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLPoolJobControllerConfig.java 3 Mar 2006 04:19:57 -0000 1.1 --- XMLPoolJobControllerConfig.java 8 Mar 2006 05:17:48 -0000 1.2 *************** *** 15,24 **** /** ! * ! * @author Suresh Pragada */ public class XMLPoolJobControllerConfig extends PoolJobControllerConfig { ! /** Creates a new instance of XMLPoolJobControllerConfig */ XMLPoolJobControllerConfig(Element controllerConfigElement) { --- 15,50 ---- /** ! * <p> ! * XMLPoolJobControllerConfig loads the controller configuration from XML Job controller ! * configuration. This reads the following XML block and loads the XMLPoolJobControllerConfig. ! * <br><br> ! * <pre> ! * <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController"> ! * <pool-job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> ! * <property key="pool-job-loader-key1">loader-value1</property> ! * </pool-job-loader> ! * <pool-job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobLoader" thread-count="1"> ! * <property key="pool-job-processor-key1">processor-value1</property> ! * </pool-job-processor> ! * <job-pool job-pool-class-name="org.jmonks.batchserver.framework.controller.pool.DefaultJobPool"> ! * <property key="job-pool-size">50000</property> ! * </job-pool> ! * <property key="pool-job-controller-restart">true</property> ! * </job-controller> ! * </pre> ! * </p> ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public class XMLPoolJobControllerConfig extends PoolJobControllerConfig { ! /** ! * Loads the XMLPoolJobControllerConfig from XML DOM Element <job-controller> ! * ! * @param controllerConfigElement XML DOM Element represents the <job-controller> element. ! * ! * @throws ConfigurationException If controller class name not defined or required controller properties missing. ! */ XMLPoolJobControllerConfig(Element controllerConfigElement) { Index: XMLJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobControllerConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLJobControllerConfig.java 8 Mar 2006 00:31:12 -0000 1.2 --- XMLJobControllerConfig.java 8 Mar 2006 05:17:48 -0000 1.3 *************** *** 11,14 **** --- 11,19 ---- package org.jmonks.batchserver.framework.config.xml; + import java.lang.reflect.Constructor; + import java.lang.reflect.InvocationTargetException; + import org.jmonks.batchserver.framework.common.ErrorCode; + import org.jmonks.batchserver.framework.config.ConfigurationException; + import org.jmonks.batchserver.framework.config.FrameworkConfig; import org.jmonks.batchserver.framework.config.JobControllerConfig; import org.w3c.dom.Element; *************** *** 23,31 **** * 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) { ! return null; } } --- 28,93 ---- * Element name that identifies the job controller configuration. */ ! public static final String JOB_CONTROLLER_ELEMENT_NAME = "job-controller"; ! /** ! * Attribute name that identifies the job controller class name. ! */ ! public static final String JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME = "job-controller-class-name"; ! /** ! * Element name that identifies the job controller configuration class name. ! */ ! public static final String JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME = "xml-factory-config-class-name"; ! /** ! * ! * @throws ConfigurationException If controller config class name is not defined. ! */ public static JobControllerConfig getJobControllerConfig(Element controllerConfigElement) { ! JobControllerConfig controllerConfig=null; ! ! String controllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); ! if(controllerClassName==null) ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CLASS_NOT_DEFINED); ! else ! { ! try ! { ! String controllerConfigClassName=FrameworkConfig.getInstance().getJobControllerConfig().getConfigClassName(controllerClassName, XMLJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME); ! if(controllerConfigClassName==null) ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CLASS_NOT_DEFINED); ! else ! { ! Class configClass=Class.forName(controllerConfigClassName); ! Constructor constructor=configClass.getConstructor(new Class[]{Element.class}); ! controllerConfig=(JobControllerConfig)constructor.newInstance(new Object[]{controllerConfigElement}); ! } ! } ! catch(InstantiationException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CONFIG_CLASS_NOT_VALID); ! } ! catch(NoSuchMethodException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CONFIG_CLASS_NOT_VALID); ! } ! catch(ClassNotFoundException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CONFIG_CLASS_NOT_VALID); ! } ! catch(IllegalAccessException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CONFIG_CLASS_NOT_VALID); ! } ! catch(InvocationTargetException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CONFIG_CLASS_NOT_VALID); ! } ! } ! ! return controllerConfig; } } Index: XMLJobConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XMLJobConfig.java 8 Mar 2006 00:31:12 -0000 1.3 --- XMLJobConfig.java 8 Mar 2006 05:17:48 -0000 1.4 *************** *** 26,31 **** * <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> --- 26,30 ---- * <pre> * <job-config job-name="process_file_xyz"> ! * <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController"> * <basic-job-processor basic-job-processor-class-name="com.mycompany.batch.processfilexyz.XyzProcessor"> * <property key="basic-job-processor-key1">processor-value1</property> *************** *** 62,66 **** { this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); ! NodeList controllerConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobControllerConfig.JOB_CONTROLLER_CONFIG_ELEMENT_NAME); if(controllerConfigNodeList.getLength()==1) { --- 61,65 ---- { this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); ! NodeList controllerConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobControllerConfig.JOB_CONTROLLER_ELEMENT_NAME); if(controllerConfigNodeList.getLength()==1) { |