[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/config/xml XMLBasicJobControllerC
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-08 23:21:17
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21935 Modified Files: XMLBasicJobControllerConfig.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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLBasicJobControllerConfig.java 8 Mar 2006 05:17:48 -0000 1.2 --- XMLBasicJobControllerConfig.java 8 Mar 2006 23:21:13 -0000 1.3 *************** *** 11,16 **** --- 11,20 ---- package org.jmonks.batchserver.framework.config.xml; + import org.jmonks.batchserver.framework.common.ErrorCode; + import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; + import org.jmonks.batchserver.framework.config.ConfigurationException; import org.w3c.dom.Element; + import org.w3c.dom.NodeList; /** *************** *** 35,38 **** --- 39,50 ---- public class XMLBasicJobControllerConfig extends BasicJobControllerConfig { + /** + * XML Element name defiens the basic job processor configuration. + */ + private static final String BASIC_JOB_PROCESSOR_ELEMENT_NAME = "basic-job-processor"; + /** + * XML Attribute name defines the basic job processor class name. + */ + private static final String BASIC_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME = "basic-job-processor-class-name"; /** * Loads the XML job controller configuration into XMLBasicJobControllerConfig object. *************** *** 44,48 **** --- 56,79 ---- XMLBasicJobControllerConfig(Element controllerConfigElement) { + this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); + if(this.jobControllerClassName==null) + throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CLASS_NOT_DEFINED); + FrameworkUtil.loadPropertiesFromElementToMap(controllerConfigElement, this.jobControllerConfigProps); + + NodeList xmlBasicJobProcessorNodeList=controllerConfigElement.getElementsByTagName(XMLBasicJobControllerConfig.BASIC_JOB_PROCESSOR_ELEMENT_NAME); + if(xmlBasicJobProcessorNodeList.getLength()==1) + { + Element xmlBasicJobProcessorElement=(Element)xmlBasicJobProcessorNodeList.item(0); + this.basicJobProcessorClassName=xmlBasicJobProcessorElement.getAttribute(XMLBasicJobControllerConfig.BASIC_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME); + if(this.basicJobProcessorClassName==null) + throw new ConfigurationException(ErrorCode.BASIC_JOB_PROCESSOR_CLASS_NAME_NOT_DEFINED); + else + { + FrameworkUtil.loadPropertiesFromElementToMap(xmlBasicJobProcessorElement, this.basicJobProcessorConfigProps); + } + } + else + throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_BASIC_JOB_PROCESSOR_ELEMENTS_FOUND); } } Index: XMLPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLPoolJobControllerConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XMLPoolJobControllerConfig.java 8 Mar 2006 05:17:48 -0000 1.2 --- XMLPoolJobControllerConfig.java 8 Mar 2006 23:21:14 -0000 1.3 *************** *** 11,16 **** --- 11,20 ---- package org.jmonks.batchserver.framework.config.xml; + import org.jmonks.batchserver.framework.common.ErrorCode; + import org.jmonks.batchserver.framework.common.FrameworkUtil; + import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.PoolJobControllerConfig; import org.w3c.dom.Element; + import org.w3c.dom.NodeList; /** *************** *** 40,43 **** --- 44,72 ---- public class XMLPoolJobControllerConfig extends PoolJobControllerConfig { + /** + * XML Element name defines the pool job loader configuration. + */ + private static final String POOL_JOB_LOADER_ELEMENT_NAME = "pool-job-loader"; + /** + * XML Attribute name defines the pool job loader class name. + */ + private static final String POOL_JOB_LOADER_CLASS_ATTRIBUTE_NAME = "pool-job-loader-class-name"; + /** + * XML Element name defines the job pool configuration. + */ + private static final String POOL_JOB_POOL_ELEMENT_NAME = "job-pool"; + /** + * XML Attribute name defines the job pool class name. + */ + private static final String POOL_JOB_POOL_CLASS_ATTRIBUTE_NAME = "job-pool-class-name"; + /** + * XML Element name defines the pool job processor configuration. + */ + private static final String POOL_JOB_PROCESSOR_ELEMENT_NAME = "pool-job-processor"; + /** + * XML Attribute name defines the pool job processor class name. + */ + private static final String POOL_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME = "pool-job-processor-class-name"; + /** * Loads the XMLPoolJobControllerConfig from XML DOM Element <job-controller> *************** *** 49,55 **** XMLPoolJobControllerConfig(Element controllerConfigElement) { /** ! * Load everything defined in base class using the input element. */ } --- 78,140 ---- XMLPoolJobControllerConfig(Element controllerConfigElement) { + this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); + if(this.jobControllerClassName==null) + throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CLASS_NOT_DEFINED); + + FrameworkUtil.loadPropertiesFromElementToMap(controllerConfigElement, this.jobControllerConfigProps); + /** ! * Load pool job loader configuration. */ + NodeList xmlPoolJobLoaderNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_LOADER_ELEMENT_NAME); + if(xmlPoolJobLoaderNodeList.getLength()==1) + { + Element xmlPoolJobLoaderElement=(Element)xmlPoolJobLoaderNodeList.item(0); + this.poolJobLoaderClassName=xmlPoolJobLoaderElement.getAttribute(XMLPoolJobControllerConfig.POOL_JOB_LOADER_CLASS_ATTRIBUTE_NAME); + if(this.poolJobProcessorClassName==null) + throw new ConfigurationException(ErrorCode.POOL_JOB_LOADER_CLASS_NAME_NOT_DEFINED); + else + { + FrameworkUtil.loadPropertiesFromElementToMap(xmlPoolJobLoaderElement, this.poolJobLoaderConfigProps); + } + } + else + throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_POOL_JOB_LOADER_ELEMENTS_FOUND); + + /** + * Load pool job procesor configuration. + */ + NodeList xmlPoolJobProcessorNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_PROCESSOR_ELEMENT_NAME); + if(xmlPoolJobProcessorNodeList.getLength()==1) + { + Element xmlPoolJobProcessorElement=(Element)xmlPoolJobProcessorNodeList.item(0); + this.poolJobProcessorClassName=xmlPoolJobProcessorElement.getAttribute(XMLPoolJobControllerConfig.POOL_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME); + if(this.poolJobProcessorClassName==null) + throw new ConfigurationException(ErrorCode.POOL_JOB_PROCESSOR_CLASS_NAME_NOT_DEFINED); + else + { + FrameworkUtil.loadPropertiesFromElementToMap(xmlPoolJobProcessorElement, this.poolJobProcessorConfigProps); + } + } + else + throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_POOL_JOB_PROCESSOR_ELEMENTS_FOUND); + + /** + * Load job pool configuration. + */ + NodeList xmlJobPoolNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_POOL_ELEMENT_NAME); + if(xmlJobPoolNodeList.getLength()==1) + { + Element xmlJobPoolElement=(Element)xmlJobPoolNodeList.item(0); + this.poolClassName=xmlJobPoolElement.getAttribute(XMLPoolJobControllerConfig.POOL_JOB_POOL_CLASS_ATTRIBUTE_NAME); + if(this.poolClassName==null) + throw new ConfigurationException(ErrorCode.POOL_JOB_POOL_CLASS_NAME_NOT_DEFINED); + else + { + FrameworkUtil.loadPropertiesFromElementToMap(xmlJobPoolElement, this.poolConfigProps); + } + } + else + throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_JOB_POOL_ELEMENTS_FOUND); } Index: XMLJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobControllerConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XMLJobControllerConfig.java 8 Mar 2006 05:17:48 -0000 1.3 --- XMLJobControllerConfig.java 8 Mar 2006 23:21:14 -0000 1.4 *************** *** 20,25 **** /** ! * ! * @author Suresh Pragada */ public abstract class XMLJobControllerConfig extends JobControllerConfig --- 20,29 ---- /** ! * XMLJobControllerConfig responsible to build the controller specific ! * JobControllerConfig objects from the given XML. ! * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public abstract class XMLJobControllerConfig extends JobControllerConfig *************** *** 38,43 **** 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) --- 42,62 ---- public static final String JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME = "xml-factory-config-class-name"; /** + * <p> + * Factory method creates and returns the controller specific controller config object + * from the following XML block from the job configuration file. This looks for the + * controller class name and tries to find specific controller config object for this controller + * and defined for the XML factory in framework configuration file. + * <br><br> + * <pre> + * <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController"> + * <property key="basic-job-controller-restart">true</property> + * </job-controller> + * </pre> + * </p> + * + * @return Returns the controller specific controller config object. * ! * @throws ConfigurationException If controller config class name is not defined or controller specific config object cannot be found ! * in framework controller configuration. */ public static JobControllerConfig getJobControllerConfig(Element controllerConfigElement) *************** *** 88,92 **** } } ! return controllerConfig; } --- 107,111 ---- } } ! return controllerConfig; } |