batchserver-cvs Mailing List for Enterprise Batch Server (Page 21)
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-17 14:04:50
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13438 Modified Files: XMLJobConfig.java XMLJobConfigFactory.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.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** XMLJobConfig.java 14 Mar 2006 23:05:25 -0000 1.8 --- XMLJobConfig.java 17 Mar 2006 14:04:38 -0000 1.9 *************** *** 32,35 **** --- 32,38 ---- * <property key="basic-job-controller-restart">true</property> * </job-controller> + * <job-logging-config> + * <logger-config logger-name="com.mycompany.batch" logger-level="ERROR"/> + * </job-logging-config> * </job-config> * </pre> Index: XMLJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfigFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** XMLJobConfigFactory.java 14 Mar 2006 23:05:25 -0000 1.8 --- XMLJobConfigFactory.java 17 Mar 2006 14:04:38 -0000 1.9 *************** *** 77,83 **** /** ! * This constructor initializes the factory by accepting the required properties ! * map as a parameter to the constructor. If it doesnt find any required properties ! * to initialize the factory, throws ConfigurationException with the appropriate error code. * * @param configFactoryProps Map consists of all the properties defined for this factory. --- 77,83 ---- /** ! * This method initializes the factory by accepting the required properties ! * from the input map. If it doesnt find any required properties ! * to initialize the factory, throws ConfigurationException with the appropriate error message. * * @param configFactoryProps Map consists of all the properties defined for this factory. *************** *** 85,91 **** * @throws ConfigurationException If required properties are missing. */ ! public XMLJobConfigFactory(Map configFactoryProps) { ! logger.trace("Entering Constructor"); this.configFactoryProps=new HashMap(configFactoryProps); --- 85,91 ---- * @throws ConfigurationException If required properties are missing. */ ! protected void init(Map configFactoryProps) { ! logger.trace("Entering init"); this.configFactoryProps=new HashMap(configFactoryProps); *************** *** 149,153 **** } } ! logger.trace("Exiting Constructor"); } --- 149,153 ---- } } ! logger.trace("Exiting init"); } |
From: Suresh <sur...@us...> - 2006-03-17 05:16:13
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19662 Added Files: RepositoryTest.java Log Message: no message --- NEW FILE: RepositoryTest.java --- /* * RepositoryTest.java * JUnit based test * * Created on March 14, 2006, 3:54 PM */ package org.jmonks.batchserver.framework.repository; import junit.framework.*; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.*; import org.jmonks.batchserver.framework.controller.JobController; /** * * @author w951h8m */ public class RepositoryTest extends TestCase { public RepositoryTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(RepositoryTest.class); return suite; } /** * Test to make sure repository cannot be instantiated. */ public void testInstantiation() { try { Repository repository=(Repository)Repository.class.newInstance(); fail("Repository should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as Repository cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of Repository is protected. */ } } /** * Test to make sure this is not returning null. */ public void testGetRepository() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.RepositoryConfig repositoryConfig=frameworkConfig.getRepositoryConfig(); assertNotNull(repositoryConfig); Repository repository=Repository.getRepository(repositoryConfig); assertNotNull(repository); } } |
From: Suresh <sur...@us...> - 2006-03-17 05:15:44
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19373/repository Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository added to the repository |
From: Suresh <sur...@us...> - 2006-03-17 05:15:36
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19336 Modified Files: FrameworkTestSuite.java Removed Files: RepositoryTest.java Log Message: no message Index: FrameworkTestSuite.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/FrameworkTestSuite.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FrameworkTestSuite.java 14 Mar 2006 23:08:49 -0000 1.4 --- FrameworkTestSuite.java 17 Mar 2006 05:15:28 -0000 1.5 *************** *** 19,22 **** --- 19,23 ---- import org.jmonks.batchserver.framework.config.JobControllerConfigTest; import org.jmonks.batchserver.framework.config.PoolJobControllerConfigTest; + import org.jmonks.batchserver.framework.repository.RepositoryTest; /** --- RepositoryTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-03-17 05:14:51
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/mgmtmntr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19020 Modified Files: DefaultMgmtMntrManager.java MgmtMntrManager.java Log Message: no message Index: MgmtMntrManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/mgmtmntr/MgmtMntrManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MgmtMntrManager.java 4 Mar 2006 04:42:28 -0000 1.2 --- MgmtMntrManager.java 17 Mar 2006 05:14:47 -0000 1.3 *************** *** 20,26 **** private JobManagerMBean mJobManager; - protected MgmtMntrManager() - { - } /** --- 20,23 ---- *************** *** 41,91 **** */ public static org.jmonks.batchserver.framework.mgmtmntr.MgmtMntrManager getMgmtMntrManager(String jobName, org.jmonks.batchserver.framework.config.FrameworkConfig.MgmtMntrConfig config) - - - - - - - - - - - - - - - - - - - - - { return null; - - - - - - - - - - - - - - - - - - - - - } /** * This method creates the MBeanServer with JobManagerMBean and JobMonitorMBean beans and passes this controller references to the these mbeans and creates the connector server and saves this connector information in the common place to be looked up by server. * --- 38,56 ---- */ public static org.jmonks.batchserver.framework.mgmtmntr.MgmtMntrManager getMgmtMntrManager(String jobName, org.jmonks.batchserver.framework.config.FrameworkConfig.MgmtMntrConfig config) { return null; } /** + * Method to initialize the MgmtMntrManager with the properties defined + * for this manager in framework configuration file. + * + * @param mgmtMntrConfig Properties defined for this manager as a map. + * + * @throws ConfigurationException If required properties of the implementation misses. + */ + protected abstract void init(FrameworkConfig.MgmtMntrConfig mgmtMntrConfig); + + /** * This method creates the MBeanServer with JobManagerMBean and JobMonitorMBean beans and passes this controller references to the these mbeans and creates the connector server and saves this connector information in the common place to be looked up by server. * *************** *** 105,113 **** * @return Returns the job name. */ ! public String getJobName() ! { return null; - } --- 70,76 ---- * @return Returns the job name. */ ! public String getJobName() { return null; } Index: DefaultMgmtMntrManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/mgmtmntr/DefaultMgmtMntrManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DefaultMgmtMntrManager.java 4 Mar 2006 04:42:28 -0000 1.2 --- DefaultMgmtMntrManager.java 17 Mar 2006 05:14:46 -0000 1.3 *************** *** 9,18 **** * </p> * ! * @author : Suresh Pragada * @version 1.0 */ public class DefaultMgmtMntrManager extends MgmtMntrManager { ! protected DefaultMgmtMntrManager(FrameworkConfig.MgmtMntrConfig config) { --- 9,22 ---- * </p> * ! * @author Suresh Pragada * @version 1.0 + * @since 1.0 */ public class DefaultMgmtMntrManager extends MgmtMntrManager { ! /** ! * @see org.jmonks.batchserver.framework.mgmtmntr.MgmtMntrManager@init(org.jmonks.batchserver.framework.config.FrameworkConfig.MgmtMntrConfig) ! */ ! protected void init(org.jmonks.batchserver.framework.config.FrameworkConfig.MgmtMntrConfig mgmtMntrConfig) { *************** *** 32,34 **** --- 36,39 ---- { } + } |
From: Suresh <sur...@us...> - 2006-03-17 05:14:31
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18973 Modified Files: JobController.java Log Message: no message Index: JobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/JobController.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobController.java 4 Mar 2006 04:41:19 -0000 1.2 --- JobController.java 17 Mar 2006 05:14:27 -0000 1.3 *************** *** 12,17 **** * </p> * ! * @author : Suresh Pragada * @version 1.0 */ public abstract class JobController implements JobMonitorMBean, JobManagerMBean --- 12,18 ---- * </p> * ! * @author Suresh Pragada * @version 1.0 + * @since 1.0 */ public abstract class JobController implements JobMonitorMBean, JobManagerMBean *************** *** 34,72 **** */ public static org.jmonks.batchserver.framework.controller.JobController getJobController(String jobName, org.jmonks.batchserver.framework.config.JobControllerConfig config) - - - - - - - - - - - - - - - - - { return null; - - - - - - - - - - - - - - - - } --- 35,40 ---- *************** *** 77,85 **** */ public JobControllerConfig getControllerConfig() - - { return null; - } --- 45,50 ---- |
From: Suresh <sur...@us...> - 2006-03-17 05:14:20
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18933 Modified Files: framework-config.xml JobConfigFactory.java Log Message: no message Index: JobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobConfigFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JobConfigFactory.java 14 Mar 2006 05:45:25 -0000 1.6 --- JobConfigFactory.java 17 Mar 2006 05:14:13 -0000 1.7 *************** *** 67,74 **** { 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 --- 67,74 ---- { Class factoryClass=Class.forName(factoryClassName); if(JobConfigFactory.class.isAssignableFrom(factoryClass)) { ! factoryObject=(JobConfigFactory)factoryClass.newInstance(); ! factoryObject.init(factoryConfig.getJobConfigFactoryProperties()); } else *************** *** 80,88 **** { 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()); } --- 80,84 ---- { exception.printStackTrace(); ! logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } *************** *** 90,93 **** --- 86,90 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } *************** *** 95,103 **** { 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()); } --- 92,96 ---- { exception.printStackTrace(); ! logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, exception.getMessage()); } *************** *** 115,117 **** --- 108,121 ---- */ public abstract JobConfig getJobConfig(String jobName); + + /** + * Method to initialize the factory using properies defined for this factory + * in framework configuration file. All the properties defined for this + * configuration factory will be passed as map to this method. + * + * @param configFactoryProps Map consists of all the properties defined for this factory. + * + * @throws ConfigurationException If required properties by the factory are missing. + */ + protected abstract void init(Map configFactoryProps); } Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** framework-config.xml 15 Mar 2006 04:36:50 -0000 1.13 --- framework-config.xml 17 Mar 2006 05:14:13 -0000 1.14 *************** *** 14,18 **** </job-config-factory-config> --> ! <repository-config repository-class-name="org.jmonks.batchserver.framework.DefaultRepository"> <property key="repository-location">/batchserver/repository</property> </repository-config> --- 14,18 ---- </job-config-factory-config> --> ! <repository-config repository-class-name="org.jmonks.batchserver.framework.repository.db4o.Db4oRepository"> <property key="repository-location">/batchserver/repository</property> </repository-config> |
From: Suresh <sur...@us...> - 2006-03-17 05:13:51
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18608 Modified Files: Repository.java Log Message: no message Index: Repository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/Repository.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Repository.java 16 Mar 2006 14:13:26 -0000 1.1 --- Repository.java 17 Mar 2006 05:13:48 -0000 1.2 *************** *** 19,22 **** --- 19,29 ---- * information between framework and server. * </p> + * <p> + * <i>Implementation Note : </i><br> + * This declares an abstract method init with the protected access for the repository + * implementors to inititalize the repository implementation. Implementors should implement + * this method and make sure default constructor exist to enable the initialization of + * this implementation from the factory method. + * </p> * @author Suresh Pragada * @version 1.0 *************** *** 28,42 **** private static Logger logger=Logger.getLogger(Repository.class); /** ! * Protected constructor to make sure Repository cannot be instantiated ! * other than extending this class. */ ! protected Repository() ! { ! } /** * Factory method returns the specific implementation of repository based on the ! * repository configuration. * * @param repositoryConfig Repository configuration object. --- 35,54 ---- private static Logger logger=Logger.getLogger(Repository.class); + /** ! * Method to initialize the repository implementation with the properties ! * defined in the framework configuration. ! * ! * @param configProps Configuration properties defined in <repository-config> element ! * in framework configuration file. ! * ! * @throws ConfigurationException If required configuration properties are missing or the values ! * are invalid. */ ! protected abstract void init(Map configProps); /** * Factory method returns the specific implementation of repository based on the ! * repository configuration in framework configuration file. * * @param repositoryConfig Repository configuration object. *************** *** 62,70 **** try ! { ! Class repositoryClass=Class.forName(repositoryClassName); ! Constructor repositoryConstructor=repositoryClass.getConstructor(new Class[]{Map.class}); ! repository=(Repository)repositoryConstructor.newInstance(new Object[]{repositoryConfig.getRepositoryConfigProperties()}); logger.debug("created the repository implemenation class"); } catch(ClassNotFoundException exception) --- 74,82 ---- try ! { ! repository=(Repository)Class.forName(repositoryClassName).newInstance(); ! repository.init(repositoryConfig.getRepositoryConfigProperties()); logger.debug("created the repository implemenation class"); + } catch(ClassNotFoundException exception) *************** *** 74,83 **** throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } - catch(NoSuchMethodException exception) - { - exception.printStackTrace(); - logger.error(exception.getMessage(),exception); - throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); - } catch(InstantiationException exception) { --- 86,89 ---- *************** *** 92,101 **** throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } - catch(InvocationTargetException exception) - { - exception.printStackTrace(); - logger.error(exception.getMessage(),exception); - throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); - } logger.trace("Exiting getRepository"); --- 98,101 ---- *************** *** 104,110 **** /** * Data will be sent to the specified target job. This data * will be marked with the data identifier. Target job ! * should use the data identifier to read the data. * * @param dataIdentifier Identifier to be used to exchange the data between two jobs.. --- 104,113 ---- /** + * <p> * Data will be sent to the specified target job. This data * will be marked with the data identifier. Target job ! * should use the data identifier to read the data. If there is any ! * data with this identifier from this job, it will be overriden. ! * </p> * * @param dataIdentifier Identifier to be used to exchange the data between two jobs.. *************** *** 114,120 **** * * @return Returns true, if it could save the data to be sent to the next job. */ ! public abstract boolean sendDatatoNextJob(String dataIdentifier, String sourceJobName, ! String targetJobName, Object data); /** --- 117,125 ---- * * @return Returns true, if it could save the data to be sent to the next job. + * + * @throws IllegalArgumentException If any one of the input values is null. */ ! public abstract boolean sendDataToNextJob(String dataIdentifier, String sourceJobName, ! String targetJobName, final Object data); /** *************** *** 127,130 **** --- 132,137 ---- * * @return Returns the data, null, if it couldnt find any data. + * + * @throws IllegalArgumentException If any one of the input values is null. */ public abstract Object getDataFromPreviousJob(String dataIdentifer, String sourceJobName, *************** *** 140,158 **** * * @param jobName Name of job that put up the data. */ public abstract boolean clearDataTransferredToNextJob(String jobName); /** * Registers the job management and monitoring info with the given job name. ! * If there is an association with this job name existing, that information * will be overriden. This could happen, if job forgot to unregister the * management and monitoring information. ! * * @param jobName Name of the job. * @param registrationInfo Information to be associated with this job name. * * @return Return true, if it could assosciate this information, false, otherwise. */ ! public abstract boolean registerJobMgmtMntrInfo(String jobName, Object registrationInfo); /** --- 147,172 ---- * * @param jobName Name of job that put up the data. + * + * @throws IllegalArgumentException If input job name is null. */ public abstract boolean clearDataTransferredToNextJob(String jobName); /** + * <p> * Registers the job management and monitoring info with the given job name. ! * If there is an info association with this job name, that information * will be overriden. This could happen, if job forgot to unregister the * management and monitoring information. ! * </p> ! * * @param jobName Name of the job. * @param registrationInfo Information to be associated with this job name. * * @return Return true, if it could assosciate this information, false, otherwise. + * + * @throws IllegalArgumentException If input arguments jobname or registration information + * values are null. */ ! public abstract boolean registerJobMgmtMntrInfo(String jobName, final Object registrationInfo); /** *************** *** 162,165 **** --- 176,181 ---- * * @return Returns the registered information, null, if it doesnt find any information. + * + * @throws IllegalArgumentException If input argument job name is null. */ public abstract Object lookupJobMgmtMntrInfo(String jobName); *************** *** 171,174 **** --- 187,192 ---- * * @return Return true, it it could unregister the information, false, otherwise. + * + * @throws IllegalArgumentException If input argument job name is null. */ public abstract boolean unregisterJobMgmtMntrInfo(String jobName); *************** *** 181,186 **** * * @return Returns true if statistics can be logged into repository, false, otherwise. */ ! public abstract boolean logStatistics(JobStatistics statistics); /** --- 199,206 ---- * * @return Returns true if statistics can be logged into repository, false, otherwise. + * + * @throws IllegalArgumentException If input argument job statistics is null. */ ! public abstract boolean logStatistics(final JobStatistics statistics); /** *************** *** 188,199 **** * * @param jobName Name of the job for which statistics are required. ! * @return Returns the array of JobStatistics object, null, if it couldnt find any job with that name. */ public abstract JobStatistics[] getStatistics(String jobName); /** ! * Persist the controller in repository. This will be useful, when job wants to be restarted. * When controller receives stop signal from servier with restart flag, it persist itself into * the repository. * * @param jobName Name of the job --- 208,226 ---- * * @param jobName Name of the job for which statistics are required. ! * ! * @return Returns the array of JobStatistics object. zero length statistics array, if it doestnt find any. ! * ! * @throws IllegalArgumentException If input argument job name is null. */ public abstract JobStatistics[] getStatistics(String jobName); /** ! * <p> ! * Persist the controller in repository with the given job name. ! * If there are any controller entries with this job name, it removes them ! * first and then saves this controller. This will be useful, when job wants to be restarted. * When controller receives stop signal from servier with restart flag, it persist itself into * the repository. + * </p> * * @param jobName Name of the job *************** *** 201,214 **** * * @return Returns true, if it could persist the controller, false, otherwise. */ ! public abstract boolean saveController(String jobName, JobController controller); /** * Loads the controller assosicated with this job name in the repsoitory. When controller starts * execution, always, it looks into the reposiotry for restart. This can be overriden by passing addition * configuration property. ! * * @param jobName Name of the job. * @return Returns the controller object, null, if it couldnt find any. */ public abstract JobController loadController(String jobName); --- 228,248 ---- * * @return Returns true, if it could persist the controller, false, otherwise. + * + * @throws IllegalArgumentException If input arguments job name or controller is null. */ ! public abstract boolean saveController(String jobName, final JobController controller); /** + * <p> * Loads the controller assosicated with this job name in the repsoitory. When controller starts * execution, always, it looks into the reposiotry for restart. This can be overriden by passing addition * configuration property. ! * </p> ! * * @param jobName Name of the job. + * * @return Returns the controller object, null, if it couldnt find any. + * + * @throws IllegalArgumentException If input arguments job name is null. */ public abstract JobController loadController(String jobName); *************** *** 218,222 **** --- 252,259 ---- * * @param jobName Name of the job. + * * @return Returns true, if it could release the controller from repository, null, otherwise. + * + * @throws IllegalArgumentException If input arguments job name is null. */ public abstract boolean releaseController(String jobName); |
From: Suresh <sur...@us...> - 2006-03-17 05:13:29
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18539 Modified Files: Db4oRepository.java Added Files: Db4oJobControllerHolderPredicate.java Db4oJobDataTransferHolder.java Db4oJobMgmtMntrInfoHolder.java Db4oJobMgmtMntrInfoHolderPredicate.java Db4oJobStatisticsPredicate.java Removed Files: Db4oJobDataTransfer.java Db4oMgmtMntrInfoHolder.java Log Message: no message --- Db4oJobDataTransfer.java DELETED --- --- NEW FILE: Db4oJobControllerHolderPredicate.java --- /* * Db4oJobControllerHolderPredicate.java * * Created on March 16, 2006, 7:32 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.repository.db4o; import com.db4o.query.Predicate; /** * Db4oJobControllerHolderPredicate used to find the Db4oJobControllerHolder * objects in Db4o database using native query. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oJobControllerHolderPredicate extends Predicate { /** * job name to find the controller holder objects for. */ private String jobName=null; /** * Creates a new instance of Db4oJobControllerHolderPredicate with the job name. */ Db4oJobControllerHolderPredicate(String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null for Db4oJobControllerHolder Predicate."); this.jobName=jobName; } /** * Method to run the the native query. This receives the Db4oJobControllerHolder * objects and look for the job name this predicate initialized with. */ public boolean match(Db4oJobControllerHolder holder) { if(jobName.equals(holder.getJobName())) return true; else return false; } } --- Db4oMgmtMntrInfoHolder.java DELETED --- Index: Db4oRepository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o/Db4oRepository.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Db4oRepository.java 16 Mar 2006 14:16:40 -0000 1.1 --- Db4oRepository.java 17 Mar 2006 05:13:25 -0000 1.2 *************** *** 23,31 **** * <br><br> * <pre> ! * <repository-config repository-class-name="org.jmonks.batchserver.framework.Db4oRepository"> * <property key="repository-location">/batchserver/repository</property> * </repository-config> * </pre> ! * <br><br> * Here repository-location defines where the DB4O database needs to create * the repository file. By default framework will be configured with the values --- 23,31 ---- * <br><br> * <pre> ! * <repository-config repository-class-name="org.jmonks.batchserver.framework.repository.db4o.Db4oRepository"> * <property key="repository-location">/batchserver/repository</property> * </repository-config> * </pre> ! * <br> * Here repository-location defines where the DB4O database needs to create * the repository file. By default framework will be configured with the values *************** *** 55,61 **** */ ObjectContainer container=null; /** * <p> ! * Creates the Db4oRepository by accepting the map consist of properties * needed to setup the repository. This make sure repository-location property * has been defined and the value defined for this property is valid. --- 55,62 ---- */ ObjectContainer container=null; + /** * <p> ! * Initializes the Db4oRepository by accepting the map consist of properties * needed to setup the repository. This make sure repository-location property * has been defined and the value defined for this property is valid. *************** *** 66,72 **** * the value specified is invalid. */ ! public Db4oRepository(Map configProps) { ! logger.trace("Entering constructor"); this.repositoryConfigProperties=new HashMap(configProps); String repositoryLocation=(String)this.repositoryConfigProperties.get(Db4oRepository.PROPERTY_REPOSIOTRY_LOCATION); --- 67,73 ---- * the value specified is invalid. */ ! protected void init(Map configProps) { ! logger.trace("Entering init"); this.repositoryConfigProperties=new HashMap(configProps); String repositoryLocation=(String)this.repositoryConfigProperties.get(Db4oRepository.PROPERTY_REPOSIOTRY_LOCATION); *************** *** 97,110 **** throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to create the file " + completeRepositoryFileName + " to setup repository."); } ! logger.trace("Exiting constructor"); } /** ! * @see org.jmonks.batchserver.framework.Repository#sendDataToNextJob(String,String,String,Object) */ ! public boolean sendDatatoNextJob(final String dataIdentifier, final String sourceJobName, final String targetJobName, final Object data) { if(dataIdentifier==null || sourceJobName==null || targetJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); boolean dataSaved=false; --- 98,118 ---- throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to create the file " + completeRepositoryFileName + " to setup repository."); } ! logger.trace("Exiting init"); } /** ! * @see org.jmonks.batchserver.framework.repository Repository#sendDataToNextJob(String,String,String,Object) */ ! public boolean sendDataToNextJob(String dataIdentifier, String sourceJobName, String targetJobName, final Object data) { + logger.trace("Entering sendDataToNextJob);"); + logger.debug("data identifier = " + dataIdentifier + " source job name = " + sourceJobName + " target job name = " + targetJobName + " data = " + data); + if(dataIdentifier==null || sourceJobName==null || targetJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); + + final String finalDataIdentifier=dataIdentifier; + final String finalSourceJobName=sourceJobName; + final String finalTargetJobName=targetJobName; boolean dataSaved=false; *************** *** 118,126 **** ObjectSet dataTransferredSet=container.query(new Predicate() { ! public boolean match(Db4oJobDataTransfer jobDataTransfer) { ! if(dataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && ! sourceJobName.equals(jobDataTransfer.getSourceJobName()) && ! targetJobName.equals(jobDataTransfer.getTargetJobName())) return true; else --- 126,134 ---- ObjectSet dataTransferredSet=container.query(new Predicate() { ! public boolean match(Db4oJobDataTransferHolder jobDataTransfer) { ! if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && ! finalSourceJobName.equals(jobDataTransfer.getSourceJobName()) && ! finalTargetJobName.equals(jobDataTransfer.getTargetJobName())) return true; else *************** *** 133,168 **** } container.commit(); /** * Add the new entry. */ ! Db4oJobDataTransfer dataTransfer=new Db4oJobDataTransfer(dataIdentifier, sourceJobName, targetJobName, data); container.set(dataTransfer); container.commit(); dataSaved=true; } return dataSaved; } /** ! * @see org.jmonks.batchserver.framework.Repository#getDataFromPreviousJob(String,String,String) */ ! public Object getDataFromPreviousJob(final String dataIdentifier, final String sourceJobName, final String targetJobName) { if(dataIdentifier==null || sourceJobName==null || targetJobName==null) throw new IllegalArgumentException("Data identifer, source job name and target job name cannot be null " + "to get the data from previous job."); if(container==null) ! return null; else { ObjectSet dataTransferResultSet=container.query(new Predicate() { ! public boolean match(Db4oJobDataTransfer jobDataTransfer) { ! if(dataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && ! sourceJobName.equals(jobDataTransfer.getSourceJobName()) && ! targetJobName.equals(jobDataTransfer.getTargetJobName())) { return true; --- 141,187 ---- } container.commit(); + logger.trace("deleted the data identified by " + dataIdentifier + " from the job name " + sourceJobName); /** * Add the new entry. */ ! Db4oJobDataTransferHolder dataTransfer=new Db4oJobDataTransferHolder(dataIdentifier, sourceJobName, targetJobName, data); container.set(dataTransfer); container.commit(); + logger.trace("data has been added with the identifier " + dataIdentifier + " from job name " + sourceJobName); dataSaved=true; } + logger.trace("Exiting sendDataToNextJob"); return dataSaved; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getDataFromPreviousJob(String,String,String) */ ! public Object getDataFromPreviousJob(String dataIdentifier, String sourceJobName, String targetJobName) { + logger.trace("Entering getDataFromPreviousJob"); + logger.debug("data identifier = " + dataIdentifier + " source job name = " + sourceJobName + " target job name = " + targetJobName); + if(dataIdentifier==null || sourceJobName==null || targetJobName==null) throw new IllegalArgumentException("Data identifer, source job name and target job name cannot be null " + "to get the data from previous job."); + final String finalDataIdentifier=dataIdentifier; + final String finalSourceJobName=sourceJobName; + final String finalTargetJobName=targetJobName; + + Object data=null; if(container==null) ! data=null; else { ObjectSet dataTransferResultSet=container.query(new Predicate() { ! public boolean match(Db4oJobDataTransferHolder jobDataTransfer) { ! if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && ! finalSourceJobName.equals(jobDataTransfer.getSourceJobName()) && ! finalTargetJobName.equals(jobDataTransfer.getTargetJobName())) { return true; *************** *** 175,190 **** if(dataTransferResultSet.hasNext()) { ! return ((Db4oJobDataTransfer)dataTransferResultSet.next()).getData(); } else ! return null; } } ! ! public boolean clearDataTransferredToNextJob(final String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null."); boolean dataCleared=false; if(container==null) --- 194,219 ---- if(dataTransferResultSet.hasNext()) { ! data=((Db4oJobDataTransferHolder)dataTransferResultSet.next()).getData(); ! logger.debug("data identified by " + dataIdentifier + " has been found from the source job name " + sourceJobName); } else ! data=null; } + logger.trace("Exiting getDataFromPreviousJob"); + return data; } ! ! /** ! * @see org.jmonks.batchserver.framework.repository.Repository#clearDataTransferredToNextJob(String) ! */ ! public boolean clearDataTransferredToNextJob(String jobName) { + logger.trace("Entering clearDataTransferredToNextJob"); + logger.debug("clearDataTransferredToNextJob :: job name = " + jobName); + if(jobName==null) throw new IllegalArgumentException("job name cannot be null."); + final String finalJobName=jobName; boolean dataCleared=false; if(container==null) *************** *** 194,200 **** ObjectSet dataTransferResultSet=container.query(new Predicate() { ! public boolean match(Db4oJobDataTransfer jobDataTransfer) { ! if(jobName.equals(jobDataTransfer.getSourceJobName())) { return true; --- 223,229 ---- ObjectSet dataTransferResultSet=container.query(new Predicate() { ! public boolean match(Db4oJobDataTransferHolder jobDataTransfer) { ! if(finalJobName.equals(jobDataTransfer.getSourceJobName())) { return true; *************** *** 207,248 **** while(dataTransferResultSet.hasNext()) container.delete(dataTransferResultSet.next()); ! container.commit(); dataCleared=true; } return dataCleared; } /** ! * @see org.jmonks.batchserver.framework.Repository#registerJobMgmtMntrInfo(String,Object) */ ! public boolean registerJobMgmtMntrInfo(String jobName, Object registrationInfo) { ! return true; } /** ! * @see org.jmonks.batchserver.framework.Repository#lookupJobMgmtMntrInfo(String) */ public Object lookupJobMgmtMntrInfo(String jobName) { ! return null; } /** ! * @see org.jmonks.batchserver.framework.Repository#unregisterJobMgmtMntrInfo(String) */ public boolean unregisterJobMgmtMntrInfo(String jobName) { ! return true; } /** * ! * @see org.jmonks.batchserver.framework.Repository#logStatistics(org.jmonks.batchserver.framework.JobStatistics) */ ! public boolean logStatistics(JobStatistics statistics) { if(statistics==null) throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); --- 236,349 ---- while(dataTransferResultSet.hasNext()) container.delete(dataTransferResultSet.next()); ! logger.debug(jobName + " data has been cleared from the repository."); container.commit(); dataCleared=true; } + logger.trace("Exiting clearDataTransferredToNextJob"); return dataCleared; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#registerJobMgmtMntrInfo(String,Object) */ ! public boolean registerJobMgmtMntrInfo(String jobName, final Object registrationInfo) { ! logger.trace("Entering registerJobMgmtMntrInfo"); ! logger.debug("job name = " + jobName + " registratinfo = " + registrationInfo); ! ! if(jobName==null || registrationInfo==null) ! throw new IllegalArgumentException("job name and mgmt&mntr registration information cannot be null to register the job."); ! ! boolean registered=true; ! ! if(container==null) ! registered=false; ! else ! { ! ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(jobName)); ! ! while(mgmtMntrInfoHolderResultSet.hasNext()) ! container.delete(mgmtMntrInfoHolderResultSet.next()); ! container.commit(); ! logger.trace(jobName + " previous mgmt and mntr information has been deleted"); ! ! container.set(new Db4oJobMgmtMntrInfoHolder(jobName, registrationInfo)); ! container.commit(); ! logger.trace(jobName + " mgmt and mntr information has been added to the repository"); ! registered=true; ! } ! logger.trace("Exiting registerJobMgmtMntrInfo"); ! return registered; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#lookupJobMgmtMntrInfo(String) */ public Object lookupJobMgmtMntrInfo(String jobName) { ! logger.trace("Entering lookupJobMgmtMntrInfo"); ! logger.debug("lookupJobMgmtMntrInfo :: job name = " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("jobName cannot be null to lookup the mgmt and mntr information."); ! ! Object registratInfo=null; ! if(container==null) ! registratInfo=null; ! else ! { ! ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(jobName)); ! if(mgmtMntrInfoHolderResultSet.hasNext()) ! { ! registratInfo=((Db4oJobMgmtMntrInfoHolder)mgmtMntrInfoHolderResultSet.next()).getMgmtMntrInfo(); ! logger.debug(jobName + " management and monitoring information has been found and being returned"); ! } ! else ! registratInfo=null; ! } ! logger.trace("Exiting lookupJobMgmtMntrInfo"); ! return registratInfo; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#unregisterJobMgmtMntrInfo(String) */ public boolean unregisterJobMgmtMntrInfo(String jobName) { ! logger.trace("Entering unregisterJobMgmtMntrInfo"); ! logger.debug("unregisterJobMgmtMntrInfo :: job name = " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("jobName cannot be null to unregister the mgmt and mntr information."); + boolean unregistered=false; + + if(container==null) + unregistered=false; + else + { + ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(jobName)); + if(mgmtMntrInfoHolderResultSet.hasNext()) + { + container.delete(mgmtMntrInfoHolderResultSet.next()); + container.commit(); + logger.debug(jobName + " mgmt and mntr information has been deleted."); + unregistered=true; + } + else + unregistered=false; + } + logger.trace("Exiting unregisterJobMgmtMntrInfo"); + return unregistered; } /** * ! * @see org.jmonks.batchserver.framework.repository.Repository#logStatistics(org.jmonks.batchserver.framework.JobStatistics) */ ! public boolean logStatistics(final JobStatistics statistics) { + logger.trace("Entering logStatistics"); + if(statistics==null) throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); *************** *** 255,268 **** container.set(statistics); container.commit(); logged=true; } return logged; } /** ! * @see org.jmonks.batchserver.framework.Repository#getStatistics(String) */ ! public JobStatistics[] getStatistics(final String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); --- 356,374 ---- container.set(statistics); container.commit(); + logger.debug(statistics.getJobname() + " has been logged."); logged=true; } + logger.trace("Exiting logStatistics"); return logged; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getStatistics(String) */ ! public JobStatistics[] getStatistics(String jobName) { + logger.trace("Entering getStatistics"); + logger.debug("getStatistics :: job name = " + jobName); + if(jobName==null) throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); *************** *** 274,317 **** else { ! ObjectSet statisticsResultSet=container.query(new Predicate() ! { ! public boolean match(JobStatistics jobStatistics) ! { ! if(jobName.equals(jobStatistics.getJobname())) ! return true; ! else ! return false; ! } ! }); ! statistics=new JobStatistics[statisticsResultSet.size()]; for(int i=0;statisticsResultSet.hasNext();i++) statistics[i]=(JobStatistics)statisticsResultSet.next(); } return statistics; } /** ! * @see org.jmonks.batchserver.framework.Repository#saveController(org.jmonks.batchserver.framework.controller.JobController,String) */ ! public boolean saveController(String jobName, JobController controller) { ! return true; } /** ! * @see org.jmonks.batchserver.framework.Repository#loadController(String) */ public JobController loadController(String jobName) { ! return null; } /** ! * @see org.jmonks.batchserver.framework.Repository#releaseController(String) */ public boolean releaseController(String jobName) { ! return true; } --- 380,483 ---- else { ! ObjectSet statisticsResultSet=container.query(new Db4oJobStatisticsPredicate(jobName)); ! logger.debug("Number of statistics objects = " + statisticsResultSet.size()); statistics=new JobStatistics[statisticsResultSet.size()]; for(int i=0;statisticsResultSet.hasNext();i++) statistics[i]=(JobStatistics)statisticsResultSet.next(); } + logger.trace("Exiting getStatistics"); return statistics; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#saveController(String,org.jmonks.batchserver.framework.controller.JobController) */ ! public boolean saveController(String jobName, final JobController controller) { ! logger.trace("Entering saveController"); ! logger.debug("saveController :: job name = " + jobName + " controller = " + controller); ! if(jobName==null || controller==null) ! throw new IllegalArgumentException("job name and controller cannot be null to save the controller."); ! ! boolean saved=true; ! ! if(container==null) ! saved=false; ! else ! { ! ObjectSet jobControllerHolderResultSet=container.query(new Db4oJobControllerHolderPredicate(jobName)); ! ! while(jobControllerHolderResultSet.hasNext()) ! container.delete(jobControllerHolderResultSet.next()); ! container.commit(); ! ! container.set(new Db4oJobControllerHolder(jobName, controller)); ! container.commit(); ! logger.debug(jobName + " controller has been added to the repository."); ! saved=true; ! } ! logger.trace("Exiting saveController"); ! return saved; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#loadController(String) */ public JobController loadController(String jobName) { ! logger.trace("Entering loadController"); ! logger.debug(" loadController :: job name = " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("jobName cannot be null to load the controller."); ! ! JobController controller=null; ! if(container==null) ! controller=null; ! else ! { ! ObjectSet jobControllerHolderResultSet=container.query(new Db4oJobControllerHolderPredicate(jobName)); ! if(jobControllerHolderResultSet.hasNext()) ! { ! controller=((Db4oJobControllerHolder)jobControllerHolderResultSet.next()).getJobController(); ! logger.debug(jobName + " controller found and being returned"); ! } ! else ! controller=null; ! } ! logger.trace("Exiting loadController"); ! return controller; } /** ! * @see org.jmonks.batchserver.framework.repository.Repository#releaseController(String) */ public boolean releaseController(String jobName) { ! logger.trace("Entering releaseController"); ! logger.debug(" releaseController :: job name = " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("jobName cannot be null to release the controller."); ! ! boolean released=false; ! ! if(container==null) ! released=false; ! else ! { ! ObjectSet jobControllerHolderResultSet=container.query(new Db4oJobControllerHolderPredicate(jobName)); ! if(jobControllerHolderResultSet.hasNext()) ! { ! container.delete(jobControllerHolderResultSet.next()); ! container.commit(); ! logger.debug(jobName + " controller has been released"); ! released=true; ! } ! else ! released=false; ! } ! logger.trace("Exiting releaseController"); ! return released; } --- NEW FILE: Db4oJobMgmtMntrInfoHolder.java --- /* * Db4oJobMgmtMntrInfoHolder.java * * Created on March 15, 2006, 10:54 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.repository.db4o; /** * Db4oJobMgmtMntrInfoHolder holds the job mgmt&mntr information and job name. * This will be used only by Db4oRepository. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oJobMgmtMntrInfoHolder { /** * Holds the job name */ private String jobName=null; /** * Holds the mgmtMntrInfo object */ private Object mgmtMntrInfo=null; /** * Constructor takes job name and mgmt & mntr info and constructs the object. */ Db4oJobMgmtMntrInfoHolder(String jobName,Object mgmtMntrInfo) { this.jobName=jobName; this.mgmtMntrInfo=mgmtMntrInfo; } /** * Returns the jobName. */ public String getJobName() { return this.jobName; } /** * Returns the mgmt & mntr object. */ public Object getMgmtMntrInfo() { return this.mgmtMntrInfo; } /** * <p> * Returns the string representation of Db4oJobMgmtMntrInfoHolder class in the format * <br> {Db4oJobMgmtMntrInfoHolder [jobName = value] [mgmtMntrInfo = value]} * </p> * * @return Returns the string representation of Db4oJobMgmtMntrInfoHolder. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oJobMgmtMntrInfoHolder "); stringValue.append("[jobName = " + this.jobName + "]"); stringValue.append("[mgmtMntrInfo = " + this.mgmtMntrInfo + "]"); stringValue.append("}"); return stringValue.toString(); } } --- NEW FILE: Db4oJobMgmtMntrInfoHolderPredicate.java --- /* * Db4oJobMgmtMntrInfoHolderPredicate.java * * Created on March 16, 2006, 7:23 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.repository.db4o; import com.db4o.query.Predicate; /** * Db4oJobMgmtMntrInfoHolderPredicate used to find the Db4oJobMgmtMntrInfoHolder * objects in Db4o database using native query. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oJobMgmtMntrInfoHolderPredicate extends Predicate { /** * job name to find the job mgmt and mntr info objects for. */ private String jobName=null; /** * Creates a new instance of Db4oJobMgmtMntrInfoHolderPredicate with the job name. */ Db4oJobMgmtMntrInfoHolderPredicate(String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null"); this.jobName=jobName; } /** * Method to run the the native query. This receives the Db4oJobMgmtMntrInfoHolder * objects and look for the job name this predicate initialized with. */ public boolean match(Db4oJobMgmtMntrInfoHolder holder) { if(jobName.equals(holder.getJobName())) return true; else return false; } } --- NEW FILE: Db4oJobStatisticsPredicate.java --- /* * Db4oJobStatisticsPredicate.java * * Created on March 16, 2006, 7:41 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.repository.db4o; import com.db4o.query.Predicate; import org.jmonks.batchserver.framework.JobStatistics; /** * Db4oJobStatisticsPredicate used to find the JobStatistics * objects in Db4o database using native query. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oJobStatisticsPredicate extends Predicate { /** * job name to find the job statistics objects for. */ private String jobName=null; /** * Creates a new instance of Db4oJobStatisticsPredicate with the given job name. */ Db4oJobStatisticsPredicate(String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null"); this.jobName=jobName; } /** * Method to run the the native query. This receives the JobStatistics * objects and look for the job name this predicate initialized with. */ public boolean match(JobStatistics statistics) { if(jobName.equals(statistics.getJobname())) return true; else return false; } } --- NEW FILE: Db4oJobDataTransferHolder.java --- /* * Db4oJobDataTransferHolder.java * * Created on March 15, 2006, 10:39 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.repository.db4o; /** * <p> * Db4oJobDataTransferHolder holds the data being transferred between the jobs. * This will not have any functionality except holding the data and * this will be used to store in DB4O database. * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oJobDataTransferHolder { /** * Holds the identifier by which jobs will communicated. */ private String dataIdentifier; /** * Source job name. */ private String sourceJobName; /** * Target job name, where data to be sent. */ private String targetJobName; /** * Data object. */ private Object data; /** * Constructor with all the argument to make this class immutable, * once it got created. */ Db4oJobDataTransferHolder(String dataIdentifer,String sourceJobName,String targetJobName,Object data) { this.dataIdentifier=dataIdentifer; this.sourceJobName=sourceJobName; this.targetJobName=targetJobName; this.data=data; } /** * Returns the data identifier. */ public String getDataIdentifier() { return this.dataIdentifier; } /** * Returns the source job name. */ public String getSourceJobName() { return this.sourceJobName; } /** * Returns the target job name. */ public String getTargetJobName() { return this.targetJobName; } /** * Returns the job data. */ public Object getData() { return this.data; } /** * <p> * Returns the string representation of Db4oJobDataTransferHolder class in the format * <br> {Db4oJobDataTransferHolder [dataIdentifier = value] [sourceJN = value] * [targetJN = value] [data = value]} * </p> * * @return Returns the string representation of Db4oJobDataTransferHolder. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oJobDataTransferHolder "); stringValue.append("[dataIdentifier = " + this.dataIdentifier + "]"); stringValue.append("[sourceJobName = " + this.sourceJobName + "]"); stringValue.append("[targetJobName = " + this.targetJobName + "]"); stringValue.append("[Data = " + this.data + "]"); stringValue.append("}"); return stringValue.toString(); } } |
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18609 Added Files: Db4oJobControllerHolder.java Db4oJobDataTransfer.java Db4oMgmtMntrInfoHolder.java Db4oRepository.java Log Message: no message --- NEW FILE: Db4oMgmtMntrInfoHolder.java --- /* * Db4oMgmtMntrInfoHolder.java * * Created on March 15, 2006, 10:54 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.repository.db4o; /** * Db4oMgmtMntrInfoHolder holds the job mgmt&mntr information and job name. * This will be used only by Db4oRepository. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oMgmtMntrInfoHolder { /** * Holds the job name */ private String jobName=null; /** * Holds the mgmtMntrInfo object */ private Object mgmtMntrInfo=null; /** * Constructor takes job name and mgmt & mntr info and constructs the object. */ Db4oMgmtMntrInfoHolder(String jobName,Object mgmtMntrInfo) { this.jobName=jobName; this.mgmtMntrInfo=mgmtMntrInfo; } /** * Returns the jobName. */ public String getJobName() { return this.jobName; } /** * Returns the mgmt & mntr object. */ public Object getMgmtMntrInfo() { return this.mgmtMntrInfo; } /** * <p> * Returns the string representation of Db4oMgmtMntrInfoHolder class in the format * <br> {Db4oMgmtMntrInfoHolder [jobName = value] [mgmtMntrInfo = value]} * </p> * * @return Returns the string representation of Db4oMgmtMntrInfoHolder. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oMgmtMntrInfoHolder "); stringValue.append("[jobName = " + this.jobName + "]"); stringValue.append("[mgmtMntrInfo = " + this.mgmtMntrInfo + "]"); stringValue.append("}"); return stringValue.toString(); } } --- NEW FILE: Db4oJobDataTransfer.java --- /* * Db4oJobDataTransfer.java * * Created on March 15, 2006, 10:39 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.repository.db4o; /** * <p> * Db4oJobDataTransfer holds the data being transferred between the jobs. * This will not have any functionality except holding the data and * this will be used to store in DB4O database. * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oJobDataTransfer { /** * Holds the identifier by which jobs will communicated. */ private String dataIdentifier; /** * Source job name. */ private String sourceJobName; /** * Target job name, where data to be sent. */ private String targetJobName; /** * Data object. */ private Object data; /** * Constructor with all the argument to make this class immutable, * once it got created. */ Db4oJobDataTransfer(String dataIdentifer,String sourceJobName,String targetJobName,Object data) { this.dataIdentifier=dataIdentifer; this.sourceJobName=sourceJobName; this.targetJobName=targetJobName; this.data=data; } /** * Returns the data identifier. */ public String getDataIdentifier() { return this.dataIdentifier; } /** * Returns the source job name. */ public String getSourceJobName() { return this.sourceJobName; } /** * Returns the target job name. */ public String getTargetJobName() { return this.targetJobName; } /** * Returns the job data. */ public Object getData() { return this.data; } /** * <p> * Returns the string representation of Db4oJobDataTransfer class in the format * <br> {Db4oJobDataTransfer [dataIdentifier = value] [sourceJN = value] * [targetJN = value] [data = value]} * </p> * * @return Returns the string representation of Db4oJobDataTransfer. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oJobDataTransfer "); stringValue.append("[dataIdentifier = " + this.dataIdentifier + "]"); stringValue.append("[sourceJobName = " + this.sourceJobName + "]"); stringValue.append("[targetJobName = " + this.targetJobName + "]"); stringValue.append("[Data = " + this.data + "]"); stringValue.append("}"); return stringValue.toString(); } } --- NEW FILE: Db4oJobControllerHolder.java --- /* * Db4oJobControllerHolder.java * * Created on March 15, 2006, 10:52 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.repository.db4o; import org.jmonks.batchserver.framework.controller.JobController; /** * Db4oJobControllerHolder holds the job controller object and job name. * This class will be accessed by only Db4oRepository. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ class Db4oJobControllerHolder { /** * Holds the job name */ private String jobName=null; /** * Holds the job controller object */ private JobController jobController=null; /** * Constructor takes job name and job controller to constructs the object. */ Db4oJobControllerHolder(String jobName,JobController jobController) { this.jobName=jobName; this.jobController=jobController; } /** * Returns the jobName. */ public String getJobName() { return this.jobName; } /** * Returns the mgmt & mntr object. */ public JobController getJobController() { return this.jobController; } /** * <p> * Returns the string representation of Db4oJobControllerHolder class in the format * <br> {Db4oJobControllerHolder [jobName = value] [mgmtMntrInfo = value]} * </p> * * @return Returns the string representation of Db4oJobControllerHolder. */ public String toString() { StringBuffer stringValue=new StringBuffer("{Db4oJobControllerHolder "); stringValue.append("[jobName = " + this.jobName + "]"); stringValue.append("[jobController = " + this.jobController + "]"); stringValue.append("}"); return stringValue.toString(); } } --- NEW FILE: Db4oRepository.java --- package org.jmonks.batchserver.framework.repository.db4o; import com.db4o.Db4o; import com.db4o.ObjectContainer; import com.db4o.ObjectSet; import com.db4o.query.Predicate; import java.io.File; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; import org.jmonks.batchserver.framework.repository.Repository; import org.jmonks.batchserver.framework.JobStatistics; /** * <p> * This implementation of repository uses the DB4O database as the repository. * It expects the property repository-location present in the repository configuration * in framework-cofig.xml file. The value of this property should be a valid directory name. * If directory doesnt exist, it will try to create directory with that path. * <br><br> * <pre> * <repository-config repository-class-name="org.jmonks.batchserver.framework.Db4oRepository"> * <property key="repository-location">/batchserver/repository</property> * </repository-config> * </pre> * <br><br> * Here repository-location defines where the DB4O database needs to create * the repository file. By default framework will be configured with the values * shown in the above XML configuration snippet. * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class Db4oRepository extends Repository { private static Logger logger=Logger.getLogger(Db4oRepository.class); /** * Property identifies the repository location. */ private static final String PROPERTY_REPOSIOTRY_LOCATION = "repository-location"; /** * Name of the db40 datbase file used as the repository. */ private static final String REPOSITORY_FILENAME = "batchserver_repository.db"; /** * Map holds the configuration properties of repository. */ private Map repositoryConfigProperties=null; /** * Db4o container object. */ ObjectContainer container=null; /** * <p> * Creates the Db4oRepository by accepting the map consist of properties * needed to setup the repository. This make sure repository-location property * has been defined and the value defined for this property is valid. * </p> * @param configProps Map contains the configuration properties. * * @throws ConfigurationException If repository-location property is not defined and * the value specified is invalid. */ public Db4oRepository(Map configProps) { logger.trace("Entering constructor"); this.repositoryConfigProperties=new HashMap(configProps); String repositoryLocation=(String)this.repositoryConfigProperties.get(Db4oRepository.PROPERTY_REPOSIOTRY_LOCATION); if(repositoryLocation==null || "".equals(repositoryLocation)) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "repository-location is required for DefaultReposiotry implementation."); else { File repositoryDirectory=new File(repositoryLocation); if(!repositoryDirectory.exists()) { boolean created=repositoryDirectory.mkdirs(); if(!created) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Attempt to create directory " + repositoryLocation + " is failed."); } else if(repositoryDirectory.isFile()) { throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Location " + repositoryLocation + " defined is a file. Directory name is expected."); } /** * Just to make sure, would be able to setup the repository. */ String completeRepositoryFileName=repositoryDirectory.getAbsolutePath()+File.separator+Db4oRepository.REPOSITORY_FILENAME; this.container=Db4o.openFile(completeRepositoryFileName); if(this.container==null) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to create the file " + completeRepositoryFileName + " to setup repository."); } logger.trace("Exiting constructor"); } /** * @see org.jmonks.batchserver.framework.Repository#sendDataToNextJob(String,String,String,Object) */ public boolean sendDatatoNextJob(final String dataIdentifier, final String sourceJobName, final String targetJobName, final Object data) { if(dataIdentifier==null || sourceJobName==null || targetJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); boolean dataSaved=false; if(this.container==null) dataSaved=false; else { /** * Delete the entries exist with the identifier, source and target job names. */ ObjectSet dataTransferredSet=container.query(new Predicate() { public boolean match(Db4oJobDataTransfer jobDataTransfer) { if(dataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && sourceJobName.equals(jobDataTransfer.getSourceJobName()) && targetJobName.equals(jobDataTransfer.getTargetJobName())) return true; else return false; } }); while(dataTransferredSet.hasNext()) { container.delete(dataTransferredSet.next()); } container.commit(); /** * Add the new entry. */ Db4oJobDataTransfer dataTransfer=new Db4oJobDataTransfer(dataIdentifier, sourceJobName, targetJobName, data); container.set(dataTransfer); container.commit(); dataSaved=true; } return dataSaved; } /** * @see org.jmonks.batchserver.framework.Repository#getDataFromPreviousJob(String,String,String) */ public Object getDataFromPreviousJob(final String dataIdentifier, final String sourceJobName, final String targetJobName) { if(dataIdentifier==null || sourceJobName==null || targetJobName==null) throw new IllegalArgumentException("Data identifer, source job name and target job name cannot be null " + "to get the data from previous job."); if(container==null) return null; else { ObjectSet dataTransferResultSet=container.query(new Predicate() { public boolean match(Db4oJobDataTransfer jobDataTransfer) { if(dataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && sourceJobName.equals(jobDataTransfer.getSourceJobName()) && targetJobName.equals(jobDataTransfer.getTargetJobName())) { return true; } else return false; } }); if(dataTransferResultSet.hasNext()) { return ((Db4oJobDataTransfer)dataTransferResultSet.next()).getData(); } else return null; } } public boolean clearDataTransferredToNextJob(final String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null."); boolean dataCleared=false; if(container==null) dataCleared=false; else { ObjectSet dataTransferResultSet=container.query(new Predicate() { public boolean match(Db4oJobDataTransfer jobDataTransfer) { if(jobName.equals(jobDataTransfer.getSourceJobName())) { return true; } else return false; } }); while(dataTransferResultSet.hasNext()) container.delete(dataTransferResultSet.next()); container.commit(); dataCleared=true; } return dataCleared; } /** * @see org.jmonks.batchserver.framework.Repository#registerJobMgmtMntrInfo(String,Object) */ public boolean registerJobMgmtMntrInfo(String jobName, Object registrationInfo) { return true; } /** * @see org.jmonks.batchserver.framework.Repository#lookupJobMgmtMntrInfo(String) */ public Object lookupJobMgmtMntrInfo(String jobName) { return null; } /** * @see org.jmonks.batchserver.framework.Repository#unregisterJobMgmtMntrInfo(String) */ public boolean unregisterJobMgmtMntrInfo(String jobName) { return true; } /** * * @see org.jmonks.batchserver.framework.Repository#logStatistics(org.jmonks.batchserver.framework.JobStatistics) */ public boolean logStatistics(JobStatistics statistics) { if(statistics==null) throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); boolean logged=false; if(container==null) logged=false; else { container.set(statistics); container.commit(); logged=true; } return logged; } /** * @see org.jmonks.batchserver.framework.Repository#getStatistics(String) */ public JobStatistics[] getStatistics(final String jobName) { if(jobName==null) throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); JobStatistics[] statistics=null; if(container==null) statistics=new JobStatistics[0]; else { ObjectSet statisticsResultSet=container.query(new Predicate() { public boolean match(JobStatistics jobStatistics) { if(jobName.equals(jobStatistics.getJobname())) return true; else return false; } }); statistics=new JobStatistics[statisticsResultSet.size()]; for(int i=0;statisticsResultSet.hasNext();i++) statistics[i]=(JobStatistics)statisticsResultSet.next(); } return statistics; } /** * @see org.jmonks.batchserver.framework.Repository#saveController(org.jmonks.batchserver.framework.controller.JobController,String) */ public boolean saveController(String jobName, JobController controller) { return true; } /** * @see org.jmonks.batchserver.framework.Repository#loadController(String) */ public JobController loadController(String jobName) { return null; } /** * @see org.jmonks.batchserver.framework.Repository#releaseController(String) */ public boolean releaseController(String jobName) { return true; } } |
From: Suresh <sur...@us...> - 2006-03-16 14:13:33
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17379 Added Files: Repository.java Log Message: no message --- NEW FILE: Repository.java --- package org.jmonks.batchserver.framework.repository; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.*; import org.jmonks.batchserver.framework.controller.JobController; import org.jmonks.batchserver.framework.*; /** * <p> * Repository provides utility methods to access and use the repository maintained * by the framework. There could be differnt implementations of the repository. * Framework configuration defines which implementation should be used for this framework. * This povides utility methods to logs the job statistics and persist job controllers, * transfer some information between the jobs and transfer some management and monitor * information between framework and server. * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public abstract class Repository { private static Logger logger=Logger.getLogger(Repository.class); /** * Protected constructor to make sure Repository cannot be instantiated * other than extending this class. */ protected Repository() { } /** * Factory method returns the specific implementation of repository based on the * repository configuration. * * @param repositoryConfig Repository configuration object. * * @throws ConfigurationException If repositoryClassName is missing or invalid * or it cannot be instantiated because of the lack of mandatory properties required * by the specific repository implementations. * @throws IllegalArgumentException If input repositoryConfig is null. */ public static Repository getRepository(FrameworkConfig.RepositoryConfig repositoryConfig) { logger.trace("Entering getRepository"); if(repositoryConfig==null) throw new IllegalArgumentException("repository configuration object cannot be null."); String repositoryClassName=repositoryConfig.getRepositoryClassName(); if(repositoryClassName==null || "".equals(repositoryClassName)) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "repository class name is not defined in repository configuration"); logger.debug("repository class name = " + repositoryClassName); Repository repository=null; try { Class repositoryClass=Class.forName(repositoryClassName); Constructor repositoryConstructor=repositoryClass.getConstructor(new Class[]{Map.class}); repository=(Repository)repositoryConstructor.newInstance(new Object[]{repositoryConfig.getRepositoryConfigProperties()}); logger.debug("created the repository implemenation class"); } catch(ClassNotFoundException exception) { exception.printStackTrace(); logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } catch(NoSuchMethodException exception) { exception.printStackTrace(); logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } catch(InstantiationException exception) { exception.printStackTrace(); logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } catch(IllegalAccessException exception) { exception.printStackTrace(); logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } catch(InvocationTargetException exception) { exception.printStackTrace(); logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } logger.trace("Exiting getRepository"); return repository; } /** * Data will be sent to the specified target job. This data * will be marked with the data identifier. Target job * should use the data identifier to read the data. * * @param dataIdentifier Identifier to be used to exchange the data between two jobs.. * @param sourceJobName Name of the source job. * @param targetJobName Name of the target job. * @param data Data that needs to be sent as the object. * * @return Returns true, if it could save the data to be sent to the next job. */ public abstract boolean sendDatatoNextJob(String dataIdentifier, String sourceJobName, String targetJobName, Object data); /** * Gets the data that has been sent to the target job from the source job * and identified by the given data identifier. * * @param dataIdentifier Identifier tied to the data wants to be read. * @param sourceJobName Name of the source job. * @param sourceComponent Name of the source componenet. * * @return Returns the data, null, if it couldnt find any data. */ public abstract Object getDataFromPreviousJob(String dataIdentifer, String sourceJobName, String targetJobName); /** * <p> * Clears the data that has not been received by the target jobs. * This method will clear all the data that has been put up by * this job. Usually, this will be called by startp of framework, * before kickoff the controller. * </p> * * @param jobName Name of job that put up the data. */ public abstract boolean clearDataTransferredToNextJob(String jobName); /** * Registers the job management and monitoring info with the given job name. * If there is an association with this job name existing, that information * will be overriden. This could happen, if job forgot to unregister the * management and monitoring information. * * @param jobName Name of the job. * @param registrationInfo Information to be associated with this job name. * * @return Return true, if it could assosciate this information, false, otherwise. */ public abstract boolean registerJobMgmtMntrInfo(String jobName, Object registrationInfo); /** * Retrieves the management and monitoring information assosciated with this job. * * @param jobName Name of the job. * * @return Returns the registered information, null, if it doesnt find any information. */ public abstract Object lookupJobMgmtMntrInfo(String jobName); /** * Unregisters the job management and monitoring info assosciated with the given job name. * * @param jobName Name of the job. * * @return Return true, it it could unregister the information, false, otherwise. */ public abstract boolean unregisterJobMgmtMntrInfo(String jobName); /** * Logs the job statistics given in the form of JobStatistics object * in the repository for further use/reference. * * @param statistics Job Statistics object which holds all the statistics related to that job. * * @return Returns true if statistics can be logged into repository, false, otherwise. */ public abstract boolean logStatistics(JobStatistics statistics); /** * Gets the statistics related to that given job as a JobStatistics object array. * * @param jobName Name of the job for which statistics are required. * @return Returns the array of JobStatistics object, null, if it couldnt find any job with that name. */ public abstract JobStatistics[] getStatistics(String jobName); /** * Persist the controller in repository. This will be useful, when job wants to be restarted. * When controller receives stop signal from servier with restart flag, it persist itself into * the repository. * * @param jobName Name of the job * @param controller Controller object to be persisted. * * @return Returns true, if it could persist the controller, false, otherwise. */ public abstract boolean saveController(String jobName, JobController controller); /** * Loads the controller assosicated with this job name in the repsoitory. When controller starts * execution, always, it looks into the reposiotry for restart. This can be overriden by passing addition * configuration property. * * @param jobName Name of the job. * @return Returns the controller object, null, if it couldnt find any. */ public abstract JobController loadController(String jobName); /** * Releases the persistedcontroller object from repository. * * @param jobName Name of the job. * @return Returns true, if it could release the controller from repository, null, otherwise. */ public abstract boolean releaseController(String jobName); } |
From: Suresh <sur...@us...> - 2006-03-16 05:57:33
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14912/db4o Log Message: Directory /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o added to the repository |
From: Suresh <sur...@us...> - 2006-03-16 05:57:06
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14711/repository Log Message: Directory /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository added to the repository |
From: Suresh <sur...@us...> - 2006-03-16 05:56:39
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14498 Modified Files: JobContext.java JobStatistics.java Removed Files: DefaultRepository.java Repository.java Log Message: no message Index: JobContext.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/JobContext.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobContext.java 4 Mar 2006 04:48:52 -0000 1.2 --- JobContext.java 16 Mar 2006 05:56:31 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- import org.jmonks.batchserver.framework.config.*; + import org.jmonks.batchserver.framework.repository.Repository; /** *************** *** 37,41 **** * it cannot access the repository. */ ! public org.jmonks.batchserver.framework.Repository getReposiotry() { --- 38,42 ---- * it cannot access the repository. */ ! public org.jmonks.batchserver.framework.repository.Repository getReposiotry() { Index: JobStatistics.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/JobStatistics.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JobStatistics.java 15 Mar 2006 04:36:32 -0000 1.3 --- JobStatistics.java 16 Mar 2006 05:56:31 -0000 1.4 *************** *** 39,42 **** --- 39,46 ---- { this.jobName=jobName; + this.startTime=null; + this.endTime=null; + this.maxMemoryUsage=0; + this.recordsProcessed=0; } --- Repository.java DELETED --- --- DefaultRepository.java DELETED --- |
From: Suresh <sur...@us...> - 2006-03-15 04:36:55
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18212 Modified Files: framework-config.xml Log Message: no message Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** framework-config.xml 14 Mar 2006 23:02:19 -0000 1.12 --- framework-config.xml 15 Mar 2006 04:36:50 -0000 1.13 *************** *** 16,20 **** <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> <framework-logging-config framework-logging-level="DEBUG" job-logging-directory="/batchserver/logs" --- 16,19 ---- |
From: Suresh <sur...@us...> - 2006-03-15 04:36:38
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18147 Modified Files: DefaultRepository.java JobStatistics.java Repository.java Log Message: no message Index: JobStatistics.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/JobStatistics.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobStatistics.java 4 Mar 2006 04:48:52 -0000 1.2 --- JobStatistics.java 15 Mar 2006 04:36:32 -0000 1.3 *************** *** 12,27 **** public class JobStatistics { ! private Date startTime; ! private Date endTime; ! private int recordsProcessed; ! private int maxMemoryUsage; ! private String jobName; ! public JobStatistics() { } --- 12,42 ---- public class JobStatistics { ! /** ! * Starting time of the job. ! */ private Date startTime; ! /** ! * Ending time of the job. ! */ private Date endTime; ! /** ! * Number of records processed in this job. ! */ private int recordsProcessed; ! /** ! * Maximum memory usage of this job. ! */ private int maxMemoryUsage; ! /** ! * Name of the job. ! */ private String jobName; ! ! /** ! * Constructor takes the job name and build the skelton. ! */ ! public JobStatistics(String jobName) { + this.jobName=jobName; } *************** *** 33,36 **** --- 48,52 ---- public void setStartTime(Date startTime) { + this.startTime=startTime; } *************** *** 41,48 **** */ public void setEndTime(Date endTime) - { this.endTime = endTime; - } --- 57,62 ---- *************** *** 53,60 **** */ public void setRecordsProcessed(int recordCount) - { this.recordsProcessed = recordCount; - } --- 67,72 ---- *************** *** 66,69 **** --- 78,82 ---- public void setMaxMemeoryUsage(int memoryUsage) { + this.maxMemoryUsage=memoryUsage; } *************** *** 74,81 **** */ public Date getStartTime() - { ! return startTime; ! } --- 87,92 ---- */ public Date getStartTime() { ! return this.startTime; } *************** *** 86,93 **** */ public Date getEndTime() - { ! return endTime; ! } --- 97,102 ---- */ public Date getEndTime() { ! return this.endTime; } *************** *** 98,105 **** */ public int getRecordsProcessed() - { ! return recordsProcessed; ! } --- 107,112 ---- */ public int getRecordsProcessed() { ! return this.recordsProcessed; } *************** *** 110,117 **** */ public int getMaxMemoryUsage() - { ! return maxMemoryUsage; ! } --- 117,122 ---- */ public int getMaxMemoryUsage() { ! return this.maxMemoryUsage; } *************** *** 122,138 **** */ public String getJobname() - { ! return null; ! } ! /** ! * Sets the name of the job. ! * ! * @param jobName Name of the job. */ ! public void setJobname(String jobName) { ! } } --- 127,153 ---- */ public String getJobname() { ! return this.jobName; } ! /** ! * <p> ! * Returns the string representation of JobStatistics class in the format ! * <br> {JobStatistics [jobName = value] [startTime = value] [endTime = value]} ! * </p> ! * ! * @return Returns the string representation of JobStatistics. */ ! public String toString() { ! StringBuffer stringValue=new StringBuffer("{JobStatistics "); ! stringValue.append("[jobName = " + this.jobName + "]"); ! stringValue.append("[startTime = " + ((this.startTime!=null)?this.startTime.toString():"") + "]"); ! stringValue.append("[endTime = " + ((this.endTime!=null)?this.endTime.toString():"") + "]"); ! stringValue.append("[maxMemoryUsage = " + this.maxMemoryUsage + "]"); ! stringValue.append("[recordsProcessed = " + this.recordsProcessed + "]"); ! stringValue.append("}"); ! return stringValue.toString(); ! } ! } Index: Repository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/Repository.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Repository.java 14 Mar 2006 23:00:57 -0000 1.3 --- Repository.java 15 Mar 2006 04:36:32 -0000 1.4 *************** *** 103,145 **** /** ! * Logs the job statistics given in the form of JobStatistics object ! * in the repository for further use/reference. ! * ! * @param statistics Job Statistics object which holds all the statistics related to that job. ! * ! * @return Returns true if statistics can be logged into repository, false, otherwise. ! */ ! public abstract boolean logStatistics(JobStatistics statistics); ! ! /** ! * Data will be sent to the specified component of the specified ! * job behalf of the specific component from specific job. * * @param sourceJobName Name of the source job. - * @param sourceComponent Name of the source componenet. * @param targetJobName Name of the target job. - * @param targetComponent Name of the target component. * @param data Data that needs to be sent as the object. * * @return Returns true, if it could save the data to be sent to the next job. */ ! public abstract boolean sendDatatoNextJob(String sourceJobName, String sourceComponent, ! String targetJobName, String targetComponent, Object data); /** ! * Gets the data that has been sent to this component of this job from ! * specific component of specific job. * * @param sourceJobName Name of the source job. * @param sourceComponent Name of the source componenet. - * @param targetJobName Name of the target job. - * @param targetComponent Name of the target component. * * @return Returns the data, null, if it couldnt find any data. */ ! public abstract Object getDataFromPreviousJob(String sourceJobName, String sourceComponent, ! String targetJobName, String targetComponent); /** * Registers the job management and monitoring info with the given job name. * If there is an association with this job name existing, that information --- 103,146 ---- /** ! * Data will be sent to the specified target job. This data ! * will be marked with the data identifier. Target job ! * should use the data identifier to read the data. * + * @param dataIdentifier Identifier to be used to exchange the data between two jobs.. * @param sourceJobName Name of the source job. * @param targetJobName Name of the target job. * @param data Data that needs to be sent as the object. * * @return Returns true, if it could save the data to be sent to the next job. */ ! public abstract boolean sendDatatoNextJob(String dataIdentifier, String sourceJobName, ! String targetJobName, Object data); /** ! * Gets the data that has been sent to the target job from the source job ! * and identified by the given data identifier. * + * @param dataIdentifier Identifier tied to the data wants to be read. * @param sourceJobName Name of the source job. * @param sourceComponent Name of the source componenet. * * @return Returns the data, null, if it couldnt find any data. */ ! public abstract Object getDataFromPreviousJob(String dataIdentifer, String sourceJobName, ! String targetJobName); /** + * <p> + * Clears the data that has not been received by the target jobs. + * This method will clear all the data that has been put up by + * this job. Usually, this will be called by startp of framework, + * before kickoff the controller. + * </p> + * + * @param jobName Name of job that put up the data. + */ + public abstract boolean clearDataTransferredToNextJob(String jobName); + + /** * Registers the job management and monitoring info with the given job name. * If there is an association with this job name existing, that information *************** *** 173,176 **** --- 174,187 ---- /** + * Logs the job statistics given in the form of JobStatistics object + * in the repository for further use/reference. + * + * @param statistics Job Statistics object which holds all the statistics related to that job. + * + * @return Returns true if statistics can be logged into repository, false, otherwise. + */ + public abstract boolean logStatistics(JobStatistics statistics); + + /** * Gets the statistics related to that given job as a JobStatistics object array. * Index: DefaultRepository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/DefaultRepository.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DefaultRepository.java 14 Mar 2006 23:00:57 -0000 1.3 --- DefaultRepository.java 15 Mar 2006 04:36:32 -0000 1.4 *************** *** 1,7 **** --- 1,12 ---- package org.jmonks.batchserver.framework; + import com.db4o.Db4o; + import com.db4o.ObjectContainer; + import com.db4o.ObjectSet; + import java.io.File; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; + import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; *************** *** 10,26 **** * <p> * This implementation of repository uses the DB4O database as the repository. ! * It expects the two properties repository-location and repository-filename present in the repository configuration ! * in framework-cofig.xml file. * <br><br> * <pre> * <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> * </pre> * <br><br> ! * Here repository-location defines where the DB4O database needs to be created and ! * repository-filename defines the name of the file to be used as the repository. ! * By default framework will be configured with the values shown in the above XML configuration snippet. * </p> * @author Suresh Pragada --- 15,31 ---- * <p> * This implementation of repository uses the DB4O database as the repository. ! * It expects the property repository-location present in the repository configuration ! * in framework-cofig.xml file. The value of this property should be a valid directory name. ! * If directory doesnt exist, it will try to create directory with that path. * <br><br> * <pre> * <repository-config repository-class-name="org.jmonks.batchserver.framework.DefaultRepository"> * <property key="repository-location">/batchserver/repository</property> * </repository-config> * </pre> * <br><br> ! * Here repository-location defines where the DB4O database needs to create ! * the repository file. By default framework will be configured with the values ! * shown in the above XML configuration snippet. * </p> * @author Suresh Pragada *************** *** 30,72 **** public class DefaultRepository extends Repository { private Map repositoryConfigProperties=null; - - private static Logger logger=Logger.getLogger(DefaultRepository.class); - /** * */ public DefaultRepository(Map configProps) { this.repositoryConfigProperties=new HashMap(configProps); } /** ! * @see org.jmonks.batchserver.framework.Repository#logStatistics(org.jmonks.batchserver.framework.JobStatistics) */ ! public boolean logStatistics(org.jmonks.batchserver.framework.JobStatistics statistics) { ! return true; ! } /** ! * @see org.jmonks.batchserver.framework.Repository#sendDataToNextJob(String,String,String,String,Object) */ ! public boolean sendDatatoNextJob(String srcJN, String srcCmp, String tgtJN, String tgtCmp, Object data) { ! return true; ! } ! /** ! * @see org.jmonks.batchserver.framework.Repository#getDataFromPreviousJob(String,String,String,String) ! */ ! public Object getDataFromPreviousJob(String srcJN, String srcCmp, String tgtJN, String tgtCmp) { ! return null; ! } ! /** * @see org.jmonks.batchserver.framework.Repository#registerJobMgmtMntrInfo(String,Object) --- 35,167 ---- public class DefaultRepository extends Repository { + private static Logger logger=Logger.getLogger(DefaultRepository.class); + /** + * Property identifies the repository location. + */ + private static final String PROPERTY_REPOSIOTRY_LOCATION = "repository-location"; + /** + * Name of the db40 datbase file used as the repository. + */ + private static final String REPOSITORY_FILENAME = "batchserver_repository.db"; + /** + * Map holds the configuration properties of repository. + */ private Map repositoryConfigProperties=null; /** + * Db4o container object. + */ + ObjectContainer container=null; + /** + * <p> + * Creates the DefaultRepository by accepting the map consist of properties + * needed to setup the repository. This make sure repository-location property + * has been defined and the value defined for this property is valid. + * </p> + * @param configProps Map contains the configuration properties. * + * @throws ConfigurationException If repository-location property is not defined and + * the value specified is invalid. */ public DefaultRepository(Map configProps) { + logger.trace("Entering constructor"); this.repositoryConfigProperties=new HashMap(configProps); + String repositoryLocation=(String)this.repositoryConfigProperties.get(DefaultRepository.PROPERTY_REPOSIOTRY_LOCATION); + if(repositoryLocation==null || "".equals(repositoryLocation)) + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, + "repository-location is required for DefaultReposiotry implementation."); + else + { + File repositoryDirectory=new File(repositoryLocation); + if(!repositoryDirectory.exists()) + { + boolean created=repositoryDirectory.mkdirs(); + if(!created) + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Attempt to create directory " + repositoryLocation + " is failed."); + } + else if(repositoryDirectory.isFile()) + { + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Location " + + repositoryLocation + " defined is a file. Directory name is expected."); + } + + /** + * Just to make sure, would be able to setup the repository. + */ + String completeRepositoryFileName=repositoryDirectory.getAbsolutePath()+File.separator+DefaultRepository.REPOSITORY_FILENAME; + this.container=Db4o.openFile(completeRepositoryFileName); + if(this.container==null) + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Unable to create the file " + completeRepositoryFileName + " to setup repository."); + } + logger.trace("Exiting constructor"); } /** ! * @see org.jmonks.batchserver.framework.Repository#sendDataToNextJob(String,String,String,Object) */ ! public boolean sendDatatoNextJob(String dataIdentifer, String sourceJobName, String targetJobName, Object data) { ! boolean dataSaved=false; ! if(this.container==null) ! dataSaved=false; ! else ! { ! /** ! * Delete the entries exist with the identifier, source and target job names. ! */ ! JobDataTransfer dataTransferredQuery=new JobDataTransfer(dataIdentifer,sourceJobName,targetJobName,null); ! ObjectSet dataTransferredSet=container.get(dataTransferredQuery); ! while(dataTransferredSet.hasNext()) ! { ! JobDataTransfer dataTransferred=(JobDataTransfer)dataTransferredSet.next(); ! container.delete(dataTransferred); ! } ! container.commit(); ! ! /** ! * Add the new entry. ! */ ! JobDataTransfer dataTransfer=new JobDataTransfer(dataIdentifer, sourceJobName, targetJobName, data); ! container.set(dataTransfer); ! container.commit(); ! dataSaved=true; ! } ! return dataSaved; } /** ! * @see org.jmonks.batchserver.framework.Repository#getDataFromPreviousJob(String,String,String) */ ! public Object getDataFromPreviousJob(String datIdentifier, String sourceJobName, String targetJobName) { ! if(container==null) ! return null; ! else ! { ! JobDataTransfer dataTransfer=new JobDataTransfer(datIdentifier, sourceJobName, targetJobName, null); ! ObjectSet dataTransferSet=container.get(dataTransfer); ! if(dataTransferSet.hasNext()) ! { ! return ((JobDataTransfer)dataTransferSet.next()).getData(); ! } ! else ! return null; ! } } ! public boolean clearDataTransferredToNextJob(String jobName) { ! boolean dataCleared=false; ! if(container==null) ! dataCleared=false; ! else ! { ! JobDataTransfer dataTransfer=new JobDataTransfer(null, jobName, null, null); ! container.delete(dataTransfer); ! dataCleared=true; ! } ! return dataCleared; } ! /** * @see org.jmonks.batchserver.framework.Repository#registerJobMgmtMntrInfo(String,Object) *************** *** 75,79 **** { return true; - } --- 170,173 ---- *************** *** 97,106 **** /** * @see org.jmonks.batchserver.framework.Repository#getStatistics(String) */ public JobStatistics[] getStatistics(String jobName) { ! return null; ! } --- 191,235 ---- /** + * + * @see org.jmonks.batchserver.framework.Repository#logStatistics(org.jmonks.batchserver.framework.JobStatistics) + */ + public boolean logStatistics(JobStatistics statistics) + { + if(statistics==null) + throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); + + boolean logged=false; + if(container==null) + logged=false; + else + { + container.set(statistics); + container.commit(); + logged=true; + } + return logged; + } + + /** * @see org.jmonks.batchserver.framework.Repository#getStatistics(String) */ public JobStatistics[] getStatistics(String jobName) { ! if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); ! ! JobStatistics[] statistics=null; ! ! if(container==null) ! statistics=new JobStatistics[0]; ! else ! { ! JobStatistics statisticsQuery=new JobStatistics(jobName); ! ObjectSet statisticsSet=container.get(statisticsQuery); ! statistics=new JobStatistics[statisticsSet.size()]; ! for(int i=0;statisticsSet.hasNext();i++) ! statistics[i]=(JobStatistics)statisticsSet.next(); ! } ! return statistics; } *************** *** 111,115 **** { return true; - } --- 240,243 ---- *************** *** 120,124 **** { return null; - } --- 248,251 ---- *************** *** 129,168 **** { return true; - } ! /** ! * <p> ! * This is the inner class in the DefaultRepository class to hold the data being transferred between the jobs. This will not have any functionality except holding the data. ! * </p> ! * @author : Suresh Pragada ! * @version 1.0 ! */ ! public class JobDataTransfer ! { ! ! ! private String sourceJobName; ! ! ! private String sourceComponentName; ! ! ! private Object data; ! ! private int targetJobName; ! ! private int targetComponentName; ! public JobDataTransfer() ! { } - - - } - - - - } --- 256,353 ---- { return true; } ! ! /** ! * <p> ! * JobDataTransfer holds the data being transferred between the jobs. ! * This will not have any functionality except holding the data and ! * this will be used to store in DB4O database. ! * </p> ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 ! */ ! private class JobDataTransfer { + /** + * Holds the identifier by which jobs will communicated. + */ + private String dataIdentifier; + /** + * Source job name. + */ + private String sourceJobName; + /** + * Target job name, where data to be sent. + */ + private String targetJobName; + /** + * Data object. + */ + private Object data; + /** + * Constructor with all the argument to make this class immutable, + * once it got created. + */ + private JobDataTransfer(String dataIdentifer,String sourceJobName,String targetJobName,Object data) + { + this.dataIdentifier=dataIdentifer; + this.sourceJobName=sourceJobName; + this.targetJobName=targetJobName; + this.data=data; + } + /** + * Returns the data identifier. + */ + public String getDataIdentifier() + { + return this.dataIdentifier; + } + + /** + * Returns the source job name. + */ + public String getSourceJobName() + { + return this.sourceJobName; + } + + /** + * Returns the target job name. + */ + public String getTargetJobName() + { + return this.targetJobName; + } + + /** + * Returns the job data. + */ + public Object getData() + { + return this.data; + } + + /** + * <p> + * Returns the string representation of JobDataTransfer class in the format + * <br> {JobDataTransfer [dataIdentifier = value] [sourceJN = value] + * [targetJN = value] [data = value]} + * </p> + * + * @return Returns the string representation of JobDataTransfer. + */ + public String toString() + { + StringBuffer stringValue=new StringBuffer("{JobDataTransfer "); + stringValue.append("[dataIdentifier = " + this.dataIdentifier + "]"); + stringValue.append("[sourceJobName = " + this.sourceJobName + "]"); + stringValue.append("[targetJobName = " + this.targetJobName + "]"); + stringValue.append("[Data = " + this.data + "]"); + stringValue.append("}"); + return stringValue.toString(); + } } } |
From: Suresh <sur...@us...> - 2006-03-14 23:10:51
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23048 Modified Files: 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FrameworkConfigTest.java 13 Mar 2006 14:31:14 -0000 1.3 --- FrameworkConfigTest.java 14 Mar 2006 23:10:48 -0000 1.4 *************** *** 98,107 **** FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); ! FrameworkConfig.LoggingConfig loggingConfig=frameworkConfig.getLoggingConfig(); assertNotNull(loggingConfig); ! assertNotNull(loggingConfig.getLoggingDirecotry()); ! assertTrue(!loggingConfig.getLoggingDirecotry().equals("")); ! assertNotNull(loggingConfig.getFrameworkLogLevel()); ! assertNotNull(loggingConfig.getBasePackageName()); System.out.println(loggingConfig); } --- 98,108 ---- FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); ! FrameworkConfig.FrameworkLoggingConfig loggingConfig=frameworkConfig.getFrameworkLoggingConfig(); assertNotNull(loggingConfig); ! assertNotNull(loggingConfig.getJobLoggingDirecotry()); ! assertTrue(!loggingConfig.getJobLoggingDirecotry().equals("")); ! assertNotNull(loggingConfig.getFrameworkLoggingLevel()); ! assertNotNull(loggingConfig.getJobBasePackageName()); ! assertNotNull(loggingConfig.getJobLoggingLevel()); System.out.println(loggingConfig); } |
From: Suresh <sur...@us...> - 2006-03-14 23:08:56
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22170 Modified Files: FrameworkTestSuite.java LoggingManagerTest.java Added Files: RepositoryTest.java Log Message: no message Index: FrameworkTestSuite.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/FrameworkTestSuite.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FrameworkTestSuite.java 13 Mar 2006 14:27:15 -0000 1.3 --- FrameworkTestSuite.java 14 Mar 2006 23:08:49 -0000 1.4 *************** *** 48,51 **** --- 48,52 ---- { TestSuite mainSuite = new TestSuite(); + mainSuite.addTest(LoggingManagerTest.suite()); mainSuite.addTest(FrameworkUtilTest.suite()); *************** *** 59,63 **** mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); ! return mainSuite; --- 60,64 ---- mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); ! mainSuite.addTest(RepositoryTest.suite()); return mainSuite; --- NEW FILE: RepositoryTest.java --- /* * RepositoryTest.java * JUnit based test * * Created on March 14, 2006, 3:54 PM */ package org.jmonks.batchserver.framework; import junit.framework.*; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.*; import org.jmonks.batchserver.framework.controller.JobController; /** * * @author w951h8m */ public class RepositoryTest extends TestCase { public RepositoryTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(RepositoryTest.class); return suite; } /** * Test to make sure repository cannot be instantiated. */ public void testInstantiation() { try { Repository repository=(Repository)Repository.class.newInstance(); fail("Repository should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as Repository cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of Repository is protected. */ } } /** * Test to make sure this is not returning null. */ public void testGetRepository() { FrameworkConfig frameworkConfig=FrameworkConfig.getInstance(); assertNotNull(frameworkConfig); FrameworkConfig.RepositoryConfig repositoryConfig=frameworkConfig.getRepositoryConfig(); assertNotNull(repositoryConfig); Repository repository=Repository.getRepository(repositoryConfig); assertNotNull(repository); } } Index: LoggingManagerTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/LoggingManagerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoggingManagerTest.java 13 Mar 2006 14:31:15 -0000 1.1 --- LoggingManagerTest.java 14 Mar 2006 23:08:50 -0000 1.2 *************** *** 9,21 **** 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.*; --- 9,13 ---- import junit.framework.*; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.*; *************** *** 26,30 **** public class LoggingManagerTest extends TestCase { ! public LoggingManagerTest(String testName) { --- 18,22 ---- public class LoggingManagerTest extends TestCase { ! private FrameworkConfig frameworkConfig=null; public LoggingManagerTest(String testName) { *************** *** 34,37 **** --- 26,30 ---- protected void setUp() throws Exception { + frameworkConfig=FrameworkConfig.getInstance(); } *************** *** 42,114 **** 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); } --- 35,85 ---- public static Test suite() { ! //TestSuite suite = new TestSuite(LoggingManagerTest.class); ! TestSuite suite=new TestSuite(); ! suite.addTest(new LoggingManagerTest("testInitializeFrameworkLogging")); ! suite.addTest(new LoggingManagerTest("testInitializeJobLogging")); return suite; } /** * Test of initializeJobLogging method, of class org.jmonks.batchserver.framework.LoggingManager. */ public void testInitializeJobLogging() { ! assertNotNull(frameworkConfig); ! FrameworkConfig.FrameworkLoggingConfig loggingConfig=frameworkConfig.getFrameworkLoggingConfig(); assertNotNull(loggingConfig); ! FrameworkConfig.JobConfigFactoryConfig configFactoryConfig=frameworkConfig.getJobConfigFactoryConfig(); ! assertNotNull(configFactoryConfig); ! JobConfigFactory factory=JobConfigFactory.getJobConfigFactory(configFactoryConfig); ! assertNotNull(factory); ! JobConfig jobConfig=factory.getJobConfig("process_file_xyz"); ! assertNotNull(jobConfig); ! JobLoggingConfig jobLoggingConfig=jobConfig.getJobLoggingConfig(); ! assertNotNull(jobLoggingConfig); ! LoggingManager.initializeJobLogging("process_file_xyz", loggingConfig,jobLoggingConfig); + Logger logger=Logger.getLogger(LoggingManagerTest.class); + logger.debug("This is debug message after job initialization"); + logger.info("This is info message after job initialization"); + logger.warn("This is warn message after job initialization"); + logger.error("This is error message after job initialization"); } /** * Test of initializeLogging method, of class org.jmonks.batchserver.framework.LoggingManager. */ ! public void testInitializeFrameworkLogging() { ! assertNotNull(frameworkConfig); ! FrameworkConfig.FrameworkLoggingConfig loggingConfig=frameworkConfig.getFrameworkLoggingConfig(); ! assertNotNull(loggingConfig); ! LoggingManager.initializeFrameworkLogging(loggingConfig); ! Logger logger=Logger.getLogger(LoggingManagerTest.class); ! logger.debug("This is debug message"); ! logger.info("This is info message"); ! logger.warn("This is warn message"); ! logger.error("This is error message"); } |
From: Suresh <sur...@us...> - 2006-03-14 23:05:35
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20471 Modified Files: batch-config.xml XMLBasicJobControllerConfig.java XMLJobConfig.java XMLJobConfigFactory.java XMLJobControllerConfig.java XMLJobLoggingConfig.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.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLJobConfig.java 14 Mar 2006 05:47:15 -0000 1.7 --- XMLJobConfig.java 14 Mar 2006 23:05:25 -0000 1.8 *************** *** 69,72 **** --- 69,73 ---- logger.trace("Entering Constructor"); this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); + logger.info("Job name = " + this.jobName); String jobStatusInStr=jobConfigElement.getAttribute(XMLJobConfig.JOB_STATUS_ATTRIBUTE_NAME); *************** *** 79,89 **** this.jobStatus=false; } ! NodeList jobLoggingConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobLoggingConfig.JOB_LOGGING_CONFIG_ELEMENT_NAME); if(jobLoggingConfigNodeList.getLength()==1) { Element jobLoggingConfigElement=(Element)jobLoggingConfigNodeList.item(0); this.jobLoggingConfig=new XMLJobLoggingConfig(jobLoggingConfigElement); ! logger.info("Read job logging configuration : " + this.jobLoggingConfig); } else --- 80,92 ---- this.jobStatus=false; } ! logger.info("Job status = " + this.jobStatus); ! NodeList jobLoggingConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobLoggingConfig.JOB_LOGGING_CONFIG_ELEMENT_NAME); if(jobLoggingConfigNodeList.getLength()==1) { Element jobLoggingConfigElement=(Element)jobLoggingConfigNodeList.item(0); + logger.trace("Creating the XML Job logging configuration object"); this.jobLoggingConfig=new XMLJobLoggingConfig(jobLoggingConfigElement); ! logger.info("Job logging configuration = " + this.jobLoggingConfig); } else *************** *** 95,101 **** { Element controllerConfigElement=(Element)controllerConfigNodeList.item(0); ! logger.info("Requesting controller config factory to get the controller configuration object"); this.jobControllerConfig=XMLJobControllerConfig.getJobControllerConfig(controllerConfigElement); ! logger.info("Returned controller configuration : " + this.jobControllerConfig); } else --- 98,104 ---- { Element controllerConfigElement=(Element)controllerConfigNodeList.item(0); ! logger.trace("Requesting controller config factory to get the controller configuration object"); this.jobControllerConfig=XMLJobControllerConfig.getJobControllerConfig(controllerConfigElement); ! logger.info("Job controller configuration = " + this.jobControllerConfig); } else Index: batch-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/batch-config.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** batch-config.xml 14 Mar 2006 05:47:15 -0000 1.4 --- batch-config.xml 14 Mar 2006 23:05:25 -0000 1.5 *************** *** 28,31 **** --- 28,32 ---- <job-logger-config logger-name="com.mycompany.batch.xyz" logger-level="DEBUG"/> <job-logger-config logger-name="com.mycompany.batch.abc.processor" logger-level="ERROR"/> + <job-logger-config logger-name="org.jmonks.batchserver.framework" logger-level="ERROR"/> </job-logging-config> </job-config> Index: XMLJobLoggingConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobLoggingConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLJobLoggingConfig.java 14 Mar 2006 05:47:15 -0000 1.1 --- XMLJobLoggingConfig.java 14 Mar 2006 23:05:25 -0000 1.2 *************** *** 68,71 **** --- 68,72 ---- String loggerName=jobLoggerConfigElement.getAttribute(XMLJobLoggingConfig.LOGGER_NAME_ATTRIBUTE_NAME); String loggerLevel=jobLoggerConfigElement.getAttribute(XMLJobLoggingConfig.LOGGER_LEVEL_ATTRIBUTE_NAME); + logger.trace("Adding the logger information = " + loggerName + " " + loggerLevel); this.addLogger(loggerName,loggerLevel); } Index: XMLPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLPoolJobControllerConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLPoolJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 --- XMLPoolJobControllerConfig.java 14 Mar 2006 23:05:25 -0000 1.8 *************** *** 95,98 **** --- 95,99 ---- * Load pool job loader configuration. */ + logger.trace("Started reading the pool job loader configuration"); NodeList xmlPoolJobLoaderNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_LOADER_ELEMENT_NAME); if(xmlPoolJobLoaderNodeList.getLength()==1) *************** *** 111,118 **** throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlPoolJobLoaderNodeList.getLength() + " element(s) in the pool job controller configuration."); ! /** * Load pool job procesor configuration. */ NodeList xmlPoolJobProcessorNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_PROCESSOR_ELEMENT_NAME); if(xmlPoolJobProcessorNodeList.getLength()==1) --- 112,120 ---- throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlPoolJobLoaderNodeList.getLength() + " element(s) in the pool job controller configuration."); ! logger.trace("Finished reading the pool job loader configuration"); /** * Load pool job procesor configuration. */ + logger.trace("Started reading the pool job processor configuration"); NodeList xmlPoolJobProcessorNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_PROCESSOR_ELEMENT_NAME); if(xmlPoolJobProcessorNodeList.getLength()==1) *************** *** 132,139 **** throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlPoolJobProcessorNodeList.getLength() + " element(s) in the pool job controller configuration."); ! /** * Load job pool configuration. */ NodeList xmlJobPoolNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_POOL_ELEMENT_NAME); if(xmlJobPoolNodeList.getLength()==1) --- 134,142 ---- throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlPoolJobProcessorNodeList.getLength() + " element(s) in the pool job controller configuration."); ! logger.trace("Finished reading the pool job processor configuration"); /** * Load job pool configuration. */ + logger.trace("Started reading the job pool configuration"); NodeList xmlJobPoolNodeList=controllerConfigElement.getElementsByTagName(XMLPoolJobControllerConfig.POOL_JOB_POOL_ELEMENT_NAME); if(xmlJobPoolNodeList.getLength()==1) *************** *** 152,156 **** throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlJobPoolNodeList.getLength() + " element(s) in the pool job controller configuration."); ! logger.trace("Exiting Constructor"); } --- 155,159 ---- throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlJobPoolNodeList.getLength() + " element(s) in the pool job controller configuration."); ! logger.trace("Finished reading the job pool configuration"); logger.trace("Exiting Constructor"); } Index: XMLJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XMLJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.6 --- XMLJobControllerConfig.java 14 Mar 2006 23:05:25 -0000 1.7 *************** *** 69,72 **** --- 69,74 ---- String controllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); + logger.debug("Controller class name = " + controllerClassName); + if(controllerClassName==null) throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME *************** *** 77,80 **** --- 79,84 ---- { String controllerConfigClassName=FrameworkConfig.getInstance().getJobControllerConfig().getConfigClassName(controllerClassName, XMLJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME); + logger.debug("Controller configuration class name = " + controllerConfigClassName); + if(controllerConfigClassName==null) throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, Index: XMLJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfigFactory.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLJobConfigFactory.java 14 Mar 2006 05:47:15 -0000 1.7 --- XMLJobConfigFactory.java 14 Mar 2006 23:05:25 -0000 1.8 *************** *** 141,145 **** else { ! logger.debug("Would be able to read the configuration from class path : " + classpathLocation); if(!this.createBatchConfigElement(inputStream)) throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, --- 141,145 ---- else { ! logger.debug("Would be able to read the configuration from class path location : " + classpathLocation); if(!this.createBatchConfigElement(inputStream)) throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, *************** *** 149,153 **** } } ! logger.trace("ExitingConstructor"); } --- 149,153 ---- } } ! logger.trace("Exiting Constructor"); } *************** *** 166,170 **** public JobConfig getJobConfig(String jobName) { ! logger.trace("Entering getJobConfig"); JobConfig jobConfig=null; /** --- 166,170 ---- public JobConfig getJobConfig(String jobName) { ! logger.trace("Entering getJobConfig " + jobName); JobConfig jobConfig=null; /** *************** *** 179,182 **** --- 179,183 ---- NodeList jobConfigNodeList=this.batchConfigElement.getElementsByTagName(XMLJobConfig.JOB_CONFIG_ELEMENT_NAME); + logger.trace("Number of job-config elements found in job configuration file = " + jobConfigNodeList.getLength()); for(int i=0;i<jobConfigNodeList.getLength();i++) { *************** *** 185,188 **** --- 186,190 ---- if(jobName.equals(elementJobName)) { + logger.trace("Found the job-config matching the job name"); jobConfig=new XMLJobConfig(jobConfigElement); break; Index: XMLBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLBasicJobControllerConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLBasicJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 --- XMLBasicJobControllerConfig.java 14 Mar 2006 23:05:25 -0000 1.8 *************** *** 71,74 **** --- 71,75 ---- FrameworkUtil.loadPropertiesFromElementToMap(controllerConfigElement, this.jobControllerConfigProps); + logger.trace("Started reading the basic job processor configuration"); NodeList xmlBasicJobProcessorNodeList=controllerConfigElement.getElementsByTagName(XMLBasicJobControllerConfig.BASIC_JOB_PROCESSOR_ELEMENT_NAME); if(xmlBasicJobProcessorNodeList.getLength()==1) *************** *** 88,92 **** throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlBasicJobProcessorNodeList.getLength() + " element(s) in the basic job controller configuration."); ! logger.trace("Exiting Constructor"); } --- 89,94 ---- throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Found " + xmlBasicJobProcessorNodeList.getLength() + " element(s) in the basic job controller configuration."); ! logger.trace("Finished reading the basic job processor configuration"); ! logger.trace("Exiting Constructor"); } |
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19554 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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DBJobConfig.java 14 Mar 2006 05:47:15 -0000 1.4 --- DBJobConfig.java 14 Mar 2006 23:04:09 -0000 1.5 *************** *** 59,65 **** DBJobConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor"); this.jobName=jobName; ! try { --- 59,65 ---- DBJobConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor " + jobName); this.jobName=jobName; ! logger.debug("Job Name = " + this.jobName); try { *************** *** 71,76 **** --- 71,79 ---- int status=resultSet.getInt(1); this.jobStatus=(status==1?true:false); + logger.debug("Job Status = " + this.jobStatus); this.jobLoggingConfig=new DBJobLoggingConfig(jobName, connection); + logger.debug("Job Logging configuration = " + this.jobLoggingConfig); this.jobControllerConfig=DBJobControllerConfig.getJobControllerConfig(jobName, connection); + logger.debug("Job Controller configuration = " + this.jobControllerConfig); } else *************** *** 79,82 **** --- 82,86 ---- * How can this is possible? Just now.. I could see this entry in job_config. */ + logger.error("Could not find entry in job_config with job name " + jobName); throw new IllegalStateException("Surprisingly.. Could not find entry in job_config with job_name " + jobName); } Index: DBJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobConfigFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DBJobConfigFactory.java 14 Mar 2006 05:47:15 -0000 1.5 --- DBJobConfigFactory.java 14 Mar 2006 23:04:09 -0000 1.6 *************** *** 131,135 **** public JobConfig getJobConfig(String jobName) { ! logger.trace("Entering getJobConfig"); JobConfig jobConfig=null; if(jobName==null) --- 131,135 ---- public JobConfig getJobConfig(String jobName) { ! logger.trace("Entering getJobConfig " + jobName); JobConfig jobConfig=null; if(jobName==null) *************** *** 149,156 **** --- 149,161 ---- if(resultSet.next()) { + logger.debug("Job found in database configuration"); jobConfig=new DBJobConfig(jobName,connection); + logger.trace("Would be able to read the job configuration from database"); } else + { jobConfig=null; + logger.error("Could not find an entry in table job_config with the job name " + jobName); + } } catch(SQLException exception) Index: DBBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBBasicJobControllerConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DBBasicJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 --- DBBasicJobControllerConfig.java 14 Mar 2006 23:04:09 -0000 1.8 *************** *** 65,69 **** public DBBasicJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor"); try { --- 65,69 ---- public DBBasicJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor " + jobName); try { *************** *** 75,78 **** --- 75,79 ---- this.jobControllerClassName=jobConfigResultSet.getString(1); String controllerConfigProps=jobConfigResultSet.getString(2); + logger.debug("controller configuration props = " + controllerConfigProps); if(controllerConfigProps!=null) FrameworkUtil.loadPropertiesFromStringToMap(controllerConfigProps, this.jobControllerConfigProps); *************** *** 85,89 **** logger.error("Job configuration not found with the name " + jobName); } ! PreparedStatement controllerConfigStatement=connection.prepareStatement(DBBasicJobControllerConfig.BASIC_JOB_CONTROLLER_CONFIG_QUERY); controllerConfigStatement.setString(1,jobName); --- 86,90 ---- logger.error("Job configuration not found with the name " + jobName); } ! logger.trace("Started loading basic job processor configuration"); PreparedStatement controllerConfigStatement=connection.prepareStatement(DBBasicJobControllerConfig.BASIC_JOB_CONTROLLER_CONFIG_QUERY); controllerConfigStatement.setString(1,jobName); *************** *** 101,104 **** --- 102,106 ---- throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Controller configuration is not defined for the job " + jobName); } + logger.trace("Finished loading basic job processor configuration"); } catch(SQLException exception) Index: DBPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBPoolJobControllerConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DBPoolJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 --- DBPoolJobControllerConfig.java 14 Mar 2006 23:04:09 -0000 1.8 *************** *** 72,76 **** public DBPoolJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor"); try { --- 72,76 ---- public DBPoolJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor " + jobName); try { *************** *** 93,96 **** --- 93,97 ---- } + logger.trace("Started loading pool job controller configuration"); PreparedStatement controllerConfigStatement=connection.prepareStatement(DBPoolJobControllerConfig.POOL_JOB_CONTROLLER_CONFIG_QUERY); controllerConfigStatement.setString(1,jobName); *************** *** 118,121 **** --- 119,123 ---- throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "Controller configuration is not defined for the job " + jobName + "."); } + logger.trace("Finished loading pool job controller configuration"); } catch(SQLException exception) Index: DBJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DBJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.5 --- DBJobControllerConfig.java 14 Mar 2006 23:04:09 -0000 1.6 *************** *** 58,62 **** public static JobControllerConfig getJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering getJobControllerConfig"); JobControllerConfig controllerConfig=null; --- 58,62 ---- public static JobControllerConfig getJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering getJobControllerConfig " + jobName); JobControllerConfig controllerConfig=null; *************** *** 69,76 **** { String controllerClassName=resultSet.getString(1); try { 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 + "."); --- 69,78 ---- { String controllerClassName=resultSet.getString(1); + logger.debug("Controller class name = " + controllerClassName); try { String controllerConfigClassName=FrameworkConfig.getInstance().getJobControllerConfig().getConfigClassName(controllerClassName, DBJobControllerConfig.JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME); ! logger.debug("Controller config class name = " + controllerConfigClassName); ! 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 + "."); |
From: Suresh <sur...@us...> - 2006-03-14 23:02:31
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18605 Modified Files: ConfigurationException.java framework-config.xml framework-config.xsd FrameworkConfig.java Log Message: no message Index: framework-config.xsd =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xsd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** framework-config.xsd 13 Mar 2006 14:32:37 -0000 1.1 --- framework-config.xsd 14 Mar 2006 23:02:19 -0000 1.2 *************** *** 6,10 **** <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"/> --- 6,10 ---- <xsd:complexType name="FrameworkConfigType"> <xsd:element name="job-config-factory-config" type="JobConfigFactoryConfigType"/> ! <xsd:element name="framework-logging-config" type="FrameworkLoggingConfigType"/> <xsd:element name="repository-config" type="RepositoryConfigType"/> <xsd:element name="mgmt-mntr-config" type="MgmtMntrConfigType"/> *************** *** 18,24 **** </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> --- 18,25 ---- </xsd:complexType> ! <xsd:complexType name="FrameworkLoggingConfigType"> ! <xsd:attribute name="framework-logging-level" type="LogLevelType" use="required"/> ! <xsd:attribute name="job-logging-direcotry" type="xsd:string" use="required"/> ! <xsd:attribute name="job-logging-level" type="LogLevelType" use="required"/> <xsd:attribute name="job-base-package-name" type="xsd:string" use="required"/> </xsd:complexType> *************** *** 54,58 **** --- 55,63 ---- <xsd:simpleType name="LogLevelType"> <xsd:restriction base="xsd:string"> + <xsd:enumeration value="ALL"/> + <xsd:enumeration value="TRACE"/> <xsd:enumeration value="DEBUG"/> + <xsd:enumeration value="INFO"/> + <xsd:enumeration value="WARN"/> <xsd:enumeration value="ERROR"/> </xsd:restriction> Index: framework-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/framework-config.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** framework-config.xml 14 Mar 2006 05:45:25 -0000 1.11 --- framework-config.xml 14 Mar 2006 23:02:19 -0000 1.12 *************** *** 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> --- 18,23 ---- <property key="repository-filename">batchserver_repository.db</property> </repository-config> ! <framework-logging-config framework-logging-level="DEBUG" job-logging-directory="/batchserver/logs" ! job-base-package-name="com.mycompany.batch" job-logging-level="INFO"/> <mgmt-mntr-config mgmt-mntr-class-name="org.jmonks.batchserver.framework.mgmtmntr.DefaultMgmtMntrManager"> <property key="port-range">15000-20000</property> Index: FrameworkConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/FrameworkConfig.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FrameworkConfig.java 14 Mar 2006 05:45:25 -0000 1.8 --- FrameworkConfig.java 14 Mar 2006 23:02:19 -0000 1.9 *************** *** 61,67 **** private JobConfigFactoryConfig configFactoryConfig=null; /** ! * LoggingConfig variable to hold the LoggingConfig object. */ ! private LoggingConfig logginConfig=null; /** * MgmtMntrConfig variable to hold the MgmtMntrConfig object. --- 61,67 ---- private JobConfigFactoryConfig configFactoryConfig=null; /** ! * FrameworkLoggingConfig variable to hold the FrameworkLoggingConfig object. */ ! private FrameworkLoggingConfig frameworkLoggingConfig=null; /** * MgmtMntrConfig variable to hold the MgmtMntrConfig object. *************** *** 77,87 **** private JobControllerConfig controllerConfig=null; ! /** * Private constructor to make sure FrameworkCongi cannot be instantiated. This will * read the framework configuration file and create the instances of of JobConfigFactoryConfig, ! * LoggingConfig, MgmtMntrConfig and RepositoryConfig by passing the correct DOM elements to their * constructors. This does the validation of configuration file against the defined XML schema file. * In case of errors it throws the ConfigurationException with the correct error code. ! * * @throws RuntimeException If framework configuration file is not properly formed and validation is failed. * @throws ConfigurationException If configuration file could not be found. --- 77,88 ---- private JobControllerConfig controllerConfig=null; ! /** ! * * Private constructor to make sure FrameworkCongi cannot be instantiated. This will * read the framework configuration file and create the instances of of JobConfigFactoryConfig, ! * FrameworkLoggingConfig, MgmtMntrConfig and RepositoryConfig by passing the correct DOM elements to their * constructors. This does the validation of configuration file against the defined XML schema file. * In case of errors it throws the ConfigurationException with the correct error code. ! * * @throws RuntimeException If framework configuration file is not properly formed and validation is failed. * @throws ConfigurationException If configuration file could not be found. *************** *** 130,144 **** } 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) { ! this.logginConfig=new LoggingConfig(((Element)loggingConfigNodeList.item(0))); } 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.debug("Logging configuration has been loaded and the configuration is : " + this.logginConfig); NodeList mgmtMntrConfigNodeList=frameworkConfigElement.getElementsByTagName(MgmtMntrConfig.TAG_NAME); if(mgmtMntrConfigNodeList.getLength()==1) --- 131,145 ---- } logger.debug("Job Config Factory configuration has been loaded and the configuration is : " + this.configFactoryConfig); ! NodeList loggingConfigNodeList=frameworkConfigElement.getElementsByTagName(FrameworkLoggingConfig.TAG_NAME); if(loggingConfigNodeList.getLength()==1) { ! this.frameworkLoggingConfig=new FrameworkLoggingConfig(((Element)loggingConfigNodeList.item(0))); } else { throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Found " + loggingConfigNodeList.getLength() + " " + ! FrameworkLoggingConfig.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.frameworkLoggingConfig); NodeList mgmtMntrConfigNodeList=frameworkConfigElement.getElementsByTagName(MgmtMntrConfig.TAG_NAME); if(mgmtMntrConfigNodeList.getLength()==1) *************** *** 178,181 **** --- 179,183 ---- { ioException.printStackTrace(); + logger.error(ioException.getMessage(),ioException); throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, ioException.getMessage()); } *************** *** 183,186 **** --- 185,189 ---- { parserConfigException.printStackTrace(); + logger.error(parserConfigException.getMessage(), parserConfigException); throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, parserConfigException.getMessage()); } *************** *** 188,191 **** --- 191,195 ---- { saxException.printStackTrace(); + logger.error(saxException.getMessage(), saxException); throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, saxException.getMessage()); } *************** *** 215,225 **** /** ! * Returns the logging configuration defined in the framework configuration as a LoggingConfig object. ! * ! * @return Returns the LoggingConfig object. */ ! public LoggingConfig getLoggingConfig() { ! return this.logginConfig; } --- 219,229 ---- /** ! * Returns the logging configuration defined in the framework configuration as a FrameworkLoggingConfig object. ! * ! * @return Returns the FrameworkLoggingConfig object. */ ! public FrameworkLoggingConfig getFrameworkLoggingConfig() { ! return this.frameworkLoggingConfig; } *************** *** 358,365 **** /** * <p> ! * LoggingConfig class holds configuration required to enable the framework logging * by LoggingManager. This configuration would be like the directory needs to write ! * job log files and logging level and base package name to be used to create the ! * logging handlers. This class can be accessed by all the classes in the framework * but cannot be instantiated outside of this class. * </p> --- 362,370 ---- /** * <p> ! * FrameworkLoggingConfig class holds configuration required to enable the framework logging * by LoggingManager. This configuration would be like the directory needs to write ! * job log files and logging level of the framework logs and job logs and base package name ! * to be used to create the logging handlers. ! * This class can be accessed by all the classes in the framework * but cannot be instantiated outside of this class. * </p> *************** *** 368,406 **** * <br><br> * <pre> ! * <logging-config logging-direcotry="/batchserver/logs" logging-level="DEBUG" job-base-package-name="com.mycompany.batch"/> * </pre> * </p> */ ! public class LoggingConfig { /** * Tag name represents the logging config in framework configuration file. */ ! private static final String TAG_NAME = "logging-config"; /** ! * 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. */ ! private static final String BASE_PACKAGE_ATTRIB_NAME = "job-base-package-name"; /** * Direcotry where all the log files needs to be written. */ ! private String loggingDirectory=null; /** ! * Logging level. */ ! private String loggingLevel="ERROR"; /** * Base package name of the application(job). */ ! private String basePackageName=null; /** --- 373,420 ---- * <br><br> * <pre> ! * <framework-logging-config framework-logging-level="DEBUG" job-logging-direcotry="/batchserver/logs" ! * job-base-package-name="com.mycompany.batch" job-logging-level="DEBUG"/> * </pre> * </p> */ ! public class FrameworkLoggingConfig { /** * Tag name represents the logging config in framework configuration file. */ ! private static final String TAG_NAME = "framework-logging-config"; /** ! * Attribute name defines the framework logging level. ! */ ! private static final String FRAMEWORK_LOGGING_LEVEL_ATTRIB_NAME = "framework-logging-level"; ! /** ! * Attribute name defines the job logging directory. */ ! private static final String JOB_LOGGING_DIRECTORY_ATTRIB_NAME = "job-logging-directory"; /** ! * Attribute name defines the job logging level. */ ! private static final String JOB_LOGGING_LEVEL_ATTRIB_NAME = "job-logging-level"; /** ! * Attribute name defines the job base package name. */ ! private static final String JOB_BASE_PACKAGE_ATTRIB_NAME = "job-base-package-name"; ! /** ! * Framework logging level. ! */ ! private String frameworkLoggingLevel="DEBUG"; /** * Direcotry where all the log files needs to be written. */ ! private String jobLoggingDirectory=null; /** ! * Job logging level. */ ! private String jobLoggingLevel="ERROR"; /** * Base package name of the application(job). */ ! private String jobBasePackageName=null; /** *************** *** 411,445 **** * @param loggingConfigElement DOM Element represents <logging-config> tag in framework configuration file. */ ! private LoggingConfig(Element loggingConfigElement) { logger.trace("Entering LoggingConfig 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.basePackageName=loggingConfigElement.getAttribute(LoggingConfig.BASE_PACKAGE_ATTRIB_NAME); logger.trace("Exiting LoggingConfig Constructor"); } /** ! * Returns the logging directory name, where to all the job logs needs to be written. * * @return Returns the logging directory name. */ ! public String getLoggingDirecotry() { ! return this.loggingDirectory; } /** ! * Returns the log level to use for the logging. * * @return Returns the log level. */ ! public String getFrameworkLogLevel() { ! return this.loggingLevel; } --- 425,476 ---- * @param loggingConfigElement DOM Element represents <logging-config> tag in framework configuration file. */ ! private FrameworkLoggingConfig(Element loggingConfigElement) { logger.trace("Entering LoggingConfig Constructor"); ! this.jobLoggingDirectory=loggingConfigElement.getAttribute(FrameworkLoggingConfig.JOB_LOGGING_DIRECTORY_ATTRIB_NAME); ! if(jobLoggingDirectory==null || "".equals(jobLoggingDirectory)) ! throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, FrameworkLoggingConfig.JOB_LOGGING_DIRECTORY_ATTRIB_NAME + " attribute value cannot be null."); ! this.frameworkLoggingLevel=loggingConfigElement.getAttribute(FrameworkLoggingConfig.FRAMEWORK_LOGGING_LEVEL_ATTRIB_NAME); ! if(this.frameworkLoggingLevel== null || "".equals(this.frameworkLoggingLevel)) ! this.frameworkLoggingLevel="DEBUG"; ! ! this.jobLoggingLevel=loggingConfigElement.getAttribute(FrameworkLoggingConfig.JOB_LOGGING_LEVEL_ATTRIB_NAME); ! if(this.jobLoggingLevel== null || "".equals(this.jobLoggingLevel)) ! this.jobLoggingLevel="ERROR"; ! ! this.jobBasePackageName=loggingConfigElement.getAttribute(FrameworkLoggingConfig.JOB_BASE_PACKAGE_ATTRIB_NAME); logger.trace("Exiting LoggingConfig Constructor"); } /** ! * Returns the job logging directory name, where to all the job logs needs to be written. * * @return Returns the logging directory name. */ ! public String getJobLoggingDirecotry() { ! return this.jobLoggingDirectory; } /** ! * Returns the framework log level to use for the logging. * * @return Returns the log level. */ ! public String getFrameworkLoggingLevel() { ! return this.frameworkLoggingLevel; ! } ! ! /** ! * Returns the job log level to use for the logging. ! * ! * @return Returns the log level. ! */ ! public String getJobLoggingLevel() ! { ! return this.jobLoggingLevel; } *************** *** 450,472 **** * @return Returns the jobs base package name. */ ! public String getBasePackageName() { ! return this.basePackageName; } /** * <p> ! * Returns the string representation of LoggingConfig class in the format ! * <br> {LoggingConfig [loggingDirectory = value] [loggingLevel = value] [basePackageName = value]} * </p> ! * ! * @return Returns the string representation of LoggingConfig. */ public String toString() { StringBuffer stringValue=new StringBuffer("{LoggingConfig "); ! stringValue.append("[loggingDirectory = " + this.loggingDirectory + "]"); ! stringValue.append("[loggingLevel = " + this.loggingLevel + "]"); ! stringValue.append("[basePackageName = " + this.basePackageName + "]"); stringValue.append("}"); return stringValue.toString(); --- 481,505 ---- * @return Returns the jobs base package name. */ ! public String getJobBasePackageName() { ! return this.jobBasePackageName; } /** * <p> ! * Returns the string representation of FrameworkLoggingConfig class in the format ! * <br> {FrameworkLoggingConfig [jobLoggingDirectory = value] [frameworkLoggingLevel = value] ! * [jobBasePackageName = value] [jobLoggingLevel = value]} * </p> ! * ! * @return Returns the string representation of FrameworkLoggingConfig. */ public String toString() { StringBuffer stringValue=new StringBuffer("{LoggingConfig "); ! stringValue.append("[jobLoggingDirectory = " + this.jobLoggingDirectory + "]"); ! stringValue.append("[frameworkLoggingLevel = " + this.frameworkLoggingLevel + "]"); ! stringValue.append("[jobBasePackageName = " + this.jobBasePackageName + "]"); ! stringValue.append("[jobLoggingLevel = " + this.jobLoggingLevel + "]"); stringValue.append("}"); return stringValue.toString(); *************** *** 776,780 **** * <p> * Returns the string representation of FrameworkConfig class in the format ! * <br> {FrameworkConfig [jobConfigFactoryConfig = value] [loggingConfig = value] * [mgmtMntrConfig = value] [repositoryConfig = value][controllerConfig = value]} * </p> --- 809,813 ---- * <p> * Returns the string representation of FrameworkConfig class in the format ! * <br> {FrameworkConfig [jobConfigFactoryConfig = value] [frameworkLoggingConfig = value] * [mgmtMntrConfig = value] [repositoryConfig = value][controllerConfig = value]} * </p> *************** *** 786,790 **** StringBuffer stringValue=new StringBuffer("{FrameworkConfig "); stringValue.append("[jobConfigFactoryConfig = " + this.configFactoryConfig + "]"); ! stringValue.append("[loggingConfig = " + this.logginConfig + "]"); stringValue.append("[mgmtMntrConfig = " + this.mgmtMntrConfig + "]"); stringValue.append("[repositoryConfig = " + this.repositoryConfig + "]"); --- 819,823 ---- StringBuffer stringValue=new StringBuffer("{FrameworkConfig "); stringValue.append("[jobConfigFactoryConfig = " + this.configFactoryConfig + "]"); ! stringValue.append("[frameworkLoggingConfig = " + this.frameworkLoggingConfig + "]"); stringValue.append("[mgmtMntrConfig = " + this.mgmtMntrConfig + "]"); stringValue.append("[repositoryConfig = " + this.repositoryConfig + "]"); Index: ConfigurationException.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/ConfigurationException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConfigurationException.java 13 Mar 2006 14:32:37 -0000 1.5 --- ConfigurationException.java 14 Mar 2006 23:02:19 -0000 1.6 *************** *** 41,44 **** --- 41,48 ---- */ public static final String LOGGING_CONFIG = "logging-config"; + /** + * Constant defines the source of repository config component. + */ + public static final String REPOSITORY_CONFIG = "repository-config"; |
From: Suresh <sur...@us...> - 2006-03-14 23:01:22
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18019 Modified Files: DefaultRepository.java LoggingManager.java Repository.java Log Message: no message Index: DefaultRepository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/DefaultRepository.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DefaultRepository.java 4 Mar 2006 04:48:52 -0000 1.2 --- DefaultRepository.java 14 Mar 2006 23:00:57 -0000 1.3 *************** *** 1,18 **** package org.jmonks.batchserver.framework; /** * <p> ! * This implementation of repository uses the DB4O database as the repository. It expects the following two properties present in the repository configuration in framework-cofig.xml file. * <br><br> * <pre> ! * <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> * </pre> * <br><br> ! * Here repository-location defines where the DB4O database needs to be created and repository-filename defines the name of the file to be used as the repository. ! * * </p> * @author Suresh Pragada --- 1,26 ---- package org.jmonks.batchserver.framework; + import java.util.HashMap; + import java.util.Map; + import org.apache.log4j.Logger; + import org.jmonks.batchserver.framework.controller.JobController; + /** * <p> ! * This implementation of repository uses the DB4O database as the repository. ! * It expects the two properties repository-location and repository-filename present in the repository configuration ! * in framework-cofig.xml file. * <br><br> * <pre> ! * <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> * </pre> * <br><br> ! * Here repository-location defines where the DB4O database needs to be created and ! * repository-filename defines the name of the file to be used as the repository. ! * By default framework will be configured with the values shown in the above XML configuration snippet. * </p> * @author Suresh Pragada *************** *** 20,27 **** * @since 1.0 */ ! public abstract class DefaultRepository extends Repository { ! private DefaultRepository(java.util.Map configProps) { } --- 28,43 ---- * @since 1.0 */ ! public class DefaultRepository extends Repository { ! private Map repositoryConfigProperties=null; ! ! private static Logger logger=Logger.getLogger(DefaultRepository.class); ! ! /** ! * ! */ ! public DefaultRepository(Map configProps) { + this.repositoryConfigProperties=new HashMap(configProps); } *************** *** 30,34 **** */ public boolean logStatistics(org.jmonks.batchserver.framework.JobStatistics statistics) - { return true; --- 46,49 ---- *************** *** 40,44 **** */ public boolean sendDatatoNextJob(String srcJN, String srcCmp, String tgtJN, String tgtCmp, Object data) - { return true; --- 55,58 ---- *************** *** 50,54 **** */ public Object getDataFromPreviousJob(String srcJN, String srcCmp, String tgtJN, String tgtCmp) - { return null; --- 64,67 ---- *************** *** 60,64 **** */ public boolean registerJobMgmtMntrInfo(String jobName, Object registrationInfo) - { return true; --- 73,76 ---- *************** *** 70,74 **** */ public Object lookupJobMgmtMntrInfo(String jobName) - { return null; --- 82,85 ---- *************** *** 80,84 **** */ public boolean unregisterJobMgmtMntrInfo(String jobName) - { return true; --- 91,94 ---- *************** *** 89,94 **** * @see org.jmonks.batchserver.framework.Repository#getStatistics(String) */ ! public org.jmonks.batchserver.framework.JobStatistics[] getStatistics(String jobName) ! { return null; --- 99,103 ---- * @see org.jmonks.batchserver.framework.Repository#getStatistics(String) */ ! public JobStatistics[] getStatistics(String jobName) { return null; *************** *** 99,104 **** * @see org.jmonks.batchserver.framework.Repository#saveController(org.jmonks.batchserver.framework.controller.JobController,String) */ ! public boolean saveController(org.jmonks.batchserver.framework.controller.JobController controller, String jobName) ! { return true; --- 108,112 ---- * @see org.jmonks.batchserver.framework.Repository#saveController(org.jmonks.batchserver.framework.controller.JobController,String) */ ! public boolean saveController(String jobName, JobController controller) { return true; *************** *** 109,114 **** * @see org.jmonks.batchserver.framework.Repository#loadController(String) */ ! public org.jmonks.batchserver.framework.controller.JobController loadController(String jobName) ! { return null; --- 117,121 ---- * @see org.jmonks.batchserver.framework.Repository#loadController(String) */ ! public JobController loadController(String jobName) { return null; *************** *** 120,124 **** */ public boolean releaseController(String jobName) - { return true; --- 127,130 ---- Index: Repository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/Repository.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Repository.java 4 Mar 2006 04:48:52 -0000 1.2 --- Repository.java 14 Mar 2006 23:00:57 -0000 1.3 *************** *** 1,13 **** package org.jmonks.batchserver.framework; import org.jmonks.batchserver.framework.config.*; ! import org.jmonks.batchserver.framework.controller.*; /** * <p> ! * Repository provides utility methods to access and use the repository. ! * There could be differnt implementations of the repository. Framework ! * configuration defines which implementation should be used for this framework. ! * This povides utility methods to logs the job statistics and persist any objects, * transfer some information between the jobs and transfer some management and monitor * information between framework and server. --- 1,18 ---- package org.jmonks.batchserver.framework; + import java.lang.reflect.Constructor; + import java.lang.reflect.InvocationTargetException; + import java.util.Map; + import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.*; ! import org.jmonks.batchserver.framework.controller.JobController; ! /** * <p> ! * Repository provides utility methods to access and use the repository maintained ! * by the framework. There could be differnt implementations of the repository. ! * Framework configuration defines which implementation should be used for this framework. ! * This povides utility methods to logs the job statistics and persist job controllers, * transfer some information between the jobs and transfer some management and monitor * information between framework and server. *************** *** 20,69 **** { protected Repository() { } ! public static void getRepository(org.jmonks.batchserver.framework.config.FrameworkConfig.RepositoryConfig config) { } /** ! * This method logs the job statistics given in the form JobStatistics object ! * in the repository for further use. * * @param statistics Job Statistics object which holds all the statistics related to that job. * ! * @return Returns true if statistics can be logged, false, otherwise. */ ! public abstract boolean logStatistics(org.jmonks.batchserver.framework.JobStatistics statistics); /** ! * Given data will be sent to the specified job behalf of this job. * ! * @param srcJN Name of the source job. ! * @param srcCmp Name of the source componenet. ! * @param tgtJN Name of the target job. ! * @param tgtCmp Name of the target component. ! * @param data data that needs to be sent as the object. * * @return Returns true, if it could save the data to be sent to the next job. */ ! public abstract boolean sendDatatoNextJob(String srcJN, String srcCmp, String tgtJN, String tgtCmp, Object data); /** ! * Gets the data that has been sent to this job. * ! * @param srcJN Name of the source job. ! * @param srcCmp Name of the source componenet. ! * @param tgtJN Name of the target job. ! * @param tgtCmp Name of the target component. * ! * @return Returns the data, null, it it couldnt find any data. */ ! public abstract Object getDataFromPreviousJob(String srcJN, String srcCmp, String tgtJN, String tgtCmp); /** * Registers the job management and monitoring info with the given job name. * ! * @param jobName Name of the job. * @param registrationInfo Information to be associated with this job name. * --- 25,151 ---- { + private static Logger logger=Logger.getLogger(Repository.class); + + /** + * Protected constructor to make sure Repository cannot be instantiated + * other than extending this class. + */ protected Repository() { } ! ! /** ! * Factory method returns the specific implementation of repository based on the ! * repository configuration. ! * ! * @param repositoryConfig Repository configuration object. ! * ! * @throws ConfigurationException If repositoryClassName is missing or invalid ! * or it cannot be instantiated because of the lack of mandatory properties required ! * by the specific repository implementations. ! * @throws IllegalArgumentException If input repositoryConfig is null. ! */ ! public static Repository getRepository(FrameworkConfig.RepositoryConfig repositoryConfig) { + logger.trace("Entering getRepository"); + + if(repositoryConfig==null) + throw new IllegalArgumentException("repository configuration object cannot be null."); + + String repositoryClassName=repositoryConfig.getRepositoryClassName(); + if(repositoryClassName==null || "".equals(repositoryClassName)) + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "repository class name is not defined in repository configuration"); + logger.debug("repository class name = " + repositoryClassName); + + Repository repository=null; + + try + { + Class repositoryClass=Class.forName(repositoryClassName); + Constructor repositoryConstructor=repositoryClass.getConstructor(new Class[]{Map.class}); + repository=(Repository)repositoryConstructor.newInstance(new Object[]{repositoryConfig.getRepositoryConfigProperties()}); + logger.debug("created the repository implemenation class"); + } + catch(ClassNotFoundException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); + } + catch(NoSuchMethodException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); + } + catch(InstantiationException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); + } + catch(IllegalAccessException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); + } + catch(InvocationTargetException exception) + { + exception.printStackTrace(); + logger.error(exception.getMessage(),exception); + throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); + } + + logger.trace("Exiting getRepository"); + return repository; } /** ! * Logs the job statistics given in the form of JobStatistics object ! * in the repository for further use/reference. * * @param statistics Job Statistics object which holds all the statistics related to that job. * ! * @return Returns true if statistics can be logged into repository, false, otherwise. */ ! public abstract boolean logStatistics(JobStatistics statistics); /** ! * Data will be sent to the specified component of the specified ! * job behalf of the specific component from specific job. * ! * @param sourceJobName Name of the source job. ! * @param sourceComponent Name of the source componenet. ! * @param targetJobName Name of the target job. ! * @param targetComponent Name of the target component. ! * @param data Data that needs to be sent as the object. * * @return Returns true, if it could save the data to be sent to the next job. */ ! public abstract boolean sendDatatoNextJob(String sourceJobName, String sourceComponent, ! String targetJobName, String targetComponent, Object data); /** ! * Gets the data that has been sent to this component of this job from ! * specific component of specific job. * ! * @param sourceJobName Name of the source job. ! * @param sourceComponent Name of the source componenet. ! * @param targetJobName Name of the target job. ! * @param targetComponent Name of the target component. * ! * @return Returns the data, null, if it couldnt find any data. */ ! public abstract Object getDataFromPreviousJob(String sourceJobName, String sourceComponent, ! String targetJobName, String targetComponent); /** * Registers the job management and monitoring info with the given job name. + * If there is an association with this job name existing, that information + * will be overriden. This could happen, if job forgot to unregister the + * management and monitoring information. * ! * @param jobName Name of the job. * @param registrationInfo Information to be associated with this job name. * *************** *** 96,100 **** * @return Returns the array of JobStatistics object, null, if it couldnt find any job with that name. */ ! public abstract org.jmonks.batchserver.framework.JobStatistics[] getStatistics(String jobName); /** --- 178,182 ---- * @return Returns the array of JobStatistics object, null, if it couldnt find any job with that name. */ ! public abstract JobStatistics[] getStatistics(String jobName); /** *************** *** 108,112 **** * @return Returns true, if it could persist the controller, false, otherwise. */ ! public abstract boolean saveController(org.jmonks.batchserver.framework.controller.JobController controller, String jobName); /** --- 190,194 ---- * @return Returns true, if it could persist the controller, false, otherwise. */ ! public abstract boolean saveController(String jobName, JobController controller); /** *************** *** 118,122 **** * @return Returns the controller object, null, if it couldnt find any. */ ! public abstract org.jmonks.batchserver.framework.controller.JobController loadController(String jobName); /** --- 200,204 ---- * @return Returns the controller object, null, if it couldnt find any. */ ! public abstract JobController loadController(String jobName); /** Index: LoggingManager.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/LoggingManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LoggingManager.java 14 Mar 2006 05:46:33 -0000 1.4 --- LoggingManager.java 14 Mar 2006 23:00:57 -0000 1.5 *************** *** 44,49 **** * Standard pattern expression used for all the log files. */ ! public static final String DEFAULT_MESSAGE_PATTERN = "%-5p [%t]: %m%n"; private LoggingManager() { --- 44,52 ---- * Standard pattern expression used for all the log files. */ ! public static final String DEFAULT_MESSAGE_PATTERN = "%5p [%d{ISO8601}] [%t - %C] %m%n"; + /** + * Private constructor to make sure LoggingManager will not be instantiated. + */ private LoggingManager() { *************** *** 60,64 **** * <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> --- 63,67 ---- * <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 to the root logger and set the log level to the defined in framework configuration. * <li>Access the defined loggers at job level and set the level for those loggers. * </ul> *************** *** 72,76 **** * </p> */ ! public static void initializeJobLogging(String jobName, FrameworkConfig.LoggingConfig frameworkLoggingConfig,JobLoggingConfig jobLoggingConfig) { if(jobName==null) --- 75,79 ---- * </p> */ ! public static void initializeJobLogging(String jobName, FrameworkConfig.FrameworkLoggingConfig frameworkLoggingConfig,JobLoggingConfig jobLoggingConfig) { if(jobName==null) *************** *** 80,88 **** 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) { --- 83,110 ---- throw new IllegalArgumentException("framework logging config object cannot be null to establish the job logging service."); ! File loggingDirecotry=new File(frameworkLoggingConfig.getJobLoggingDirecotry()+File.separator+jobName); LoggingManager.createDirectory(loggingDirecotry); String completeFileName=loggingDirecotry.getAbsolutePath()+File.separator+ ! jobName+"_"+new SimpleDateFormat("yyyyMMdd_HHmmss_S").format(Calendar.getInstance().getTime())+".log"; ! ! PatternLayout layout=new PatternLayout(LoggingManager.DEFAULT_MESSAGE_PATTERN); ! RollingFileAppender fileAppender=null; ! try ! { ! fileAppender=new RollingFileAppender(layout,completeFileName); ! } ! catch(IOException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG, exception.getMessage()); ! } ! ! fileAppender.setMaxFileSize("10MB"); ! fileAppender.activateOptions(); ! Logger rootLogger=LogManager.getRootLogger(); ! rootLogger.removeAllAppenders(); ! rootLogger.addAppender(fileAppender); ! rootLogger.setLevel(Level.toLevel(frameworkLoggingConfig.getJobLoggingLevel())); ! if(jobLoggingConfig!=null) { *************** *** 99,103 **** /** * 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. --- 121,126 ---- /** * Initializes the logging of the framework in the directory defined in framework configuration. ! * After initialized the job logging framework logging will be send to the job and framwork ! * log files. * * @param frameworkLoggingConfig Framework logging configuration object. *************** *** 105,114 **** * @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); } --- 128,157 ---- * @throws ConfigurationException If logging directory cannot be created. */ ! public static void initializeFrameworkLogging(FrameworkConfig.FrameworkLoggingConfig frameworkLoggingConfig) { ! File loggingDirecotry=new File(frameworkLoggingConfig.getJobLoggingDirecotry()); LoggingManager.createDirectory(loggingDirecotry); String completeFileName=loggingDirecotry.getAbsolutePath()+File.separator+LoggingManager.FRAMEWORK_LOGGING_FILE; ! ! PatternLayout layout=new PatternLayout(LoggingManager.DEFAULT_MESSAGE_PATTERN); ! RollingFileAppender fileAppender=null; ! try ! { ! fileAppender=new RollingFileAppender(layout,completeFileName,true); ! } ! catch(IOException exception) ! { ! exception.printStackTrace(); ! throw new ConfigurationException(ConfigurationException.LOGGING_CONFIG, exception.getMessage()); ! } ! fileAppender.setMaxFileSize("10MB"); ! fileAppender.activateOptions(); ! Logger rootLogger=LogManager.getRootLogger(); ! rootLogger.removeAllAppenders(); ! ! Logger frameworkLogger=Logger.getLogger("org.jmonks.batchserver.framework"); ! frameworkLogger.addAppender(fileAppender); ! frameworkLogger.setAdditivity(true); ! frameworkLogger.setLevel(Level.toLevel(frameworkLoggingConfig.getFrameworkLoggingLevel())); } *************** *** 130,157 **** } } - - /** - * 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) - { - exception.printStackTrace(); - } - - } } --- 173,175 ---- |
From: Suresh <sur...@us...> - 2006-03-14 17:17:45
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/oracle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15045 Added Files: create_job_logging_config.sql Log Message: no message --- NEW FILE: create_job_logging_config.sql --- -- Creating the table job_logging_config create table JOB_LOGGING_CONFIG ( JOB_NAME VARCHAR2(64) not null, JOB_LOGGER_NAME VARCHAR2(256) not null, JOB_LOGGER_LEVEL VARCHAR2(32) not null ); -- Add comments to the table comment on table JOB_LOGGING_CONFIG is 'Table holds the logging configuration of the job.'; -- Add comments to the columns comment on column JOB_LOGGING_CONFIG.JOB_NAME is 'Column represents the job name.'; comment on column JOB_LOGGING_CONFIG.JOB_LOGGER_NAME is 'Column holds the logger name.'; comment on column JOB_LOGGING_CONFIG.JOB_LOGGER_LEVEL is 'Column holds the logger level.'; -- Create/Recreate primary, unique and foreign key constraints alter table JOB_LOGGING_CONFIG add constraint PK_JOB_LOGGING_CONFIG primary key (JOB_NAME,JOB_LOGGER_NAME); -- Create/Recreate foreign key constraints alter table JOB_LOGGING_CONFIG add constraint FK_JOB_LOGGING_CONFIG foreign key (JOB_NAME) references JOB_CONFIG (JOB_NAME) on delete cascade; |
From: Suresh <sur...@us...> - 2006-03-14 05:47:18
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30780/xml Modified Files: batch-config.xml XMLBasicJobControllerConfig.java XMLJobConfig.java XMLJobConfigFactory.java XMLJobControllerConfig.java XMLPoolJobControllerConfig.java Added Files: XMLJobLoggingConfig.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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XMLJobConfig.java 13 Mar 2006 14:32:37 -0000 1.6 --- XMLJobConfig.java 14 Mar 2006 05:47:15 -0000 1.7 *************** *** 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; --- 10,15 ---- package org.jmonks.batchserver.framework.config.xml; ! ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 54,58 **** public static final String JOB_STATUS_ATTRIBUTE_NAME = "job-status"; ! private static Logger logger=Logger.getLogger(XMLJobConfig.class.getName()); /** --- 55,59 ---- public static final String JOB_STATUS_ATTRIBUTE_NAME = "job-status"; ! private static Logger logger=Logger.getLogger(XMLJobConfig.class); /** *************** *** 66,70 **** XMLJobConfig(Element jobConfigElement) { ! logger.entering(XMLJobConfig.class.getName(),"Constructor"); this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); --- 67,71 ---- XMLJobConfig(Element jobConfigElement) { ! logger.trace("Entering Constructor"); this.jobName=jobConfigElement.getAttribute(XMLJobConfig.JOB_NAME_ATTRIBUTE_NAME); *************** *** 78,81 **** --- 79,93 ---- this.jobStatus=false; } + + NodeList jobLoggingConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobLoggingConfig.JOB_LOGGING_CONFIG_ELEMENT_NAME); + if(jobLoggingConfigNodeList.getLength()==1) + { + Element jobLoggingConfigElement=(Element)jobLoggingConfigNodeList.item(0); + this.jobLoggingConfig=new XMLJobLoggingConfig(jobLoggingConfigElement); + logger.info("Read job logging configuration : " + this.jobLoggingConfig); + } + else + throw new ConfigurationException(ConfigurationException.JOB_CONFIG, "Found " + jobLoggingConfigNodeList.getLength() + + XMLJobLoggingConfig.JOB_LOGGING_CONFIG_ELEMENT_NAME + " element(s) in configuration of job " + jobName + "."); NodeList controllerConfigNodeList=jobConfigElement.getElementsByTagName(XMLJobControllerConfig.JOB_CONTROLLER_ELEMENT_NAME); *************** *** 83,89 **** { 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 --- 95,101 ---- { Element controllerConfigElement=(Element)controllerConfigNodeList.item(0); ! logger.info("Requesting controller config factory to get the controller configuration object"); this.jobControllerConfig=XMLJobControllerConfig.getJobControllerConfig(controllerConfigElement); ! logger.info("Returned controller configuration : " + this.jobControllerConfig); } else *************** *** 91,95 **** + XMLJobControllerConfig.JOB_CONTROLLER_ELEMENT_NAME + " element(s) in configuration of job " + jobName + "."); ! logger.exiting(XMLJobConfig.class.getName(),"Constructor"); } --- 103,107 ---- + XMLJobControllerConfig.JOB_CONTROLLER_ELEMENT_NAME + " element(s) in configuration of job " + jobName + "."); ! logger.trace("Exiting Constructor"); } Index: batch-config.xml =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/batch-config.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** batch-config.xml 13 Mar 2006 14:32:37 -0000 1.3 --- batch-config.xml 14 Mar 2006 05:47:15 -0000 1.4 *************** *** 14,17 **** --- 14,20 ---- <property key="pool-job-controller-restart">true</property> </job-controller> + <job-logging-config> + <job-logger-config logger-name="com.mycompany.batch.abc" logger-level="DEBUG"/> + </job-logging-config> </job-config> <job-config job-name="process_file_xyz" job-status="active"> *************** *** 22,25 **** --- 25,32 ---- <property key="basic-job-controller-restart">true</property> </job-controller> + <job-logging-config> + <job-logger-config logger-name="com.mycompany.batch.xyz" logger-level="DEBUG"/> + <job-logger-config logger-name="com.mycompany.batch.abc.processor" logger-level="ERROR"/> + </job-logging-config> </job-config> </batch-config> \ No newline at end of file --- NEW FILE: XMLJobLoggingConfig.java --- /* * XMLJobLoggingConfig.java * * Created on March 13, 2006, 7:27 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.xml; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.JobLoggingConfig; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * Reads the job logging configuration from the XML job configuration file. * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class XMLJobLoggingConfig extends JobLoggingConfig { /** * Element name represents the job logging config. */ public static final String JOB_LOGGING_CONFIG_ELEMENT_NAME = "job-logging-config"; /** * Element name represents the job logger config. */ private static final String JOB_LOGGER_CONFIG_ELEMENT_NAME = "job-logger-config"; /** * Atrribute name represents the logger name in job logger config. */ private static final String LOGGER_NAME_ATTRIBUTE_NAME = "logger-name"; /** * Atrribute name represents the logger level in job logger config. */ private static final String LOGGER_LEVEL_ATTRIBUTE_NAME = "logger-level"; private static Logger logger=Logger.getLogger(XMLJobLoggingConfig.class); /** * <p> * Loads the job logging config object from the input element represents * job-logging-config element. This element represents the following XML block. * <br><br> * <pre> * <job-logging-config> * <job-logger-config logger-name="com.mycompany.batch.xyz" logger-level="DEBUG"/> * <job-logger-config logger-name="com.mycompany.batch.abc.processor" logger-level="ERROR"/> * </job-logging-config> * </pre> * </p> * * @param jobLoggingConfigElement XML DOM Element represents the job-logging-config element. */ public XMLJobLoggingConfig(Element jobLoggingConfigElement) { logger.trace("Entering constructor"); NodeList jobLoggerConfigNodeList=jobLoggingConfigElement.getElementsByTagName(XMLJobLoggingConfig.JOB_LOGGER_CONFIG_ELEMENT_NAME); for(int i=0;i<jobLoggerConfigNodeList.getLength();i++) { Element jobLoggerConfigElement=(Element)jobLoggerConfigNodeList.item(i); String loggerName=jobLoggerConfigElement.getAttribute(XMLJobLoggingConfig.LOGGER_NAME_ATTRIBUTE_NAME); String loggerLevel=jobLoggerConfigElement.getAttribute(XMLJobLoggingConfig.LOGGER_LEVEL_ATTRIBUTE_NAME); this.addLogger(loggerName,loggerLevel); } logger.trace("Exiting constructor"); } } Index: XMLPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLPoolJobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XMLPoolJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 --- XMLPoolJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 *************** *** 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; --- 10,15 ---- package org.jmonks.batchserver.framework.config.xml; ! ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.ConfigurationException; *************** *** 72,76 **** private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; ! private static Logger logger=Logger.getLogger(XMLPoolJobControllerConfig.class.getName()); /** --- 73,77 ---- private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; ! private static Logger logger=Logger.getLogger(XMLPoolJobControllerConfig.class); /** *************** *** 83,87 **** public XMLPoolJobControllerConfig(Element controllerConfigElement) { ! logger.entering(XMLPoolJobControllerConfig.class.getName(),"Constructor"); this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); if(this.jobControllerClassName==null) --- 84,88 ---- public XMLPoolJobControllerConfig(Element controllerConfigElement) { ! logger.trace("Entering Constructor"); this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); if(this.jobControllerClassName==null) *************** *** 152,156 **** "Found " + xmlJobPoolNodeList.getLength() + " element(s) in the pool job controller configuration."); ! logger.exiting(XMLPoolJobControllerConfig.class.getName(),"Constructor"); } --- 153,157 ---- "Found " + xmlJobPoolNodeList.getLength() + " element(s) in the pool job controller configuration."); ! logger.trace("Exiting Constructor"); } Index: XMLJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobControllerConfig.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XMLJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.5 --- XMLJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.6 *************** *** 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; --- 13,17 ---- import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; *************** *** 42,46 **** 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()); /** --- 42,46 ---- public static final String JOB_CONTROLLER_CONFIG_FACTORY_CLASS_ATTRIBUTE_NAME = "xml-factory-config-class-name"; ! private static Logger logger=Logger.getLogger(XMLJobControllerConfig.class); /** *************** *** 65,69 **** public static JobControllerConfig getJobControllerConfig(Element controllerConfigElement) { ! logger.entering(XMLJobControllerConfig.class.getName(),"getJobControllerConfig"); JobControllerConfig controllerConfig=null; --- 65,69 ---- public static JobControllerConfig getJobControllerConfig(Element controllerConfigElement) { ! logger.trace("Entering getJobControllerConfig"); JobControllerConfig controllerConfig=null; *************** *** 87,91 **** Constructor constructor=configClass.getConstructor(new Class[]{Element.class}); controllerConfig=(JobControllerConfig)constructor.newInstance(new Object[]{controllerConfigElement}); ! logger.fine("Got the controller configuration : " + controllerConfig); } } --- 87,91 ---- Constructor constructor=configClass.getConstructor(new Class[]{Element.class}); controllerConfig=(JobControllerConfig)constructor.newInstance(new Object[]{controllerConfigElement}); ! logger.debug("Got the controller configuration : " + controllerConfig); } } *************** *** 93,96 **** --- 93,97 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 98,101 **** --- 99,103 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 103,106 **** --- 105,109 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 108,111 **** --- 111,115 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 113,120 **** { exception.printStackTrace(); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } } ! logger.exiting(XMLJobControllerConfig.class.getName(),"getJobControllerConfig"); return controllerConfig; } --- 117,125 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } } ! logger.trace("Exiting getJobControllerConfig"); return controllerConfig; } Index: XMLJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfigFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XMLJobConfigFactory.java 13 Mar 2006 14:32:37 -0000 1.6 --- XMLJobConfigFactory.java 14 Mar 2006 05:47:15 -0000 1.7 *************** *** 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; --- 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.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 74,78 **** private Element batchConfigElement=null; ! private static Logger logger=Logger.getLogger(XMLJobConfigFactory.class.getName()); /** --- 74,78 ---- private Element batchConfigElement=null; ! private static Logger logger=Logger.getLogger(XMLJobConfigFactory.class); /** *************** *** 87,91 **** public XMLJobConfigFactory(Map configFactoryProps) { ! logger.entering(XMLJobConfigFactory.class.getName(),"Constructor"); this.configFactoryProps=new HashMap(configFactoryProps); --- 87,91 ---- public XMLJobConfigFactory(Map configFactoryProps) { ! logger.trace("Entering Constructor"); this.configFactoryProps=new HashMap(configFactoryProps); *************** *** 93,97 **** 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 " + --- 93,97 ---- String classpathLocation=(String)this.configFactoryProps.get(XMLJobConfigFactory.PROPERTY_JOB_CONFIG_FILE_CLASSPATH_LOCATION); ! logger.debug("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 " + *************** *** 109,113 **** { 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, --- 109,113 ---- { InputStream inputStream=new FileInputStream(jobConfigFile); ! logger.debug("Would be able to read the configuration stream from absolute path " + absoluteLocation); if(!this.createBatchConfigElement(inputStream)) throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, *************** *** 123,126 **** --- 123,127 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, "XML job configuration file " + absoluteLocation + " cannot be found"); *************** *** 140,144 **** 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, --- 141,145 ---- else { ! logger.debug("Would be able to read the configuration from class path : " + classpathLocation); if(!this.createBatchConfigElement(inputStream)) throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, *************** *** 148,152 **** } } ! logger.exiting(XMLJobConfigFactory.class.getName(),"Constructor"); } --- 149,153 ---- } } ! logger.trace("ExitingConstructor"); } *************** *** 165,169 **** public JobConfig getJobConfig(String jobName) { ! logger.entering(XMLJobConfigFactory.class.getName(),"getJobConfig"); JobConfig jobConfig=null; /** --- 166,170 ---- public JobConfig getJobConfig(String jobName) { ! logger.trace("Entering getJobConfig"); JobConfig jobConfig=null; /** *************** *** 188,192 **** } } ! logger.exiting(XMLJobConfigFactory.class.getName(),"getJobConfig", jobConfig); return jobConfig; } --- 189,193 ---- } } ! logger.trace("Exiting getJobConfig"); return jobConfig; } *************** *** 217,230 **** { exception.printStackTrace(); } catch(SAXException exception) { exception.printStackTrace(); } catch(IOException exception) { exception.printStackTrace(); } - return created; } --- 218,233 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); } catch(SAXException exception) { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); } catch(IOException exception) { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); } return created; } Index: XMLBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLBasicJobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XMLBasicJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 --- XMLBasicJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 *************** *** 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; --- 10,15 ---- package org.jmonks.batchserver.framework.config.xml; ! ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; *************** *** 51,55 **** private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; ! private static Logger logger=Logger.getLogger(XMLBasicJobControllerConfig.class.getName()); /** --- 52,56 ---- private static final String THREAD_COUNT_ATTRIBUTE_NAME = "thread-count"; ! private static Logger logger=Logger.getLogger(XMLBasicJobControllerConfig.class); /** *************** *** 62,66 **** public XMLBasicJobControllerConfig(Element controllerConfigElement) { ! logger.entering(XMLBasicJobControllerConfig.class.getName(),"Constructor"); this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); if(this.jobControllerClassName==null) --- 63,67 ---- public XMLBasicJobControllerConfig(Element controllerConfigElement) { ! logger.trace("Entering Constructor"); this.jobControllerClassName=controllerConfigElement.getAttribute(XMLJobControllerConfig.JOB_CONTROLLER_CLASS_ATTRIBUTE_NAME); if(this.jobControllerClassName==null) *************** *** 88,92 **** "Found " + xmlBasicJobProcessorNodeList.getLength() + " element(s) in the basic job controller configuration."); ! logger.exiting(XMLBasicJobControllerConfig.class.getName(),"Constructor"); } } --- 89,93 ---- "Found " + xmlBasicJobProcessorNodeList.getLength() + " element(s) in the basic job controller configuration."); ! logger.trace("Exiting Constructor"); } } |
From: Suresh <sur...@us...> - 2006-03-14 05:47:18
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30780/db Modified Files: DBBasicJobControllerConfig.java DBJobConfig.java DBJobConfigFactory.java DBJobControllerConfig.java DBPoolJobControllerConfig.java Added Files: DBJobLoggingConfig.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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DBJobConfigFactory.java 13 Mar 2006 14:32:37 -0000 1.4 --- DBJobConfigFactory.java 14 Mar 2006 05:47:15 -0000 1.5 *************** *** 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; --- 18,22 ---- import java.util.HashMap; import java.util.Map; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 78,82 **** private static final String JOB_CONFIG_QUERY = "select 1 from job_config where job_name=?"; ! private static Logger logger=Logger.getLogger(DBJobConfigFactory.class.getName()); /** --- 78,82 ---- private static final String JOB_CONFIG_QUERY = "select 1 from job_config where job_name=?"; ! private static Logger logger=Logger.getLogger(DBJobConfigFactory.class); /** *************** *** 92,96 **** public DBJobConfigFactory(Map configFactoryProps) { ! logger.entering(DBJobConfigFactory.class.getName(),"Constructor"); this.configFactoryProps=new HashMap(configFactoryProps); /** --- 92,96 ---- public DBJobConfigFactory(Map configFactoryProps) { ! logger.trace("Entering constructor"); this.configFactoryProps=new HashMap(configFactoryProps); /** *************** *** 111,117 **** { sqle.printStackTrace(); } } ! logger.exiting(DBJobConfigFactory.class.getName(),"Constructor"); } --- 111,118 ---- { sqle.printStackTrace(); + logger.error(sqle.getMessage(),sqle); } } ! logger.trace("Exiting constructor"); } *************** *** 130,134 **** public JobConfig getJobConfig(String jobName) { ! logger.entering(DBJobConfigFactory.class.getName(),"getJobConfig"); JobConfig jobConfig=null; if(jobName==null) --- 131,135 ---- public JobConfig getJobConfig(String jobName) { ! logger.trace("Entering getJobConfig"); JobConfig jobConfig=null; if(jobName==null) *************** *** 156,159 **** --- 157,161 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); } finally *************** *** 161,165 **** try{ connection.close(); } catch(Exception exception){ exception.printStackTrace(); } } ! logger.exiting(DBJobConfigFactory.class.getName(),"getJobConfig", jobConfig); return jobConfig; } --- 163,167 ---- try{ connection.close(); } catch(Exception exception){ exception.printStackTrace(); } } ! logger.trace("ExitinggetJobConfig"); return jobConfig; } *************** *** 174,179 **** private Connection getConnection() { ! logger.entering(DBJobConfigFactory.class.getName(),"getConnection"); ! logger.config("Connection configuration : " + this.configFactoryProps); Connection connection=null; --- 176,181 ---- private Connection getConnection() { ! logger.trace("Exiting getConnection"); ! logger.info("Connection configuration : " + this.configFactoryProps); Connection connection=null; *************** *** 201,208 **** { exception.printStackTrace(); connection=null; } } ! logger.exiting(DBJobConfigFactory.class.getName(),"getConnection"); return connection; } --- 203,211 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); connection=null; } } ! logger.trace("Exiting getConnection"); return connection; } Index: DBJobConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DBJobConfig.java 13 Mar 2006 14:32:37 -0000 1.3 --- DBJobConfig.java 14 Mar 2006 05:47:15 -0000 1.4 *************** *** 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; --- 15,19 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobConfig; *************** *** 47,51 **** 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()); /** --- 47,51 ---- private static final String JOB_CONFIG_QUERY = "select job_status from job_config where job_name=?"; ! private static Logger logger=Logger.getLogger(DBJobConfig.class); /** *************** *** 59,63 **** DBJobConfig(String jobName,Connection connection) { ! logger.entering(DBJobConfig.class.getName(),"Constructor"); this.jobName=jobName; --- 59,63 ---- DBJobConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor"); this.jobName=jobName; *************** *** 71,75 **** int status=resultSet.getInt(1); this.jobStatus=(status==1?true:false); ! this.jobControllerConfig=DBJobControllerConfig.getJobControllerConfig(jobName, connection); } --- 71,75 ---- int status=resultSet.getInt(1); this.jobStatus=(status==1?true:false); ! this.jobLoggingConfig=new DBJobLoggingConfig(jobName, connection); this.jobControllerConfig=DBJobControllerConfig.getJobControllerConfig(jobName, connection); } *************** *** 85,91 **** { exception.printStackTrace(); throw new ConfigurationException(ConfigurationException.JOB_CONFIG, exception.getMessage()); } ! logger.exiting(DBJobConfig.class.getName(),"Constructor"); } } --- 85,92 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONFIG, exception.getMessage()); } ! logger.trace("Exiting constructor"); } } Index: DBPoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBPoolJobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DBPoolJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 --- DBPoolJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 *************** *** 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; --- 15,19 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.ConfigurationException; *************** *** 60,64 **** "where job_name=?"; ! private static Logger logger=Logger.getLogger(DBPoolJobControllerConfig.class.getName()); /** * Loads the pool job controller configuration from table pool_job_controller_config --- 60,64 ---- "where job_name=?"; ! private static Logger logger=Logger.getLogger(DBPoolJobControllerConfig.class); /** * Loads the pool job controller configuration from table pool_job_controller_config *************** *** 72,76 **** public DBPoolJobControllerConfig(String jobName,Connection connection) { ! logger.entering(DBPoolJobControllerConfig.class.getName(),"Constructor"); try { --- 72,76 ---- public DBPoolJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor"); try { *************** *** 90,93 **** --- 90,94 ---- * Surprising!!!!!!!!! */ + logger.error("no controller configuration found"); } *************** *** 121,127 **** { exception.printStackTrace(); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } ! logger.exiting(DBPoolJobControllerConfig.class.getName(),"Constructor"); } --- 122,129 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } ! logger.trace("Exiting constructor"); } Index: DBJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBJobControllerConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DBJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.4 --- DBJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.5 *************** *** 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; --- 17,21 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; *************** *** 41,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()); /** --- 41,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); /** *************** *** 58,62 **** public static JobControllerConfig getJobControllerConfig(String jobName,Connection connection) { ! logger.entering(DBJobControllerConfig.class.getName(),"getJobControllerConfig"); JobControllerConfig controllerConfig=null; --- 58,62 ---- public static JobControllerConfig getJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering getJobControllerConfig"); JobControllerConfig controllerConfig=null; *************** *** 85,88 **** --- 85,89 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 90,93 **** --- 91,95 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 95,98 **** --- 97,101 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 100,103 **** --- 103,107 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 105,108 **** --- 109,113 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } *************** *** 112,118 **** { exception.printStackTrace(); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } ! logger.exiting(DBJobControllerConfig.class.getName(),"getJobControllerConfig", controllerConfig); return controllerConfig; } --- 117,124 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } ! logger.trace("Exiting getJobControllerConfig"); return controllerConfig; } Index: DBBasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/db/DBBasicJobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DBBasicJobControllerConfig.java 13 Mar 2006 14:32:37 -0000 1.6 --- DBBasicJobControllerConfig.java 14 Mar 2006 05:47:15 -0000 1.7 *************** *** 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; --- 15,19 ---- import java.sql.ResultSet; import java.sql.SQLException; ! import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.common.FrameworkUtil; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; *************** *** 52,56 **** 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()); /** --- 52,56 ---- 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); /** *************** *** 65,69 **** public DBBasicJobControllerConfig(String jobName,Connection connection) { ! logger.entering(DBBasicJobControllerConfig.class.getName(),"Constructor"); try { --- 65,69 ---- public DBBasicJobControllerConfig(String jobName,Connection connection) { ! logger.trace("Entering constructor"); try { *************** *** 83,87 **** * Surprising!!!!!!!!! */ ! logger.severe("Job configuration not found with the name " + jobName); } --- 83,87 ---- * Surprising!!!!!!!!! */ ! logger.error("Job configuration not found with the name " + jobName); } *************** *** 105,111 **** { exception.printStackTrace(); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } ! logger.exiting(DBBasicJobControllerConfig.class.getName(),"Constructor"); } --- 105,112 ---- { exception.printStackTrace(); + logger.error(exception.getMessage(), exception); throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, exception.getMessage()); } ! logger.trace("Exiting constructor"); } --- NEW FILE: DBJobLoggingConfig.java --- /* * DBJobLoggingConfig.java * * Created on March 13, 2006, 8:17 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.db; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.JobLoggingConfig; /** * <p> * DBJobLoggingConfig reads the job logging configuration from the table "job_logging_config". * Below is the schema of job_logging_config table. * <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>JOB_LOGGER_NAME</td><td>VARCHAR2(256)</td></tr> * <tr><td>JOB_LOGGER_LEVEL</td><td>VARCHAR2(32)</td></tr> * </table> * </pre> * </p> * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public class DBJobLoggingConfig extends JobLoggingConfig { private static final String JOB_LOGGING_CONFIG_QUERY="select job_logger_name,job_logger_level from job_logging_config where job_name=?"; private static Logger logger=Logger.getLogger(DBJobLoggingConfig.class); /** * Reads the configuration from the table job_logging_config and add * each record as JobLoggerConfig object. * * @param jobName Name of the job. * @param connection Database connection to the defined database. */ public DBJobLoggingConfig(String jobName,Connection connection) { logger.trace("Entering constructor"); try { PreparedStatement statement=connection.prepareStatement(DBJobLoggingConfig.JOB_LOGGING_CONFIG_QUERY); statement.setString(1, jobName); ResultSet resultSet=statement.executeQuery(); while(resultSet.next()) { String loggerName=resultSet.getString(1); String loggerLevel=resultSet.getString(2); this.addLogger(loggerName,loggerLevel); } } catch(SQLException exception) { exception.printStackTrace(); logger.error(exception.getMessage(),exception); throw new ConfigurationException(ConfigurationException.JOB_CONFIG, exception.getMessage()); } logger.trace("Exiting constructor"); } } |