Thread: [Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/mgmtmntr MgmtMntrManager.java,1.3
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-21 04:27:55
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/mgmtmntr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12688 Modified Files: MgmtMntrManager.java Removed Files: DefaultMgmtMntrManager.java Log Message: no message Index: MgmtMntrManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/mgmtmntr/MgmtMntrManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MgmtMntrManager.java 17 Mar 2006 05:14:47 -0000 1.3 --- MgmtMntrManager.java 21 Mar 2006 04:27:48 -0000 1.4 *************** *** 1,48 **** package org.jmonks.batchserver.framework.mgmtmntr; ! import org.jmonks.batchserver.framework.*; import org.jmonks.batchserver.framework.controller.JobController; - import org.jmonks.batchserver.framework.controller.*; import org.jmonks.batchserver.framework.config.*; import org.jmonks.batchserver.framework.common.*; /** * <p> ! * This class will define the methods needs to be implemented by the concrete classes of this manager. This provides the factory method to create the appropriate implementation based on the configuration in MgmtMntrConfig object. * </p> ! * @author : Suresh Pragada * @version 1.0 */ public abstract class MgmtMntrManager ! { ! ! private JobMonitorMBean mJobMonitor; ! ! private JobManagerMBean mJobManager; /** ! * This factory method creates the correct implementation of MgmtMntrManager based on the configuration defines in framework-config.xml file. * This looks for the following configuration. ! * * <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> * ! * @param jobName Name of the job. ! * @param mgmtMntrConfig MgmtMntrConfig object represents the above show config block from the framework-config.xml file. * * @return Returns the MgmtMntrManager implemenation. */ ! public static org.jmonks.batchserver.framework.mgmtmntr.MgmtMntrManager getMgmtMntrManager(String jobName, org.jmonks.batchserver.framework.config.FrameworkConfig.MgmtMntrConfig config) { ! return null; } /** * Method to initialize the MgmtMntrManager with the properties defined ! * for this manager in framework configuration file. * * @param mgmtMntrConfig Properties defined for this manager as a map. --- 1,96 ---- package org.jmonks.batchserver.framework.mgmtmntr; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.controller.JobController; import org.jmonks.batchserver.framework.config.*; import org.jmonks.batchserver.framework.common.*; + /** * <p> ! * MgmtMntrManager defines the methods to be implemented by the concrete classes ! * to register and unregister the JMX connector servers, which allows the remote ! * clients to manage and monitor the job being run. This provides the factory method ! * to create the appropriate implementation based on the configuration ! * provided in framework configuration file. * </p> ! * @author Suresh Pragada * @version 1.0 + * @since 1.0 */ public abstract class MgmtMntrManager ! { ! public static final String MBEAN_SERVER_NAME = "DefaultMBeanServer"; ! ! public static final String JOB_MANAGER_MBEAN_NAME = "JobManagerMBean"; ! ! public static final String JOB_MONITOR_MBEAN_NAME = "JobMonitorMBean"; ! /** ! * Name of the job this manager is configured to. ! */ ! private String jobName; + private static Logger logger=Logger.getLogger(MgmtMntrManager.class); /** ! * This factory method creates the correct implementation of MgmtMntrManager ! * based on the configuration defines in framework-config.xml file. * This looks for the following configuration. ! * <br> * <pre> ! * <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.jmxmp.repository.JMXMPRepositoryMgmtMntrManager"> ! * <property key="mgmt-mntr-config-key">mgmt-mntr-config-value</property> ! * </mgmt-mntr-config> * </pre> * ! * @param jobName Name of the job this manager is configured to manage and monitor. ! * @param mgmtMntrConfig MgmtMntrConfig object represents the above shown config block from the framework-config.xml file. * * @return Returns the MgmtMntrManager implemenation. */ ! public static MgmtMntrManager getMgmtMntrManager(String jobName, FrameworkConfig.MgmtMntrConfig mgmtMntrconfig) { ! logger.trace("Entering getMgmtMntrManager " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null to get the mgmt and mntr manager"); ! ! if(mgmtMntrconfig==null) ! throw new ConfigurationException(ConfigurationException.MGMT_MNTR_CONFIG, "mgmt and mntr configuration object cannot be null"); ! ! String mgmtMntrManagerClassName=mgmtMntrconfig.getMgmtMntrClassName(); ! MgmtMntrManager mmManager=null; ! try ! { ! mmManager=(MgmtMntrManager)Class.forName(mgmtMntrManagerClassName).newInstance(); ! mmManager.init(mgmtMntrconfig.getMgmtMntrProperties()); ! mmManager.jobName=jobName; ! } ! catch(ClassNotFoundException exception) ! { ! exception.printStackTrace(); ! logger.error(exception.getMessage(),exception); ! throw new ConfigurationException(ConfigurationException.MGMT_MNTR_CONFIG, exception.getMessage()); ! } ! catch(InstantiationException exception) ! { ! exception.printStackTrace(); ! logger.error(exception.getMessage(),exception); ! throw new ConfigurationException(ConfigurationException.MGMT_MNTR_CONFIG, exception.getMessage()); ! } ! catch(IllegalAccessException exception) ! { ! exception.printStackTrace(); ! logger.error(exception.getMessage(),exception); ! throw new ConfigurationException(ConfigurationException.MGMT_MNTR_CONFIG, exception.getMessage()); ! } ! logger.trace("Exiting getMgmtMntrManager"); ! return mmManager; } /** * Method to initialize the MgmtMntrManager with the properties defined ! * for this manager in framework configuration file. This method is provided ! * for the implementors to initialize the manager by getting the properties ! * defined in configuration file. * * @param mgmtMntrConfig Properties defined for this manager as a map. *************** *** 50,68 **** * @throws ConfigurationException If required properties of the implementation misses. */ ! protected abstract void init(FrameworkConfig.MgmtMntrConfig mgmtMntrConfig); /** ! * This method creates the MBeanServer with JobManagerMBean and JobMonitorMBean beans and passes this controller references to the these mbeans and creates the connector server and saves this connector information in the common place to be looked up by server. * * @param controller Controller reference to be passed to the mbeans. */ ! public abstract void registerController(org.jmonks.batchserver.framework.controller.JobController controller); /** ! * Unregisters the controller from mbeans and shuts down the connector server and shuts down the mbean server and unregister information from common place. * * @param existStatus errorCode returned by controller to the Main class. */ ! public abstract void unregisterController(org.jmonks.batchserver.framework.common.StatusCode controllerExitStatus); /** --- 98,127 ---- * @throws ConfigurationException If required properties of the implementation misses. */ ! protected abstract void init(java.util.Map mgmtMntrManagerConfigProps); /** ! * This method creates the MBeanServer with JobManagerMBean and JobMonitorMBean beans ! * and passes this controller references to the these mbeans and creates the connector server ! * and saves this connector information in the common place to be looked up by server. * * @param controller Controller reference to be passed to the mbeans. + * + * @return Returns true, if controller is registered properly, false, otherwise. + * + * @throws IllegalArgumentException If input parameter controller is null. */ ! public abstract boolean registerController(JobController controller); /** ! * Unregisters the controller from mbeans and shuts down the connector server and ! * shuts down the mbean server and unregister information from common place. * * @param existStatus errorCode returned by controller to the Main class. + * + * @return Returns true, if conroller is unregistered properly, false otherwise. + * + * @throws IllegalArgumentException If input parameter status code is null. */ ! public abstract boolean unregisterController(StatusCode controllerExitStatus); /** *************** *** 72,76 **** public String getJobName() { ! return null; } --- 131,135 ---- public String getJobName() { ! return this.jobName; } --- DefaultMgmtMntrManager.java DELETED --- |