batchserver-cvs Mailing List for Enterprise Batch Server (Page 22)
Brought to you by:
suresh_pragada
You can subscribe to this list here.
2006 |
Jan
|
Feb
(10) |
Mar
(159) |
Apr
(5) |
May
(52) |
Jun
(70) |
Jul
|
Aug
(28) |
Sep
(256) |
Oct
(38) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Suresh <sur...@us...> - 2006-03-14 05:46:37
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30386 Modified Files: LoggingManager.java Main.java Log Message: no message Index: Main.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/Main.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Main.java 13 Mar 2006 14:32:38 -0000 1.3 --- Main.java 14 Mar 2006 05:46:33 -0000 1.4 *************** *** 3,7 **** import java.util.HashMap; import java.util.Map; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.mgmtmntr.*; import org.jmonks.batchserver.framework.common.*; --- 3,7 ---- import java.util.HashMap; import java.util.Map; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.mgmtmntr.*; import org.jmonks.batchserver.framework.common.*; *************** *** 23,33 **** public class Main { ! private static Logger logger=null; ! ! static ! { ! LoggingManager.getInstance().initializeFrameworkLogging(); ! logger=Logger.getLogger(Main.class.getName()); ! } private MgmtMntrManager mMgmtMntrManager; --- 23,27 ---- public class Main { ! private static Logger logger=Logger.getLogger(Main.class); private MgmtMntrManager mMgmtMntrManager; *************** *** 60,66 **** public static ErrorCode process(Map configMap) { ! logger.entering(Main.class.getName(),"process"); ! logger.exiting(Main.class.getName(),"process"); return null; } --- 54,60 ---- public static ErrorCode process(Map configMap) { ! logger.trace("Entering process"); ! logger.trace("Exiting process"); return null; } Index: LoggingManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/LoggingManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LoggingManager.java 13 Mar 2006 14:32:38 -0000 1.3 --- LoggingManager.java 14 Mar 2006 05:46:33 -0000 1.4 *************** *** 4,15 **** import java.text.SimpleDateFormat; import java.util.Calendar; ! import java.util.Enumeration; ! import java.util.logging.FileHandler; ! import java.util.logging.Formatter; ! import java.util.logging.Handler; ! import java.util.logging.Level; ! import java.util.logging.LogManager; ! import java.util.logging.Logger; ! import java.util.logging.SimpleFormatter; import org.jmonks.batchserver.framework.config.*; --- 4,12 ---- import java.text.SimpleDateFormat; import java.util.Calendar; ! import org.apache.log4j.Level; ! import org.apache.log4j.LogManager; ! import org.apache.log4j.Logger; ! import org.apache.log4j.PatternLayout; ! import org.apache.log4j.RollingFileAppender; import org.jmonks.batchserver.framework.config.*; *************** *** 23,27 **** * The default logging mechanism defined at the framework will * work like this. It reads the directory to create the log files from ! * the framework logging configuration <logging-directory> and creates a directory * with the "job-name" and create the log files for each run. So, the format * will be --- 20,24 ---- * The default logging mechanism defined at the framework will * work like this. It reads the directory to create the log files from ! * the framework logging configuration <logging-config> and creates a directory * with the "job-name" and create the log files for each run. So, the format * will be *************** *** 31,36 **** * * If job developer would like to override this logging mechanism, they can ! * define their logging configuration in the element <job-config> in batch ! * configuration file. * </p> * @author Suresh Pragada --- 28,33 ---- * * If job developer would like to override this logging mechanism, they can ! * define their logging configuration in the element <job-logging-config> in batch ! * configuration file or defining entries in job_logging_config table. * </p> * @author Suresh Pragada *************** *** 40,53 **** public class LoggingManager { - private static LoggingManager loggingManager = new LoggingManager(); - /** ! * Holds the path of the file framework logging handler is using. */ ! private String frameworkLoggingFileName=null; /** ! * Holds the path of the file job logging handler is using. ! */ ! private String jobLoggingFileName=null; private LoggingManager() --- 37,48 ---- public class LoggingManager { /** ! * Framework configuration file. */ ! public static final String FRAMEWORK_LOGGING_FILE = "batch_framework.log"; /** ! * Standard pattern expression used for all the log files. ! */ ! public static final String DEFAULT_MESSAGE_PATTERN = "%-5p [%t]: %m%n"; private LoggingManager() *************** *** 55,164 **** } - public static LoggingManager getInstance() - { - return loggingManager; - } - /** * <p> * This method accepts all the information available from framwork logging configuration ! * and loads the required loggers appropriately. This does the follwing steps. * <ul> * <li>Create the directory <directory name configured in logging config>/jobName ! * <li>Generates the logging file name jobName_yyyymmdd_hhmmss.log ! * <li>Creates the File handler with the above created directory and logging file name. ! * <li>Looks for the framework logger and removes the existing file handler and adds the ! * above created file handler. ! * <li>Creates the logger for the base package name provided and add the above file handler. ! * <li>Make sure these two loggers have been added to the LogManager. * </ul> * ! * @param jobName Name of the job. ! * @param loggingConfig Logging configuration defined at the framework. * ! * @throws IllegalArgumentException If input values are null. * @throws ConfigurationException If logging file cannot be created at the configured directory. * </p> */ ! public void initializeJobLogging(String jobName, org.jmonks.batchserver.framework.config.FrameworkConfig.LoggingConfig loggingConfig) { if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null to establish the framework logging service."); ! if(loggingConfig==null) ! throw new IllegalArgumentException("logging config object cannot be null to establish the framework logging service."); ! String loggingDirectoryName=loggingConfig.getLoggingDirecotry(); ! if(loggingDirectoryName!=null) { ! File loggingDirectory=new File(loggingDirectoryName+File.separator+jobName); ! if(!loggingDirectory.exists()) { ! boolean created=loggingDirectory.mkdirs(); ! if(!created) ! throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG,"Unable to create the directory " + loggingDirectoryName + "."); } } ! else ! throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG,"logging directory in framework logging config cannot be null to establish the framework logging service."); ! ! String logFileName=jobName+"_"+new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime())+".log"; ! this.jobLoggingFileName=loggingDirectoryName+File.separator+jobName+File.separator+logFileName; ! Handler jobLoggingHandler=null; ! try ! { ! jobLoggingHandler=new FileHandler(this.jobLoggingFileName); ! jobLoggingHandler.setLevel(Level.ALL); ! Formatter jobLoggingFormatter=new SimpleFormatter(); ! jobLoggingHandler.setFormatter(jobLoggingFormatter); ! } ! catch(IOException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG, "Exception while creating the file handler with the name " + ! this.jobLoggingFileName + ". Exceptions Message is : " +exception.getMessage()); ! } ! Logger frameworkLogger=LogManager.getLogManager().getLogger("org.jmonks"); ! if(frameworkLogger==null) ! { ! frameworkLogger=Logger.getLogger("org.jmonks"); ! LogManager.getLogManager().addLogger(frameworkLogger); ! } ! else { ! Handler[] handlers=frameworkLogger.getHandlers(); ! for(int i=0;i<handlers.length;i++) ! frameworkLogger.removeHandler(handlers[i]); } - frameworkLogger.addHandler(jobLoggingHandler); - frameworkLogger.setLevel(Level.parse(loggingConfig.getFrameworkLogLevel())); - - Logger jobLogger=Logger.getLogger(loggingConfig.getBasePackageName()); - jobLogger.setLevel(Level.parse(loggingConfig.getFrameworkLogLevel())); - jobLogger.addHandler(jobLoggingHandler); - LogManager.getLogManager().addLogger(jobLogger); - } /** ! * Initializes the logging of the framework in the user home directory. ! * This will be used untile the job logging is enabled. */ ! public void initializeFrameworkLogging() { try { ! String userHomeDirectory=System.getProperty("user.home"); ! this.frameworkLoggingFileName=userHomeDirectory+File.separator+"batch_framework.log"; ! ! Logger initialFrameworkLogger=Logger.getLogger("org.jmonks"); ! initialFrameworkLogger.setLevel(Level.CONFIG); ! Handler frameworkLoggignHandler=new FileHandler(this.frameworkLoggingFileName,true); ! frameworkLoggignHandler.setLevel(Level.ALL); ! Formatter frameworkLoggingFormatter=new SimpleFormatter(); ! frameworkLoggignHandler.setFormatter(frameworkLoggingFormatter); ! initialFrameworkLogger.addHandler(frameworkLoggignHandler); ! LogManager.getLogManager().addLogger(initialFrameworkLogger); } catch(IOException exception) --- 50,151 ---- } /** * <p> * This method accepts all the information available from framwork logging configuration ! * and job logging configuration and loads the required loggers appropriately. ! * This does the follwing steps. * <ul> * <li>Create the directory <directory name configured in logging config>/jobName ! * <li>Generates the logging file name jobName_yyyymmdd_hhmmss_ms.log ! * <li>Creates the Rolling File appender with the above created directory and logging file name. ! * <li>Remove all the existing appenders from the root logger. ! * <li>Attaches the above created appender for the root logger. ! * <li>Access the defined loggers at job level and set the level for those loggers. * </ul> * ! * @param jobName Name of the job. ! * @param frameworkLoggingConfig Logging configuration defined at the framework. ! * @param jobLoggingFramework Logging configuration defined at the job level. * ! * @throws IllegalArgumentException If input values jobName and frameworkLoggingConfig are null. * @throws ConfigurationException If logging file cannot be created at the configured directory. * </p> */ ! public static void initializeJobLogging(String jobName, FrameworkConfig.LoggingConfig frameworkLoggingConfig,JobLoggingConfig jobLoggingConfig) { if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null to establish the job logging service."); ! if(frameworkLoggingConfig==null) ! throw new IllegalArgumentException("framework logging config object cannot be null to establish the job logging service."); ! File loggingDirecotry=new File(frameworkLoggingConfig.getLoggingDirecotry()+File.separator+jobName); ! LoggingManager.createDirectory(loggingDirecotry); ! String completeFileName=loggingDirecotry.getAbsolutePath()+File.separator+ ! jobName+"_"+new SimpleDateFormat("yyyyMMdd_HHmmss_S").format(Calendar.getInstance().getTime())+"_.log"; ! LoggingManager.addAppender(completeFileName); ! if(jobLoggingConfig!=null) { ! JobLoggingConfig.JobLoggerConfig jobLoggerConfigs[]=jobLoggingConfig.getLoggers(); ! for(int i=0;i<jobLoggerConfigs.length;i++) { ! Logger customLogger=Logger.getLogger(jobLoggerConfigs[i].getLoggerName()); ! if(customLogger!=null) ! customLogger.setLevel(Level.toLevel(jobLoggerConfigs[i].getLoggerLevel())); } } ! } ! ! /** ! * Initializes the logging of the framework in the directory defined in framework configuration. ! * This will be used until the job logging is enabled. ! * ! * @param frameworkLoggingConfig Framework logging configuration object. ! * ! * @throws ConfigurationException If logging directory cannot be created. ! */ ! public static void initializeFrameworkLogging(FrameworkConfig.LoggingConfig frameworkLoggingConfig) ! { ! File loggingDirecotry=new File(frameworkLoggingConfig.getLoggingDirecotry()); ! LoggingManager.createDirectory(loggingDirecotry); ! String completeFileName=loggingDirecotry.getAbsolutePath()+File.separator+LoggingManager.FRAMEWORK_LOGGING_FILE; ! LoggingManager.addAppender(completeFileName); ! } ! /** ! * Method to make sure given file entry exist. If it doenst exist, it will tries to create that ! * entry. ! */ ! private static void createDirectory(File loggingDirecotry) ! { ! if(loggingDirecotry.exists() && loggingDirecotry.isFile()) ! throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG, "Logging directory " + ! loggingDirecotry.getAbsolutePath() + " defined in framework configuration is a file."); ! else if(!loggingDirecotry.exists()) { ! boolean created=loggingDirecotry.mkdirs(); ! if(!created) ! throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG, "Logging directory " + ! loggingDirecotry.getAbsolutePath() + " defined in framework configuration cannot be created."); } } /** ! * Common method creates the rolling file appender with the given name and attaches it ! * to the root logger after creating all the existing loggers. ! * ! * @param fileName Name of the file to be attached to the appender. */ ! private static void addAppender(String fileName) { try { ! PatternLayout layout=new PatternLayout(LoggingManager.DEFAULT_MESSAGE_PATTERN); ! RollingFileAppender fileAppender=new RollingFileAppender(layout,fileName,true); ! fileAppender.setMaxFileSize("10MB"); ! fileAppender.activateOptions(); ! Logger rootLogger=LogManager.getRootLogger(); ! rootLogger.removeAllAppenders(); ! rootLogger.addAppender(fileAppender); } catch(IOException exception) *************** *** 166,184 **** exception.printStackTrace(); } ! } ! ! /** ! * Changes the logging level of all the existing logger to the requested level. ! * ! * @param logLevel level of the logging needed. ! */ ! public void changeLoggingLevel(Level logLevel) ! { ! Enumeration loggerNameEnumeration=LogManager.getLogManager().getLoggerNames(); ! while(loggerNameEnumeration.hasMoreElements()) ! { ! Logger logger=LogManager.getLogManager().getLogger((String)loggerNameEnumeration.nextElement()); ! logger.setLevel(logLevel); ! } } } --- 153,157 ---- exception.printStackTrace(); } ! } } |
From: Suresh <sur...@us...> - 2006-03-14 05:46:06
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29952 Added Files: JobLoggingConfig.java Log Message: no message --- NEW FILE: JobLoggingConfig.java --- /* * JobLoggingConfig.java * * Created on March 13, 2006, 7:01 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batchserver.framework.config; import java.util.ArrayList; import java.util.List; /** * <p> * JobLoggingConfig holds the list of loggers defined for this job. Each logger * will be represented by the JobLoggerConfig object. Implementation of this class * will be done by the classes defined in corresponding factories. * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public abstract class JobLoggingConfig { /** * Holds the list of JobLoggerConfig objects. */ private List loggerList=new ArrayList(); /** * Gets the array of JobLoggerConfig objects defined for this job. * */ public JobLoggerConfig[] getLoggers() { JobLoggerConfig[] returnConfigs=new JobLoggerConfig[this.loggerList.size()]; return (JobLoggerConfig[])this.loggerList.toArray(returnConfigs); } protected void addLogger(String loggerName,String loggerLevel) { JobLoggerConfig loggerConfig=new JobLoggerConfig(loggerName,loggerLevel); this.loggerList.add(loggerConfig); } /** * JobLoggerConfig holds the information of each logger defined for the job. */ public class JobLoggerConfig { /** * Holds the logger name. */ private String loggerName=null; /** * Holds the logger level. */ private String loggerLevel=null; /** * Private constructor make sure only this class can create the instances of * JobLoggerConfig. Sub classes should use addLogger method JobLoggingConfig * to add the logger configuration. * * @param loggerName Logger name. * @param loggerLevel Logger level. */ private JobLoggerConfig(String loggerName,String loggerLevel) { this.loggerName=loggerName; this.loggerLevel=loggerLevel; } /** * Returns the logger name. */ public String getLoggerName() { return this.loggerName; } /** * Returns the logger level. */ public String getLoggerLevel() { return this.loggerLevel; } /** * <p> * Returns the string representation of JobLoggerConfig class in the format * <br> {JobLoggerConfig [loggerName = value] [loggerLevel = value]} * </p> * * @return Returns the string representation of JobLoggerConfig. */ public String toString() { StringBuffer stringValue=new StringBuffer("{JobLoggerConfig "); stringValue.append("[loggerName = " + this.loggerName + "]"); stringValue.append("[loggerLevel = " + this.loggerLevel + "]"); stringValue.append("}"); return stringValue.toString(); } } /** * <p> * Returns the string representation of JobLoggingConfig class in the format * <br> {JobLoggingConfig [loggerList = value]} * </p> * * @return Returns the string representation of JobLoggingConfig. */ public String toString() { StringBuffer stringValue=new StringBuffer("{JobLoggingConfig "); stringValue.append("[loggerList = " + this.loggerList + "]"); stringValue.append("}"); return stringValue.toString(); } } |
From: Suresh <sur...@us...> - 2006-03-14 05:45:34
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29740 Modified Files: BasicJobControllerConfig.java framework-config.xml FrameworkConfig.java JobConfig.java JobConfigFactory.java JobControllerConfig.java PoolJobControllerConfig.java Log Message: no message Index: JobConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JobConfig.java 11 Mar 2006 02:16:38 -0000 1.6 --- JobConfig.java 14 Mar 2006 05:45:25 -0000 1.7 *************** *** 40,43 **** --- 40,48 ---- /** + * Map holds the logger information. This will hold the logger + */ + protected JobLoggingConfig jobLoggingConfig=null; + + /** * Returns the Controller configuraiton of the job this JobConfig represents. * *************** *** 72,75 **** --- 77,91 ---- /** + * Returns job logging configuration. + * Job Loggers can be found by using the getLoggers method of this config object. + * + * @return Returns job logging configuraiton. + */ + public JobLoggingConfig getJobLoggingConfig() + { + return this.jobLoggingConfig; + } + + /** * <p> * Returns the string representation of JobConfig class in the format Index: BasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/BasicJobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BasicJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 --- BasicJobControllerConfig.java 14 Mar 2006 05:45:25 -0000 1.7 *************** *** 14,18 **** import java.util.Iterator; import java.util.Map; ! import java.util.logging.Logger; /** --- 14,18 ---- import java.util.Iterator; import java.util.Map; ! import org.apache.log4j.Logger; /** *************** *** 45,49 **** protected int basicJobProcessorThreadCount=1; ! private static Logger logger=Logger.getLogger(BasicJobControllerConfig.class.getName()); /** * Gets the basic job processor class name. --- 45,49 ---- protected int basicJobProcessorThreadCount=1; ! private static Logger logger=Logger.getLogger(BasicJobControllerConfig.class); /** * Gets the basic job processor class name. *************** *** 87,91 **** public void overrideConfigProperties(Map newProps) { ! logger.entering(BasicJobControllerConfig.class.getName(),"overrideConfigProperties"); super.overrideConfigProperties(newProps); --- 87,91 ---- public void overrideConfigProperties(Map newProps) { ! logger.trace("Entering overrideConfigProperties"); super.overrideConfigProperties(newProps); *************** *** 99,106 **** { this.basicJobProcessorConfigProps.put(key, newProps.get(key)); ! logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } ! logger.exiting(BasicJobControllerConfig.class.getName(),"overrideConfigProperties"); } --- 99,106 ---- { this.basicJobProcessorConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); } } ! logger.trace("Exiting overrideConfigProperties"); } Index: FrameworkConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/FrameworkConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FrameworkConfig.java 13 Mar 2006 14:32:37 -0000 1.7 --- FrameworkConfig.java 14 Mar 2006 05:45:25 -0000 1.8 *************** *** 14,22 **** import java.util.HashMap; import java.util.Map; - import java.util.logging.Level; - import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.w3c.dom.Document; --- 14,21 ---- import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; + import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.w3c.dom.Document; *************** *** 42,46 **** public final class FrameworkConfig { ! private static Logger logger=Logger.getLogger(FrameworkConfig.class.getName()); /** * FrameworkConfig singleton instance varaible. --- 41,45 ---- public final class FrameworkConfig { ! private static Logger logger=Logger.getLogger(FrameworkConfig.class); /** * FrameworkConfig singleton instance varaible. *************** *** 90,94 **** private FrameworkConfig() { ! logger.entering(FrameworkConfig.class.getName(),"DefaultConstructor"); try { --- 89,93 ---- private FrameworkConfig() { ! logger.trace("Entering DefaultConstructor"); try { *************** *** 98,102 **** FrameworkConfig.FRAMEWORK_CONFIG_FILE + " cannot be accessed from the classpath."); ! logger.fine("Framework configuration file has been accessed"); if(System.getProperty("javax.xml.parsers.DocumentBuilderFactory")==null) System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); --- 97,101 ---- FrameworkConfig.FRAMEWORK_CONFIG_FILE + " cannot be accessed from the classpath."); ! logger.debug("Framework configuration file has been accessed"); if(System.getProperty("javax.xml.parsers.DocumentBuilderFactory")==null) System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); *************** *** 111,115 **** documentBuilder.setErrorHandler(new DefaultHandler()); Document document=documentBuilder.parse(configFileStream); ! logger.fine("Framework configuration file has been parsed."); Element frameworkConfigElement=document.getDocumentElement(); if(FrameworkConfig.FRAMEWORK_CONFIG_TAG_NAME.equals(frameworkConfigElement.getTagName())) --- 110,114 ---- documentBuilder.setErrorHandler(new DefaultHandler()); Document document=documentBuilder.parse(configFileStream); ! logger.debug("Framework configuration file has been parsed."); Element frameworkConfigElement=document.getDocumentElement(); if(FrameworkConfig.FRAMEWORK_CONFIG_TAG_NAME.equals(frameworkConfigElement.getTagName())) *************** *** 130,134 **** JobConfigFactoryConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("Job Config Factory configuration has been loaded and the configuration is : " + this.configFactoryConfig); NodeList loggingConfigNodeList=frameworkConfigElement.getElementsByTagName(LoggingConfig.TAG_NAME); if(loggingConfigNodeList.getLength()==1) --- 129,133 ---- JobConfigFactoryConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.debug("Job Config Factory configuration has been loaded and the configuration is : " + this.configFactoryConfig); NodeList loggingConfigNodeList=frameworkConfigElement.getElementsByTagName(LoggingConfig.TAG_NAME); if(loggingConfigNodeList.getLength()==1) *************** *** 141,145 **** LoggingConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("Logging configuration has been loaded and the configuration is : " + this.logginConfig); NodeList mgmtMntrConfigNodeList=frameworkConfigElement.getElementsByTagName(MgmtMntrConfig.TAG_NAME); if(mgmtMntrConfigNodeList.getLength()==1) --- 140,144 ---- LoggingConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.debug("Logging configuration has been loaded and the configuration is : " + this.logginConfig); NodeList mgmtMntrConfigNodeList=frameworkConfigElement.getElementsByTagName(MgmtMntrConfig.TAG_NAME); if(mgmtMntrConfigNodeList.getLength()==1) *************** *** 152,156 **** MgmtMntrConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("MgmtMntr configuration has been loaded and the configuration is : " + this.mgmtMntrConfig); NodeList repositoryConfigNodeList=frameworkConfigElement.getElementsByTagName(RepositoryConfig.TAG_NAME); if(repositoryConfigNodeList.getLength()==1) --- 151,155 ---- 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) *************** *** 163,167 **** RepositoryConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("Repository configuration has been loaded and the configuration is : " + this.repositoryConfig); NodeList controllerConfigNodeList=frameworkConfigElement.getElementsByTagName(JobControllerConfig.TAG_NAME); if(controllerConfigNodeList.getLength()==1) --- 162,166 ---- RepositoryConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.debug("Repository configuration has been loaded and the configuration is : " + this.repositoryConfig); NodeList controllerConfigNodeList=frameworkConfigElement.getElementsByTagName(JobControllerConfig.TAG_NAME); if(controllerConfigNodeList.getLength()==1) *************** *** 174,178 **** JobControllerConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("Job Controller configuration has been loaded and the configuration is : " + this.controllerConfig); } catch(IOException ioException) --- 173,177 ---- JobControllerConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.debug("Job Controller configuration has been loaded and the configuration is : " + this.controllerConfig); } catch(IOException ioException) *************** *** 191,195 **** throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, saxException.getMessage()); } ! logger.exiting(FrameworkConfig.class.getName(), "DefaultConstrutor"); } --- 190,194 ---- throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, saxException.getMessage()); } ! logger.trace("Exiting DefaultConstructor"); } *************** *** 310,314 **** private JobConfigFactoryConfig(Element jobConfigFactoryElement) { ! logger.entering(JobConfigFactoryConfig.class.getName(),"Constructor"); this.jobConfigFactoryClassName=jobConfigFactoryElement.getAttribute(JobConfigFactoryConfig.FACTORY_CLASS_ATTRIBUTE_NAME); if(this.jobConfigFactoryClassName==null || "".equals(this.jobConfigFactoryClassName)) --- 309,313 ---- private JobConfigFactoryConfig(Element jobConfigFactoryElement) { ! logger.trace("Entering Constructor"); this.jobConfigFactoryClassName=jobConfigFactoryElement.getAttribute(JobConfigFactoryConfig.FACTORY_CLASS_ATTRIBUTE_NAME); if(this.jobConfigFactoryClassName==null || "".equals(this.jobConfigFactoryClassName)) *************** *** 317,321 **** FrameworkUtil.loadPropertiesFromElementToMap(jobConfigFactoryElement,jobConfigFactoryProperties); ! logger.exiting(JobConfigFactoryConfig.class.getName(),"Constructor"); } --- 316,320 ---- FrameworkUtil.loadPropertiesFromElementToMap(jobConfigFactoryElement,jobConfigFactoryProperties); ! logger.trace("Exiting Constructor"); } *************** *** 383,391 **** * Attribute name defines the logging directory. */ ! private static final String LOGGING_DIRECTORY_ATTRIB_NAME = "logging-directory"; /** * Attribute name defines the logging level. */ ! private static final String LOGGING_LEVEL_ATTRIB_NAME = "logging-level"; /** * Attribute name defines the base package name. --- 382,390 ---- * Attribute name defines the logging directory. */ ! private static final String LOGGING_DIRECTORY_ATTRIB_NAME = "job-logging-directory"; /** * Attribute name defines the logging level. */ ! private static final String LOGGING_LEVEL_ATTRIB_NAME = "job-logging-level"; /** * Attribute name defines the base package name. *************** *** 399,403 **** * Logging level. */ ! private String loggingLevel="SEVERE"; /** * Base package name of the application(job). --- 398,402 ---- * Logging level. */ ! private String loggingLevel="ERROR"; /** * Base package name of the application(job). *************** *** 414,418 **** private LoggingConfig(Element loggingConfigElement) { ! logger.entering(LoggingConfig.class.getName(),"Constructor"); this.loggingDirectory=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_DIRECTORY_ATTRIB_NAME); if(loggingDirectory==null || "".equals(loggingDirectory)) --- 413,417 ---- private LoggingConfig(Element loggingConfigElement) { ! logger.trace("Entering LoggingConfig Constructor"); this.loggingDirectory=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_DIRECTORY_ATTRIB_NAME); if(loggingDirectory==null || "".equals(loggingDirectory)) *************** *** 421,427 **** this.loggingLevel=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_LEVEL_ATTRIB_NAME); - this.setLoggingLevel(loggingLevel); this.basePackageName=loggingConfigElement.getAttribute(LoggingConfig.BASE_PACKAGE_ATTRIB_NAME); ! logger.exiting(LoggingConfig.class.getName(),"Constructor"); } --- 420,425 ---- this.loggingLevel=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_LEVEL_ATTRIB_NAME); this.basePackageName=loggingConfigElement.getAttribute(LoggingConfig.BASE_PACKAGE_ATTRIB_NAME); ! logger.trace("Exiting LoggingConfig Constructor"); } *************** *** 458,483 **** /** - * This method validates the defined logging level and sets "SEVERE" - * if the defines logging level is not a valid one. - * - * @param loggingLevel Level defined framework logging configuration. - */ - private void setLoggingLevel(String loggingLevel) - { - try - { - /** - * Just to make sure Level could recognize the given level. - */ - Level.parse(loggingLevel); - this.loggingLevel=loggingLevel; - } - catch(Exception exception) - { - this.loggingLevel="SEVERE"; - logger.severe("Defined level of logging " + loggingLevel + " is not a valid and changed to default SEVERE level"); - } - } - /** * <p> * Returns the string representation of LoggingConfig class in the format --- 456,459 ---- *************** *** 545,549 **** private MgmtMntrConfig(Element mgmtMntrConfigElement) { ! logger.entering(MgmtMntrConfig.class.getName(),"Constructor"); this.mgmtMntrClassName=mgmtMntrConfigElement.getAttribute(MgmtMntrConfig.MGMT_MNTR_CLASS_ATTRIB_NAME); if(this.mgmtMntrClassName==null || "".equals(this.mgmtMntrClassName)) --- 521,525 ---- 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)) *************** *** 553,557 **** FrameworkUtil.loadPropertiesFromElementToMap(mgmtMntrConfigElement, this.mgmtMntrConfigProperties); ! logger.exiting(MgmtMntrConfig.class.getName(),"Constructor"); } --- 529,533 ---- FrameworkUtil.loadPropertiesFromElementToMap(mgmtMntrConfigElement, this.mgmtMntrConfigProperties); ! logger.trace("Exiting MgmtMntrConfig Constructor"); } *************** *** 644,648 **** private RepositoryConfig(Element repositoryConfigElement) { ! logger.entering(RepositoryConfig.class.getName(),"Constructor"); this.repositoryClassName=repositoryConfigElement.getAttribute(RepositoryConfig.REPOSITORY_CLASS_ATTRIB_NAME); if(this.repositoryClassName==null || "".equals(this.repositoryClassName)) --- 620,624 ---- private RepositoryConfig(Element repositoryConfigElement) { ! logger.trace("Entering RepositoryConfig Constructor"); this.repositoryClassName=repositoryConfigElement.getAttribute(RepositoryConfig.REPOSITORY_CLASS_ATTRIB_NAME); if(this.repositoryClassName==null || "".equals(this.repositoryClassName)) *************** *** 652,656 **** FrameworkUtil.loadPropertiesFromElementToMap(repositoryConfigElement, this.repositoryConfigProperties); ! logger.exiting(RepositoryConfig.class.getName(),"Constructor"); } --- 628,632 ---- FrameworkUtil.loadPropertiesFromElementToMap(repositoryConfigElement, this.repositoryConfigProperties); ! logger.trace("Exiting RepositoryConfig Constructor"); } *************** *** 735,739 **** private JobControllerConfig(Element controllerConfigElement) { ! logger.entering(JobControllerConfig.class.getName(),"Constructor"); NodeList controllerNodeList=controllerConfigElement.getElementsByTagName(JobControllerConfig.JOB_CONTROLLER_TAG_NAME); for(int i=0;i<controllerNodeList.getLength();i++) --- 711,715 ---- private JobControllerConfig(Element controllerConfigElement) { ! logger.trace("Entering JobControllerConfig Constructor"); NodeList controllerNodeList=controllerConfigElement.getElementsByTagName(JobControllerConfig.JOB_CONTROLLER_TAG_NAME); for(int i=0;i<controllerNodeList.getLength();i++) *************** *** 763,767 **** } } ! logger.exiting(JobControllerConfig.class.getName(),"Constructor"); } --- 739,743 ---- } } ! logger.trace("Exiting JobControllerConfig Constructor"); } Index: JobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobConfigFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JobConfigFactory.java 13 Mar 2006 14:32:37 -0000 1.5 --- JobConfigFactory.java 14 Mar 2006 05:45:25 -0000 1.6 *************** *** 14,18 **** import java.lang.reflect.InvocationTargetException; import java.util.Map; ! import java.util.logging.Logger; /** --- 14,18 ---- import java.lang.reflect.InvocationTargetException; import java.util.Map; ! import org.apache.log4j.Logger; /** *************** *** 40,44 **** public abstract class JobConfigFactory { ! private static Logger logger=Logger.getLogger(JobConfigFactory.class.getName()); /** --- 40,44 ---- public abstract class JobConfigFactory { ! private static Logger logger=Logger.getLogger(JobConfigFactory.class); /** *************** *** 58,62 **** public static JobConfigFactory getJobConfigFactory(FrameworkConfig.JobConfigFactoryConfig factoryConfig) { ! logger.entering(JobConfigFactory.class.getName(),"getJobConfigFactory"); JobConfigFactory factoryObject=null; if(factoryConfig==null) --- 58,62 ---- public static JobConfigFactory getJobConfigFactory(FrameworkConfig.JobConfigFactoryConfig factoryConfig) { ! logger.trace("Entering getJobConfigFactory"); JobConfigFactory factoryObject=null; if(factoryConfig==null) *************** *** 75,79 **** throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, factoryClass + " is not assignable to the class " + JobConfigFactory.class.getName()); ! logger.info("Job Configuration factory has been created."); } catch(ClassNotFoundException exception) --- 75,79 ---- throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, factoryClass + " is not assignable to the class " + JobConfigFactory.class.getName()); ! logger.debug("Job Configuration factory has been created."); } catch(ClassNotFoundException exception) *************** *** 102,106 **** throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } ! logger.exiting(JobConfigFactory.class.getName(),"getJobConfigFactory"); return factoryObject; } --- 102,106 ---- throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } ! logger.trace("Exiting getJobConfigFactory"); return factoryObject; } Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** framework-config.xml 13 Mar 2006 14:32:37 -0000 1.10 --- framework-config.xml 14 Mar 2006 05:45:25 -0000 1.11 *************** *** 18,22 **** <property key="repository-filename">batchserver_repository.db</property> </repository-config> ! <logging-config logging-directory="/batchserver/logs" logging-level="CONFIG" job-base-package-name="com.mycompany.batch"/> <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.DefaultMgmtMntrManager"> <property key="port-range">15000-20000</property> --- 18,22 ---- <property key="repository-filename">batchserver_repository.db</property> </repository-config> ! <logging-config job-logging-directory="/batchserver/logs" job-base-package-name="com.mycompany.batch" job-logging-level="ERROR"/> <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.DefaultMgmtMntrManager"> <property key="port-range">15000-20000</property> Index: JobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.5 --- JobControllerConfig.java 14 Mar 2006 05:45:25 -0000 1.6 *************** *** 13,17 **** import java.util.Iterator; import java.util.Map; ! import java.util.logging.Logger; /** --- 13,17 ---- import java.util.Iterator; import java.util.Map; ! import org.apache.log4j.Logger; /** *************** *** 46,50 **** protected Map jobControllerConfigProps=new HashMap(); ! private static Logger logger=Logger.getLogger(JobControllerConfig.class.getName()); /** --- 46,50 ---- protected Map jobControllerConfigProps=new HashMap(); ! private static Logger logger=Logger.getLogger(JobControllerConfig.class); /** *************** *** 83,87 **** public void overrideConfigProperties(Map newProps) { ! logger.entering(JobControllerConfig.class.getName(),"overrideConfigProperties"); if(newProps==null ) return; --- 83,87 ---- public void overrideConfigProperties(Map newProps) { ! logger.trace("Entering overrideConfigProperties"); if(newProps==null ) return; *************** *** 95,99 **** { this.jobControllerConfigProps.put(key, newProps.get(key)); ! logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } --- 95,99 ---- { this.jobControllerConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); } } *************** *** 113,121 **** { this.jobControllerConfigProps.put(key, newProps.get(key)); ! logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } ! logger.exiting(JobControllerConfig.class.getName(),"overrideConfigProperties"); } --- 113,121 ---- { this.jobControllerConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); } } ! logger.trace("Entering overrideConfigProperties"); } Index: PoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/PoolJobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PoolJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 --- PoolJobControllerConfig.java 14 Mar 2006 05:45:25 -0000 1.7 *************** *** 14,18 **** import java.util.Iterator; import java.util.Map; ! import java.util.logging.Logger; /** --- 14,18 ---- import java.util.Iterator; import java.util.Map; ! import org.apache.log4j.Logger; /** *************** *** 58,62 **** protected String poolClassName=null; ! private static Logger logger=Logger.getLogger(PoolJobControllerConfig.class.getName()); /** --- 58,62 ---- protected String poolClassName=null; ! private static Logger logger=Logger.getLogger(PoolJobControllerConfig.class); /** *************** *** 147,152 **** { super.overrideConfigProperties(newProps); ! ! logger.entering(PoolJobControllerConfig.class.getName(),"overrideConfigProperties"); if(newProps==null ) return; --- 147,151 ---- { super.overrideConfigProperties(newProps); ! logger.trace("Entering overrideConfigProperties"); if(newProps==null ) return; *************** *** 161,165 **** { this.poolJobLoaderConfigProps.put(key, newProps.get(key)); ! logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } --- 160,164 ---- { this.poolJobLoaderConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); } } *************** *** 173,177 **** { this.poolJobProcessorConfigProps.put(key, newProps.get(key)); ! logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } --- 172,176 ---- { this.poolJobProcessorConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); } } *************** *** 185,192 **** { this.poolConfigProps.put(key, newProps.get(key)); ! logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } ! logger.exiting(PoolJobControllerConfig.class.getName(),"overrideConfigProperties"); } --- 184,191 ---- { this.poolConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); } } ! logger.trace("Exiting overrideConfigProperties"); } |
From: Suresh <sur...@us...> - 2006-03-13 14:32:45
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19442/common Modified Files: ErrorCode.java FrameworkUtil.java Log Message: no message Index: FrameworkUtil.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/FrameworkUtil.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FrameworkUtil.java 10 Mar 2006 08:14:21 -0000 1.6 --- FrameworkUtil.java 13 Mar 2006 14:32:37 -0000 1.7 *************** *** 3,6 **** --- 3,7 ---- import java.util.Map; import java.util.StringTokenizer; + import java.util.logging.Logger; import org.w3c.dom.Element; import org.w3c.dom.Node; *************** *** 24,27 **** --- 25,29 ---- public final class FrameworkUtil { + private static Logger logger=Logger.getLogger(FrameworkUtil.class.getName()); /** * Private constructor to make sure it will not be instantiated. *************** *** 53,56 **** --- 55,59 ---- public static void loadPropertiesFromElementToMap(Element configElement,Map propertyMap) { + logger.entering(FrameworkUtil.class.getName(),"loadPropertiesFromElementToMap"); if(configElement==null) throw new IllegalArgumentException("Input configuration element configElement cannot be null"); *************** *** 78,81 **** --- 81,85 ---- propertyMap.put(key,value); } + logger.exiting(FrameworkUtil.class.getName(),"loadPropertiesFromElementToMap"); } *************** *** 99,102 **** --- 103,107 ---- public static void loadPropertiesFromStringToMap(String propertiesString,Map propertyMap) { + logger.entering(FrameworkUtil.class.getName(),"loadPropertiesFromStringToMap"); if(propertiesString==null) throw new IllegalArgumentException("Input properties string cannot be null"); *************** *** 114,117 **** --- 119,123 ---- propertyMap.put(key,value); } + logger.exiting(FrameworkUtil.class.getName(),"loadPropertiesFromStringToMap"); } Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/ErrorCode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ErrorCode.java 11 Mar 2006 18:36:20 -0000 1.10 --- ErrorCode.java 13 Mar 2006 14:32:37 -0000 1.11 *************** *** 79,127 **** /** ! * Framework Configuration Error Codes. ! */ ! public static final ErrorCode JOBNAME_KEY_NOT_FOUND = new ErrorCode(1001,"job-name key not found in the startup properties"); ! public static final ErrorCode FRAMEWORK_CONFIG_FILE_NOT_FOUND = new ErrorCode(1002,"framework configuration file framework-config.xml is not found in the classpath"); ! public static final ErrorCode NONE_OR_MULITPLE_JOB_CONFIG_FACTORY_CONFIG_TAGS = new ErrorCode(1003,"None or multiple job-config-factory-config tag(s) in framework configuration"); ! public static final ErrorCode NONE_OR_MULITPLE_LOGGING_CONFIG_TAGS = new ErrorCode(1004,"None or multiple logging-config tag(s) in framework configuration"); ! public static final ErrorCode NONE_OR_MULITPLE_MGMT_MNTR_CONFIG_TAGS = new ErrorCode(1005,"None or multiple mgmt-mntr-config tag(s) in framework configuration"); ! public static final ErrorCode NONE_OR_MULITPLE_REPOSITORY_CONFIG_TAGS = new ErrorCode(1006,"None or multiple repository-config tag(s) in framework configuration"); ! public static final ErrorCode JOB_CONFIG_FACTORY_CLASS_NAME_ATTRIB_NOT_FOUND = new ErrorCode(1007,"Attribute job-config-factory-class-name not found in job-config-factory-config element"); ! public static final ErrorCode LOGGING_DIRECTORY_NOT_DEFINED = new ErrorCode(1008,"Logging directory is not defined in the logging-config"); ! public static final ErrorCode MGMT_MNTR_CLASS_NAME_ATTRIB_NOT_FOUND = new ErrorCode(1009,"Attribute mgmt-mntr-class-name not found in mgmt-mntr-config element"); ! public static final ErrorCode REPOSITORY_CLASS_NAME_ATTRIB_NOT_FOUND = new ErrorCode(1010,"Attribute repository-class-name not found in repository-config element"); ! public static final ErrorCode CONTROLLER_CLASS_NAME_ATTRIB_NOT_FOUND = new ErrorCode(1011,"Attribute controller-class-name not found in job-controller element"); ! public static final ErrorCode NONE_OR_MULITPLE_JOB_CONTROLLER_CONFIG_TAGS = new ErrorCode(1012,"None or multiple job-controller-config elements found in framework configuration"); ! ! /** ! * Job Configuration Error Codes. */ ! public static final ErrorCode JOB_NOT_CONFIGURED = new ErrorCode(2001,"job is not configured in the job configuration source"); ! public static final ErrorCode JOB_CONFIG_FACTORY_CLASS_NOT_VALID = new ErrorCode(2002,"defined configuration factory class is not assignable to the JobConfigFactory super class or cannot be instantiated because of illegal access to constructor or exception in constructor"); ! public static final ErrorCode JOB_CONFIG_FACTORY_CLASS_NOT_FOUND = new ErrorCode(2003,"defined configuration factory class could not be found on the classpath"); ! public static final ErrorCode JOB_CONFIG_FACTORY_CLASS_CONSTRUCTOR_NOT_FOUND = new ErrorCode(2004,"constructor takes map as parameter not found in defined config factory class"); ! public static final ErrorCode XML_JOB_CONFIG_FACTORY_PROPERTIES_MISSING = new ErrorCode(2005,"required properties for XMLJobConfigFactory are missing"); ! public static final ErrorCode XML_JOB_CONFIG_FACTORY_INVALID_ABS_LOCATION = new ErrorCode(2006,"defined absolute file path for the XML Job Configuration file is not valid"); ! public static final ErrorCode XML_JOB_CONFIG_FACTORY_INVALID_CLASSPATH_LOCATION = new ErrorCode(2006,"defined classpath location for the XML Job Configiguation file is not valid"); ! public static final ErrorCode NO_BATCH_CONFIG_ELEMENT_IN_XML_JOB_CONFIGURATION = new ErrorCode(2008,"could not load the batch-config element from the defined XML job configuration file"); ! public static final ErrorCode NONE_OR_MULTIPLE_JOB_CONTROLLER_CONFIGS = new ErrorCode(2009,"None or multiple job-controller configurations found in job-config element"); ! public static final ErrorCode JOB_CONTROLLER_CLASS_NOT_DEFINED = new ErrorCode(2010,"job-controller-class-name is not defined in job-controller"); ! public static final ErrorCode JOB_CONTROLLER_CONFIG_CLASS_NOT_DEFINED = new ErrorCode(2011,"job controller config class is not defined in framework configuration"); ! public static final ErrorCode JOB_CONTROLLER_CONFIG_CLASS_NOT_VALID = new ErrorCode(2012,"job controller config class is not a valid"); ! public static final ErrorCode NONE_OR_MULTIPLE_BASIC_JOB_PROCESSOR_ELEMENTS_FOUND = new ErrorCode(2013,"None or multiple basic job processor elements found in job controller"); ! public static final ErrorCode BASIC_JOB_PROCESSOR_CLASS_NAME_NOT_DEFINED = new ErrorCode(2014,"basic-job-processor-class-name is not defined in basic-job-processor element."); ! ! public static final ErrorCode NONE_OR_MULTIPLE_POOL_JOB_PROCESSOR_ELEMENTS_FOUND = new ErrorCode(2015,"None or multiple pool job processor elements found in job controller"); ! public static final ErrorCode POOL_JOB_PROCESSOR_CLASS_NAME_NOT_DEFINED = new ErrorCode(2016,"pool-job-processor-class-name is not defined in pool-job-processor element."); ! public static final ErrorCode NONE_OR_MULTIPLE_POOL_JOB_LOADER_ELEMENTS_FOUND = new ErrorCode(2017,"None or multiple pool job loader elements found in job controller"); ! public static final ErrorCode POOL_JOB_LOADER_CLASS_NAME_NOT_DEFINED = new ErrorCode(2018,"pool-job-loader-class-name is not defined in pool-job-loader element."); ! public static final ErrorCode NONE_OR_MULTIPLE_JOB_POOL_ELEMENTS_FOUND = new ErrorCode(2019,"None or multiple job pool elements found in job controller"); ! public static final ErrorCode POOL_JOB_POOL_CLASS_NAME_NOT_DEFINED = new ErrorCode(2020,"job-pool-class-name is not defined in job-pool element."); - public static final ErrorCode DB_JOB_CONFIG_FACTORY_PROPERTIES_INVALID = new ErrorCode(2021,"required properties to create db job config factory are missing or values are not valid"); - public static final ErrorCode CANNOT_CREATE_DB_JOB_CONFIG = new ErrorCode(2022,"Cannot create JobConfig due sql exception"); - public static final ErrorCode BASIC_JOB_CONTROLLER_CONFIG_NOT_FOUND = new ErrorCode(2023,"basic job controller cofiguration not defined"); - public static final ErrorCode POOL_JOB_CONTROLLER_CONFIG_NOT_FOUND = new ErrorCode(2024,"pool job controller cofiguration not defined"); - public static final ErrorCode DB_CONNECTIVITY_ERROR = new ErrorCode(2025,"SQLException while doing the database activity"); - } --- 79,89 ---- /** ! * Configuration Error Codes. */ ! public static final ErrorCode FRAMEWORK_CONFIGURATION_ERROR = new ErrorCode(1001,"Error while accessing or parsing the framework configuration file."); ! public static final ErrorCode JOB_CONFIG_FACTORY_CONFIGURATION_ERROR = new ErrorCode(1002,"Job configuration factory cannot be created by the given factory configuration."); ! public static final ErrorCode JOB_CONFIGURATION_ERROR = new ErrorCode(1003,"Error while loading the job configuration from the defined factory."); ! public static final ErrorCode JOB_IS_NOT_CONFIGURED = new ErrorCode(1004,"Job is not configured"); ! public static final ErrorCode JOB_CONTROLLER_CONFIGURATION_ERROR = new ErrorCode(1005,"Job controller configuration is not defined properly."); } |
From: Suresh <sur...@us...> - 2006-03-13 14:32:45
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19442/config Modified Files: BasicJobControllerConfig.java ConfigurationException.java framework-config.xml FrameworkConfig.java JobConfigFactory.java JobControllerConfig.java PoolJobControllerConfig.java Added Files: framework-config.xsd Log Message: no message --- NEW FILE: framework-config.xsd --- <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="framework-config" type="FrameworkConfigType"/> <xsd:complexType name="FrameworkConfigType"> <xsd:element name="job-config-factory-config" type="JobConfigFactoryConfigType"/> <xsd:element name="logging-config" type="LoggingConfigType"/> <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> <xsd:complexType name="JobConfigFactoryConfigType"> <xsd:attribute name="job-config-factory-class-name" type="xsd:string" use="required"/> <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> <xsd:complexType name="LoggingConfigType"> <xsd:attribute name="logging-direcotry" type="xsd:string" use="required"/> <xsd:attribute name="logging-level" type="LogLevelType" use="required"/> <xsd:attribute name="job-base-package-name" type="xsd:string" use="required"/> </xsd:complexType> <xsd:complexType name="RepositoryConfigType"> <xsd:attribute name="repository-class-name" type="xsd:string" use="required"/> <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> </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> <xsd:complexType name="JobControllerConfigType"> <xsd:element name="job-controller" type="JobControllerType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> <xsd:complexType name="PropertyType"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="key" type="xsd:string" use="required"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="JobControllerType"> <xsd:attribute name="controller-class-name" type="xsd:string" use="required"/> <xsd:attribute name="xml-factory-config-class-name" type="xsd:string" use="required"/> <xsd:attribute name="db-factory-config-class-name" type="xsd:string" use="required"/> </xsd:complexType> <xsd:simpleType name="LogLevelType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="DEBUG"/> <xsd:enumeration value="ERROR"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> Index: BasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/BasicJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BasicJobControllerConfig.java 10 Mar 2006 08:14:51 -0000 1.5 --- BasicJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 14,17 **** --- 14,18 ---- import java.util.Iterator; import java.util.Map; + import java.util.logging.Logger; /** *************** *** 43,46 **** --- 44,49 ---- */ protected int basicJobProcessorThreadCount=1; + + private static Logger logger=Logger.getLogger(BasicJobControllerConfig.class.getName()); /** * Gets the basic job processor class name. *************** *** 84,87 **** --- 87,91 ---- public void overrideConfigProperties(Map newProps) { + logger.entering(BasicJobControllerConfig.class.getName(),"overrideConfigProperties"); super.overrideConfigProperties(newProps); *************** *** 95,100 **** --- 99,106 ---- { this.basicJobProcessorConfigProps.put(key, newProps.get(key)); + logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } + logger.exiting(BasicJobControllerConfig.class.getName(),"overrideConfigProperties"); } Index: FrameworkConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/FrameworkConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FrameworkConfig.java 9 Mar 2006 04:44:07 -0000 1.6 --- FrameworkConfig.java 13 Mar 2006 14:32:37 -0000 1.7 *************** *** 10,22 **** package org.jmonks.batchserver.framework.config; - import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; - import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.w3c.dom.Document; --- 10,22 ---- package org.jmonks.batchserver.framework.config; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; + import java.util.logging.Level; + import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.w3c.dom.Document; *************** *** 26,29 **** --- 26,30 ---- import org.w3c.dom.NodeList; import org.xml.sax.SAXException; + import org.xml.sax.helpers.DefaultHandler; /** *************** *** 41,44 **** --- 42,46 ---- public final class FrameworkConfig { + private static Logger logger=Logger.getLogger(FrameworkConfig.class.getName()); /** * FrameworkConfig singleton instance varaible. *************** *** 49,55 **** * Declaration of XML file holds the framework configuration. */ ! private static final String FRAMEWORK_CONFIG_FILE = "framework-config.xml"; /** * JobConfigFactoryConfig variable to hold the JobConfigFactoryObject object. */ --- 51,61 ---- * Declaration of XML file holds the framework configuration. */ ! private static final String FRAMEWORK_CONFIG_FILE = "/org/jmonks/batchserver/framework/config/framework-config.xml"; /** + * Name of the tag represents the complete framework configuration. + */ + private static final String FRAMEWORK_CONFIG_TAG_NAME = "framework-confg"; + /** * JobConfigFactoryConfig variable to hold the JobConfigFactoryObject object. */ *************** *** 84,98 **** private FrameworkConfig() { try { InputStream configFileStream=FrameworkConfig.class.getResourceAsStream(FrameworkConfig.FRAMEWORK_CONFIG_FILE); if(configFileStream==null) ! throw new ConfigurationException(ErrorCode.FRAMEWORK_CONFIG_FILE_NOT_FOUND); ! DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance(); documentBuilderFactory.setValidating(true); DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder(); Document document=documentBuilder.parse(configFileStream); Element frameworkConfigElement=document.getDocumentElement(); NodeList jobConfigFactoryConfigNodeList=frameworkConfigElement.getElementsByTagName(JobConfigFactoryConfig.TAG_NAME); --- 90,122 ---- private FrameworkConfig() { + logger.entering(FrameworkConfig.class.getName(),"DefaultConstructor"); try { InputStream configFileStream=FrameworkConfig.class.getResourceAsStream(FrameworkConfig.FRAMEWORK_CONFIG_FILE); if(configFileStream==null) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Framework configuration file " + ! FrameworkConfig.FRAMEWORK_CONFIG_FILE + " cannot be accessed from the classpath."); ! ! logger.fine("Framework configuration file has been accessed"); ! if(System.getProperty("javax.xml.parsers.DocumentBuilderFactory")==null) ! System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); ! DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance(); documentBuilderFactory.setValidating(true); + documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema"); + InputStream xsdStream=FrameworkConfig.class.getResourceAsStream("framework-config.xsd"); + documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",xsdStream); + DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder(); + documentBuilder.setErrorHandler(new DefaultHandler()); Document document=documentBuilder.parse(configFileStream); + logger.fine("Framework configuration file has been parsed."); Element frameworkConfigElement=document.getDocumentElement(); + if(FrameworkConfig.FRAMEWORK_CONFIG_TAG_NAME.equals(frameworkConfigElement.getTagName())) + { + throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Expected the root element of framework configuration to be " + + FrameworkConfig.FRAMEWORK_CONFIG_TAG_NAME + ", but encountered the tag with the name " + frameworkConfigElement.getTagName() + + " accessed from the location " + FrameworkConfig.FRAMEWORK_CONFIG_FILE + "."); + } NodeList jobConfigFactoryConfigNodeList=frameworkConfigElement.getElementsByTagName(JobConfigFactoryConfig.TAG_NAME); *************** *** 103,109 **** else { ! throw new ConfigurationException(ErrorCode.NONE_OR_MULITPLE_JOB_CONFIG_FACTORY_CONFIG_TAGS); } ! NodeList loggingConfigNodeList=frameworkConfigElement.getElementsByTagName(LoggingConfig.TAG_NAME); if(loggingConfigNodeList.getLength()==1) --- 127,134 ---- else { ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Found " + jobConfigFactoryConfigNodeList.getLength() + " " + ! JobConfigFactoryConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("Job Config Factory configuration has been loaded and the configuration is : " + this.configFactoryConfig); NodeList loggingConfigNodeList=frameworkConfigElement.getElementsByTagName(LoggingConfig.TAG_NAME); if(loggingConfigNodeList.getLength()==1) *************** *** 113,119 **** else { ! throw new ConfigurationException(ErrorCode.NONE_OR_MULITPLE_LOGGING_CONFIG_TAGS); } ! NodeList mgmtMntrConfigNodeList=frameworkConfigElement.getElementsByTagName(MgmtMntrConfig.TAG_NAME); if(mgmtMntrConfigNodeList.getLength()==1) --- 138,145 ---- else { ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Found " + loggingConfigNodeList.getLength() + " " + ! LoggingConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("Logging configuration has been loaded and the configuration is : " + this.logginConfig); NodeList mgmtMntrConfigNodeList=frameworkConfigElement.getElementsByTagName(MgmtMntrConfig.TAG_NAME); if(mgmtMntrConfigNodeList.getLength()==1) *************** *** 123,129 **** else { ! throw new ConfigurationException(ErrorCode.NONE_OR_MULITPLE_MGMT_MNTR_CONFIG_TAGS); } ! NodeList repositoryConfigNodeList=frameworkConfigElement.getElementsByTagName(RepositoryConfig.TAG_NAME); if(repositoryConfigNodeList.getLength()==1) --- 149,156 ---- 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.config("MgmtMntr configuration has been loaded and the configuration is : " + this.mgmtMntrConfig); NodeList repositoryConfigNodeList=frameworkConfigElement.getElementsByTagName(RepositoryConfig.TAG_NAME); if(repositoryConfigNodeList.getLength()==1) *************** *** 133,139 **** else { ! throw new ConfigurationException(ErrorCode.NONE_OR_MULITPLE_REPOSITORY_CONFIG_TAGS); } ! NodeList controllerConfigNodeList=frameworkConfigElement.getElementsByTagName(JobControllerConfig.TAG_NAME); if(controllerConfigNodeList.getLength()==1) --- 160,167 ---- else { ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Found " + repositoryConfigNodeList.getLength() + " " + ! RepositoryConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } ! logger.config("Repository configuration has been loaded and the configuration is : " + this.repositoryConfig); NodeList controllerConfigNodeList=frameworkConfigElement.getElementsByTagName(JobControllerConfig.TAG_NAME); if(controllerConfigNodeList.getLength()==1) *************** *** 143,164 **** else { ! throw new ConfigurationException(ErrorCode.NONE_OR_MULITPLE_JOB_CONTROLLER_CONFIG_TAGS); } } catch(IOException ioException) { ioException.printStackTrace(); ! throw new RuntimeException(ioException); } catch(ParserConfigurationException parserConfigException) { parserConfigException.printStackTrace(); ! throw new RuntimeException(parserConfigException); } catch(SAXException saxException) { saxException.printStackTrace(); ! throw new RuntimeException(saxException); } } --- 171,195 ---- else { ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Found " + controllerConfigNodeList.getLength() + " " + ! JobControllerConfig.TAG_NAME + " element(s) in the framework configuration, where only one such element is allowed."); } + logger.config("Job Controller configuration has been loaded and the configuration is : " + this.controllerConfig); } catch(IOException ioException) { ioException.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, ioException.getMessage()); } catch(ParserConfigurationException parserConfigException) { parserConfigException.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, parserConfigException.getMessage()); } catch(SAXException saxException) { saxException.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, saxException.getMessage()); } + logger.exiting(FrameworkConfig.class.getName(), "DefaultConstrutor"); } *************** *** 279,287 **** private JobConfigFactoryConfig(Element jobConfigFactoryElement) { this.jobConfigFactoryClassName=jobConfigFactoryElement.getAttribute(JobConfigFactoryConfig.FACTORY_CLASS_ATTRIBUTE_NAME); ! if(this.jobConfigFactoryClassName==null) ! throw new ConfigurationException(ErrorCode.JOB_CONFIG_FACTORY_CLASS_NAME_ATTRIB_NOT_FOUND); FrameworkUtil.loadPropertiesFromElementToMap(jobConfigFactoryElement,jobConfigFactoryProperties); } --- 310,321 ---- private JobConfigFactoryConfig(Element jobConfigFactoryElement) { + logger.entering(JobConfigFactoryConfig.class.getName(),"Constructor"); this.jobConfigFactoryClassName=jobConfigFactoryElement.getAttribute(JobConfigFactoryConfig.FACTORY_CLASS_ATTRIBUTE_NAME); ! if(this.jobConfigFactoryClassName==null || "".equals(this.jobConfigFactoryClassName)) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, JobConfigFactoryConfig.FACTORY_CLASS_ATTRIBUTE_NAME + ! " attribute value cannot be null."); FrameworkUtil.loadPropertiesFromElementToMap(jobConfigFactoryElement,jobConfigFactoryProperties); + logger.exiting(JobConfigFactoryConfig.class.getName(),"Constructor"); } *************** *** 365,369 **** * Logging level. */ ! private String loggingLevel="ERROR"; /** * Base package name of the application(job). --- 399,403 ---- * Logging level. */ ! private String loggingLevel="SEVERE"; /** * Base package name of the application(job). *************** *** 380,392 **** private LoggingConfig(Element loggingConfigElement) { this.loggingDirectory=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_DIRECTORY_ATTRIB_NAME); ! if(this.loggingDirectory==null) ! throw new ConfigurationException(ErrorCode.LOGGING_DIRECTORY_NOT_DEFINED); this.loggingLevel=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_LEVEL_ATTRIB_NAME); ! if(this.loggingLevel==null) ! this.loggingLevel="ERROR"; ! this.basePackageName=loggingConfigElement.getAttribute(LoggingConfig.BASE_PACKAGE_ATTRIB_NAME); } --- 414,427 ---- private LoggingConfig(Element loggingConfigElement) { + logger.entering(LoggingConfig.class.getName(),"Constructor"); this.loggingDirectory=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_DIRECTORY_ATTRIB_NAME); ! if(loggingDirectory==null || "".equals(loggingDirectory)) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, LoggingConfig.LOGGING_DIRECTORY_ATTRIB_NAME + ! " attribute value cannot be null."); this.loggingLevel=loggingConfigElement.getAttribute(LoggingConfig.LOGGING_LEVEL_ATTRIB_NAME); ! this.setLoggingLevel(loggingLevel); this.basePackageName=loggingConfigElement.getAttribute(LoggingConfig.BASE_PACKAGE_ATTRIB_NAME); + logger.exiting(LoggingConfig.class.getName(),"Constructor"); } *************** *** 423,426 **** --- 458,483 ---- /** + * This method validates the defined logging level and sets "SEVERE" + * if the defines logging level is not a valid one. + * + * @param loggingLevel Level defined framework logging configuration. + */ + private void setLoggingLevel(String loggingLevel) + { + try + { + /** + * Just to make sure Level could recognize the given level. + */ + Level.parse(loggingLevel); + this.loggingLevel=loggingLevel; + } + catch(Exception exception) + { + this.loggingLevel="SEVERE"; + logger.severe("Defined level of logging " + loggingLevel + " is not a valid and changed to default SEVERE level"); + } + } + /** * <p> * Returns the string representation of LoggingConfig class in the format *************** *** 488,496 **** private MgmtMntrConfig(Element mgmtMntrConfigElement) { this.mgmtMntrClassName=mgmtMntrConfigElement.getAttribute(MgmtMntrConfig.MGMT_MNTR_CLASS_ATTRIB_NAME); ! if(this.mgmtMntrClassName==null) ! throw new ConfigurationException(ErrorCode.MGMT_MNTR_CLASS_NAME_ATTRIB_NOT_FOUND); FrameworkUtil.loadPropertiesFromElementToMap(mgmtMntrConfigElement, this.mgmtMntrConfigProperties); } --- 545,557 ---- private MgmtMntrConfig(Element mgmtMntrConfigElement) { + logger.entering(MgmtMntrConfig.class.getName(),"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.exiting(MgmtMntrConfig.class.getName(),"Constructor"); } *************** *** 583,591 **** private RepositoryConfig(Element repositoryConfigElement) { this.repositoryClassName=repositoryConfigElement.getAttribute(RepositoryConfig.REPOSITORY_CLASS_ATTRIB_NAME); ! if(this.repositoryClassName==null) ! throw new ConfigurationException(ErrorCode.REPOSITORY_CLASS_NAME_ATTRIB_NOT_FOUND); FrameworkUtil.loadPropertiesFromElementToMap(repositoryConfigElement, this.repositoryConfigProperties); } --- 644,656 ---- private RepositoryConfig(Element repositoryConfigElement) { + logger.entering(RepositoryConfig.class.getName(),"Constructor"); this.repositoryClassName=repositoryConfigElement.getAttribute(RepositoryConfig.REPOSITORY_CLASS_ATTRIB_NAME); ! if(this.repositoryClassName==null || "".equals(this.repositoryClassName)) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, RepositoryConfig.REPOSITORY_CLASS_ATTRIB_NAME + ! " attribute value cannot be null."); ! FrameworkUtil.loadPropertiesFromElementToMap(repositoryConfigElement, this.repositoryConfigProperties); + logger.exiting(RepositoryConfig.class.getName(),"Constructor"); } *************** *** 670,673 **** --- 735,739 ---- private JobControllerConfig(Element controllerConfigElement) { + logger.entering(JobControllerConfig.class.getName(),"Constructor"); NodeList controllerNodeList=controllerConfigElement.getElementsByTagName(JobControllerConfig.JOB_CONTROLLER_TAG_NAME); for(int i=0;i<controllerNodeList.getLength();i++) *************** *** 675,680 **** Element controllerElement=(Element)controllerNodeList.item(i); String controllerClassName=controllerElement.getAttribute(JobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIB_NAME); ! if(controllerClassName==null) ! throw new ConfigurationException(ErrorCode.CONTROLLER_CLASS_NAME_ATTRIB_NOT_FOUND); else { --- 741,747 ---- Element controllerElement=(Element)controllerNodeList.item(i); String controllerClassName=controllerElement.getAttribute(JobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIB_NAME); ! if(controllerClassName==null || "".equals(controllerClassName)) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, JobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIB_NAME + ! " attribute value cannot be null."); else { *************** *** 696,699 **** --- 763,767 ---- } } + logger.exiting(JobControllerConfig.class.getName(),"Constructor"); } Index: JobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobConfigFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JobConfigFactory.java 8 Mar 2006 05:18:55 -0000 1.4 --- JobConfigFactory.java 13 Mar 2006 14:32:37 -0000 1.5 *************** *** 14,18 **** import java.lang.reflect.InvocationTargetException; import java.util.Map; ! import org.jmonks.batchserver.framework.common.ErrorCode; /** --- 14,18 ---- import java.lang.reflect.InvocationTargetException; import java.util.Map; ! import java.util.logging.Logger; /** *************** *** 24,28 **** * </p> * <p> ! * This will get the following XML block from framework configuration as JobConfigFactoryConfig * object. * <br><br> --- 24,28 ---- * </p> * <p> ! * This will get the following XML block from framework configuration as JobConfigFactoryConfig * object. * <br><br> *************** *** 38,43 **** * @since 1.0 */ ! public abstract class JobConfigFactory { /** * This factory method will return the appropriated job configuration factory based --- 38,45 ---- * @since 1.0 */ ! public abstract class JobConfigFactory { + private static Logger logger=Logger.getLogger(JobConfigFactory.class.getName()); + /** * This factory method will return the appropriated job configuration factory based *************** *** 54,101 **** * @throws IllegalArgumentException If input factory configuration is null. */ ! public static JobConfigFactory getJobConfigFactory(FrameworkConfig.JobConfigFactoryConfig factoryConfig) { JobConfigFactory factoryObject=null; if(factoryConfig==null) ! throw new IllegalArgumentException("Input factory configuration cannot be null."); String factoryClassName=factoryConfig.getJobConfigFactoryClassName(); ! try { Class factoryClass=Class.forName(factoryClassName); Constructor factoryConstructor=factoryClass.getConstructor(new Class[]{Map.class}); ! if(JobConfigFactory.class.isAssignableFrom(factoryClass)) { factoryObject=(JobConfigFactory)factoryConstructor.newInstance(new Object[]{factoryConfig.getJobConfigFactoryProperties()}); ! } else ! throw new ConfigurationException(ErrorCode.JOB_CONFIG_FACTORY_CLASS_NOT_VALID); ! } ! catch(ClassNotFoundException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONFIG_FACTORY_CLASS_NOT_FOUND); } catch(NoSuchMethodException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONFIG_FACTORY_CLASS_CONSTRUCTOR_NOT_FOUND); } catch(InstantiationException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONFIG_FACTORY_CLASS_NOT_VALID); } catch(IllegalAccessException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONFIG_FACTORY_CLASS_NOT_VALID); } catch(InvocationTargetException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.JOB_CONFIG_FACTORY_CLASS_NOT_VALID); } ! return factoryObject; } --- 56,106 ---- * @throws IllegalArgumentException If input factory configuration is null. */ ! public static JobConfigFactory getJobConfigFactory(FrameworkConfig.JobConfigFactoryConfig factoryConfig) { + logger.entering(JobConfigFactory.class.getName(),"getJobConfigFactory"); JobConfigFactory factoryObject=null; if(factoryConfig==null) ! throw new IllegalArgumentException("Input job config factory configuration cannot be null."); String factoryClassName=factoryConfig.getJobConfigFactoryClassName(); ! try { Class factoryClass=Class.forName(factoryClassName); Constructor factoryConstructor=factoryClass.getConstructor(new Class[]{Map.class}); ! if(JobConfigFactory.class.isAssignableFrom(factoryClass)) { factoryObject=(JobConfigFactory)factoryConstructor.newInstance(new Object[]{factoryConfig.getJobConfigFactoryProperties()}); ! } else ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, factoryClass + " is not assignable to the class " + JobConfigFactory.class.getName()); ! ! logger.info("Job Configuration factory has been created."); ! } ! catch(ClassNotFoundException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } catch(NoSuchMethodException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } catch(InstantiationException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } catch(IllegalAccessException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } catch(InvocationTargetException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } ! logger.exiting(JobConfigFactory.class.getName(),"getJobConfigFactory"); return factoryObject; } Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** framework-config.xml 11 Mar 2006 02:16:38 -0000 1.9 --- framework-config.xml 13 Mar 2006 14:32:37 -0000 1.10 *************** *** 1,5 **** <framework-config> <job-config-factory-config job-config-factory-class-name="org.jmonks.batchserver.framework.config.xml.XMLJobConfigFactory"> ! <property key="job-config-file-classpath-location">batch-config.xml</property> </job-config-factory-config> <!-- --- 1,6 ---- + <?xml version="1.0" encoding="UTF-8"?> <framework-config> <job-config-factory-config job-config-factory-class-name="org.jmonks.batchserver.framework.config.xml.XMLJobConfigFactory"> ! <property key="job-config-file-classpath-location">/org/jmonks/batchserver/framework/config/xml/batch-config.xml</property> </job-config-factory-config> <!-- *************** *** 15,21 **** <repository-config repository-class-name="org.jmonks.batchserver.framework.DefaultRepository"> <property key="repository-location">/batchserver/repository</property> ! <property key="repository-filename">batchserver_repository.db</property> </repository-config> ! <logging-config logging-direcotry="/batchserver/logs" logging-level="DEBUG" job-base-package-name="com.mycompany.batch"/> <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.DefaultMgmtMntrManager"> <property key="port-range">15000-20000</property> --- 16,22 ---- <repository-config repository-class-name="org.jmonks.batchserver.framework.DefaultRepository"> <property key="repository-location">/batchserver/repository</property> ! <property key="repository-filename">batchserver_repository.db</property> </repository-config> ! <logging-config logging-directory="/batchserver/logs" logging-level="CONFIG" job-base-package-name="com.mycompany.batch"/> <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.DefaultMgmtMntrManager"> <property key="port-range">15000-20000</property> *************** *** 23,27 **** <job-controller-config> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController" ! xml-factory-config-class-name="org.jmonks.batchserver.framework.config.xml.XMLPoolJobControllerConfig" db-factory-config-class-name="org.jmonks.batchserver.framework.config.db.DBPoolJobControllerConfig"/> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController" --- 24,28 ---- <job-controller-config> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController" ! xml-factory-config-class-name="org.jmonks.batchserver.framework.config.xml.XMLPoolJobControllerConfig" db-factory-config-class-name="org.jmonks.batchserver.framework.config.db.DBPoolJobControllerConfig"/> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController" Index: JobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobControllerConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JobControllerConfig.java 9 Mar 2006 04:44:07 -0000 1.4 --- JobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.5 *************** *** 13,16 **** --- 13,17 ---- import java.util.Iterator; import java.util.Map; + import java.util.logging.Logger; /** *************** *** 45,48 **** --- 46,51 ---- protected Map jobControllerConfigProps=new HashMap(); + private static Logger logger=Logger.getLogger(JobControllerConfig.class.getName()); + /** * Gets the job controller class name. *************** *** 80,83 **** --- 83,87 ---- public void overrideConfigProperties(Map newProps) { + logger.entering(JobControllerConfig.class.getName(),"overrideConfigProperties"); if(newProps==null ) return; *************** *** 91,94 **** --- 95,99 ---- { this.jobControllerConfigProps.put(key, newProps.get(key)); + logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } *************** *** 108,114 **** --- 113,121 ---- { this.jobControllerConfigProps.put(key, newProps.get(key)); + logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } + logger.exiting(JobControllerConfig.class.getName(),"overrideConfigProperties"); } Index: PoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/PoolJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PoolJobControllerConfig.java 10 Mar 2006 08:14:51 -0000 1.5 --- PoolJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 14,17 **** --- 14,18 ---- import java.util.Iterator; import java.util.Map; + import java.util.logging.Logger; /** *************** *** 56,59 **** --- 57,63 ---- */ protected String poolClassName=null; + + private static Logger logger=Logger.getLogger(PoolJobControllerConfig.class.getName()); + /** * Map contains the properties needed by pool class. *************** *** 144,147 **** --- 148,152 ---- super.overrideConfigProperties(newProps); + logger.entering(PoolJobControllerConfig.class.getName(),"overrideConfigProperties"); if(newProps==null ) return; *************** *** 156,159 **** --- 161,165 ---- { this.poolJobLoaderConfigProps.put(key, newProps.get(key)); + logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } *************** *** 167,170 **** --- 173,177 ---- { this.poolJobProcessorConfigProps.put(key, newProps.get(key)); + logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } *************** *** 178,185 **** { this.poolConfigProps.put(key, newProps.get(key)); } } ! ! } --- 185,192 ---- { this.poolConfigProps.put(key, newProps.get(key)); + logger.fine("Overriden the property " + key + " with " + newProps.get(key)); } } ! logger.exiting(PoolJobControllerConfig.class.getName(),"overrideConfigProperties"); } Index: ConfigurationException.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/ConfigurationException.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConfigurationException.java 6 Mar 2006 23:54:45 -0000 1.4 --- ConfigurationException.java 13 Mar 2006 14:32:37 -0000 1.5 *************** *** 4,12 **** /** * <p> ! * Exception defines problems in either framework configuration or ! * job configuration. Configuration problems ! * cannot be detected until the runtime, so this exception will be ! * runtime exception. This will have the errorCode tells the ! * cause of the exception. * </p> * --- 4,12 ---- /** * <p> ! * ConfigurationException defines problems in either framework configuration ! * or job configuration. This is runtime exception, since, configuration ! * problems cannot be detected until the runtime. This will have component ! * name identifies either framework configuration or job configuration and the message ! * explains the complete problem. * </p> * *************** *** 18,42 **** { /** ! * Error code represents the cause of this exception. */ ! private ErrorCode errorCode=null; /** ! * Constructs an instance of <code>ConfigurationException</code> with the specified error code. ! * @param errorCode Error code represents the cause of the exception. */ ! public ConfigurationException(ErrorCode errorCode) { ! super(errorCode.getMessage()); ! this.errorCode=errorCode; } /** ! * Returns the error code represents the cause of this exception. * ! * @return Returns the error code. */ ! public ErrorCode getErrorCode() { ! return this.errorCode; } --- 18,67 ---- { /** ! * Componenet caused this exception. */ ! private String exceptionComponent=null; ! /** ! * Constant defines the source of framework config component. ! */ ! public static final String FRAMEWORK_CONFIG = "framework-config"; ! /** ! * Constant defines the source of job config component. ! */ ! public static final String JOB_CONFIG = "job-config"; ! /** ! * Constant defines the source of job config factory config component. ! */ ! public static final String JOB_CONFIG_FACTORY_CONFIG = "job-config-factory-config"; ! /** ! * Constant defines the source of controller config component. ! */ ! 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"; ! ! /** ! * Constructs an instance of <code>ConfigurationException</code> with the specified component ! * name and the message. ! * ! * @param exceptionComponent Specifies the source component of this exception. ! * @param message Messages states the problem. */ ! public ConfigurationException(String exceptionComponent,String message) { ! super(message); ! this.exceptionComponent=exceptionComponent; } /** ! * Returns the componenet caused this exception. * ! * @return Returns the component name. */ ! public String getExceptionComponent() { ! return this.exceptionComponent; } *************** *** 44,48 **** * <p> * Returns the string representation of ConfigurationException class in the format ! * <br> {ConfigurationException [errorCode = value]} * </p> * --- 69,73 ---- * <p> * Returns the string representation of ConfigurationException class in the format ! * <br> {ConfigurationException [component = value] [message = value]} * </p> * *************** *** 52,58 **** { StringBuffer stringValue=new StringBuffer("{ConfigurationException "); ! stringValue.append("[code = " + this.errorCode.toString() + "]"); stringValue.append("}"); return stringValue.toString(); } } --- 77,85 ---- { StringBuffer stringValue=new StringBuffer("{ConfigurationException "); ! stringValue.append("[component = " + this.exceptionComponent + "]"); ! stringValue.append("[message = " + this.getMessage() + "]"); stringValue.append("}"); return stringValue.toString(); } + } |
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19442/config/db Modified Files: DBBasicJobControllerConfig.java DBJobConfig.java DBJobConfigFactory.java DBJobControllerConfig.java DBPoolJobControllerConfig.java Log Message: no message Index: DBJobConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DBJobConfig.java 10 Mar 2006 08:15:16 -0000 1.2 --- DBJobConfig.java 13 Mar 2006 14:32:37 -0000 1.3 *************** *** 15,19 **** import java.sql.ResultSet; import java.sql.SQLException; ! import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; --- 15,19 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 46,49 **** --- 46,52 ---- */ private static final String JOB_CONFIG_QUERY = "select job_status from job_config where job_name=?"; + + private static Logger logger=Logger.getLogger(DBJobConfig.class.getName()); + /** * Loads the job name and controller configuration into the job configuration object. *************** *** 56,59 **** --- 59,63 ---- DBJobConfig(String jobName,Connection connection) { + logger.entering(DBJobConfig.class.getName(),"Constructor"); this.jobName=jobName; *************** *** 81,86 **** { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.CANNOT_CREATE_DB_JOB_CONFIG); } } } --- 85,91 ---- { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG, exception.getMessage()); } + logger.exiting(DBJobConfig.class.getName(),"Constructor"); } } Index: DBJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobConfigFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DBJobConfigFactory.java 10 Mar 2006 08:57:18 -0000 1.3 --- DBJobConfigFactory.java 13 Mar 2006 14:32:37 -0000 1.4 *************** *** 18,22 **** import java.util.HashMap; import java.util.Map; ! import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; --- 18,22 ---- import java.util.HashMap; import java.util.Map; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 77,80 **** --- 77,83 ---- */ private static final String JOB_CONFIG_QUERY = "select 1 from job_config where job_name=?"; + + private static Logger logger=Logger.getLogger(DBJobConfigFactory.class.getName()); + /** * This constructor initializes the factory by accepting the required properties *************** *** 89,92 **** --- 92,96 ---- public DBJobConfigFactory(Map configFactoryProps) { + logger.entering(DBJobConfigFactory.class.getName(),"Constructor"); this.configFactoryProps=new HashMap(configFactoryProps); /** *************** *** 96,100 **** Connection connection=this.getConnection(); if(connection==null) ! throw new ConfigurationException(ErrorCode.DB_JOB_CONFIG_FACTORY_PROPERTIES_INVALID); else { --- 100,105 ---- Connection connection=this.getConnection(); if(connection==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, "Unable to establish the database " + ! "connection with the properties " + this.configFactoryProps +"."); else { *************** *** 108,111 **** --- 113,117 ---- } } + logger.exiting(DBJobConfigFactory.class.getName(),"Constructor"); } *************** *** 124,127 **** --- 130,134 ---- public JobConfig getJobConfig(String jobName) { + logger.entering(DBJobConfigFactory.class.getName(),"getJobConfig"); JobConfig jobConfig=null; if(jobName==null) *************** *** 154,158 **** try{ connection.close(); } catch(Exception exception){ exception.printStackTrace(); } } ! return jobConfig; } --- 161,165 ---- try{ connection.close(); } catch(Exception exception){ exception.printStackTrace(); } } ! logger.exiting(DBJobConfigFactory.class.getName(),"getJobConfig", jobConfig); return jobConfig; } *************** *** 167,170 **** --- 174,180 ---- private Connection getConnection() { + logger.entering(DBJobConfigFactory.class.getName(),"getConnection"); + logger.config("Connection configuration : " + this.configFactoryProps); + Connection connection=null; *************** *** 194,197 **** --- 204,208 ---- } } + logger.exiting(DBJobConfigFactory.class.getName(),"getConnection"); return connection; } Index: DBBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBBasicJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DBBasicJobControllerConfig.java 11 Mar 2006 02:16:19 -0000 1.5 --- DBBasicJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 15,19 **** import java.sql.ResultSet; import java.sql.SQLException; ! import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; --- 15,19 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; *************** *** 51,54 **** --- 51,57 ---- */ private static final String BASIC_JOB_CONTROLLER_CONFIG_QUERY = "select basic_job_processor_class_name, basic_job_processor_thread_cnt, basic_job_processor_props from basic_job_controller_config where job_name=?"; + + private static Logger logger=Logger.getLogger(DBBasicJobControllerConfig.class.getName()); + /** * Loads the basic job controller configuration from table basic_job_controller_config *************** *** 62,65 **** --- 65,69 ---- public DBBasicJobControllerConfig(String jobName,Connection connection) { + logger.entering(DBBasicJobControllerConfig.class.getName(),"Constructor"); try { *************** *** 79,82 **** --- 83,87 ---- * Surprising!!!!!!!!! */ + logger.severe("Job configuration not found with the name " + jobName); } *************** *** 94,98 **** else { ! throw new ConfigurationException(ErrorCode.BASIC_JOB_CONTROLLER_CONFIG_NOT_FOUND); } } --- 99,103 ---- else { ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Controller configuration is not defined for the job " + jobName); } } *************** *** 100,105 **** { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.DB_CONNECTIVITY_ERROR); } } --- 105,111 ---- { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } + logger.exiting(DBBasicJobControllerConfig.class.getName(),"Constructor"); } Index: DBPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBPoolJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DBPoolJobControllerConfig.java 11 Mar 2006 02:16:19 -0000 1.5 --- DBPoolJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 15,19 **** import java.sql.ResultSet; import java.sql.SQLException; ! import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.ConfigurationException; --- 15,19 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.ConfigurationException; *************** *** 59,62 **** --- 59,64 ---- "pool_job_loader_props, job_pool_class_name, job_pool_props from pool_job_controller_config " + "where job_name=?"; + + private static Logger logger=Logger.getLogger(DBPoolJobControllerConfig.class.getName()); /** * Loads the pool job controller configuration from table pool_job_controller_config *************** *** 70,74 **** public DBPoolJobControllerConfig(String jobName,Connection connection) { ! try { --- 72,76 ---- public DBPoolJobControllerConfig(String jobName,Connection connection) { ! logger.entering(DBPoolJobControllerConfig.class.getName(),"Constructor"); try { *************** *** 113,117 **** else { ! throw new ConfigurationException(ErrorCode.POOL_JOB_CONTROLLER_CONFIG_NOT_FOUND); } } --- 115,119 ---- else { ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Controller configuration is not defined for the job " + jobName + "."); } } *************** *** 119,125 **** { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.DB_CONNECTIVITY_ERROR); } ! } --- 121,127 ---- { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } ! logger.exiting(DBPoolJobControllerConfig.class.getName(),"Constructor"); } Index: DBJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobControllerConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DBJobControllerConfig.java 11 Mar 2006 02:16:19 -0000 1.3 --- DBJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.4 *************** *** 17,22 **** import java.sql.ResultSet; import java.sql.SQLException; ! 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.FrameworkConfig; --- 17,21 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; *************** *** 41,44 **** --- 40,45 ---- */ public static final String JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME = "db-factory-config-class-name"; + + private static Logger logger=Logger.getLogger(DBJobControllerConfig.class.getName()); /** *************** *** 57,60 **** --- 58,62 ---- public static JobControllerConfig getJobControllerConfig(String jobName,Connection connection) { + logger.entering(DBJobControllerConfig.class.getName(),"getJobControllerConfig"); JobControllerConfig controllerConfig=null; *************** *** 71,75 **** String controllerConfigClassName=FrameworkConfig.getInstance().getJobControllerConfig().getConfigClassName(controllerClassName, DBJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME); if(controllerConfigClassName==null) ! throw new ConfigurationException(ErrorCode.JOB_CONTROLLER_CLASS_NOT_DEFINED); else { --- 73,78 ---- String controllerConfigClassName=FrameworkConfig.getInstance().getJobControllerConfig().getConfigClassName(controllerClassName, DBJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME); if(controllerConfigClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Could not found controller config class for the controller " + controllerClassName + ! " for the factory " + DBJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME + "."); else { *************** *** 82,106 **** { 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); } } --- 85,109 ---- { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(NoSuchMethodException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(ClassNotFoundException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(IllegalAccessException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(InvocationTargetException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } } *************** *** 109,114 **** { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.CANNOT_CREATE_DB_JOB_CONFIG); } return controllerConfig; } --- 112,118 ---- { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } + logger.exiting(DBJobControllerConfig.class.getName(),"getJobControllerConfig", controllerConfig); return controllerConfig; } |
From: Suresh <sur...@us...> - 2006-03-13 14:32:41
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19442/config/xml Modified Files: batch-config.xml XMLBasicJobControllerConfig.java XMLJobConfig.java XMLJobConfigFactory.java XMLJobControllerConfig.java XMLPoolJobControllerConfig.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.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XMLJobConfig.java 10 Mar 2006 08:15:36 -0000 1.5 --- XMLJobConfig.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 10,15 **** 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; --- 10,14 ---- package org.jmonks.batchserver.framework.config.xml; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 54,57 **** --- 53,59 ---- */ public static final String JOB_STATUS_ATTRIBUTE_NAME = "job-status"; + + private static Logger logger=Logger.getLogger(XMLJobConfig.class.getName()); + /** * Loads the job name and controller configuration into the job configuration object. *************** *** 64,67 **** --- 66,70 ---- XMLJobConfig(Element jobConfigElement) { + logger.entering(XMLJobConfig.class.getName(),"Constructor"); this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); *************** *** 80,87 **** { Element controllerConfigElement=(Element)controllerConfigNodeList.item(0); this.jobControllerConfig=XMLJobControllerConfig.getJobControllerConfig(controllerConfigElement); } else ! throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_JOB_CONTROLLER_CONFIGS); } --- 83,95 ---- { Element controllerConfigElement=(Element)controllerConfigNodeList.item(0); + logger.fine("Requesting controller config factory to get the controller configuration object"); this.jobControllerConfig=XMLJobControllerConfig.getJobControllerConfig(controllerConfigElement); + logger.config("Returned controller configuration : " + this.jobControllerConfig); } else ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG, "Found " + controllerConfigNodeList.getLength() ! + XMLJobControllerConfig.JOB_CONTROLLER_ELEMENT_NAME + " element(s) in configuration of job " + jobName + "."); ! ! logger.exiting(XMLJobConfig.class.getName(),"Constructor"); } Index: batch-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/batch-config.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** batch-config.xml 10 Mar 2006 08:15:36 -0000 1.2 --- batch-config.xml 13 Mar 2006 14:32:37 -0000 1.3 *************** *** 17,21 **** <job-config job-name="process_file_xyz" job-status="active"> <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> --- 17,21 ---- <job-config job-name="process_file_xyz" job-status="active"> <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" thread-count="2"> <property key="basic-job-processor-key1">processor-value1</property> </basic-job-processor> Index: XMLPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLPoolJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XMLPoolJobControllerConfig.java 10 Mar 2006 08:15:36 -0000 1.5 --- XMLPoolJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 10,15 **** 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; --- 10,14 ---- package org.jmonks.batchserver.framework.config.xml; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.ConfigurationException; *************** *** 73,76 **** --- 72,77 ---- private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; + private static Logger logger=Logger.getLogger(XMLPoolJobControllerConfig.class.getName()); + /** * Loads the XMLPoolJobControllerConfig from XML DOM Element <job-controller> *************** *** 82,88 **** public 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); --- 83,91 ---- public XMLPoolJobControllerConfig(Element controllerConfigElement) { + logger.entering(XMLPoolJobControllerConfig.class.getName(),"Constructor"); this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); if(this.jobControllerClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME + " attribute value cannot be null."); FrameworkUtil.loadPropertiesFromElementToMap(controllerConfigElement, this.jobControllerConfigProps); *************** *** 97,101 **** this.poolJobLoaderClassName=xmlPoolJobLoaderElement.getAttribute(XMLPoolJobControllerConfig.POOL_JOB_LOADER_CLASS_ATTRIBUTE_NAME); if(this.poolJobLoaderClassName==null) ! throw new ConfigurationException(ErrorCode.POOL_JOB_LOADER_CLASS_NAME_NOT_DEFINED); else { --- 100,105 ---- this.poolJobLoaderClassName=xmlPoolJobLoaderElement.getAttribute(XMLPoolJobControllerConfig.POOL_JOB_LOADER_CLASS_ATTRIBUTE_NAME); if(this.poolJobLoaderClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! XMLPoolJobControllerConfig.POOL_JOB_LOADER_CLASS_ATTRIBUTE_NAME + " attribute value cannot be null."); else { *************** *** 104,108 **** } else ! throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_POOL_JOB_LOADER_ELEMENTS_FOUND); /** --- 108,113 ---- } else ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! "Found " + xmlPoolJobLoaderNodeList.getLength() + " element(s) in the pool job controller configuration."); /** *************** *** 115,119 **** 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 { --- 120,125 ---- this.poolJobProcessorClassName=xmlPoolJobProcessorElement.getAttribute(XMLPoolJobControllerConfig.POOL_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME); if(this.poolJobProcessorClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! XMLPoolJobControllerConfig.POOL_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME + " attribute value cannot be null."); else { *************** *** 123,127 **** } else ! throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_POOL_JOB_PROCESSOR_ELEMENTS_FOUND); /** --- 129,134 ---- } else ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! "Found " + xmlPoolJobProcessorNodeList.getLength() + " element(s) in the pool job controller configuration."); /** *************** *** 134,138 **** 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 { --- 141,146 ---- this.poolClassName=xmlJobPoolElement.getAttribute(XMLPoolJobControllerConfig.POOL_JOB_POOL_CLASS_ATTRIBUTE_NAME); if(this.poolClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! XMLPoolJobControllerConfig.POOL_JOB_POOL_CLASS_ATTRIBUTE_NAME + " attribute value cannot be null."); else { *************** *** 141,145 **** } else ! throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_JOB_POOL_ELEMENTS_FOUND); } --- 149,156 ---- } else ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! "Found " + xmlJobPoolNodeList.getLength() + " element(s) in the pool job controller configuration."); ! ! logger.exiting(XMLPoolJobControllerConfig.class.getName(),"Constructor"); } Index: XMLJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobControllerConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XMLJobControllerConfig.java 8 Mar 2006 23:21:14 -0000 1.4 --- XMLJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.5 *************** *** 13,17 **** 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; --- 13,17 ---- import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; *************** *** 41,44 **** --- 41,47 ---- */ public static final String JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME = "xml-factory-config-class-name"; + + private static Logger logger=Logger.getLogger(XMLJobControllerConfig.class.getName()); + /** * <p> *************** *** 62,70 **** 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 { --- 65,75 ---- public static JobControllerConfig getJobControllerConfig(Element controllerConfigElement) { + logger.entering(XMLJobControllerConfig.class.getName(),"getJobControllerConfig"); JobControllerConfig controllerConfig=null; String controllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); if(controllerClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME ! + " attribute value cannot be null."); else { *************** *** 73,77 **** 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 { --- 78,85 ---- String controllerConfigClassName=FrameworkConfig.getInstance().getJobControllerConfig().getConfigClassName(controllerClassName, XMLJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME); if(controllerConfigClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! "Could not found the controller config class for the controller type " + ! controllerClassName + " for the factory " + XMLJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME + "."); ! else { *************** *** 79,82 **** --- 87,91 ---- Constructor constructor=configClass.getConstructor(new Class[]{Element.class}); controllerConfig=(JobControllerConfig)constructor.newInstance(new Object[]{controllerConfigElement}); + logger.fine("Got the controller configuration : " + controllerConfig); } } *************** *** 84,111 **** { 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; } --- 93,120 ---- { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(NoSuchMethodException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(ClassNotFoundException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(IllegalAccessException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } catch(InvocationTargetException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } } ! logger.exiting(XMLJobControllerConfig.class.getName(),"getJobControllerConfig"); return controllerConfig; } Index: XMLJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfigFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XMLJobConfigFactory.java 10 Mar 2006 08:15:36 -0000 1.5 --- XMLJobConfigFactory.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 18,25 **** import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; - import org.jmonks.batchserver.framework.common.ErrorCode; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; --- 18,25 ---- import java.util.HashMap; import java.util.Map; + import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 74,77 **** --- 74,79 ---- private Element batchConfigElement=null; + private static Logger logger=Logger.getLogger(XMLJobConfigFactory.class.getName()); + /** * This constructor initializes the factory by accepting the required properties *************** *** 85,95 **** public XMLJobConfigFactory(Map configFactoryProps) { this.configFactoryProps=new HashMap(configFactoryProps); String absoluteLocation=(String)this.configFactoryProps.get(XMLJobConfigFactory.PROPERTY_JOB_CONFIG_FILE_ABSOLUTE_LOCATION); String classpathLocation=(String)this.configFactoryProps.get(XMLJobConfigFactory.PROPERTY_JOB_CONFIG_FILE_CLASSPATH_LOCATION); ! if(absoluteLocation==null && classpathLocation==null) ! throw new ConfigurationException(ErrorCode.XML_JOB_CONFIG_FACTORY_PROPERTIES_MISSING); else if(absoluteLocation!=null) { --- 87,100 ---- public XMLJobConfigFactory(Map configFactoryProps) { + logger.entering(XMLJobConfigFactory.class.getName(),"Constructor"); this.configFactoryProps=new HashMap(configFactoryProps); String absoluteLocation=(String)this.configFactoryProps.get(XMLJobConfigFactory.PROPERTY_JOB_CONFIG_FILE_ABSOLUTE_LOCATION); String classpathLocation=(String)this.configFactoryProps.get(XMLJobConfigFactory.PROPERTY_JOB_CONFIG_FILE_CLASSPATH_LOCATION); ! ! logger.fine("Absolute location : " + absoluteLocation + " classpath location : " + classpathLocation); if(absoluteLocation==null && classpathLocation==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, "XML Job configuration location is not specified " + ! "using either absolute or classpath attribute."); else if(absoluteLocation!=null) { *************** *** 104,117 **** { InputStream inputStream=new FileInputStream(jobConfigFile); if(!this.createBatchConfigElement(inputStream)) ! throw new ConfigurationException(ErrorCode.NO_BATCH_CONFIG_ELEMENT_IN_XML_JOB_CONFIGURATION); } else ! throw new ConfigurationException(ErrorCode.XML_JOB_CONFIG_FACTORY_INVALID_ABS_LOCATION); } catch(FileNotFoundException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.XML_JOB_CONFIG_FACTORY_INVALID_ABS_LOCATION); } } --- 109,128 ---- { InputStream inputStream=new FileInputStream(jobConfigFile); + logger.fine("Would be able to read the configuration stream from absolute path " + absoluteLocation); if(!this.createBatchConfigElement(inputStream)) ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, ! "Error while parsing and locating root element batch-config in the XML " + ! "job configuration file " + absoluteLocation + "."); } else ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, ! "XML job configuration file " + absoluteLocation + " is not exist or it could not be a file."); ! } catch(FileNotFoundException exception) { exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, ! "XML job configuration file " + absoluteLocation + " cannot be found"); } } *************** *** 124,134 **** InputStream inputStream=XMLJobConfigFactory.class.getResourceAsStream(classpathLocation); if(inputStream==null) ! throw new ConfigurationException(ErrorCode.XML_JOB_CONFIG_FACTORY_INVALID_CLASSPATH_LOCATION); else { if(!this.createBatchConfigElement(inputStream)) ! throw new ConfigurationException(ErrorCode.NO_BATCH_CONFIG_ELEMENT_IN_XML_JOB_CONFIGURATION); } } } --- 135,152 ---- InputStream inputStream=XMLJobConfigFactory.class.getResourceAsStream(classpathLocation); if(inputStream==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, ! "XML job configuration file " + classpathLocation + " cannot be located on the classpath."); ! else { + logger.fine("Would be able to read the configuration from class path : " + classpathLocation); if(!this.createBatchConfigElement(inputStream)) ! throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, ! "Error while parsing and locating the batch-config element in the " + ! "XML Job configuration file " + classpathLocation + "."); ! } } + logger.exiting(XMLJobConfigFactory.class.getName(),"Constructor"); } *************** *** 147,150 **** --- 165,169 ---- public JobConfig getJobConfig(String jobName) { + logger.entering(XMLJobConfigFactory.class.getName(),"getJobConfig"); JobConfig jobConfig=null; /** *************** *** 169,172 **** --- 188,192 ---- } } + logger.exiting(XMLJobConfigFactory.class.getName(),"getJobConfig", jobConfig); return jobConfig; } Index: XMLBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLBasicJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XMLBasicJobControllerConfig.java 10 Mar 2006 08:15:36 -0000 1.5 --- XMLBasicJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 *************** *** 10,15 **** 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; --- 10,14 ---- package org.jmonks.batchserver.framework.config.xml; ! import java.util.logging.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; *************** *** 51,54 **** --- 50,56 ---- */ private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; + + private static Logger logger=Logger.getLogger(XMLBasicJobControllerConfig.class.getName()); + /** * Loads the XML job controller configuration into XMLBasicJobControllerConfig object. *************** *** 60,66 **** public 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); --- 62,70 ---- public XMLBasicJobControllerConfig(Element controllerConfigElement) { + logger.entering(XMLBasicJobControllerConfig.class.getName(),"Constructor"); this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); if(this.jobControllerClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME + " attribute value cannot be null."); FrameworkUtil.loadPropertiesFromElementToMap(controllerConfigElement, this.jobControllerConfigProps); *************** *** 72,76 **** 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 { --- 76,81 ---- this.basicJobProcessorClassName=xmlBasicJobProcessorElement.getAttribute(XMLBasicJobControllerConfig.BASIC_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME); if(this.basicJobProcessorClassName==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! XMLBasicJobControllerConfig.BASIC_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME + " attribute value cannot be null."); else { *************** *** 80,84 **** } else ! throw new ConfigurationException(ErrorCode.NONE_OR_MULTIPLE_BASIC_JOB_PROCESSOR_ELEMENTS_FOUND); } } --- 85,92 ---- } else ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, ! "Found " + xmlBasicJobProcessorNodeList.getLength() + " element(s) in the basic job controller configuration."); ! ! logger.exiting(XMLBasicJobControllerConfig.class.getName(),"Constructor"); } } |
From: Suresh <sur...@us...> - 2006-03-13 14:32:41
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19442 Modified Files: LoggingManager.java Main.java Log Message: no message Index: Main.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/Main.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Main.java 4 Mar 2006 04:48:52 -0000 1.2 --- Main.java 13 Mar 2006 14:32:38 -0000 1.3 *************** *** 3,6 **** --- 3,7 ---- import java.util.HashMap; import java.util.Map; + import java.util.logging.Logger; import org.jmonks.batchserver.framework.mgmtmntr.*; import org.jmonks.batchserver.framework.common.*; *************** *** 22,27 **** --- 23,36 ---- public class Main { + private static Logger logger=null; + static + { + LoggingManager.getInstance().initializeFrameworkLogging(); + logger=Logger.getLogger(Main.class.getName()); + } + private MgmtMntrManager mMgmtMntrManager; + public Main() { *************** *** 34,48 **** * <br><br> * <pre> - * import org.jmonks.batchserver.framework.Main; - * import java.util.Map; - * import java.util.HashMap(); - * * Map configMap=new HashMap(); * configMap.put("job-name","process_file_abc"); * configMap.put("config-name1","config-value1"); * configMap.put("config-name2","config-value2"); ! * Main main=new Main(); ! * int errorCode=main.process(configMap); ! * System.out.println("Job exited with return code : " + errorCode); * </pre> * <br><br> --- 43,53 ---- * <br><br> * <pre> * Map configMap=new HashMap(); * configMap.put("job-name","process_file_abc"); * configMap.put("config-name1","config-value1"); * configMap.put("config-name2","config-value2"); ! * ! * ErrorCode statusCode=Main.process(configMap); ! * System.out.println("Job exited with return code : " + errorCode.getErrorCode()); * </pre> * <br><br> *************** *** 53,65 **** * @return Returns zero for success and non-zero for failure. */ ! public org.jmonks.batchserver.framework.common.StatusCode process(Map configMap) ! ! ! { return null; - - - } --- 58,67 ---- * @return Returns zero for success and non-zero for failure. */ ! public static ErrorCode process(Map configMap) { + logger.entering(Main.class.getName(),"process"); + + logger.exiting(Main.class.getName(),"process"); return null; } *************** *** 88,93 **** **/ Main main=new Main(); ! StatusCode statusCode=main.process(configMap); ! System.exit(statusCode.getCode()); } --- 90,95 ---- **/ Main main=new Main(); ! ErrorCode errorCode=main.process(configMap); ! System.exit(errorCode.getCode()); } Index: LoggingManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/LoggingManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LoggingManager.java 4 Mar 2006 04:48:52 -0000 1.2 --- LoggingManager.java 13 Mar 2006 14:32:38 -0000 1.3 *************** *** 1,3 **** --- 1,15 ---- package org.jmonks.batchserver.framework; + import java.io.File; + import java.io.IOException; + import java.text.SimpleDateFormat; + import java.util.Calendar; + import java.util.Enumeration; + import java.util.logging.FileHandler; + import java.util.logging.Formatter; + import java.util.logging.Handler; + import java.util.logging.Level; + import java.util.logging.LogManager; + import java.util.logging.Logger; + import java.util.logging.SimpleFormatter; import org.jmonks.batchserver.framework.config.*; *************** *** 26,56 **** * @since 1.0 */ ! public class LoggingManager { ! private static LoggingManager loggingManager = new LoggingManager(); private LoggingManager() { } ! public static LoggingManager getInstance() ! { ! return null; } /** * <p> ! * This method accepts all the information available from framwork configuration ! * and job configuration and loads the required loggers appropriately. If jobLoggingConfig ! * is null, it uses frameworkLoggingConfig to initialize the logging. * * @param jobName Name of the job. ! * @param frameworkLoggingConfig Logging configuration defined at the framework. ! * @param jobLogginConfig Logging configuration defined at the job. * </p> */ ! public void initializeLogging(String jobName, org.jmonks.batchserver.framework.config.FrameworkConfig.LoggingConfig loggingConfig) { } } --- 38,184 ---- * @since 1.0 */ ! public class LoggingManager ! { private static LoggingManager loggingManager = new LoggingManager(); + + /** + * Holds the path of the file framework logging handler is using. + */ + private String frameworkLoggingFileName=null; + /** + * Holds the path of the file job logging handler is using. + */ + private String jobLoggingFileName=null; + private LoggingManager() { } ! public static LoggingManager getInstance() { ! return loggingManager; } /** * <p> ! * This method accepts all the information available from framwork logging configuration ! * and loads the required loggers appropriately. This does the follwing steps. ! * <ul> ! * <li>Create the directory <directory name configured in logging config>/jobName ! * <li>Generates the logging file name jobName_yyyymmdd_hhmmss.log ! * <li>Creates the File handler with the above created directory and logging file name. ! * <li>Looks for the framework logger and removes the existing file handler and adds the ! * above created file handler. ! * <li>Creates the logger for the base package name provided and add the above file handler. ! * <li>Make sure these two loggers have been added to the LogManager. ! * </ul> * * @param jobName Name of the job. ! * @param loggingConfig Logging configuration defined at the framework. ! * ! * @throws IllegalArgumentException If input values are null. ! * @throws ConfigurationException If logging file cannot be created at the configured directory. * </p> */ ! public void initializeJobLogging(String jobName, org.jmonks.batchserver.framework.config.FrameworkConfig.LoggingConfig loggingConfig) { + if(jobName==null) + throw new IllegalArgumentException("job name cannot be null to establish the framework logging service."); + + if(loggingConfig==null) + throw new IllegalArgumentException("logging config object cannot be null to establish the framework logging service."); + + String loggingDirectoryName=loggingConfig.getLoggingDirecotry(); + if(loggingDirectoryName!=null) + { + File loggingDirectory=new File(loggingDirectoryName+File.separator+jobName); + if(!loggingDirectory.exists()) + { + boolean created=loggingDirectory.mkdirs(); + if(!created) + throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG,"Unable to create the directory " + loggingDirectoryName + "."); + } + } + else + throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG,"logging directory in framework logging config cannot be null to establish the framework logging service."); + + String logFileName=jobName+"_"+new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime())+".log"; + this.jobLoggingFileName=loggingDirectoryName+File.separator+jobName+File.separator+logFileName; + Handler jobLoggingHandler=null; + try + { + jobLoggingHandler=new FileHandler(this.jobLoggingFileName); + jobLoggingHandler.setLevel(Level.ALL); + Formatter jobLoggingFormatter=new SimpleFormatter(); + jobLoggingHandler.setFormatter(jobLoggingFormatter); + } + catch(IOException exception) + { + exception.printStackTrace(); + throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG, "Exception while creating the file handler with the name " + + this.jobLoggingFileName + ". Exceptions Message is : " +exception.getMessage()); + } + + Logger frameworkLogger=LogManager.getLogManager().getLogger("org.jmonks"); + if(frameworkLogger==null) + { + frameworkLogger=Logger.getLogger("org.jmonks"); + LogManager.getLogManager().addLogger(frameworkLogger); + } + else + { + Handler[] handlers=frameworkLogger.getHandlers(); + for(int i=0;i<handlers.length;i++) + frameworkLogger.removeHandler(handlers[i]); + } + frameworkLogger.addHandler(jobLoggingHandler); + frameworkLogger.setLevel(Level.parse(loggingConfig.getFrameworkLogLevel())); + + Logger jobLogger=Logger.getLogger(loggingConfig.getBasePackageName()); + jobLogger.setLevel(Level.parse(loggingConfig.getFrameworkLogLevel())); + jobLogger.addHandler(jobLoggingHandler); + LogManager.getLogManager().addLogger(jobLogger); + } + /** + * Initializes the logging of the framework in the user home directory. + * This will be used untile the job logging is enabled. + */ + public void initializeFrameworkLogging() + { + try + { + String userHomeDirectory=System.getProperty("user.home"); + this.frameworkLoggingFileName=userHomeDirectory+File.separator+"batch_framework.log"; + + Logger initialFrameworkLogger=Logger.getLogger("org.jmonks"); + initialFrameworkLogger.setLevel(Level.CONFIG); + Handler frameworkLoggignHandler=new FileHandler(this.frameworkLoggingFileName,true); + frameworkLoggignHandler.setLevel(Level.ALL); + Formatter frameworkLoggingFormatter=new SimpleFormatter(); + frameworkLoggignHandler.setFormatter(frameworkLoggingFormatter); + initialFrameworkLogger.addHandler(frameworkLoggignHandler); + LogManager.getLogManager().addLogger(initialFrameworkLogger); + } + catch(IOException exception) + { + exception.printStackTrace(); + } + } + + /** + * Changes the logging level of all the existing logger to the requested level. + * + * @param logLevel level of the logging needed. + */ + public void changeLoggingLevel(Level logLevel) + { + Enumeration loggerNameEnumeration=LogManager.getLogManager().getLoggerNames(); + while(loggerNameEnumeration.hasMoreElements()) + { + Logger logger=LogManager.getLogManager().getLogger((String)loggerNameEnumeration.nextElement()); + logger.setLevel(logLevel); + } + } } |
From: Suresh <sur...@us...> - 2006-03-13 14:31:19
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18893 Added Files: LoggingManagerTest.java Log Message: no message --- NEW FILE: LoggingManagerTest.java --- /* * LoggingManagerTest.java * JUnit based test * * Created on March 12, 2006, 1:31 PM */ package org.jmonks.batchserver.framework; import junit.framework.*; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.logging.FileHandler; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.Logger; import org.jmonks.batchserver.framework.config.*; /** * * @author Suresh Pragada */ public class LoggingManagerTest extends TestCase { public LoggingManagerTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(LoggingManagerTest.class); //TestSuite suite=new TestSuite(); //suite.addTest(new LoggingManagerTest("testChangeLoggingLevel")); return suite; } /** * Test of getInstance method, of class org.jmonks.batchserver.framework.LoggingManager. */ public void testGetInstance() { LoggingManager loggingManager=LoggingManager.getInstance(); assertNotNull(loggingManager); } /** * Test of initializeJobLogging method, of class org.jmonks.batchserver.framework.LoggingManager. */ public void testInitializeJobLogging() { LoggingManager loggingManager=LoggingManager.getInstance(); assertNotNull(loggingManager); loggingManager.initializeFrameworkLogging(); Logger logger1=Logger.getLogger("org.jmonks.batchserver.framework"); assertNotNull(logger1); logger1.warning("This is the warning message"); logger1.config("This is the config message"); logger1.config("This is the severe message"); FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.LoggingConfig loggingConfig=frameworkConfig.getLoggingConfig(); assertNotNull(loggingConfig); loggingManager.initializeJobLogging("process_file_abc", loggingConfig); Logger logger2=Logger.getLogger("org.jmonks.batchserver.framework"); assertNotNull(logger2); logger2.warning("This is the warning message"); logger2.config("This is the config message"); logger2.config("This is the severe message"); } /** * Test to make sure logging level being modifieid. */ public void testChangeLoggingLevel() { LoggingManager loggingManager=LoggingManager.getInstance(); loggingManager.initializeFrameworkLogging(); Logger logger=Logger.getLogger(LoggingManagerTest.class.getName()); logger.severe("This is the severed messaged"); } /** * Test of initializeLogging method, of class org.jmonks.batchserver.framework.LoggingManager. */ public void testInitializeLogging() { LoggingManager loggingManager=LoggingManager.getInstance(); assertNotNull(loggingManager); loggingManager.initializeFrameworkLogging(); Logger logger1=Logger.getLogger("org.jmonks"); assertNotNull(logger1); Logger logger2=Logger.getLogger("org.jmonks.batchserver.framework.config"); assertNotNull(logger2); } } |
From: Suresh <sur...@us...> - 2006-03-13 14:31:18
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18893/config Modified Files: ConfigurationExceptionTest.java FrameworkConfigTest.java Log Message: no message Index: FrameworkConfigTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config/FrameworkConfigTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FrameworkConfigTest.java 9 Mar 2006 04:42:55 -0000 1.2 --- FrameworkConfigTest.java 13 Mar 2006 14:31:14 -0000 1.3 *************** *** 36,39 **** --- 36,41 ---- { TestSuite suite = new TestSuite(FrameworkConfigTest.class); + //TestSuite suite=new TestSuite(); + //suite.addTest(new FrameworkConfigTest("testGetInstance")); return suite; } *************** *** 99,102 **** --- 101,105 ---- assertNotNull(loggingConfig); assertNotNull(loggingConfig.getLoggingDirecotry()); + assertTrue(!loggingConfig.getLoggingDirecotry().equals("")); assertNotNull(loggingConfig.getFrameworkLogLevel()); assertNotNull(loggingConfig.getBasePackageName()); Index: ConfigurationExceptionTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config/ConfigurationExceptionTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ConfigurationExceptionTest.java 7 Mar 2006 03:42:25 -0000 1.1 --- ConfigurationExceptionTest.java 13 Mar 2006 14:31:14 -0000 1.2 *************** *** 42,48 **** public void testGetErrorCode() { ! ConfigurationException exception=new ConfigurationException(ErrorCode.FRAMEWORK_CONFIG_FILE_NOT_FOUND); ! ErrorCode code=exception.getErrorCode(); ! assertNotNull(code); } --- 42,48 ---- public void testGetErrorCode() { ! ConfigurationException exception=new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Some Message"); ! String cmpName=exception.getExceptionComponent(); ! assertNotNull(cmpName); } |
From: Suresh <sur...@us...> - 2006-03-13 14:31:18
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18893/common Modified Files: ErrorCodeTest.java Log Message: no message Index: ErrorCodeTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/common/ErrorCodeTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ErrorCodeTest.java 10 Mar 2006 01:28:48 -0000 1.3 --- ErrorCodeTest.java 13 Mar 2006 14:31:15 -0000 1.4 *************** *** 44,50 **** public void testGetCode() { ! ErrorCode errorCode=ErrorCode.FRAMEWORK_CONFIG_FILE_NOT_FOUND; int code=errorCode.getCode(); ! assertEquals(1002,code); } --- 44,50 ---- public void testGetCode() { ! ErrorCode errorCode=ErrorCode.FRAMEWORK_CONFIGURATION_ERROR; int code=errorCode.getCode(); ! assertEquals(1001,code); } *************** *** 54,58 **** public void testGetMessage() { ! ErrorCode errorCode=ErrorCode.JOB_NOT_CONFIGURED; String message=errorCode.getMessage(); assertNotNull(message); --- 54,58 ---- public void testGetMessage() { ! ErrorCode errorCode=ErrorCode.FRAMEWORK_CONFIGURATION_ERROR; String message=errorCode.getMessage(); assertNotNull(message); |
From: Suresh <sur...@us...> - 2006-03-13 14:27:21
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16755 Modified Files: FrameworkTestSuite.java Log Message: no message Index: FrameworkTestSuite.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/FrameworkTestSuite.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FrameworkTestSuite.java 7 Mar 2006 03:41:19 -0000 1.2 --- FrameworkTestSuite.java 13 Mar 2006 14:27:15 -0000 1.3 *************** *** 12,17 **** --- 12,22 ---- import org.jmonks.batchserver.framework.common.FrameworkUtilTest; import org.jmonks.batchserver.framework.common.StatusCodeTest; + import org.jmonks.batchserver.framework.config.BasicJobControllerConfigTest; import org.jmonks.batchserver.framework.config.ConfigurationExceptionTest; import org.jmonks.batchserver.framework.config.FrameworkConfigTest; + import org.jmonks.batchserver.framework.config.JobConfigFactoryTest; + import org.jmonks.batchserver.framework.config.JobConfigTest; + import org.jmonks.batchserver.framework.config.JobControllerConfigTest; + import org.jmonks.batchserver.framework.config.PoolJobControllerConfigTest; /** *************** *** 43,47 **** { TestSuite mainSuite = new TestSuite(); ! mainSuite.addTest(FrameworkUtilTest.suite()); mainSuite.addTest(ErrorCodeTest.suite()); --- 48,52 ---- { TestSuite mainSuite = new TestSuite(); ! mainSuite.addTest(LoggingManagerTest.suite()); mainSuite.addTest(FrameworkUtilTest.suite()); mainSuite.addTest(ErrorCodeTest.suite()); *************** *** 49,52 **** --- 54,63 ---- mainSuite.addTest(FrameworkConfigTest.suite()); mainSuite.addTest(ConfigurationExceptionTest.suite()); + mainSuite.addTest(JobConfigTest.suite()); + mainSuite.addTest(JobControllerConfigTest.suite()); + mainSuite.addTest(JobConfigFactoryTest.suite()); + mainSuite.addTest(BasicJobControllerConfigTest.suite()); + mainSuite.addTest(PoolJobControllerConfigTest.suite()); + return mainSuite; |
From: Suresh <sur...@us...> - 2006-03-11 18:36:26
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26194 Modified Files: ErrorCode.java Log Message: no message Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/ErrorCode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ErrorCode.java 10 Mar 2006 08:14:21 -0000 1.9 --- ErrorCode.java 11 Mar 2006 18:36:20 -0000 1.10 *************** *** 122,125 **** --- 122,127 ---- public static final ErrorCode CANNOT_CREATE_DB_JOB_CONFIG = new ErrorCode(2022,"Cannot create JobConfig due sql exception"); public static final ErrorCode BASIC_JOB_CONTROLLER_CONFIG_NOT_FOUND = new ErrorCode(2023,"basic job controller cofiguration not defined"); + public static final ErrorCode POOL_JOB_CONTROLLER_CONFIG_NOT_FOUND = new ErrorCode(2024,"pool job controller cofiguration not defined"); + public static final ErrorCode DB_CONNECTIVITY_ERROR = new ErrorCode(2025,"SQLException while doing the database activity"); } |
From: Suresh <sur...@us...> - 2006-03-11 02:16:46
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12115 Modified Files: framework-config.xml JobConfig.java Log Message: no message Index: JobConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JobConfig.java 10 Mar 2006 08:14:51 -0000 1.5 --- JobConfig.java 11 Mar 2006 02:16:38 -0000 1.6 *************** *** 66,70 **** * @return Returns true, if job is active, false otherwise. */ ! public boolean isActive() { return this.jobStatus; --- 66,70 ---- * @return Returns true, if job is active, false otherwise. */ ! public boolean getJobStatus() { return this.jobStatus; Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** framework-config.xml 10 Mar 2006 08:14:51 -0000 1.8 --- framework-config.xml 11 Mar 2006 02:16:38 -0000 1.9 *************** *** 1,21 **** <framework-config> ! <job-config-factory-config job-config-factory-class-name="org.jmonks.batchserver.framework.config.xml.XMLJobConfigFactory"> ! <!-- <property key="job-config-file-absolute-location">/batchserver/batch-config.xml</property> --> <property key="job-config-file-classpath-location">batch-config.xml</property> ! <!-- ! Following is the another way to configure the XML Job configuration. ! <property key="job-config-file-classpath-location">batch-config.xml</property> ! --> ! </job-config-factory-config> <!-- ! Following is the sample configuration to read the job configuration from the database. ! <job-config-reader-config config-reader-class-name="org.jmonks.batchserver.framework.config.DBJobConfigReader"> <property key="config-db-jdbc-driver-class-name">oracle.jdbc.driver.OracleDriver</property> ! <property key="config-db-url">jdbc:oracle:thin:@hostname:1521:instname</property> <property key="config-db-username">scott</property> <property key="config-db-password">tiger</property> ! </job-config-reader-config> ! --> <repository-config repository-class-name="org.jmonks.batchserver.framework.DefaultRepository"> <property key="repository-location">/batchserver/repository</property> --- 1,16 ---- <framework-config> ! <job-config-factory-config job-config-factory-class-name="org.jmonks.batchserver.framework.config.xml.XMLJobConfigFactory"> <property key="job-config-file-classpath-location">batch-config.xml</property> ! </job-config-factory-config> <!-- ! Following is the sample configuration to read the job configuration from the database. ! <job-config-factory-config job-config-factory-class-name="org.jmonks.batchserver.framework.config.db.DBJobConfigFactory"> <property key="config-db-jdbc-driver-class-name">oracle.jdbc.driver.OracleDriver</property> ! <property key="config-db-url">jdbc:oracle:thin:@hostname:1521:instancename</property> <property key="config-db-username">scott</property> <property key="config-db-password">tiger</property> ! </job-config-factory-config> --> ! <repository-config repository-class-name="org.jmonks.batchserver.framework.DefaultRepository"> <property key="repository-location">/batchserver/repository</property> |
From: Suresh <sur...@us...> - 2006-03-11 02:16:23
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12004 Modified Files: DBBasicJobControllerConfig.java DBJobControllerConfig.java DBPoolJobControllerConfig.java Log Message: no message Index: DBBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBBasicJobControllerConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DBBasicJobControllerConfig.java 10 Mar 2006 08:57:18 -0000 1.4 --- DBBasicJobControllerConfig.java 11 Mar 2006 02:16:19 -0000 1.5 *************** *** 44,47 **** --- 44,51 ---- { /** + * SQL Query retrieves the job controller class name and controller properites from job_config. + */ + private static final String JOB_CONFIG_QUERY = "select job_controller_class_name,job_controller_props from job_config where job_name=?"; + /** * SQL Query pulls the information basic_job_controller_config table. */ *************** *** 58,72 **** public DBBasicJobControllerConfig(String jobName,Connection connection) { - try { ! PreparedStatement statement=connection.prepareStatement(DBBasicJobControllerConfig.BASIC_JOB_CONTROLLER_CONFIG_QUERY); ! statement.setString(1,jobName); ! ResultSet resultSet=statement.executeQuery(); ! if(resultSet.next()) { ! this.basicJobProcessorClassName=resultSet.getString(1); ! this.basicJobProcessorThreadCount=resultSet.getInt(2); ! String processorConfigProps=resultSet.getString(3); if(processorConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(processorConfigProps,this.basicJobProcessorConfigProps); --- 62,92 ---- public DBBasicJobControllerConfig(String jobName,Connection connection) { try { ! PreparedStatement jobConfigStatement=connection.prepareStatement(DBBasicJobControllerConfig.JOB_CONFIG_QUERY); ! jobConfigStatement.setString(1, jobName); ! ResultSet jobConfigResultSet=jobConfigStatement.executeQuery(); ! if(jobConfigResultSet.next()) { ! this.jobControllerClassName=jobConfigResultSet.getString(1); ! String controllerConfigProps=jobConfigResultSet.getString(2); ! if(controllerConfigProps!=null) ! FrameworkUtil.loadPropertiesFromStringToMap(controllerConfigProps, this.jobControllerConfigProps); ! } ! else ! { ! /** ! * Surprising!!!!!!!!! ! */ ! } ! ! PreparedStatement controllerConfigStatement=connection.prepareStatement(DBBasicJobControllerConfig.BASIC_JOB_CONTROLLER_CONFIG_QUERY); ! controllerConfigStatement.setString(1,jobName); ! ResultSet controllerConfigResultSet=controllerConfigStatement.executeQuery(); ! if(controllerConfigResultSet.next()) ! { ! this.basicJobProcessorClassName=controllerConfigResultSet.getString(1); ! this.basicJobProcessorThreadCount=controllerConfigResultSet.getInt(2); ! String processorConfigProps=controllerConfigResultSet.getString(3); if(processorConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(processorConfigProps,this.basicJobProcessorConfigProps); Index: DBPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBPoolJobControllerConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DBPoolJobControllerConfig.java 10 Mar 2006 08:57:18 -0000 1.4 --- DBPoolJobControllerConfig.java 11 Mar 2006 02:16:19 -0000 1.5 *************** *** 49,52 **** --- 49,56 ---- { /** + * SQL Query retrieves the job controller class name and controller properites from job_config. + */ + private static final String JOB_CONFIG_QUERY = "select job_controller_class_name,job_controller_props from job_config where job_name=?"; + /** * SQL Query pulls the information pool_job_controller_config table. */ *************** *** 69,90 **** try { ! PreparedStatement statement=connection.prepareStatement(DBPoolJobControllerConfig.POOL_JOB_CONTROLLER_CONFIG_QUERY); ! statement.setString(1,jobName); ! ResultSet resultSet=statement.executeQuery(); ! if(resultSet.next()) { ! this.poolJobProcessorClassName=resultSet.getString(1); ! this.poolJobProcessorThreadCount=resultSet.getInt(2); ! String processorConfigProps=resultSet.getString(3); if(processorConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(processorConfigProps,this.poolJobProcessorConfigProps); ! this.poolJobLoaderClassName=resultSet.getString(4); ! String loaderConfigProps=resultSet.getString(5); if(loaderConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(loaderConfigProps,this.poolJobLoaderConfigProps); ! this.poolClassName=resultSet.getString(6); ! String poolConfigProps=resultSet.getString(7); if(poolConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(poolConfigProps,this.poolConfigProps); --- 73,111 ---- try { ! PreparedStatement jobConfigStatement=connection.prepareStatement(DBPoolJobControllerConfig.JOB_CONFIG_QUERY); ! jobConfigStatement.setString(1, jobName); ! ResultSet jobConfigResultSet=jobConfigStatement.executeQuery(); ! if(jobConfigResultSet.next()) { ! this.jobControllerClassName=jobConfigResultSet.getString(1); ! String controllerConfigProps=jobConfigResultSet.getString(2); ! if(controllerConfigProps!=null) ! FrameworkUtil.loadPropertiesFromStringToMap(controllerConfigProps, this.jobControllerConfigProps); ! } ! else ! { ! /** ! * Surprising!!!!!!!!! ! */ ! } ! ! PreparedStatement controllerConfigStatement=connection.prepareStatement(DBPoolJobControllerConfig.POOL_JOB_CONTROLLER_CONFIG_QUERY); ! controllerConfigStatement.setString(1,jobName); ! ResultSet controllerConfigResultSet=controllerConfigStatement.executeQuery(); ! if(controllerConfigResultSet.next()) ! { ! this.poolJobProcessorClassName=controllerConfigResultSet.getString(1); ! this.poolJobProcessorThreadCount=controllerConfigResultSet.getInt(2); ! String processorConfigProps=controllerConfigResultSet.getString(3); if(processorConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(processorConfigProps,this.poolJobProcessorConfigProps); ! this.poolJobLoaderClassName=controllerConfigResultSet.getString(4); ! String loaderConfigProps=controllerConfigResultSet.getString(5); if(loaderConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(loaderConfigProps,this.poolJobLoaderConfigProps); ! this.poolClassName=controllerConfigResultSet.getString(6); ! String poolConfigProps=controllerConfigResultSet.getString(7); if(poolConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(poolConfigProps,this.poolConfigProps); Index: DBJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobControllerConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DBJobControllerConfig.java 10 Mar 2006 08:15:16 -0000 1.2 --- DBJobControllerConfig.java 11 Mar 2006 02:16:19 -0000 1.3 *************** *** 18,21 **** --- 18,22 ---- import java.sql.SQLException; 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.FrameworkConfig; *************** *** 40,44 **** */ public static final String JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME = "db-factory-config-class-name"; ! /** * <p> --- 41,45 ---- */ public static final String JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME = "db-factory-config-class-name"; ! /** * <p> |
From: Suresh <sur...@us...> - 2006-03-11 02:16:17
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11674 Modified Files: JobConfigFactoryTest.java Log Message: no message Index: JobConfigFactoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config/JobConfigFactoryTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JobConfigFactoryTest.java 9 Mar 2006 04:42:55 -0000 1.1 --- JobConfigFactoryTest.java 11 Mar 2006 02:16:05 -0000 1.2 *************** *** 37,40 **** --- 37,42 ---- { TestSuite suite = new TestSuite(JobConfigFactoryTest.class); + //TestSuite suite=new TestSuite(); + //suite.addTest(new JobConfigFactoryTest("testGetJobConfigFactory")); return suite; } |
From: Suresh <sur...@us...> - 2006-03-10 08:57:30
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25642 Modified Files: DBBasicJobControllerConfig.java DBJobConfigFactory.java DBPoolJobControllerConfig.java Log Message: no message Index: DBJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobConfigFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DBJobConfigFactory.java 10 Mar 2006 08:15:16 -0000 1.2 --- DBJobConfigFactory.java 10 Mar 2006 08:57:18 -0000 1.3 *************** *** 146,152 **** jobConfig=null; } finally { ! connection.close(); } --- 146,156 ---- jobConfig=null; } + catch(SQLException exception) + { + exception.printStackTrace(); + } finally { ! try{ connection.close(); } catch(Exception exception){ exception.printStackTrace(); } } Index: DBBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBBasicJobControllerConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DBBasicJobControllerConfig.java 10 Mar 2006 08:15:16 -0000 1.3 --- DBBasicJobControllerConfig.java 10 Mar 2006 08:57:18 -0000 1.4 *************** *** 80,83 **** --- 80,84 ---- { exception.printStackTrace(); + throw new ConfigurationException(ErrorCode.DB_CONNECTIVITY_ERROR); } } Index: DBPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBPoolJobControllerConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DBPoolJobControllerConfig.java 10 Mar 2006 08:15:16 -0000 1.3 --- DBPoolJobControllerConfig.java 10 Mar 2006 08:57:18 -0000 1.4 *************** *** 12,30 **** import java.sql.Connection; import org.jmonks.batchserver.framework.config.PoolJobControllerConfig; /** * ! * @author Suresh Pragada */ public class DBPoolJobControllerConfig extends PoolJobControllerConfig { ! /** Creates a new instance of DBPoolJobControllerConfig */ public DBPoolJobControllerConfig(String jobName,Connection connection) { ! /** ! * Load all the properties defined in base classes using the object passed ! * as input. ! */ } --- 12,104 ---- import java.sql.Connection; + import java.sql.PreparedStatement; + import java.sql.ResultSet; + import java.sql.SQLException; + 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; /** + * <p> + * DBPoolJobControllerConfig loads the job controller configuration from the defined + * database. This loads the pool controller configuration from the table "pool_job_controller_config". + * Following is the schema of that table defined in the database. + * <br><br> + * <pre> + * <table> + * <tr><td><b>Column Name</b></td><td><b>Data Type</b></td></tr> + * <tr><td>JOB_NAME</td><td>VARCHAR2(64)</td></tr> + * <tr><td>POOL_JOB_PROCESSOR_CLASS_NAME</td><td>VARCHAR2(256)</td></tr> + * <tr><td>POOL_JOB_PROCESSOR_THREAD_CNT</td><td>NUMBER</td></tr> + * <tr><td>POOL_JOB_PROCESSOR_PROPS</td><td>VARCHAR2(1024)</td></tr> + * <tr><td>POOL_JOB_LOADER_CLASS_NAME</td><td>VARCHAR2(256)</td></tr> + * <tr><td>POOL_JOB_LOADER_PROPS</td><td>VARCHAR2(1024)</td></tr> + * <tr><td>JOB_POOL_CLASS_NAME</td><td>VARCHAR2(256)</td></tr> + * <tr><td>JOB_POOL_PROPS</td><td>VARCHAR2(1024)</td></tr> * ! * </table> ! * </pre> ! * </p> ! * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public class DBPoolJobControllerConfig extends PoolJobControllerConfig { ! /** ! * SQL Query pulls the information pool_job_controller_config table. ! */ ! private static final String POOL_JOB_CONTROLLER_CONFIG_QUERY = "select pool_job_processor_class_name, " + ! "pool_job_processor_thread_cnt, pool_job_processor_props, pool_job_loader_class_name, " + ! "pool_job_loader_props, job_pool_class_name, job_pool_props from pool_job_controller_config " + ! "where job_name=?"; ! /** ! * Loads the pool job controller configuration from table pool_job_controller_config ! * into DBPoolJobControllerConfig object. ! * ! * @param jobName Name of the job. ! * @param connection Connection to the defined database. ! * ! * @throws ConfigurationException If controller class name or job processor name doest not found. ! */ public DBPoolJobControllerConfig(String jobName,Connection connection) { ! ! try ! { ! PreparedStatement statement=connection.prepareStatement(DBPoolJobControllerConfig.POOL_JOB_CONTROLLER_CONFIG_QUERY); ! statement.setString(1,jobName); ! ResultSet resultSet=statement.executeQuery(); ! if(resultSet.next()) ! { ! this.poolJobProcessorClassName=resultSet.getString(1); ! this.poolJobProcessorThreadCount=resultSet.getInt(2); ! String processorConfigProps=resultSet.getString(3); ! if(processorConfigProps!=null) ! FrameworkUtil.loadPropertiesFromStringToMap(processorConfigProps,this.poolJobProcessorConfigProps); ! ! this.poolJobLoaderClassName=resultSet.getString(4); ! String loaderConfigProps=resultSet.getString(5); ! if(loaderConfigProps!=null) ! FrameworkUtil.loadPropertiesFromStringToMap(loaderConfigProps,this.poolJobLoaderConfigProps); ! ! this.poolClassName=resultSet.getString(6); ! String poolConfigProps=resultSet.getString(7); ! if(poolConfigProps!=null) ! FrameworkUtil.loadPropertiesFromStringToMap(poolConfigProps,this.poolConfigProps); ! } ! else ! { ! throw new ConfigurationException(ErrorCode.POOL_JOB_CONTROLLER_CONFIG_NOT_FOUND); ! } ! } ! catch(SQLException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ErrorCode.DB_CONNECTIVITY_ERROR); ! } ! } |
From: Suresh <sur...@us...> - 2006-03-10 08:34:16
|
Update of /cvsroot/batchserver/batchserver/lib/jdbc/oracle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14624 Added Files: ojdbc14.jar Log Message: no message --- NEW FILE: ojdbc14.jar --- (This appears to be a binary file; contents omitted.) |
From: Suresh <sur...@us...> - 2006-03-10 08:33:37
|
Update of /cvsroot/batchserver/batchserver/lib/jdbc/oracle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14479/oracle Log Message: Directory /cvsroot/batchserver/batchserver/lib/jdbc/oracle added to the repository |
From: Suresh <sur...@us...> - 2006-03-10 08:33:25
|
Update of /cvsroot/batchserver/batchserver/lib/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14375/jdbc Log Message: Directory /cvsroot/batchserver/batchserver/lib/jdbc added to the repository |
From: Suresh <sur...@us...> - 2006-03-10 08:17:55
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/oracle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3900 Added Files: create_basic_job_controller.sql create_job_config.sql create_pool_job_controller.sql insert_sample_jobs.sql Log Message: no message --- NEW FILE: create_pool_job_controller.sql --- -- Create table pool job controller config create table POOL_JOB_CONTROLLER_CONFIG ( JOB_NAME VARCHAR2(64) not null, POOL_JOB_LOADER_CLASS_NAME VARCHAR2(256) not null, POOL_JOB_LOADER_PROPS VARCHAR2(1024), POOL_JOB_PROCESSOR_CLASS_NAME VARCHAR2(256) not null, POOL_JOB_PROCESSOR_THREAD_CNT NUMBER not null, POOL_JOB_PROCESSOR_PROPS VARCHAR2(1024), JOB_POOL_CLASS_NAME VARCHAR2(256) not null, JOB_POOL_PROPS VARCHAR2(1024) ); -- Add comments to the columns comment on column POOL_JOB_CONTROLLER_CONFIG.JOB_NAME is 'Name of the job this controller configuration belongs to.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_LOADER_CLASS_NAME is 'Pool Job Loader class name.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_LOADER_PROPS is 'Column holds pool job loader configuration properties in the format name1=value1:name2=value2'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_PROCESSOR_CLASS_NAME is 'Pool job processor class name.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_PROCESSOR_THREAD_CNT is 'Number of processor instances needs to be run.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_PROCESSOR_PROPS is 'Column holds pool job processor configuration properties in the format name1=value1:name2=value2'; comment on column POOL_JOB_CONTROLLER_CONFIG.JOB_POOL_CLASS_NAME is 'Job pool class name.'; comment on column POOL_JOB_CONTROLLER_CONFIG.JOB_POOL_PROPS is 'Column holds job pool configuration properties in the format name1=value1:name2=value2'; -- Create/Recreate primary, unique and foreign key constraints alter table POOL_JOB_CONTROLLER_CONFIG add constraint FK_POOL_JC_CONFIG_JOB_CONFIG foreign key (JOB_NAME) references JOB_CONFIG (JOB_NAME) on delete cascade; -- Create/Recreate check constraints alter table POOL_JOB_CONTROLLER_CONFIG add constraint CHK_POOL_PRCR_THREAD_COUNT check (POOL_JOB_PROCESSOR_THREAD_CNT >= 1); --- NEW FILE: create_job_config.sql --- -- Creating the table create table JOB_CONFIG ( JOB_NAME VARCHAR2(64) not null, JOB_STATUS NUMBER default 1 not null, JOB_CONTROLLER_CLASS_NAME VARCHAR2(256) not null, JOB_CONTROLLER_PROPS VARCHAR2(1024) ); -- Add comments to the table comment on table JOB_CONFIG is 'Table holds the configuration of all the jobs.'; -- Add comments to the columns comment on column JOB_CONFIG.JOB_NAME is 'Column represents the job name.'; comment on column JOB_CONFIG.JOB_STATUS is 'Column states whether the job is active or inactive. 1 - active 0 - inactive'; comment on column JOB_CONFIG.JOB_CONTROLLER_CLASS_NAME is 'Column holds the controller class name.'; comment on column JOB_CONFIG.JOB_CONTROLLER_PROPS is 'Column holds job controller configuration properties in the format name1=value1:name2=value2'; -- Create/Recreate primary, unique and foreign key constraints alter table JOB_CONFIG add constraint PK_JOB_CONFIG primary key (JOB_NAME); -- Create/Recreate check constraints alter table JOB_CONFIG add constraint CHK_JOB_STATUS check (job_status in (0,1)); --- NEW FILE: insert_sample_jobs.sql --- insert into JOB_CONFIG (JOB_NAME, JOB_STATUS, JOB_CONTROLLER_CLASS_NAME, JOB_CONTROLLER_PROPS) values ('process_file_abc',1,'org.jmonks.batchserver.framework.controller.pool.PoolJobController','pool-job-controller-restart=false'); insert into JOB_CONFIG (JOB_NAME, JOB_STATUS, JOB_CONTROLLER_CLASS_NAME, JOB_CONTROLLER_PROPS) values ('process_file_xyz',1,'org.jmonks.batchserver.framework.controller.basic.BasicJobController','pool-job-controller-restart=false'); insert into POOL_JOB_CONTROLLER_CONFIG (JOB_NAME, POOL_JOB_LOADER_CLASS_NAME, POOL_JOB_LOADER_PROPS, POOL_JOB_PROCESSOR_CLASS_NAME, POOL_JOB_PROCESSOR_THREAD_CNT, POOL_JOB_PROCESSOR_PROPS, JOB_POOL_CLASS_NAME, JOB_POOL_PROPS) values ('process_file_abc','com.mycompany.batch.processfileabc.AbcJobLoader','pool-job-loader-key1=loader-value1','com.mycompany.batch.processfileabc.AbcJobProcessor',5,'pool-job-processor-key1=processor-value1','org.jmonks.batchserver.framework.controller.pool.DefaultJobPool','job-pool-size=5000'); insert into BASIC_JOB_CONTROLLER_CONFIG (JOB_NAME, BASIC_JOB_PROCESSOR_CLASS_NAME, BASIC_JOB_PROCESSOR_THREAD_CNT, BASIC_JOB_PROCESSOR_PROPS) values ('process_file_xyz', 'com.mycompany.batch.processfilexyz.XyzProcessor', 1, 'basic-job-processor-key1=processor-value1'); --- NEW FILE: create_basic_job_controller.sql --- -- Create table basic_job_con create table BASIC_JOB_CONTROLLER_CONFIG ( JOB_NAME VARCHAR2(64) not null, BASIC_JOB_PROCESSOR_CLASS_NAME VARCHAR2(256) not null, BASIC_JOB_PROCESSOR_THREAD_CNT NUMBER not null, BASIC_JOB_PROCESSOR_PROPS VARCHAR2(1024) ); -- Add comments to the table comment on table BASIC_JOB_CONTROLLER_CONFIG is 'Table holds the basic job controller configuration.'; -- Add comments to the columns comment on column BASIC_JOB_CONTROLLER_CONFIG.JOB_NAME is 'Name of the job this controller configuration belongs to.'; comment on column BASIC_JOB_CONTROLLER_CONFIG.BASIC_JOB_PROCESSOR_CLASS_NAME is 'Class name of the basic job processor.'; comment on column BASIC_JOB_CONTROLLER_CONFIG.BASIC_JOB_PROCESSOR_THREAD_CNT is 'Number of basic job processor instances to be run.'; comment on column BASIC_JOB_CONTROLLER_CONFIG.BASIC_JOB_PROCESSOR_PROPS is 'Column holds basic job processor configuration properties in the format name1=value1:name2=value2'; -- Create/Recreate primary, unique and foreign key constraints alter table BASIC_JOB_CONTROLLER_CONFIG add constraint FK_JOB_CONFIG_JOB_NAME foreign key (JOB_NAME) references JOB_CONFIG (JOB_NAME) on delete cascade; -- Create/Recreate check constraints alter table BASIC_JOB_CONTROLLER_CONFIG add constraint CHK_BASIC_PRCR_THREAD_COUNT check (BASIC_JOB_PROCESSOR_THREAD_CNT >= 1); |
From: Suresh <sur...@us...> - 2006-03-10 08:16:58
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/oracle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2980/oracle Log Message: Directory /cvsroot/batchserver/batchserver/bin/dbscripts/oracle added to the repository |
From: Suresh <sur...@us...> - 2006-03-10 08:16:44
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2834/dbscripts Log Message: Directory /cvsroot/batchserver/batchserver/bin/dbscripts added to the repository |
From: Suresh <sur...@us...> - 2006-03-10 08:16:27
|
Update of /cvsroot/batchserver/batchserver/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2600/bin Log Message: Directory /cvsroot/batchserver/batchserver/bin added to the repository |
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2004 Modified Files: batch-config.xml XMLBasicJobControllerConfig.java XMLJobConfig.java XMLJobConfigFactory.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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XMLBasicJobControllerConfig.java 9 Mar 2006 04:45:08 -0000 1.4 --- XMLBasicJobControllerConfig.java 10 Mar 2006 08:15:36 -0000 1.5 *************** *** 47,50 **** --- 47,54 ---- */ private static final String BASIC_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME = "basic-job-processor-class-name"; + /** + * XML Attribute name defines the thread count of the job processor. + */ + private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; /** * Loads the XML job controller configuration into XMLBasicJobControllerConfig object. *************** *** 71,74 **** --- 75,79 ---- else { + this.basicJobProcessorThreadCount=Integer.parseInt(xmlBasicJobProcessorElement.getAttribute(XMLBasicJobControllerConfig.THREAD_COUNT_ATTRIBUTE_NAME)); FrameworkUtil.loadPropertiesFromElementToMap(xmlBasicJobProcessorElement, this.basicJobProcessorConfigProps); } Index: XMLPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLPoolJobControllerConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XMLPoolJobControllerConfig.java 9 Mar 2006 04:45:08 -0000 1.4 --- XMLPoolJobControllerConfig.java 10 Mar 2006 08:15:36 -0000 1.5 *************** *** 68,71 **** --- 68,75 ---- */ private static final String POOL_JOB_PROCESSOR_CLASS_ATTRIBUTE_NAME = "pool-job-processor-class-name"; + /** + * XML Attribute name defines the thread count of the job processor. + */ + private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; /** *************** *** 114,117 **** --- 118,122 ---- else { + this.poolJobProcessorThreadCount=Integer.parseInt(xmlPoolJobProcessorElement.getAttribute(XMLPoolJobControllerConfig.THREAD_COUNT_ATTRIBUTE_NAME)); FrameworkUtil.loadPropertiesFromElementToMap(xmlPoolJobProcessorElement, this.poolJobProcessorConfigProps); } Index: batch-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/batch-config.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** batch-config.xml 9 Mar 2006 04:45:08 -0000 1.1 --- batch-config.xml 10 Mar 2006 08:15:36 -0000 1.2 *************** *** 1,5 **** <?xml version="1.0" encoding="UTF-8"?> <batch-config> ! <job-config job-name="process_file_abc"> <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"> --- 1,5 ---- <?xml version="1.0" encoding="UTF-8"?> <batch-config> ! <job-config job-name="process_file_abc" job-status="active"> <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"> *************** *** 15,19 **** </job-controller> </job-config> ! <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"> --- 15,19 ---- </job-controller> </job-config> ! <job-config job-name="process_file_xyz" job-status="active"> <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"> Index: XMLJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfigFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XMLJobConfigFactory.java 9 Mar 2006 04:45:08 -0000 1.4 --- XMLJobConfigFactory.java 10 Mar 2006 08:15:36 -0000 1.5 *************** *** 16,19 **** --- 16,20 ---- import java.io.IOException; import java.io.InputStream; + import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilder; *************** *** 84,88 **** public XMLJobConfigFactory(Map configFactoryProps) { ! this.configFactoryProps=configFactoryProps; String absoluteLocation=(String)this.configFactoryProps.get(XMLJobConfigFactory.PROPERTY_JOB_CONFIG_FILE_ABSOLUTE_LOCATION); --- 85,89 ---- public XMLJobConfigFactory(Map configFactoryProps) { ! this.configFactoryProps=new HashMap(configFactoryProps); String absoluteLocation=(String)this.configFactoryProps.get(XMLJobConfigFactory.PROPERTY_JOB_CONFIG_FILE_ABSOLUTE_LOCATION); Index: XMLJobConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XMLJobConfig.java 8 Mar 2006 05:17:48 -0000 1.4 --- XMLJobConfig.java 10 Mar 2006 08:15:36 -0000 1.5 *************** *** 51,54 **** --- 51,58 ---- public static final String JOB_NAME_ATTRIBUTE_NAME = "job-name"; /** + * Attribute name that identifies the job status. + */ + public static final String JOB_STATUS_ATTRIBUTE_NAME = "job-status"; + /** * Loads the job name and controller configuration into the job configuration object. * *************** *** 61,64 **** --- 65,79 ---- { this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); + + String jobStatusInStr=jobConfigElement.getAttribute(XMLJobConfig.JOB_STATUS_ATTRIBUTE_NAME); + if(jobStatusInStr.equalsIgnoreCase("active")) + { + this.jobStatus=true; + } + else + { + this.jobStatus=false; + } + NodeList controllerConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobControllerConfig.JOB_CONTROLLER_ELEMENT_NAME); if(controllerConfigNodeList.getLength()==1) |