Thread: [Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/config ConfigurationException.jav
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-28 04:46:56
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29830 Modified Files: ConfigurationException.java framework-config.xml framework-config.xsd FrameworkConfig.java Log Message: no message Index: framework-config.xsd =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xsd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** framework-config.xsd 14 Mar 2006 23:02:19 -0000 1.2 --- framework-config.xsd 28 Mar 2006 04:46:51 -0000 1.3 *************** *** 8,12 **** <xsd:element name="framework-logging-config" type="FrameworkLoggingConfigType"/> <xsd:element name="repository-config" type="RepositoryConfigType"/> ! <xsd:element name="mgmt-mntr-config" type="MgmtMntrConfigType"/> <xsd:element name="job-controller-config" type="JobControllerConfigType"/> </xsd:complexType> --- 8,12 ---- <xsd:element name="framework-logging-config" type="FrameworkLoggingConfigType"/> <xsd:element name="repository-config" type="RepositoryConfigType"/> ! <xsd:element name="job-connector-config" type="JobConnectorConfigType"/> <xsd:element name="job-controller-config" type="JobControllerConfigType"/> </xsd:complexType> *************** *** 30,35 **** </xsd:complexType> ! <xsd:complexType name="MgmtMntrConfigType"> ! <xsd:attribute name="mgmt-mntr-class-name" type="xsd:string" use="required"/> <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> --- 30,35 ---- </xsd:complexType> ! <xsd:complexType name="JobConnectorConfigType"> ! <xsd:attribute name="job-connector-helper-class-name" type="xsd:string" use="required"/> <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** framework-config.xml 21 Mar 2006 04:26:37 -0000 1.15 --- framework-config.xml 28 Mar 2006 04:46:51 -0000 1.16 *************** *** 19,25 **** <framework-logging-config framework-logging-level="DEBUG" job-logging-directory="/batchserver/logs" job-base-package-name="com.mycompany.batch" job-logging-level="INFO"/> ! <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.jmxmp.repository.DefaultMgmtMntrManager"> ! <property key="port-range">15000-20000</property> ! </mgmt-mntr-config> <job-controller-config> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController" --- 19,24 ---- <framework-logging-config framework-logging-level="DEBUG" job-logging-directory="/batchserver/logs" job-base-package-name="com.mycompany.batch" job-logging-level="INFO"/> ! <job-connector-config job-connector-helper-class-name="org.jmonks.batchserver.framework.management.jmxmp.RepositoryJMXMPConnectorHelper"> ! </job-connector-config> <job-controller-config> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController" Index: FrameworkConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/FrameworkConfig.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FrameworkConfig.java 14 Mar 2006 23:02:19 -0000 1.9 --- FrameworkConfig.java 28 Mar 2006 04:46:51 -0000 1.10 *************** *** 65,71 **** private FrameworkLoggingConfig frameworkLoggingConfig=null; /** ! * MgmtMntrConfig variable to hold the MgmtMntrConfig object. */ ! private MgmtMntrConfig mgmtMntrConfig=null; /** * RepositoryConfig variable to hold the RepositoryConfig object. --- 65,71 ---- private FrameworkLoggingConfig frameworkLoggingConfig=null; /** ! * JobConnectorConfig variable to hold the JobConnectorConfig object. */ ! private JobConnectorConfig jobConnectorConfig=null; /** * RepositoryConfig variable to hold the RepositoryConfig object. *************** *** 81,85 **** * Private constructor to make sure FrameworkCongi cannot be instantiated. This will * read the framework configuration file and create the instances of of JobConfigFactoryConfig, ! * FrameworkLoggingConfig, MgmtMntrConfig and RepositoryConfig by passing the correct DOM elements to their * constructors. This does the validation of configuration file against the defined XML schema file. * In case of errors it throws the ConfigurationException with the correct error code. --- 81,85 ---- * Private constructor to make sure FrameworkCongi cannot be instantiated. This will * read the framework configuration file and create the instances of of JobConfigFactoryConfig, ! * FrameworkLoggingConfig, JobConnectorConfig and RepositoryConfig by passing the correct DOM elements to their * constructors. This does the validation of configuration file against the defined XML schema file. * In case of errors it throws the ConfigurationException with the correct error code. *************** *** 142,156 **** } logger.debug("Logging configuration has been loaded and the configuration is : " + this.frameworkLoggingConfig); ! NodeList mgmtMntrConfigNodeList=frameworkConfigElement.getElementsByTagName(MgmtMntrConfig.TAG_NAME); ! if(mgmtMntrConfigNodeList.getLength()==1) { ! this.mgmtMntrConfig=new MgmtMntrConfig(((Element)mgmtMntrConfigNodeList.item(0))); } else { ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Found " + mgmtMntrConfigNodeList.getLength() + " " + ! MgmtMntrConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.debug("MgmtMntr configuration has been loaded and the configuration is : " + this.mgmtMntrConfig); NodeList repositoryConfigNodeList=frameworkConfigElement.getElementsByTagName(RepositoryConfig.TAG_NAME); if(repositoryConfigNodeList.getLength()==1) --- 142,156 ---- } logger.debug("Logging configuration has been loaded and the configuration is : " + this.frameworkLoggingConfig); ! NodeList jobConnectorConfigNodeList=frameworkConfigElement.getElementsByTagName(JobConnectorConfig.TAG_NAME); ! if(jobConnectorConfigNodeList.getLength()==1) { ! this.jobConnectorConfig=new JobConnectorConfig(((Element)jobConnectorConfigNodeList.item(0))); } else { ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Found " + jobConnectorConfigNodeList.getLength() + " " + ! JobConnectorConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.debug("MgmtMntr configuration has been loaded and the configuration is : " + this.jobConnectorConfig); NodeList repositoryConfigNodeList=frameworkConfigElement.getElementsByTagName(RepositoryConfig.TAG_NAME); if(repositoryConfigNodeList.getLength()==1) *************** *** 229,238 **** /** ! * Returns the mgmt&mntr configuration defines in the framework configuration as MgmtMntrConfig object. ! * @return Returns the MgmtMntrConfig object. */ ! public MgmtMntrConfig getMgmtMntrConfig() { ! return this.mgmtMntrConfig; } --- 229,238 ---- /** ! * Returns the mgmt&mntr configuration defines in the framework configuration as JobConnectorConfig object. ! * @return Returns the JobConnectorConfig object. */ ! public JobConnectorConfig getJobConnectorConfig() { ! return this.jobConnectorConfig; } *************** *** 510,516 **** /** * <p> ! * MgmtMntrConfig class holds the configuration required to create the MgmtMntrManager for this ! * framework. This configuration defines the specialized manager name and properties required ! * by that manager. This class cannot be instantiated by any other classes outside this framework. * </p> * <p> --- 510,518 ---- /** * <p> ! * JobConnectorConfig class holds the configuration required to create the ! * JobConnectorHelper classes used in establishing the job management agent and clients. ! * This configuration defines the specialized job connector helper class name ! * and properties required by that helper class. ! * This class cannot be instantiated by any other classes outside this framework. * </p> * <p> *************** *** 518,601 **** * <br><br> * <pre> ! * <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.DefaultMgmtMntrManager"> * <property key="port-range">15000-20000</property> ! * </mgmt-mntr-config> * </pre> * </p> */ ! public class MgmtMntrConfig { /** ! * Tag name represents the mgmt mntr config in framework configuration file. */ ! private static final String TAG_NAME = "mgmt-mntr-config"; /** ! * Attribute name defines the mgmt mntr class name. */ ! private static final String MGMT_MNTR_CLASS_ATTRIB_NAME = "mgmt-mntr-class-name"; /** ! * Mgmt mntr class name. */ ! private String mgmtMntrClassName=null; /** ! * Supporting properties for the defined manager. */ ! private Map mgmtMntrConfigProperties=new HashMap(); /** ! * This constructor loads the MgmtMntrConfig object with the given ! * DOM Element represents the <mgmt-mntr-config> in the framework configuration file. ! * ! * @param mgmtMntrConfigElement DOM Element represents the <mgmt-mntr-config> tag in framework configuration file. */ ! private MgmtMntrConfig(Element mgmtMntrConfigElement) { ! logger.trace("Entering MgmtMntrConfig Constructor"); ! this.mgmtMntrClassName=mgmtMntrConfigElement.getAttribute(MgmtMntrConfig.MGMT_MNTR_CLASS_ATTRIB_NAME); ! if(this.mgmtMntrClassName==null || "".equals(this.mgmtMntrClassName)) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, MgmtMntrConfig.MGMT_MNTR_CLASS_ATTRIB_NAME + " attribute value cannot be null."); - ! FrameworkUtil.loadPropertiesFromElementToMap(mgmtMntrConfigElement, this.mgmtMntrConfigProperties); ! logger.trace("Exiting MgmtMntrConfig Constructor"); } /** ! * Returns the defined MgmtMntrManager class name for the framework. * ! * @return Returns the MgmtMntrManager class name. */ ! public String getMgmtMntrClassName() { ! return this.mgmtMntrClassName; } /** ! * Returns the map consist of the properties needed by the defined manager. * * @return Returns the properties in a map. */ ! public Map getMgmtMntrProperties() { ! return this.mgmtMntrConfigProperties; } /** * <p> ! * Returns the string representation of MgmtMntrConfig class in the format ! * <br> {MgmtMntrConfig [mgmtMntrClassName = value] [properties = value]} * </p> ! * ! * @return Returns the string representation of MgmtMntrConfig. */ public String toString() { ! StringBuffer stringValue=new StringBuffer("{MgmtMntrConfig "); ! stringValue.append("[mgmtMntrClassName = " + this.mgmtMntrClassName + "]"); ! stringValue.append("[properties = " + this.mgmtMntrConfigProperties + "]"); stringValue.append("}"); return stringValue.toString(); --- 520,602 ---- * <br><br> * <pre> ! * <job-connector-config job-connector-helper-class-name="org.jmonks.batchserver.framework.management.jmxmp.RepositoryJMXMPConnectorHelper"> * <property key="port-range">15000-20000</property> ! * </job-connector-config> * </pre> * </p> */ ! public class JobConnectorConfig { /** ! * Tag name represents the job connector config in framework configuration file. */ ! private static final String TAG_NAME = "job-connector-config"; /** ! * Attribute name defines the job connector server helper class name. */ ! private static final String JOB_CONNECTOR_HELPER_CLASS_ATTRIB_NAME = "job-connector-helper-class-name"; /** ! * Job connector helper class name. */ ! private String jobConnectorHelperClassName=null; /** ! * Supporting properties for the defined helper class. */ ! private Map jobConnectorConfigProperties=new HashMap(); /** ! * This constructor loads the JobConnectorConfig object with the given ! * DOM Element represents the <job-connector-config> in the framework configuration file. ! * ! * @param jobConnectorConfigElement DOM Element represents the <job-connector-config> tag in framework configuration file. */ ! private JobConnectorConfig(Element jobConnectorConfigElement) { ! logger.trace("Entering JobConnectorConfig Constructor"); ! this.jobConnectorHelperClassName=jobConnectorConfigElement.getAttribute(JobConnectorConfig.JOB_CONNECTOR_HELPER_CLASS_ATTRIB_NAME); ! if(this.jobConnectorHelperClassName==null || "".equals(this.jobConnectorHelperClassName)) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, JobConnectorConfig.JOB_CONNECTOR_HELPER_CLASS_ATTRIB_NAME + " attribute value cannot be null."); ! FrameworkUtil.loadPropertiesFromElementToMap(jobConnectorConfigElement, this.jobConnectorConfigProperties); ! logger.trace("Exiting JobConnectorConfig Constructor"); } /** ! * Returns the defined job connector helper class name for the framework. * ! * @return Returns the job connector helper class name. */ ! public String getJobConnectorHelperClassName() { ! return this.jobConnectorHelperClassName; } /** ! * Returns the map consist of the properties needed by the defined job connectors. * * @return Returns the properties in a map. */ ! public Map getJobConnectorConfigProperties() { ! return this.jobConnectorConfigProperties; } /** * <p> ! * Returns the string representation of JobConnectorConfig class in the format ! * <br> {JobConnectorConfig [jobConnectorHelperClassName = value] [properties = value]} * </p> ! * ! * @return Returns the string representation of JobConnectorConfig. */ public String toString() { ! StringBuffer stringValue=new StringBuffer("{JobConnectorConfig "); ! stringValue.append("[jobConnectorHelperClassName = " + this.jobConnectorHelperClassName + "]"); ! stringValue.append("[properties = " + this.jobConnectorConfigProperties + "]"); stringValue.append("}"); return stringValue.toString(); *************** *** 810,816 **** * Returns the string representation of FrameworkConfig class in the format * <br> {FrameworkConfig [jobConfigFactoryConfig = value] [frameworkLoggingConfig = value] ! * [mgmtMntrConfig = value] [repositoryConfig = value][controllerConfig = value]} * </p> ! * * @return Returns the string representation of FrameworkConfig. */ --- 811,817 ---- * Returns the string representation of FrameworkConfig class in the format * <br> {FrameworkConfig [jobConfigFactoryConfig = value] [frameworkLoggingConfig = value] ! * [jobConnectorConfig = value] [repositoryConfig = value][controllerConfig = value]} * </p> ! * * @return Returns the string representation of FrameworkConfig. */ *************** *** 820,824 **** stringValue.append("[jobConfigFactoryConfig = " + this.configFactoryConfig + "]"); stringValue.append("[frameworkLoggingConfig = " + this.frameworkLoggingConfig + "]"); ! stringValue.append("[mgmtMntrConfig = " + this.mgmtMntrConfig + "]"); stringValue.append("[repositoryConfig = " + this.repositoryConfig + "]"); stringValue.append("[controllerConfig = " + this.controllerConfig + "]"); --- 821,825 ---- stringValue.append("[jobConfigFactoryConfig = " + this.configFactoryConfig + "]"); stringValue.append("[frameworkLoggingConfig = " + this.frameworkLoggingConfig + "]"); ! stringValue.append("[mgmtMntrConfig = " + this.jobConnectorConfig + "]"); stringValue.append("[repositoryConfig = " + this.repositoryConfig + "]"); stringValue.append("[controllerConfig = " + this.controllerConfig + "]"); Index: ConfigurationException.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/ConfigurationException.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ConfigurationException.java 21 Mar 2006 04:26:36 -0000 1.7 --- ConfigurationException.java 28 Mar 2006 04:46:51 -0000 1.8 *************** *** 1,4 **** package org.jmonks.batchserver.framework.config; ! import org.jmonks.batchserver.framework.common.ErrorCode; /** --- 1,4 ---- package org.jmonks.batchserver.framework.config; ! import org.jmonks.batchserver.framework.common.ExitCode; /** *************** *** 38,42 **** public static final String JOB_CONTROLLER_CONFIG = "job-controller-config"; /** ! * Constant defines the source of controller config component. */ public static final String LOGGING_CONFIG = "logging-config"; --- 38,42 ---- public static final String JOB_CONTROLLER_CONFIG = "job-controller-config"; /** ! * Constant defines the source of logging config component. */ public static final String LOGGING_CONFIG = "logging-config"; *************** *** 46,52 **** public static final String REPOSITORY_CONFIG = "repository-config"; /** ! * Constant defines the source of repository config component. */ ! public static final String MGMT_MNTR_CONFIG = "mgmt-mntr-config"; --- 46,52 ---- public static final String REPOSITORY_CONFIG = "repository-config"; /** ! * Constant defines the source of job connector config component. */ ! public static final String JOB_CONNECTOR_CONFIG = "job-connector-config"; |