batchserver-cvs Mailing List for Enterprise Batch Server (Page 9)
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-09-14 05:06:14
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27416/config 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.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FrameworkConfigTest.java 25 Apr 2006 13:06:49 -0000 1.5 --- FrameworkConfigTest.java 14 Sep 2006 05:06:11 -0000 1.6 *************** *** 7,14 **** package org.jmonks.batchserver.framework.config; - import junit.framework.*; ! import java.util.Map; ! import org.w3c.dom.Element; /** --- 7,13 ---- package org.jmonks.batchserver.framework.config; import junit.framework.*; ! ! /** *************** *** 35,41 **** public static Test suite() { ! TestSuite suite = new TestSuite(FrameworkConfigTest.class); ! //TestSuite suite=new TestSuite(); ! //suite.addTest(new FrameworkConfigTest("testGetInstance")); return suite; } --- 34,38 ---- public static Test suite() { ! TestSuite suite=new TestSuite(FrameworkConfigTest.class); return suite; } |
From: Suresh <sur...@us...> - 2006-09-14 05:06:02
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27057 Modified Files: ErrorCodeTest.java FrameworkTestSuite.java RepositoryTest.java Added Files: JobStatisticsTest.java Log Message: no message Index: FrameworkTestSuite.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/FrameworkTestSuite.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FrameworkTestSuite.java 13 Sep 2006 23:30:46 -0000 1.10 --- FrameworkTestSuite.java 14 Sep 2006 05:05:58 -0000 1.11 *************** *** 19,23 **** import org.jmonks.batchserver.framework.config.JobControllerConfigTest; import org.jmonks.batchserver.framework.config.PoolJobControllerConfigTest; - import org.jmonks.batchserver.framework.RepositoryTest; import org.jmonks.batchserver.framework.repository.db4o.Db4oRepositoryTest; import org.jmonks.batchserver.framework.util.JdbcConnectionHelperTest; --- 19,22 ---- *************** *** 51,59 **** { TestSuite mainSuite = new TestSuite(); ! mainSuite.addTest(LoggingManagerTest.suite()); mainSuite.addTest(FrameworkUtilTest.suite()); mainSuite.addTest(JdbcConnectionHelperTest.suite()); - mainSuite.addTest(ErrorCodeTest.suite()); mainSuite.addTest(FrameworkConfigTest.suite()); mainSuite.addTest(ConfigurationExceptionTest.suite()); --- 50,60 ---- { TestSuite mainSuite = new TestSuite(); ! ! mainSuite.addTest(ErrorCodeTest.suite()); ! mainSuite.addTest(JobStatisticsTest.suite()); ! mainSuite.addTest(RepositoryTest.suite()); mainSuite.addTest(LoggingManagerTest.suite()); mainSuite.addTest(FrameworkUtilTest.suite()); mainSuite.addTest(JdbcConnectionHelperTest.suite()); mainSuite.addTest(FrameworkConfigTest.suite()); mainSuite.addTest(ConfigurationExceptionTest.suite()); *************** *** 63,67 **** mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); ! mainSuite.addTest(RepositoryTest.suite()); mainSuite.addTest(Db4oRepositoryTest.suite()); mainSuite.addTest(MySQLJdbcRepositoryTest.suite()); --- 64,68 ---- mainSuite.addTest(BasicJobControllerConfigTest.suite()); mainSuite.addTest(PoolJobControllerConfigTest.suite()); ! mainSuite.addTest(Db4oRepositoryTest.suite()); mainSuite.addTest(MySQLJdbcRepositoryTest.suite()); Index: ErrorCodeTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/ErrorCodeTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ErrorCodeTest.java 13 Sep 2006 04:51:14 -0000 1.2 --- ErrorCodeTest.java 14 Sep 2006 05:05:58 -0000 1.3 *************** *** 94,96 **** --- 94,104 ---- assertTrue(errorCode.getMessage().endsWith("New Message")); } + + public void testEquality() + { + ErrorCode errorCode1=ErrorCode.createErrorCode(10001,"This is my first error code."); + ErrorCode errorCode2=ErrorCode.createErrorCode(10001,"This is my second error code."); + assertTrue(errorCode1.equals(errorCode2)); + assertFalse(errorCode1==errorCode2); + } } --- NEW FILE: JobStatisticsTest.java --- /* * JobStatisticsTest.java * JUnit based test * * Created on September 13, 2006, 11:12 PM */ package org.jmonks.batchserver.framework; import java.util.Calendar; import junit.framework.*; /** * * @author Suresh Pragada */ public class JobStatisticsTest extends TestCase { public JobStatisticsTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(JobStatisticsTest.class); return suite; } public void testJobStatistics() { JobStatistics stats=new JobStatistics("process_file_abc"); stats.setStartTime(Calendar.getInstance().getTime()); stats.setEndTime(Calendar.getInstance().getTime()); stats.setExitCode(ErrorCode.createErrorCode(10001, "This is my error code")); stats.setMaxMemeoryUsage(100001); stats.setRecordsProcessed(10001); assertEquals("process_file_abc",stats.getJobname()); assertNotNull(stats.getStartTime()); assertNotNull(stats.getEndTime()); assertEquals(100001, stats.getMaxMemoryUsage()); assertEquals(10001, stats.getRecordsProcessed()); assertTrue(ErrorCode.createErrorCode(10001, "This is my error code").equals(stats.getExitCode())); } } Index: RepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/RepositoryTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RepositoryTest.java 13 Sep 2006 23:30:46 -0000 1.3 --- RepositoryTest.java 14 Sep 2006 05:05:58 -0000 1.4 *************** *** 67,95 **** public void testCreateReport() { ! FrameworkConfig.RepositoryConfig repositoryConfig=FrameworkConfig.getInstance().getRepositoryConfig(); ! if(repositoryConfig!=null) { ! Repository.createRepository("process_file_abc", repositoryConfig); ! try ! { ! Repository.createRepository("process_file_abc", repositoryConfig); ! fail("No shout when trying to create the repository second time."); ! } ! catch(IllegalStateException exception) ! { ! } } ! else { - try - { - Repository.createRepository("process_file_abc", null); - fail("Repository has been created with no repository config."); - } - catch(ConfigurationException exception) - { - } } } - } --- 67,78 ---- public void testCreateReport() { ! try { ! Repository.createRepository("process_file_abc", null, null); ! fail("Should have thrown SecurityException."); } ! catch(SecurityException ex) { } } } |
From: Suresh <sur...@us...> - 2006-09-14 05:05:18
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26981 Removed Files: batch-config.xml Log Message: no message --- batch-config.xml DELETED --- |
From: Suresh <sur...@us...> - 2006-09-14 05:05:00
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26582 Removed Files: framework-config.xml framework-config.xsd Log Message: no message --- framework-config.xsd DELETED --- --- framework-config.xml DELETED --- |
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26520/config Modified Files: BasicJobControllerConfig.java FrameworkConfig.java JobControllerConfig.java PoolJobControllerConfig.java Log Message: no message Index: BasicJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/BasicJobControllerConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BasicJobControllerConfig.java 14 Mar 2006 05:45:25 -0000 1.7 --- BasicJobControllerConfig.java 14 Sep 2006 05:04:33 -0000 1.8 *************** *** 11,16 **** package org.jmonks.batchserver.framework.config; import java.util.HashMap; - import java.util.Iterator; import java.util.Map; import org.apache.log4j.Logger; --- 11,16 ---- package org.jmonks.batchserver.framework.config; + import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; *************** *** 25,32 **** public abstract class BasicJobControllerConfig extends JobControllerConfig { - /** - * Common configuration property prefix for basic job controller. - */ - protected final static String CONFIG_PROPERTY_PREFIX = "basic-job-controller-"; /** --- 25,28 ---- *************** *** 57,61 **** /** ! * Gets the map contains the properties required by basic job processor. * * @return Returns the map contains the properties required by basic job processor. --- 53,57 ---- /** ! * Gets the unmodifiable map contains the properties required by basic job processor. * * @return Returns the map contains the properties required by basic job processor. *************** *** 63,108 **** public Map getBasicJobProcessorConfigProperties() { ! return this.basicJobProcessorConfigProps; ! } ! ! ! /** ! * Returns the common property prefix of basic job cotroller. ! * ! * @return Returns the common property prefix. ! */ ! protected String getJobControllerConfigPropertyPrefix() ! { ! return BasicJobControllerConfig.CONFIG_PROPERTY_PREFIX; } - - /** - * Override the properties controller and controller sub componenets. - * JobControllerConfig provides the implementation of overriding common controller - * properties and controller specific properties. So, this will override - * the properties of controller sub componenents like basic job processor. - * - * @param newProps Map contains new properties. - */ - public void overrideConfigProperties(Map newProps) - { - logger.trace("Entering overrideConfigProperties"); - super.overrideConfigProperties(newProps); - /** - * Override basic job processor config properites. - */ - for(Iterator iterator=newProps.keySet().iterator();iterator.hasNext();) - { - String key=(String)iterator.next(); - if(key.startsWith("basic-job-processor-")) - { - this.basicJobProcessorConfigProps.put(key, newProps.get(key)); - logger.debug("Overriden the property " + key + " with " + newProps.get(key)); - } - } - logger.trace("Exiting overrideConfigProperties"); - } - /** * Returns the number of basic job processor instances needs to be run to process this job. --- 59,65 ---- public Map getBasicJobProcessorConfigProperties() { ! return Collections.unmodifiableMap(this.basicJobProcessorConfigProps); } /** * Returns the number of basic job processor instances needs to be run to process this job. Index: JobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/JobControllerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JobControllerConfig.java 14 Mar 2006 05:45:25 -0000 1.6 --- JobControllerConfig.java 14 Sep 2006 05:04:34 -0000 1.7 *************** *** 10,13 **** --- 10,14 ---- package org.jmonks.batchserver.framework.config; + import java.util.Collections; import java.util.HashMap; import java.util.Iterator; *************** *** 59,63 **** /** ! * Gets the map contains the properties required by the controller. * * @return Returns the properites in a map. --- 60,64 ---- /** ! * Gets the unmodifiable map contains the properties required by the controller. * * @return Returns the properites in a map. *************** *** 65,130 **** public Map getJobControllerConfigProperties() { ! return this.jobControllerConfigProps; ! } ! ! /** ! * Overrides all the configuration properties defined for the controller by ! * the new properties in the incoming map. This identifies the properties needs to be ! * modified by getting the prefix for this controller by calling the method ! * <b>getJobControllerConfigPropertyPrefix</b> on the controller specific config. ! * If any property defined newProps starting with controller config prefix, ! * doesnt exist in controller defined props, it will add that property to the ! * controller map. This also overrides the properties common to the controller ! * which starts with "job-controller-". This will be used to override some common ! * properties like "job-controller-restart". ! * ! * @param newProps Map contains the new properties. ! */ ! public void overrideConfigProperties(Map newProps) ! { ! logger.trace("Entering overrideConfigProperties"); ! if(newProps==null ) ! return; ! /** ! * Override controller common properties like restart of the controller. ! */ ! for(Iterator iterator=newProps.keySet().iterator();iterator.hasNext();) ! { ! String key=(String)iterator.next(); ! if(key.startsWith("job-controller-")) ! { ! this.jobControllerConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); ! } ! } ! /** ! * Override controller specific properties by getting the prefix from ! * specific controller. ! */ ! String configPrefix=this.getJobControllerConfigPropertyPrefix(); ! if(configPrefix==null) ! configPrefix=""; ! ! for(Iterator iterator=newProps.keySet().iterator();iterator.hasNext();) ! { ! String key=(String)iterator.next(); ! ! if(key.startsWith(configPrefix)) ! { ! this.jobControllerConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); ! } ! ! } ! logger.trace("Entering overrideConfigProperties"); } - - /** - * Gets the common prefix all the properties of this controller cann be identified with. - * Each controller can have different properties. This defines the common prefix of all those - * properties. - * - * @return Returns the prefix of all the properties. - */ - protected abstract String getJobControllerConfigPropertyPrefix(); } --- 66,70 ---- public Map getJobControllerConfigProperties() { ! return Collections.unmodifiableMap(this.jobControllerConfigProps); } } Index: FrameworkConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/FrameworkConfig.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FrameworkConfig.java 29 Aug 2006 02:01:32 -0000 1.11 --- FrameworkConfig.java 14 Sep 2006 05:04:33 -0000 1.12 *************** *** 12,15 **** --- 12,16 ---- import java.io.IOException; import java.io.InputStream; + import java.util.Collections; import java.util.HashMap; import java.util.Map; *************** *** 50,54 **** * Declaration of XML file holds the framework configuration. */ ! private static final String FRAMEWORK_CONFIG_FILE = "/org/jmonks/batchserver/framework/config/framework-config.xml"; /** --- 51,55 ---- * Declaration of XML file holds the framework configuration. */ ! private static final String FRAMEWORK_CONFIG_FILE = "framework-config.xml"; /** *************** *** 93,97 **** try { ! InputStream configFileStream=FrameworkConfig.class.getResourceAsStream(FrameworkConfig.FRAMEWORK_CONFIG_FILE); if(configFileStream==null) throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Framework configuration file " + --- 94,98 ---- try { ! InputStream configFileStream=FrameworkConfig.class.getClassLoader().getResourceAsStream(FrameworkConfig.FRAMEWORK_CONFIG_FILE); if(configFileStream==null) throw new ConfigurationException(ConfigurationException.FRAMEWORK_CONFIG, "Framework configuration file " + *************** *** 105,109 **** documentBuilderFactory.setValidating(true); documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema"); ! InputStream xsdStream=FrameworkConfig.class.getResourceAsStream("framework-config.xsd"); documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",xsdStream); --- 106,110 ---- documentBuilderFactory.setValidating(true); documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema"); ! InputStream xsdStream=FrameworkConfig.class.getClassLoader().getResourceAsStream("framework-config.xsd"); documentBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",xsdStream); *************** *** 333,342 **** /** ! * Returns the properties map used by the factory class to read the job configuration. * @returns Returns properties in a map. In case if there are no properties, it returns empty map. It doesnt return null. */ public Map getJobConfigFactoryProperties() { ! return this.jobConfigFactoryProperties; } --- 334,344 ---- /** ! * Returns the unmodifiable properties map used by the factory class to read the job configuration. ! * * @returns Returns properties in a map. In case if there are no properties, it returns empty map. It doesnt return null. */ public Map getJobConfigFactoryProperties() { ! return Collections.unmodifiableMap(this.jobConfigFactoryProperties); } *************** *** 577,581 **** /** ! * Returns the map consist of the properties needed by the defined job connectors. * * @return Returns the properties in a map. --- 579,583 ---- /** ! * Returns the unmodifiable map consist of the properties needed by the defined job connectors. * * @return Returns the properties in a map. *************** *** 583,587 **** public Map getJobConnectorConfigProperties() { ! return this.jobConnectorConfigProperties; } --- 585,589 ---- public Map getJobConnectorConfigProperties() { ! return Collections.unmodifiableMap(this.jobConnectorConfigProperties); } *************** *** 676,680 **** /** ! * Returns all the properties required by the repository class to interact with the repsoitory in a map. * * @return Returns the properties required by repository class in a map. --- 678,682 ---- /** ! * Returns all the properties required by the repository class to interact with the repsoitory in a unmodifiable map. * * @return Returns the properties required by repository class in a map. *************** *** 682,686 **** public Map getRepositoryConfigProperties() { ! return this.repositoryConfigProperties; } --- 684,688 ---- public Map getRepositoryConfigProperties() { ! return Collections.unmodifiableMap(this.repositoryConfigProperties); } Index: PoolJobControllerConfig.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/PoolJobControllerConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PoolJobControllerConfig.java 14 Mar 2006 05:45:25 -0000 1.7 --- PoolJobControllerConfig.java 14 Sep 2006 05:04:34 -0000 1.8 *************** *** 11,16 **** package org.jmonks.batchserver.framework.config; import java.util.HashMap; - import java.util.Iterator; import java.util.Map; import org.apache.log4j.Logger; --- 11,16 ---- package org.jmonks.batchserver.framework.config; + import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; *************** *** 29,37 **** { /** - * Common pool controller property prefix. - */ - protected final static String CONFIG_PROPERTY_PREFIX = "pool-job-controller-"; - - /** * Pool job loader class name. */ --- 29,32 ---- *************** *** 76,80 **** /** ! * Gets the map contains the properties needed by pool job loader. * * @return Returns the map contains the properties. --- 71,75 ---- /** ! * Gets the unmodifiable map contains the properties needed by pool job loader. * * @return Returns the map contains the properties. *************** *** 82,86 **** public Map getPoolJobLoaderConfigProperties() { ! return this.poolJobLoaderConfigProps; } --- 77,81 ---- public Map getPoolJobLoaderConfigProperties() { ! return Collections.unmodifiableMap(this.poolJobLoaderConfigProps); } *************** *** 96,100 **** /** ! * Gets the map contains the properties needed by pool job processor. * * @return Returns the map contains properties. --- 91,95 ---- /** ! * Gets the unmodifiable map contains the properties needed by pool job processor. * * @return Returns the map contains properties. *************** *** 102,106 **** public Map getPoolJobProcessorConfigProperties() { ! return this.poolJobProcessorConfigProps; } --- 97,101 ---- public Map getPoolJobProcessorConfigProperties() { ! return Collections.unmodifiableMap(this.poolJobProcessorConfigProps); } *************** *** 116,120 **** /** ! * Gets the map contains properties needed by the pool class. * * @return Returns the map contains properties. --- 111,115 ---- /** ! * Gets the unmodifiable map contains properties needed by the pool class. * * @return Returns the map contains properties. *************** *** 122,193 **** public Map getPoolConfigProperties() { ! return this.poolConfigProps; ! } ! ! /** ! * Gets the common pool controller property prefix. ! * ! * @return Returns the common property prefix. ! */ ! protected String getJobControllerConfigPropertyPrefix() ! { ! return PoolJobControllerConfig.CONFIG_PROPERTY_PREFIX; ! } ! ! /** ! * Override the properties controller and controller sub componenets. ! * JobControllerConfig provides the implementation of overriding common controller ! * properties and controller specific properties. So, this will override ! * the properties of controller sub componenents like pool job processor, ! * pool job loader and job pool. ! * ! * @param newProps Map contains new properties. ! */ ! public void overrideConfigProperties(Map newProps) ! { ! super.overrideConfigProperties(newProps); ! logger.trace("Entering overrideConfigProperties"); ! if(newProps==null ) ! return; ! ! /** ! * Override pool job loader properties. ! */ ! for(Iterator iterator=newProps.keySet().iterator();iterator.hasNext();) ! { ! String key=(String)iterator.next(); ! if(key.startsWith("pool-job-loader-")) ! { ! this.poolJobLoaderConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); ! } ! } ! /** ! * Override pool job processor properties. ! */ ! for(Iterator iterator=newProps.keySet().iterator();iterator.hasNext();) ! { ! String key=(String)iterator.next(); ! if(key.startsWith("pool-job-processor-")) ! { ! this.poolJobProcessorConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); ! } ! } ! /** ! * Override pool job loader properties. ! */ ! for(Iterator iterator=newProps.keySet().iterator();iterator.hasNext();) ! { ! String key=(String)iterator.next(); ! if(key.startsWith("job-pool-")) ! { ! this.poolConfigProps.put(key, newProps.get(key)); ! logger.debug("Overriden the property " + key + " with " + newProps.get(key)); ! } ! } ! logger.trace("Exiting overrideConfigProperties"); } ! /** * Returns the number of instances of pool job processors needs to be created to process this job. --- 117,123 ---- public Map getPoolConfigProperties() { ! return Collections.unmodifiableMap(this.poolConfigProps); } ! /** * Returns the number of instances of pool job processors needs to be created to process this job. |
From: Suresh <sur...@us...> - 2006-09-14 05:04:37
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26520/config/xml Modified Files: XMLJobConfigFactory.java Log Message: no message Index: XMLJobConfigFactory.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/config/xml/XMLJobConfigFactory.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** XMLJobConfigFactory.java 22 Mar 2006 14:20:45 -0000 1.11 --- XMLJobConfigFactory.java 14 Sep 2006 05:04:34 -0000 1.12 *************** *** 148,152 **** * If we dont find this file on classpath, throw configuration exception. */ ! InputStream inputStream=XMLJobConfigFactory.class.getResourceAsStream(classpathLocation); if(inputStream==null) throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, --- 148,152 ---- * If we dont find this file on classpath, throw configuration exception. */ ! InputStream inputStream=XMLJobConfigFactory.class.getClassLoader().getResourceAsStream(classpathLocation); if(inputStream==null) throw new ConfigurationException(ConfigurationException.JOB_CONFIG_FACTORY_CONFIG, |
From: Suresh <sur...@us...> - 2006-09-14 05:02:53
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25721 Modified Files: ErrorCode.java JobStatistics.java Repository.java Log Message: no message Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/ErrorCode.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ErrorCode.java 13 Sep 2006 05:01:34 -0000 1.5 --- ErrorCode.java 14 Sep 2006 05:02:47 -0000 1.6 *************** *** 3,12 **** /** * <p> ! * The ErrorCode represents the error condition can generate in the system. ! * It holds code which uniquely identifies the error and message which explains the error in the system. ! * This is also used to represent the status code * for any processor/controller/job. This provides the flexibility to create ! * new custom error codes and append the message to the existing error code. ! * Codes ranging from 0 to 100 are reserved for framework purpose. Use the codes * above 100 to create the custom error codes. * </p> --- 3,12 ---- /** * <p> ! * The ErrorCode represents the error condition that can generate in the system. ! * It consists of the code which uniquely identifies the ErrorCode and message ! * which explains the error in the system. This is also used to represent the status code * for any processor/controller/job. This provides the flexibility to create ! * new custom ErrorCodes and append the message to the existing ErrorCode. ! * Codes ranging from 0 to 100 are reserved for framework purposes. Use the codes * above 100 to create the custom error codes. * </p> *************** *** 30,39 **** /** * <p> ! * Protected constructor to make sure no instances will be created of this class ! * from outside of this class and it is extensible. * </p> * * @param code Code represents the error. ! * @param errorMsg Message illustrates the exit code. */ private ErrorCode(int code, String errorMsg) --- 30,39 ---- /** * <p> ! * Private constructor to make sure no instances of ErrorCode will be created ! * from outside of this class and it is not extensible. * </p> * * @param code Code represents the error. ! * @param errorMsg Message explains the failure or success reason. */ private ErrorCode(int code, String errorMsg) *************** *** 64,69 **** /** ! * Creates a new ErorCode object with the same error code and appends the given ! * message to the existing message and returns that new error code. * * @param messageToBeAppended Message that needs to be appended to the existing message. --- 64,69 ---- /** ! * Creates a new ErrorCode object with the same error code and appends the given ! * message to the existing message and returns new ErrorCode. * * @param messageToBeAppended Message that needs to be appended to the existing message. *************** *** 94,98 **** /** ! * Equality will be based on the code the two error codes contain. * * @see java.lang.Object#equals(java.lang.Object) --- 94,98 ---- /** ! * Equality will be based on the code the two ErrorCodes contains. * * @see java.lang.Object#equals(java.lang.Object) *************** *** 105,109 **** /** ! * Code represented by error code will be returned as a hash code. * * @see java.lang.Object#hashCode() --- 105,109 ---- /** ! * Code represented by ErrorCode will be returned as a hash code. * * @see java.lang.Object#hashCode() Index: JobStatistics.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/JobStatistics.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** JobStatistics.java 13 Sep 2006 05:01:34 -0000 1.7 --- JobStatistics.java 14 Sep 2006 05:02:47 -0000 1.8 *************** *** 5,11 **** /** * <p> ! * JobStatistics holds the statistics of the job. These statistics will be ! * start and end time of the job, records have been processed, memory has ! * been utilized and exit code of the job. * </p> * --- 5,12 ---- /** * <p> ! * JobStatistics holds the useful metrics and information of particular run of a job. ! * These statistics helpful in research of the periodic growth of the jobs. ! * Statistics it holds are start and end time of the run, records have been processed ! * in the run, memory has been utilized in the run and exit code of that run. * </p> * *************** *** 29,33 **** private long recordsProcessed; /** ! * Maximum memory usage of this job. */ private long maxMemoryUsage; --- 30,34 ---- private long recordsProcessed; /** ! * Maximum memory consumption in bytes. */ private long maxMemoryUsage; *************** *** 85,89 **** /** ! * Sets the maximum memory used for the job. * * @param memoryUsaeg Sets the memory usage by the job. --- 86,90 ---- /** ! * Sets the maximum memory used for the job in bytes. * * @param memoryUsaeg Sets the memory usage by the job. *************** *** 125,129 **** /** ! * Gets the maximum memory used by this job. * * @return Returns the max memory used by this job. --- 126,130 ---- /** ! * Gets the maximum memory used by this job in bytes. * * @return Returns the max memory used by this job. Index: Repository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/Repository.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Repository.java 13 Sep 2006 23:29:25 -0000 1.6 --- Repository.java 14 Sep 2006 05:02:47 -0000 1.7 *************** *** 2,7 **** import java.util.Map; import org.apache.log4j.Logger; ! import org.jmonks.batchserver.framework.config.*; ! --- 2,7 ---- import java.util.Map; import org.apache.log4j.Logger; ! import org.jmonks.batchserver.framework.config.ConfigurationException; ! import org.jmonks.batchserver.framework.config.FrameworkConfig.RepositoryConfig; *************** *** 9,27 **** /** * <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 ! * transfer data between the jobs and register management and monitoring ! * information between. Repository make sure only one instance ! * of the implementation class will be created and it will be associated with the ! * job being run and all the opertions performated will be taken that job as a source job. * </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 constructor is exist and accessible to enable the initialization of ! * this implementation from the factory method. * </p> * --- 9,32 ---- /** * <p> ! * Repository class provides utility methods to access and use the repository maintained ! * by the framework. The repository could be any data store from files to databases, useful ! * to save and retrieve the data. So, there could be different implementations available of ! * this Repository class. Framework configuration defines which implementation should ! * be used for the framework. * </p> * <p> ! * This povides utility methods to log the job statistics and transfer data between the jobs ! * and register & unregister management and monitoring information. Framework creates the ! * repository at the startup and provides this reference through the JobContext to all the jobs. ! * When the repository get created, it will be associated with the job beign run and all the ! * operations will be performed with respect to that job only. The job being run will be taken ! * as source job in all the operations. ! * </p> ! * <p> ! * Default framework configuration uses Db4o database as repository for its simplicity. ! * There is a JdbcRepository implementation by using which we can use any database that ! * can be used JDBC can be configured to use as repository. If anyone wish to use tools ! * provided to manage and monitor the applications, consider of using the JdbcRepository ! * implementation. * </p> * *************** *** 46,51 **** /** ! * Method to initialize the repository implementation with the properties ! * defined in the framework configuration. * * @param configProps Configuration properties defined in <repository-config> element --- 51,59 ---- /** ! * <p> ! * Method to initialize the repository implementation by using the properties ! * defined in the framework configuration. This method will be called immediately ! * after instantiating the implementation class. ! * </p> * * @param configProps Configuration properties defined in <repository-config> element *************** *** 59,76 **** /** * <p> ! * Creates the repository instance based on the given configuration and associate ! * this repository instance with the given job. So all the repository opertions ! * performed from one job will be associated with that job only. This method ! * will be called by framework before kicking off the controller. Do not attempt ! * to call this method to create the repository from the client code. * </p> * ! * @throws IllegalStateException If there is an attempt is to create the repository ! * instance more than once. * @throws IllegalArgumentException If jobName is null to create the repository instance. ! * @throws ConfigurationException If required configuration properties are missing or the values ! * are invalid. */ ! public static Repository createRepository(String jobName, FrameworkConfig.RepositoryConfig repositoryConfig, Main repositoryCreator) { logger.trace("Entering createRepository"); --- 67,86 ---- /** * <p> ! * Factory method creates the repository instance based on the given repository configuration and associate ! * this repository instance with the given job. So, all the repository operations performed ! * using this repository instance will be associated with that job and taken that job as source ! * job in all operations. This method will be called by the framework to create the repository and ! * places the reference in JobContext object. * </p> * ! * @param jobName Name of the job this repository will be associated with. ! * @param repositoryConfig Repository configuration defined in framework configuration. ! * @param repositoryCreator Creator of the repository. This is is restrict only framework can instantiate the repository. ! * ! * @throws SecurityException If an attempt is made to create the repository by other than the Main class(framework). * @throws IllegalArgumentException If jobName is null to create the repository instance. ! * @throws ConfigurationException If required properties are missing in the repository configuration or the values are invalid. */ ! public static Repository createRepository(String jobName, RepositoryConfig repositoryConfig, Main repositoryCreator) { logger.trace("Entering createRepository"); *************** *** 93,98 **** { repository=(Repository)Class.forName(repositoryClassName).newInstance(); repository.init(repositoryConfig.getRepositoryConfigProperties()); - repository.jobName=jobName; logger.debug("created the repository implemenation class"); } --- 103,108 ---- { repository=(Repository)Class.forName(repositoryClassName).newInstance(); + repository.jobName=jobName; repository.init(repositoryConfig.getRepositoryConfigProperties()); logger.debug("created the repository implemenation class"); } *************** *** 121,137 **** /** * <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. ! * @param nextJobName Name of the job this data to be send. ! * @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. * ! * @throws IllegalArgumentException If any one of the input values is null. */ public abstract boolean sendDataToNextJob(String dataIdentifier, String nextJobName, --- 131,148 ---- /** * <p> ! * Data will be send to the specified next job and will be identified with the ! * given identifier. By using different identifiers, multiple data objects ! * can be send to the same next job. Next job should use the data identifier ! * and this (source) job name to read the data. If there is any data with this ! * identifier from this job to the next job, it will be overriden. * </p> * * @param dataIdentifier Identifier to be used to exchange the data between two jobs. ! * @param nextJobName Name of the next job this data to be send. ! * @param data Data that needs to be send as the object. * ! * @return Returns true, if it could save the data to be send to the next job. * ! * @throws IllegalArgumentException If any one of the incoming values are null. */ public abstract boolean sendDataToNextJob(String dataIdentifier, String nextJobName, *************** *** 139,160 **** /** ! * 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 previousJobName Name of the job sent the data to this job. * ! * @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 dataIdentifier, String previousJobName); /** ! * <p> ! * 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 kicking off the controller. ! * </p> */ public abstract boolean clearDataTransferredFromThisJob(); --- 150,171 ---- /** ! * Gets the data that has been sent by the previous job with the given data identifier. * ! * @param dataIdentifier Identifier tied to the data that has been sent. ! * @param previousJobName Name of the previous job sent the data to this job. * ! * @return Returns the data, null, if it couldnt find any data from the previous job with that identifier. * ! * @throws IllegalArgumentException If any one of the input values are null. */ public abstract Object getDataFromPreviousJob(String dataIdentifier, String previousJobName); /** ! * <p> ! * This method will clear all the data that has been sent by this job to all the next jobs. ! * </p> ! * ! * @return Returns true if it could clear all the data, false, otherwise. ! * */ public abstract boolean clearDataTransferredFromThisJob(); *************** *** 162,166 **** /** * <p> ! * Registers the given job management and monitoring info with the job. * If there is any information already associated with this job, it * will be overriden. --- 173,177 ---- /** * <p> ! * Registers the given job management and monitoring information to this job. * If there is any information already associated with this job, it * will be overriden. *************** *** 177,181 **** /** ! * Unregisters the job management and monitoring info assosciated with the job. * * @return Return true, it it could unregister the information, false, otherwise. --- 188,192 ---- /** ! * Unregisters the job management and monitoring information assosciated with this job. * * @return Return true, it it could unregister the information, false, otherwise. *************** *** 184,190 **** /** * Logs the job statistics given in the form of JobStatistics object * in the repository for further use/references. ! * * @param statistics Job Statistics object which holds all the statistics related to that job. * --- 195,202 ---- /** + * <p> * Logs the job statistics given in the form of JobStatistics object * in the repository for further use/references. ! * </p> * @param statistics Job Statistics object which holds all the statistics related to that job. * |
From: Suresh <sur...@us...> - 2006-09-14 05:02:30
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/mysql In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25699 Added Files: create_database_batchserver.sql Log Message: no message --- NEW FILE: create_database_batchserver.sql --- create database batchserver; |
From: Suresh <sur...@us...> - 2006-09-14 05:02:11
|
Update of /cvsroot/batchserver/batchserver/conf In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25643 Added Files: batch-config.xml framework-config.xml framework-config.xsd Log Message: no message --- NEW FILE: framework-config.xsd --- <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="framework-config" type="FrameworkConfigType"/> <xsd:complexType name="FrameworkConfigType"> <xsd:element name="job-config-factory-config" type="JobConfigFactoryConfigType"/> <xsd:element name="framework-logging-config" type="FrameworkLoggingConfigType"/> <xsd:element name="repository-config" type="RepositoryConfigType"/> <xsd:element name="job-connector-config" type="JobConnectorConfigType"/> <xsd:element name="job-controller-config" type="JobControllerConfigType"/> </xsd:complexType> <xsd:complexType name="JobConfigFactoryConfigType"> <xsd:attribute name="job-config-factory-class-name" type="xsd:string" use="required"/> <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> <xsd:complexType name="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> <xsd:complexType name="RepositoryConfigType"> <xsd:attribute name="repository-class-name" type="xsd:string" use="required"/> <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> <xsd:complexType name="JobConnectorConfigType"> <xsd:attribute name="job-connector-helper-class-name" type="xsd:string" use="required"/> <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> <xsd:complexType name="JobControllerConfigType"> <xsd:element name="job-controller" type="JobControllerType" minOccurs="0" maxOccurs="unbounded"/> </xsd:complexType> <xsd:complexType name="PropertyType"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="key" type="xsd:string" use="required"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="JobControllerType"> <xsd:attribute name="controller-class-name" type="xsd:string" use="required"/> <xsd:attribute name="xml-factory-config-class-name" type="xsd:string" use="required"/> <xsd:attribute name="db-factory-config-class-name" type="xsd:string" use="required"/> </xsd:complexType> <xsd:simpleType name="LogLevelType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="ALL"/> <xsd:enumeration value="TRACE"/> <xsd:enumeration value="DEBUG"/> <xsd:enumeration value="INFO"/> <xsd:enumeration value="WARN"/> <xsd:enumeration value="ERROR"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> --- NEW FILE: framework-config.xml --- <?xml version="1.0" encoding="UTF-8"?> <framework-config> <job-config-factory-config job-config-factory-class-name="org.jmonks.batchserver.framework.config.xml.XMLJobConfigFactory"> <property key="job-config-file-classpath-location">batch-config.xml</property> </job-config-factory-config> <!-- Following is the sample configuration to read the job configuration from the database. <job-config-factory-config job-config-factory-class-name="org.jmonks.batchserver.framework.config.db.DBJobConfigFactory"> <property key="jdbc-driver-class-name">oracle.jdbc.driver.OracleDriver</property> <property key="jdbc-url">jdbc:oracle:thin:@hostname:1521:instancename</property> <property key="username">scott</property> <property key="password">tiger</property> </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> <framework-logging-config framework-logging-level="DEBUG" job-logging-directory="/batchserver/logs" job-base-package-name="com.mycompany.batch" job-logging-level="INFO"/> <job-connector-config job-connector-helper-class-name="org.jmonks.batchserver.framework.management.jmxmp.RepositoryJMXMPConnectorHelper"> </job-connector-config> <job-controller-config> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController" xml-factory-config-class-name="org.jmonks.batchserver.framework.config.xml.XMLPoolJobControllerConfig" db-factory-config-class-name="org.jmonks.batchserver.framework.config.db.DBPoolJobControllerConfig"/> <job-controller controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController" xml-factory-config-class-name="org.jmonks.batchserver.framework.config.xml.XMLBasicJobControllerConfig" db-factory-config-class-name="org.jmonks.batchserver.framework.config.db.DBBasicJobControllerConfig"/> </job-controller-config> </framework-config> --- NEW FILE: batch-config.xml --- <?xml version="1.0" encoding="UTF-8"?> <batch-config> <job-config job-name="process_file_abc" job-status="active"> <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.pool.PoolJobController"> <pool-job-loader pool-job-loader-class-name="com.mycompany.batch.processfileabc.AbcJobLoader"> <property key="pool-job-loader-key1">loader-value1</property> </pool-job-loader> <pool-job-processor pool-job-processor-class-name="com.mycompany.batch.processfileabc.AbcJobProcessor" thread-count="1"> <property key="pool-job-processor-key1">processor-value1</property> </pool-job-processor> <job-pool job-pool-class-name="org.jmonks.batchserver.framework.controller.pool.DefaultJobPool"> <property key="job-pool-size">50000</property> </job-pool> <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"> <job-controller job-controller-class-name="org.jmonks.batchserver.framework.controller.basic.BasicJobController"> <basic-job-processor basic-job-processor-class-name="org.jmonks.batchserver.framework.controller.basic.TestBasicJobProcessor" thread-count="5"> <property key="basic-job-processor-key1">processor-value1</property> </basic-job-processor> <property key="basic-job-controller-restart">true</property> </job-controller> <job-logging-config> <job-logger-config logger-name="org.jmonks.batchserver.framework.controller.basic" logger-level="TRACE"/> <job-logger-config logger-name="org.jmonks.batchserver.framework" logger-level="ERROR"/> </job-logging-config> </job-config> </batch-config> |
From: Suresh <sur...@us...> - 2006-09-14 05:01:51
|
Update of /cvsroot/batchserver/batchserver/conf In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25287/conf Log Message: Directory /cvsroot/batchserver/batchserver/conf added to the repository |
From: Suresh <sur...@us...> - 2006-09-13 23:31:10
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26233 Removed Files: RepositoryTest.java Log Message: no message --- RepositoryTest.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-13 23:30:49
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25929 Modified Files: FrameworkTestSuite.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.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FrameworkTestSuite.java 13 Sep 2006 04:51:14 -0000 1.9 --- FrameworkTestSuite.java 13 Sep 2006 23:30:46 -0000 1.10 *************** *** 19,23 **** import org.jmonks.batchserver.framework.config.JobControllerConfigTest; import org.jmonks.batchserver.framework.config.PoolJobControllerConfigTest; ! import org.jmonks.batchserver.framework.repository.RepositoryTest; import org.jmonks.batchserver.framework.repository.db4o.Db4oRepositoryTest; import org.jmonks.batchserver.framework.util.JdbcConnectionHelperTest; --- 19,23 ---- import org.jmonks.batchserver.framework.config.JobControllerConfigTest; import org.jmonks.batchserver.framework.config.PoolJobControllerConfigTest; ! import org.jmonks.batchserver.framework.RepositoryTest; import org.jmonks.batchserver.framework.repository.db4o.Db4oRepositoryTest; import org.jmonks.batchserver.framework.util.JdbcConnectionHelperTest; --- NEW FILE: RepositoryTest.java --- /* * RepositoryTest.java * JUnit based test * * Created on September 12, 2006, 10:16 PM */ package org.jmonks.batchserver.framework; import junit.framework.*; import org.jmonks.batchserver.framework.config.*; /** * * @author Suresh Pragada */ 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(); suite.addTest(new RepositoryTest("testInstantiation")); suite.addTest(new RepositoryTest("testCreateReport")); 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. */ } } public void testCreateReport() { FrameworkConfig.RepositoryConfig repositoryConfig=FrameworkConfig.getInstance().getRepositoryConfig(); if(repositoryConfig!=null) { Repository.createRepository("process_file_abc", repositoryConfig); try { Repository.createRepository("process_file_abc", repositoryConfig); fail("No shout when trying to create the repository second time."); } catch(IllegalStateException exception) { } } else { try { Repository.createRepository("process_file_abc", null); fail("Repository has been created with no repository config."); } catch(ConfigurationException exception) { } } } } |
From: Suresh <sur...@us...> - 2006-09-13 23:30:17
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25890 Removed Files: Repository.java Log Message: no message --- Repository.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-13 23:29:49
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/controller/pool Modified Files: AbstractPoolJobLoader.java AbstractPoolJobProcessor.java CollectionJobPool.java JobPool.java PoolJobController.java PoolJobLoader.java PoolJobProcessor.java Log Message: no message Index: PoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobLoader.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PoolJobLoader.java 13 Sep 2006 04:49:46 -0000 1.8 --- PoolJobLoader.java 13 Sep 2006 23:29:45 -0000 1.9 *************** *** 1,5 **** package org.jmonks.batchserver.framework.controller.pool; - import java.util.Map; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.management.ProcessorStatus; --- 1,5 ---- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.management.ProcessorStatus; *************** *** 45,49 **** * @return Retrurns the final status of the loader. */ ! public ErrorCode loadPool(Map configProps,JobPool pool); /** * Suspends the loader. --- 45,49 ---- * @return Retrurns the final status of the loader. */ ! public ErrorCode loadPool(JobContext jobContext,JobPool pool); /** * Suspends the loader. Index: JobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/JobPool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JobPool.java 13 Sep 2006 04:49:46 -0000 1.6 --- JobPool.java 13 Sep 2006 23:29:45 -0000 1.7 *************** *** 1,4 **** package org.jmonks.batchserver.framework.controller.pool; ! import java.util.Map; /** --- 1,4 ---- package org.jmonks.batchserver.framework.controller.pool; ! import org.jmonks.batchserver.framework.JobContext; /** *************** *** 21,25 **** * @param configProps Properties defined in the configuration for the job pool. */ ! public void initialize(Map configProps); /** * Gets the next available job data(piece of information) to be processed. --- 21,25 ---- * @param configProps Properties defined in the configuration for the job pool. */ ! public void initialize(JobContext jobContext); /** * Gets the next available job data(piece of information) to be processed. Index: PoolJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobProcessor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PoolJobProcessor.java 13 Sep 2006 04:49:46 -0000 1.7 --- PoolJobProcessor.java 13 Sep 2006 23:29:45 -0000 1.8 *************** *** 1,6 **** package org.jmonks.batchserver.framework.controller.pool; - - import java.util.Map; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.management.ProcessorStatus; --- 1,5 ---- package org.jmonks.batchserver.framework.controller.pool; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.management.ProcessorStatus; *************** *** 29,33 **** * @return Returns the error code. */ ! public ErrorCode processPool(Map configProps, JobPool pool); /** --- 28,32 ---- * @return Returns the error code. */ ! public ErrorCode processPool(JobContext jobContext, JobPool pool); /** Index: AbstractPoolJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/AbstractPoolJobProcessor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractPoolJobProcessor.java 13 Sep 2006 04:49:46 -0000 1.6 --- AbstractPoolJobProcessor.java 13 Sep 2006 23:29:45 -0000 1.7 *************** *** 1,7 **** package org.jmonks.batchserver.framework.controller.pool; import EDU.oswego.cs.dl.util.concurrent.Mutex; - import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.management.ProcessorStatus; --- 1,7 ---- package org.jmonks.batchserver.framework.controller.pool; import EDU.oswego.cs.dl.util.concurrent.Mutex; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.management.ProcessorStatus; *************** *** 62,66 **** * @return Returns the status code of this processor. */ ! public ErrorCode processPool(Map configProps, JobPool pool) { logger.trace("Entering processPool"); --- 62,66 ---- * @return Returns the status code of this processor. */ ! public ErrorCode processPool(JobContext jobContext, JobPool pool) { logger.trace("Entering processPool"); *************** *** 72,76 **** { this.processorStatus=ProcessorStatus.INITIALIZING; ! initialize(configProps); this.processorStatus=ProcessorStatus.RUNNING; } --- 72,76 ---- { this.processorStatus=ProcessorStatus.INITIALIZING; ! initialize(jobContext); this.processorStatus=ProcessorStatus.RUNNING; } *************** *** 214,218 **** * @param configProps Configuration defined for the job processor in job configuration. */ ! public abstract void initialize(Map configProps); /** --- 214,218 ---- * @param configProps Configuration defined for the job processor in job configuration. */ ! public abstract void initialize(JobContext jobContext); /** Index: AbstractPoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/AbstractPoolJobLoader.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AbstractPoolJobLoader.java 13 Sep 2006 04:49:46 -0000 1.9 --- AbstractPoolJobLoader.java 13 Sep 2006 23:29:45 -0000 1.10 *************** *** 12,18 **** import EDU.oswego.cs.dl.util.concurrent.Mutex; - import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.management.ProcessorStatus; --- 12,18 ---- import EDU.oswego.cs.dl.util.concurrent.Mutex; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.management.ProcessorStatus; *************** *** 67,71 **** * @return Returns the final status of loading. */ ! public final ErrorCode loadPool(Map configProps,JobPool pool) { logger.trace("Entering loadPool"); --- 67,71 ---- * @return Returns the final status of loading. */ ! public final ErrorCode loadPool(JobContext jobContext,JobPool pool) { logger.trace("Entering loadPool"); *************** *** 75,79 **** { this.loaderStatus=ProcessorStatus.RUNNING; ! returnCode=this.loadPool(configProps); this.loaderStatus=ProcessorStatus.FINISHED; } --- 75,79 ---- { this.loaderStatus=ProcessorStatus.RUNNING; ! returnCode=this.loadPool(jobContext); this.loaderStatus=ProcessorStatus.FINISHED; } *************** *** 235,239 **** * @return Returns the final status of the loader. */ ! public abstract ErrorCode loadPool(Map configProps); /** * Returns the number of job data objects that this loader is going to load. --- 235,239 ---- * @return Returns the final status of the loader. */ ! public abstract ErrorCode loadPool(JobContext jobContext); /** * Returns the number of job data objects that this loader is going to load. Index: PoolJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobController.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PoolJobController.java 13 Sep 2006 04:49:46 -0000 1.14 --- PoolJobController.java 13 Sep 2006 23:29:45 -0000 1.15 *************** *** 10,13 **** --- 10,14 ---- import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.PoolJobControllerConfig; *************** *** 105,110 **** public ErrorCode process() { ! logger.info("Entering process in pool job controller = " + super.getJobName()); ! PoolJobControllerConfig poolJobControllerConfig=(PoolJobControllerConfig)super.getJobControllerConfig(); validateControllerConfiguration(poolJobControllerConfig); int processorCount=poolJobControllerConfig.getPoolJobProcessorThreadCount(); --- 106,111 ---- public ErrorCode process() { ! logger.info("Entering process in pool job controller = " + super.jobContext.getJobName()); ! PoolJobControllerConfig poolJobControllerConfig=(PoolJobControllerConfig)super.jobContext.getJobConfig().getJobControllerConfig(); validateControllerConfiguration(poolJobControllerConfig); int processorCount=poolJobControllerConfig.getPoolJobProcessorThreadCount(); *************** *** 114,118 **** */ this.pool=(JobPool)this.getInstance(poolJobControllerConfig.getPoolClassName()); ! pool.initialize(poolJobControllerConfig.getPoolConfigProperties()); CountDown countDownLock=new CountDown(processorCount+1); --- 115,119 ---- */ this.pool=(JobPool)this.getInstance(poolJobControllerConfig.getPoolClassName()); ! pool.initialize(super.jobContext); CountDown countDownLock=new CountDown(processorCount+1); *************** *** 121,132 **** */ PoolJobLoader jobLoader=(PoolJobLoader)this.getInstance(poolJobControllerConfig.getPoolJobLoaderClassName()); ! String jobLoaderName=super.getJobName()+"_Loader"; FutureResult jobLoaderFutureResult=new FutureResult(); Thread jobLoaderThread=new Thread(jobLoaderFutureResult.setter(this.getCallableLoader( ! countDownLock,jobLoader,poolJobControllerConfig.getPoolJobLoaderConfigProperties(),pool)),jobLoaderName); jobLoaderThread.start(); this.jobProcessorsResultMap.put(jobLoaderName, jobLoaderFutureResult); this.jobProcessorsMap.put(jobLoaderName, jobLoader); ! this.jobStatistics=new JobStatistics(super.getJobName()); this.jobStatistics.setStartTime(Calendar.getInstance().getTime()); /** --- 122,133 ---- */ PoolJobLoader jobLoader=(PoolJobLoader)this.getInstance(poolJobControllerConfig.getPoolJobLoaderClassName()); ! String jobLoaderName=super.jobContext.getJobName()+"_Loader"; FutureResult jobLoaderFutureResult=new FutureResult(); Thread jobLoaderThread=new Thread(jobLoaderFutureResult.setter(this.getCallableLoader( ! countDownLock,jobLoader,super.jobContext,pool)),jobLoaderName); jobLoaderThread.start(); this.jobProcessorsResultMap.put(jobLoaderName, jobLoaderFutureResult); this.jobProcessorsMap.put(jobLoaderName, jobLoader); ! this.jobStatistics=new JobStatistics(super.jobContext.getJobName()); this.jobStatistics.setStartTime(Calendar.getInstance().getTime()); /** *************** *** 136,143 **** { PoolJobProcessor jobProcessor=(PoolJobProcessor)this.getInstance(poolJobControllerConfig.getPoolJobProcessorClassName()); ! String jobProcessorName=super.getJobName()+"_Processor_"+i; FutureResult jobProcessorFutureResult=new FutureResult(); Thread jobProcessorThread=new Thread(jobProcessorFutureResult.setter(this.getCallableProcessor( ! countDownLock,jobProcessor,poolJobControllerConfig.getPoolJobProcessorConfigProperties(),pool)),jobProcessorName); jobProcessorThread.start(); this.jobProcessorsResultMap.put(jobProcessorName, jobProcessorFutureResult); --- 137,144 ---- { PoolJobProcessor jobProcessor=(PoolJobProcessor)this.getInstance(poolJobControllerConfig.getPoolJobProcessorClassName()); ! String jobProcessorName=super.jobContext.getJobName()+"_Processor_"+i; FutureResult jobProcessorFutureResult=new FutureResult(); Thread jobProcessorThread=new Thread(jobProcessorFutureResult.setter(this.getCallableProcessor( ! countDownLock,jobProcessor,super.jobContext,pool)),jobProcessorName); jobProcessorThread.start(); this.jobProcessorsResultMap.put(jobProcessorName, jobProcessorFutureResult); *************** *** 148,152 **** */ ErrorCode returnCode=hybernate(countDownLock); ! logger.info("Exiting process in pool job controller = " + super.getJobName() + " with return code = " + returnCode); return returnCode; } --- 149,153 ---- */ ErrorCode returnCode=hybernate(countDownLock); ! logger.info("Exiting process in pool job controller = " + super.jobContext.getJobName() + " with return code = " + returnCode); return returnCode; } *************** *** 165,169 **** long expectedRecordsCount=0; ! String jobLoaderName=super.getJobName()+"_Loader"; PoolJobLoader jobLoader=(PoolJobLoader)this.jobProcessorsMap.get(jobLoaderName); expectedRecordsCount=jobLoader.getTotalJobDataCount(); --- 166,170 ---- long expectedRecordsCount=0; ! String jobLoaderName=super.jobContext.getJobName()+"_Loader"; PoolJobLoader jobLoader=(PoolJobLoader)this.jobProcessorsMap.get(jobLoaderName); expectedRecordsCount=jobLoader.getTotalJobDataCount(); *************** *** 415,419 **** * @return Returns the callabel interface wrapped around the job loader. */ ! private Callable getCallableLoader(final CountDown countDownLock,final PoolJobLoader jobLoader, final Map configProps, final JobPool pool) { logger.trace("Entering getCallableLoader"); --- 416,420 ---- * @return Returns the callabel interface wrapped around the job loader. */ ! private Callable getCallableLoader(final CountDown countDownLock,final PoolJobLoader jobLoader, final JobContext jobContext, final JobPool pool) { logger.trace("Entering getCallableLoader"); *************** *** 425,429 **** { logger.trace("Going to call the loadPool method"); ! returnCode=jobLoader.loadPool(configProps,pool); logger.debug("Done calling the loadPool method"); } --- 426,430 ---- { logger.trace("Going to call the loadPool method"); ! returnCode=jobLoader.loadPool(jobContext,pool); logger.debug("Done calling the loadPool method"); } *************** *** 454,458 **** * @return Returns the callabel interface wrapped around the job processor. */ ! private Callable getCallableProcessor(final CountDown countDownLock,final PoolJobProcessor jobProcessor, final Map configProps, final JobPool pool) { logger.trace("Entering getCallableProcessor"); --- 455,459 ---- * @return Returns the callabel interface wrapped around the job processor. */ ! private Callable getCallableProcessor(final CountDown countDownLock,final PoolJobProcessor jobProcessor, final JobContext jobContext, final JobPool pool) { logger.trace("Entering getCallableProcessor"); *************** *** 464,468 **** { logger.trace("Going to call the processPool method"); ! returnCode=jobProcessor.processPool(configProps,pool); logger.debug("Done calling the processPool method"); } --- 465,469 ---- { logger.trace("Going to call the processPool method"); ! returnCode=jobProcessor.processPool(jobContext,pool); logger.debug("Done calling the processPool method"); } Index: CollectionJobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/CollectionJobPool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CollectionJobPool.java 13 Sep 2006 04:49:46 -0000 1.7 --- CollectionJobPool.java 13 Sep 2006 23:29:45 -0000 1.8 *************** *** 4,7 **** --- 4,9 ---- import java.util.Map; import org.apache.log4j.Logger; + import org.jmonks.batchserver.framework.JobContext; + import org.jmonks.batchserver.framework.config.PoolJobControllerConfig; /** *************** *** 128,134 **** * @param configProps Configuration defined for the job pool. */ ! public void initialize(Map configProps) { ! this.configProps=new Hashtable(configProps); /** * Try to get the pool size from configuration... If unable to get use default size. --- 130,137 ---- * @param configProps Configuration defined for the job pool. */ ! public void initialize(JobContext jobContext) { ! PoolJobControllerConfig poolJobControllerConfig=(PoolJobControllerConfig)jobContext.getJobConfig().getJobControllerConfig(); ! this.configProps=new Hashtable(poolJobControllerConfig.getPoolConfigProperties()); /** * Try to get the pool size from configuration... If unable to get use default size. |
From: Suresh <sur...@us...> - 2006-09-13 23:29:49
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/management Modified Files: JobConnectorHelper.java JobManagementAgent.java Log Message: no message Index: JobManagementAgent.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobManagementAgent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JobManagementAgent.java 6 Sep 2006 22:07:43 -0000 1.4 --- JobManagementAgent.java 13 Sep 2006 23:29:45 -0000 1.5 *************** *** 11,14 **** --- 11,16 ---- import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; + import org.jmonks.batchserver.framework.Main; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; *************** *** 115,121 **** * @throws IllegalStateException If manager is already started or already stopped. */ ! public boolean start(String jobName,JobController jobController) { logger.trace("Entering start"); if(this.started) throw new IllegalStateException("job management agent has been already started."); --- 117,127 ---- * @throws IllegalStateException If manager is already started or already stopped. */ ! public boolean start(JobContext jobContext, JobController jobController, Main agentManager) { logger.trace("Entering start"); + + if(!(agentManager instanceof Main)) + throw new SecurityException("Not authorized to manage the agent."); + if(this.started) throw new IllegalStateException("job management agent has been already started."); *************** *** 123,132 **** throw new IllegalStateException("job management agent has been already stopped."); ! if(jobName==null || "".equals(jobName)) ! throw new IllegalArgumentException("job name cannot be null or empty to start the job management agent."); if(jobController==null) throw new IllegalArgumentException("controller object cannot be null to start the job management agent."); ! this.jobName=jobName; try --- 129,138 ---- throw new IllegalStateException("job management agent has been already stopped."); ! if(jobContext==null) ! throw new IllegalArgumentException("job context cannot be null to start the job management agent."); if(jobController==null) throw new IllegalArgumentException("controller object cannot be null to start the job management agent."); ! this.jobName=jobContext.getJobName(); try *************** *** 164,168 **** */ this.jmxConnectorServer.start(); ! boolean registered=this.jobConnectorHelper.registerConnectorServer(jobName,this.jmxConnectorServer); if(registered) { --- 170,174 ---- */ this.jmxConnectorServer.start(); ! boolean registered=this.jobConnectorHelper.registerConnectorServer(jobContext,this.jmxConnectorServer); if(registered) { *************** *** 220,226 **** * @throws IllegalStateException If agent is already stopped or it not yet started. */ ! public boolean stop(ErrorCode exitCode) { logger.trace("Entering stop"); if(!this.started) throw new IllegalStateException("Job management agent has not been started."); --- 226,236 ---- * @throws IllegalStateException If agent is already stopped or it not yet started. */ ! public boolean stop(JobContext jobContext, ErrorCode exitCode, Main agentManager) { logger.trace("Entering stop"); + + if(!(agentManager instanceof Main)) + throw new SecurityException("Not authorized to manage the agent."); + if(!this.started) throw new IllegalStateException("Job management agent has not been started."); *************** *** 228,231 **** --- 238,244 ---- if(this.stopped) throw new IllegalStateException("Job management agent has been stopped already."); + + if(jobContext==null) + throw new IllegalArgumentException("Job context cannot be null to stop the server."); if(exitCode==null) *************** *** 234,238 **** { this.jmxConnectorServer.stop(); ! this.jobConnectorHelper.unregisterConnectorServer(this.jobName); this.stopped=true; logger.debug("unregistered the jmx connector server from lookup location"); --- 247,251 ---- { this.jmxConnectorServer.stop(); ! this.jobConnectorHelper.unregisterConnectorServer(jobContext); this.stopped=true; logger.debug("unregistered the jmx connector server from lookup location"); Index: JobConnectorHelper.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobConnectorHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JobConnectorHelper.java 12 Sep 2006 23:24:09 -0000 1.3 --- JobConnectorHelper.java 13 Sep 2006 23:29:45 -0000 1.4 *************** *** 10,19 **** package org.jmonks.batchserver.framework.management; - - import java.util.List; import java.util.Map; - import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorServer; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; --- 10,17 ---- package org.jmonks.batchserver.framework.management; import java.util.Map; import javax.management.remote.JMXConnectorServer; import org.apache.log4j.Logger; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; *************** *** 140,144 **** * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean registerConnectorServer(String jobName,JMXConnectorServer connectorServer); /** --- 138,142 ---- * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean registerConnectorServer(JobContext jobContext,JMXConnectorServer connectorServer); /** *************** *** 152,156 **** * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean unregisterConnectorServer(String jobName); } --- 150,154 ---- * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean unregisterConnectorServer(JobContext jobContext); } |
From: Suresh <sur...@us...> - 2006-09-13 23:29:49
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/jmxmp In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/management/jmxmp Modified Files: RepositoryJMXMPConnectorHelper.java Log Message: no message Index: RepositoryJMXMPConnectorHelper.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/jmxmp/RepositoryJMXMPConnectorHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RepositoryJMXMPConnectorHelper.java 12 Sep 2006 23:24:18 -0000 1.4 --- RepositoryJMXMPConnectorHelper.java 13 Sep 2006 23:29:45 -0000 1.5 *************** *** 1,13 **** package org.jmonks.batchserver.framework.management.jmxmp; - import java.io.IOException; - import java.net.MalformedURLException; - import java.util.HashMap; - import java.util.List; - import javax.management.remote.JMXConnector; - import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXServiceURL; import org.apache.log4j.Logger; ! import org.jmonks.batchserver.framework.repository.Repository; /** --- 1,8 ---- package org.jmonks.batchserver.framework.management.jmxmp; import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXServiceURL; import org.apache.log4j.Logger; ! import org.jmonks.batchserver.framework.JobContext; ! import org.jmonks.batchserver.framework.Repository; /** *************** *** 50,59 **** * @throws IllegalArgumentException If job name paramter or jmxConnectorServer parameter is null. */ ! public boolean registerConnectorServer(String jobName,JMXConnectorServer jmxConnectorServer) { logger.trace("Entering registerConnectorServer") ; ! if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null to registerd jmx service url."); if(jmxConnectorServer==null) throw new IllegalArgumentException("jmx connector server cannot be null to registerd jmx connector server."); --- 45,54 ---- * @throws IllegalArgumentException If job name paramter or jmxConnectorServer parameter is null. */ ! public boolean registerConnectorServer(JobContext jobContext,JMXConnectorServer jmxConnectorServer) { logger.trace("Entering registerConnectorServer") ; ! if(jobContext==null) ! throw new IllegalArgumentException("job context cannot be null to registerd jmx service url."); if(jmxConnectorServer==null) throw new IllegalArgumentException("jmx connector server cannot be null to registerd jmx connector server."); *************** *** 63,68 **** */ JMXServiceURL jmxServiceURL=jmxConnectorServer.getAddress(); ! boolean registered=Repository.getRepository().registerJobMgmtMntrInfo(jmxServiceURL.toString()); ! logger.info(jobName + " with the service url " + jmxServiceURL.toString() + " registered in repository = " + registered); logger.trace("Exiting registerConnectorServer") ; --- 58,63 ---- */ JMXServiceURL jmxServiceURL=jmxConnectorServer.getAddress(); ! boolean registered=jobContext.getRepository().registerJobMgmtMntrInfo(jmxServiceURL.toString()); ! logger.info(jobContext.getJobName() + " with the service url " + jmxServiceURL.toString() + " registered in repository = " + registered); logger.trace("Exiting registerConnectorServer") ; *************** *** 80,95 **** * @throws IllegalArgumentException If job name paramter is null. */ ! public boolean unregisterConnectorServer(String jobName) { logger.trace("Entering unregisterConnectorServer"); ! if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null to unregister the service url."); /** * By default repository will be associated with the job. So we can ignore the jobName here. */ ! boolean unregistered=Repository.getRepository().unregisterJobMgmtMntrInfo(); ! logger.debug(jobName + " mgmt and mntr information unregistered = " + unregistered); logger.trace("Exiting unregisterConnectorServer") ; --- 75,90 ---- * @throws IllegalArgumentException If job name paramter is null. */ ! public boolean unregisterConnectorServer(JobContext jobContext) { logger.trace("Entering unregisterConnectorServer"); ! if(jobContext==null) ! throw new IllegalArgumentException("job context cannot be null to unregister the service url."); /** * By default repository will be associated with the job. So we can ignore the jobName here. */ ! boolean unregistered=jobContext.getRepository().unregisterJobMgmtMntrInfo(); ! logger.debug(jobContext.getJobName() + " mgmt and mntr information unregistered = " + unregistered); logger.trace("Exiting unregisterConnectorServer") ; |
From: Suresh <sur...@us...> - 2006-09-13 23:29:48
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/controller/basic Modified Files: BasicJobController.java BasicJobProcessor.java Log Message: no message Index: BasicJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobProcessor.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BasicJobProcessor.java 13 Sep 2006 04:49:46 -0000 1.11 --- BasicJobProcessor.java 13 Sep 2006 23:29:45 -0000 1.12 *************** *** 1,6 **** package org.jmonks.batchserver.framework.controller.basic; - import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.management.ProcessorStatus; --- 1,6 ---- package org.jmonks.batchserver.framework.controller.basic; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.management.ProcessorStatus; *************** *** 134,138 **** * @return Returns the appropriate error code needs to be passed to the invocation layer. */ ! public abstract ErrorCode process(Map configProps); /** --- 134,138 ---- * @return Returns the appropriate error code needs to be passed to the invocation layer. */ ! public abstract ErrorCode process(JobContext jobContext); /** Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** BasicJobController.java 13 Sep 2006 04:49:46 -0000 1.14 --- BasicJobController.java 13 Sep 2006 23:29:45 -0000 1.15 *************** *** 4,8 **** import EDU.oswego.cs.dl.util.concurrent.FutureResult; import java.util.Calendar; - import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; --- 4,7 ---- *************** *** 11,14 **** --- 10,14 ---- import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.config.BasicJobControllerConfig; import org.jmonks.batchserver.framework.config.ConfigurationException; *************** *** 66,71 **** public ErrorCode process() { ! logger.info("Entering process in basic job controller = " + super.getJobName()); ! BasicJobControllerConfig basicJobControllerConfig=(BasicJobControllerConfig)super.getJobControllerConfig(); int threadCount=basicJobControllerConfig.getBasicJobProcessThreadCount(); /** --- 66,71 ---- public ErrorCode process() { ! logger.info("Entering process in basic job controller = " + super.jobContext.getJobName()); ! BasicJobControllerConfig basicJobControllerConfig=(BasicJobControllerConfig)getJobContext().getJobConfig().getJobControllerConfig(); int threadCount=basicJobControllerConfig.getBasicJobProcessThreadCount(); /** *************** *** 75,87 **** CountDown countDownLock=new CountDown(threadCount); logger.debug("Going to create " + threadCount + " basic job processor(s)"); ! this.jobStatistics=new JobStatistics(super.getJobName()); this.jobStatistics.setStartTime(Calendar.getInstance().getTime()); for(int i=0;i<threadCount;i++) { ! String threadID=super.getJobName()+"_"+(i+1); BasicJobProcessor jobProcessor=this.getBasicJobProcessor(basicJobControllerConfig.getBasicJobProcessorClassName()); FutureResult result=new FutureResult(); Thread processorThread=new Thread(result.setter(this.getCallableProcessor ! (countDownLock,jobProcessor,basicJobControllerConfig.getBasicJobProcessorConfigProperties())), threadID); processorThread.start(); this.jobProcessorsMap.put(threadID,jobProcessor); --- 75,87 ---- CountDown countDownLock=new CountDown(threadCount); logger.debug("Going to create " + threadCount + " basic job processor(s)"); ! this.jobStatistics=new JobStatistics(super.jobContext.getJobName()); this.jobStatistics.setStartTime(Calendar.getInstance().getTime()); for(int i=0;i<threadCount;i++) { ! String threadID=super.jobContext.getJobName()+"_"+(i+1); BasicJobProcessor jobProcessor=this.getBasicJobProcessor(basicJobControllerConfig.getBasicJobProcessorClassName()); FutureResult result=new FutureResult(); Thread processorThread=new Thread(result.setter(this.getCallableProcessor ! (countDownLock,jobProcessor,super.jobContext)), threadID); processorThread.start(); this.jobProcessorsMap.put(threadID,jobProcessor); *************** *** 90,94 **** } ErrorCode returnCode=hybernate(countDownLock); ! logger.info("Exiting process in basic job controller = " + super.getJobName() + " with return code = " + returnCode); return returnCode; } --- 90,94 ---- } ErrorCode returnCode=hybernate(countDownLock); ! logger.info("Exiting process in basic job controller = " + super.jobContext.getJobName() + " with return code = " + returnCode); return returnCode; } *************** *** 294,298 **** * @return Returns the runnable instance. */ ! private Callable getCallableProcessor(final CountDown countDownLock,final BasicJobProcessor jobProcessor,final Map configProps) { logger.trace("Entering getCallableProcessor"); --- 294,298 ---- * @return Returns the runnable instance. */ ! private Callable getCallableProcessor(final CountDown countDownLock,final BasicJobProcessor jobProcessor,final JobContext jobContext) { logger.trace("Entering getCallableProcessor"); *************** *** 306,310 **** logger.debug("Status of registering thread with the processor = " + registered); logger.trace("Going to call the process method"); ! returnCode=jobProcessor.process(new HashMap(configProps)); logger.debug("Done calling the process method"); } --- 306,310 ---- logger.debug("Status of registering thread with the processor = " + registered); logger.trace("Going to call the process method"); ! returnCode=jobProcessor.process(jobContext); logger.debug("Done calling the process method"); } |
From: Suresh <sur...@us...> - 2006-09-13 23:29:48
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/controller 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.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** JobController.java 29 Aug 2006 02:01:33 -0000 1.11 --- JobController.java 13 Sep 2006 23:29:45 -0000 1.12 *************** *** 5,10 **** import org.jmonks.batchserver.framework.LoggingManager; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.config.ConfigurationException; - import org.jmonks.batchserver.framework.config.JobControllerConfig; import org.jmonks.batchserver.framework.management.JobMonitorMBean; import org.jmonks.batchserver.framework.management.JobManagerMBean; --- 5,10 ---- import org.jmonks.batchserver.framework.LoggingManager; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.management.JobMonitorMBean; import org.jmonks.batchserver.framework.management.JobManagerMBean; *************** *** 30,42 **** public abstract class JobController implements JobMonitorMBean, JobManagerMBean { - //protected static final String JOB_CONTROLLER_RESTART_PROPERTY_NAME = "job-controller-restart"; /** * Name of the job this controller belongs to. */ ! private String jobName=null; ! /** ! * Job controller configuration this controller is going to use. ! */ ! private JobControllerConfig jobControllerConfig=null; /** * Singletone instance of job controller. --- 30,37 ---- public abstract class JobController implements JobMonitorMBean, JobManagerMBean { /** * Name of the job this controller belongs to. */ ! protected JobContext jobContext=null; /** * Singletone instance of job controller. *************** *** 64,82 **** * @return Returns the correct implementation of the controller. */ ! public static synchronized JobController getJobController(String jobName, JobControllerConfig jobControllerConfig) { ! logger.trace("Entering getJobController = " + jobName); if(jobController==null) { ! if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null to create the job controller."); ! if(jobControllerConfig==null) ! throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "job controller configuration is not defined in framework configuration"); ! ! /** ! * TODO :: Check for the restart flag all over and take necessary actions before actually instantiating the ! * job controller. ! */ ! String jobControllerClassName=jobControllerConfig.getJobControllerClasName(); if(jobControllerClassName==null || "".equals(jobControllerClassName)) throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "job controller class name is not defined in job controller configuration"); --- 59,68 ---- * @return Returns the correct implementation of the controller. */ ! public static synchronized JobController getJobController(JobContext jobContext) { ! logger.trace("Entering getJobController = " + jobContext.getJobName()); if(jobController==null) { ! String jobControllerClassName=jobContext.getJobConfig().getJobControllerConfig().getJobControllerClasName(); if(jobControllerClassName==null || "".equals(jobControllerClassName)) throw new ConfigurationException(ConfigurationException.JOB_CONTROLLER_CONFIG, "job controller class name is not defined in job controller configuration"); *************** *** 86,91 **** { jobController=(JobController)Class.forName(jobControllerClassName).newInstance(); ! jobController.jobName=jobName; ! jobController.jobControllerConfig=jobControllerConfig; logger.debug("created the job controller implemenation class"); } --- 72,76 ---- { jobController=(JobController)Class.forName(jobControllerClassName).newInstance(); ! jobController.jobContext=jobContext; logger.debug("created the job controller implemenation class"); } *************** *** 109,134 **** } } ! logger.trace("Exiting getJobController = " + jobName); return jobController; } - /** ! * Returns the job name. */ ! public String getJobName() { ! return this.jobName; } /** - * Returns the job controller configuration defined in job configuration. - */ - public JobControllerConfig getJobControllerConfig() - { - return this.jobControllerConfig; - } - - /** * Gets the log level of the given logger name. * --- 94,110 ---- } } ! logger.trace("Exiting getJobController = " + jobContext.getJobName()); return jobController; } /** ! * Gets the job context. */ ! public JobContext getJobContext() { ! return this.jobContext; } /** * Gets the log level of the given logger name. * |
From: Suresh <sur...@us...> - 2006-09-13 23:29:48
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/repository/jdbc Modified Files: JdbcRepository.java Log Message: no message Index: JdbcRepository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/jdbc/JdbcRepository.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JdbcRepository.java 13 Sep 2006 04:49:47 -0000 1.4 --- JdbcRepository.java 13 Sep 2006 23:29:45 -0000 1.5 *************** *** 28,32 **** import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.config.ConfigurationException; ! import org.jmonks.batchserver.framework.repository.Repository; import org.jmonks.batchserver.framework.util.JdbcConnectionHelper; --- 28,32 ---- import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.config.ConfigurationException; ! import org.jmonks.batchserver.framework.Repository; import org.jmonks.batchserver.framework.util.JdbcConnectionHelper; |
From: Suresh <sur...@us...> - 2006-09-13 23:29:48
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/repository/db4o Modified Files: Db4oRepository.java Log Message: no message Index: Db4oRepository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o/Db4oRepository.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Db4oRepository.java 13 Sep 2006 04:49:46 -0000 1.10 --- Db4oRepository.java 13 Sep 2006 23:29:45 -0000 1.11 *************** *** 11,15 **** 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; --- 11,15 ---- import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; ! import org.jmonks.batchserver.framework.Repository; import org.jmonks.batchserver.framework.JobStatistics; |
From: Suresh <sur...@us...> - 2006-09-13 23:29:32
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25409 Modified Files: Main.java Added Files: JobContext.java Repository.java Log Message: no message Index: Main.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/Main.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Main.java 13 Sep 2006 04:49:46 -0000 1.18 --- Main.java 13 Sep 2006 23:29:25 -0000 1.19 *************** *** 6,15 **** import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; - import org.jmonks.batchserver.framework.config.FrameworkConfig.RepositoryConfig; import org.jmonks.batchserver.framework.config.JobConfig; import org.jmonks.batchserver.framework.config.JobConfigFactory; import org.jmonks.batchserver.framework.controller.JobController; import org.jmonks.batchserver.framework.management.JobManagementAgent; ! import org.jmonks.batchserver.framework.repository.Repository; --- 6,14 ---- import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; import org.jmonks.batchserver.framework.config.JobConfig; import org.jmonks.batchserver.framework.config.JobConfigFactory; import org.jmonks.batchserver.framework.controller.JobController; import org.jmonks.batchserver.framework.management.JobManagementAgent; ! *************** *** 81,84 **** --- 80,85 ---- ErrorCode returnCode=ErrorCode.JOB_COMPLETED_SUCCESSFULLY; JobManagementAgent jobManagementAgent=null; + JobContext jobContext=null; + Main frameworkCreator=new Main(); String jobName=null; try *************** *** 114,138 **** logger.debug("Initializing the job logging"); LoggingManager.initializeJobLogging(jobName,frameworkConfig.getFrameworkLoggingConfig(), jobConfig.getJobLoggingConfig()); ! logger.debug("Initialize the repository"); ! if(frameworkConfig.getRepositoryConfig()!=null) ! { ! /** ! * Repository has been configured for this framework. ! * Initialize and clear the data transferred in the earlier run. ! */ ! Repository.createRepository(jobName, frameworkConfig.getRepositoryConfig()); ! Repository.getRepository().clearDataTransferredFromThisJob(); ! } ! logger.debug("Overriding the controller configuration properties with the command line properties."); ! jobConfig.getJobControllerConfig().overrideConfigProperties(configMap); logger.debug("Creating the job controller"); ! JobController jobController=JobController.getJobController(jobName, jobConfig.getJobControllerConfig()); logger.debug("Retrieving the management agent"); - /** - * TODO ::: This should be configurable or default service. - */ jobManagementAgent=JobManagementAgent.getJobManagementAgent(); logger.debug("Registering the controller with the management agent"); ! jobManagementAgent.start(jobName, jobController); logger.error("Kicking off the controller"); returnCode=jobController.process(); --- 115,126 ---- logger.debug("Initializing the job logging"); LoggingManager.initializeJobLogging(jobName,frameworkConfig.getFrameworkLoggingConfig(), jobConfig.getJobLoggingConfig()); ! logger.debug("Create the job context"); ! jobContext=createJobContext(jobConfig, configMap, frameworkCreator); logger.debug("Creating the job controller"); ! JobController jobController=JobController.getJobController(jobContext); logger.debug("Retrieving the management agent"); jobManagementAgent=JobManagementAgent.getJobManagementAgent(); logger.debug("Registering the controller with the management agent"); ! jobManagementAgent.start(jobContext, jobController, frameworkCreator); logger.error("Kicking off the controller"); returnCode=jobController.process(); *************** *** 142,146 **** JobStatistics jobStatistics=jobController.getJobStatistics(); logger.error(jobStatistics); ! Repository.getRepository().logStatistics(jobStatistics); } else --- 130,134 ---- JobStatistics jobStatistics=jobController.getJobStatistics(); logger.error(jobStatistics); ! jobContext.getRepository().logStatistics(jobStatistics); } else *************** *** 175,179 **** logger.debug("Unregistering the controller with the management agent"); if(jobManagementAgent!=null && jobManagementAgent.isRunning()) ! jobManagementAgent.stop(returnCode); } logger.error("Exiting process = " + returnCode); --- 163,167 ---- logger.debug("Unregistering the controller with the management agent"); if(jobManagementAgent!=null && jobManagementAgent.isRunning()) ! jobManagementAgent.stop(jobContext, returnCode, frameworkCreator); } logger.error("Exiting process = " + returnCode); *************** *** 251,253 **** --- 239,252 ---- System.exit(exitCode.getCode()); } + + private static JobContext createJobContext(JobConfig jobConfig, Map commandLineConfig, Main frameworkCreator) + { + Map contextParams=new HashMap(); + contextParams.put(JobContext.CONTEXT_PARAM_JOB_CONFIG, jobConfig); + contextParams.put(JobContext.CONTEXT_PARAM_JOB_COMMAND_LINE_CONFIG, commandLineConfig); + Repository repository=Repository.createRepository(jobConfig.getJobName(), FrameworkConfig.getInstance().getRepositoryConfig(), frameworkCreator); + contextParams.put(JobContext.CONTEXT_PARAM_REPOSITORY, repository); + JobContext jobContext=new JobContext(contextParams, frameworkCreator); + return jobContext; + } } --- NEW FILE: JobContext.java --- /* * JobContext.java * * Created on September 13, 2006, 1:18 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; import java.util.Collections; import java.util.Map; import org.jmonks.batchserver.framework.config.FrameworkConfig; import org.jmonks.batchserver.framework.config.JobConfig; /** * * @author Suresh Pragada */ public class JobContext { public static final String CONTEXT_PARAM_JOB_CONFIG="job.config"; public static final String CONTEXT_PARAM_JOB_COMMAND_LINE_CONFIG="job.command.line.config"; public static final String CONTEXT_PARAM_REPOSITORY="repository"; protected JobConfig jobConfig=null; protected Repository repository=null; protected Map commandLineConfig=null; public JobContext(Map contextParams, Main contextCreator) { if(!(contextCreator instanceof Main)) throw new SecurityException("Not authorized to create the job context."); if(contextParams==null) throw new IllegalArgumentException("Context params to initialize the context cannot be null."); /** * Retrieve and add the command line config map to the context. */ if(contextParams.containsKey(JobContext.CONTEXT_PARAM_JOB_COMMAND_LINE_CONFIG)) { Object objectCommandLineConfig=contextParams.get(JobContext.CONTEXT_PARAM_JOB_COMMAND_LINE_CONFIG); if(objectCommandLineConfig instanceof Map) this.commandLineConfig=(Map)objectCommandLineConfig; else throw new IllegalArgumentException("Provided job command line configuration object to initalize job context is not valid."); } else throw new IllegalArgumentException("Missing the required job command line configuration map object in context params."); /** * Retrieve and add the job config instance to the context. */ if(contextParams.containsKey(JobContext.CONTEXT_PARAM_JOB_CONFIG)) { Object objectJobConfig=contextParams.get(JobContext.CONTEXT_PARAM_JOB_CONFIG); if(objectJobConfig instanceof JobConfig) this.jobConfig=(JobConfig)objectJobConfig; else throw new IllegalArgumentException("Provided job config object to initailize the job context is not valid."); } else throw new IllegalArgumentException("Missing the required job configuration object in context params."); /** * Retrieve and add the repository instance to the context. */ if(contextParams.containsKey(JobContext.CONTEXT_PARAM_REPOSITORY)) { Object objectRepository=contextParams.get(JobContext.CONTEXT_PARAM_REPOSITORY); if(objectRepository instanceof Repository) this.repository=(Repository)objectRepository; else throw new IllegalArgumentException("Provided repository object to initailize the job context is not valid."); } else throw new IllegalArgumentException("Missing the required repository object in context params."); } public String getJobName() { return this.jobConfig.getJobName(); } public Repository getRepository() { return this.repository; } public JobConfig getJobConfig() { return this.jobConfig; } public Map getJobCommandLineConfig() { return Collections.unmodifiableMap(this.commandLineConfig); } public FrameworkConfig getFrameworkConfig() { return FrameworkConfig.getInstance(); } } --- NEW FILE: Repository.java --- package org.jmonks.batchserver.framework; import java.util.Map; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.*; /** * <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 * transfer data between the jobs and register management and monitoring * information between. Repository make sure only one instance * of the implementation class will be created and it will be associated with the * job being run and all the opertions performated will be taken that job as a source job. * </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 constructor is exist and accessible to enable the initialization of * this implementation from the factory method. * </p> * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ public abstract class Repository { private static Logger logger=Logger.getLogger(Repository.class); /** * Variable to hold the singleton instance of repository implementation * defined in framework configuration. */ private static Repository repository=null; /** * Name of the job associated with the repository. */ protected String jobName=null; /** * 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); /** * <p> * Creates the repository instance based on the given configuration and associate * this repository instance with the given job. So all the repository opertions * performed from one job will be associated with that job only. This method * will be called by framework before kicking off the controller. Do not attempt * to call this method to create the repository from the client code. * </p> * * @throws IllegalStateException If there is an attempt is to create the repository * instance more than once. * @throws IllegalArgumentException If jobName is null to create the repository instance. * @throws ConfigurationException If required configuration properties are missing or the values * are invalid. */ public static Repository createRepository(String jobName, FrameworkConfig.RepositoryConfig repositoryConfig, Main repositoryCreator) { logger.trace("Entering createRepository"); if(!(repositoryCreator instanceof Main)) throw new SecurityException("Not authorized to create the repository."); if(repositoryConfig==null) throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Repository configuration is not defined in framework configuration"); if(jobName==null || "".equals(jobName)) throw new IllegalArgumentException("Job Name cannot be null or empty to create repository instance."); 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); try { repository=(Repository)Class.forName(repositoryClassName).newInstance(); repository.init(repositoryConfig.getRepositoryConfigProperties()); repository.jobName=jobName; 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(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()); } logger.trace("Exiting createRepository " + (repository!=null)); return repository; } /** * <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. * @param nextJobName Name of the job this data to be send. * @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. * * @throws IllegalArgumentException If any one of the input values is null. */ public abstract boolean sendDataToNextJob(String dataIdentifier, String nextJobName, final 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 previousJobName Name of the job sent the data to this job. * * @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 dataIdentifier, String previousJobName); /** * <p> * 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 kicking off the controller. * </p> */ public abstract boolean clearDataTransferredFromThisJob(); /** * <p> * Registers the given job management and monitoring info with the job. * If there is any information already associated with this job, it * will be overriden. * </p> * * @param registrationInfo Information to be associated with the job. * * @return Return true, if it could assosciate this information, false, otherwise. * * @throws IllegalArgumentException If input argument registration information * value is null. */ public abstract boolean registerJobMgmtMntrInfo(final Object registrationInfo); /** * Unregisters the job management and monitoring info assosciated with the job. * * @return Return true, it it could unregister the information, false, otherwise. */ public abstract boolean unregisterJobMgmtMntrInfo(); /** * Logs the job statistics given in the form of JobStatistics object * in the repository for further use/references. * * @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. * * @throws IllegalArgumentException If input argument job statistics is null. */ public abstract boolean logStatistics(final JobStatistics statistics); } |
From: Suresh <sur...@us...> - 2006-09-13 05:01:38
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25592 Modified Files: ErrorCode.java JobStatistics.java Log Message: no message Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/ErrorCode.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ErrorCode.java 13 Sep 2006 04:49:46 -0000 1.4 --- ErrorCode.java 13 Sep 2006 05:01:34 -0000 1.5 *************** *** 3,19 **** /** * <p> ! * The ErrorCode represents the error condition can generate in the system ! * and holds error code and message. This is also used to represent the status code ! * for any processor/controller/job. This provides the flexibility to create ! * new custom error codes and append the message to the existing error code. * Codes ranging from 0 to 100 are reserved for framework purpose. Use the codes * above 100 to create the custom error codes. * </p> ! * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ ! public final class ErrorCode { /** --- 3,20 ---- /** * <p> ! * The ErrorCode represents the error condition can generate in the system. ! * It holds code which uniquely identifies the error and message which explains the error in the system. ! * This is also used to represent the status code ! * for any processor/controller/job. This provides the flexibility to create ! * new custom error codes and append the message to the existing error code. * Codes ranging from 0 to 100 are reserved for framework purpose. Use the codes * above 100 to create the custom error codes. * </p> ! * * @author Suresh Pragada * @version 1.0 * @since 1.0 */ ! public final class ErrorCode { /** *************** *** 21,30 **** */ private int code; ! /** * Message illustrates the code. */ private String message=null; ! /** * <p> --- 22,31 ---- */ private int code; ! /** * Message illustrates the code. */ private String message=null; ! /** * <p> *************** *** 32,40 **** * from outside of this class and it is extensible. * </p> ! * * @param code Code represents the error. * @param errorMsg Message illustrates the exit code. */ ! private ErrorCode(int code, String errorMsg) { this.code=code; --- 33,41 ---- * from outside of this class and it is extensible. * </p> ! * * @param code Code represents the error. * @param errorMsg Message illustrates the exit code. */ ! private ErrorCode(int code, String errorMsg) { this.code=code; *************** *** 44,48 **** /** * Returns the error code represents the error. ! * * @return Returns the error code represents the error. */ --- 45,49 ---- /** * Returns the error code represents the error. ! * * @return Returns the error code represents the error. */ *************** *** 54,58 **** /** * Returns the error message illustrates the exit code. ! * * @return Returns the error message. */ --- 55,59 ---- /** * Returns the error message illustrates the exit code. ! * * @return Returns the error message. */ *************** *** 77,81 **** /** * Creates a new error code instance by accepting the code and message. The newMessage ! * should not be null or empty message. * * @param newCode Code to be used to construct the ErrorCode. --- 78,82 ---- /** * Creates a new error code instance by accepting the code and message. The newMessage ! * should not be null or empty message. * * @param newCode Code to be used to construct the ErrorCode. *************** *** 91,97 **** throw new IllegalArgumentException("Message to create new ErrorCode should not be null or empty."); } ! /** ! * Equality will be based on the code the two error codes contain. * * @see java.lang.Object#equals(java.lang.Object) --- 92,98 ---- throw new IllegalArgumentException("Message to create new ErrorCode should not be null or empty."); } ! /** ! * Equality will be based on the code the two error codes contain. * * @see java.lang.Object#equals(java.lang.Object) *************** *** 99,106 **** public boolean equals(Object errorCode) { ! return (errorCode!=null) && (this.getClass()==errorCode.getClass()) && (this.code==((ErrorCode)errorCode).getCode()); } ! /** * Code represented by error code will be returned as a hash code. --- 100,107 ---- public boolean equals(Object errorCode) { ! return (errorCode!=null) && (this.getClass()==errorCode.getClass()) && (this.code==((ErrorCode)errorCode).getCode()); } ! /** * Code represented by error code will be returned as a hash code. *************** *** 112,122 **** return this.code; } ! /** * <p> ! * Returns the string representation of ErrorCode class in the format * <br> {ErrorCode [code = value] [message = value]} * </p> ! * * @return Returns the string representation of ErrorCode. */ --- 113,123 ---- return this.code; } ! /** * <p> ! * Returns the string representation of ErrorCode class in the format * <br> {ErrorCode [code = value] [message = value]} * </p> ! * * @return Returns the string representation of ErrorCode. */ *************** *** 125,193 **** StringBuffer stringValue=new StringBuffer("{ErrorCode "); stringValue.append("[code = " + this.code + "]"); ! stringValue.append("[message = " + this.message + "]"); stringValue.append("}"); return stringValue.toString(); ! } ! ! /** ! * Represents job got completed successfully. Error code is 0. */ public static final ErrorCode JOB_COMPLETED_SUCCESSFULLY = new ErrorCode(0,"Job completed successfully."); ! /** ! * Represents job got completed with errors. This represents the partial success. Error code is 1. */ public static final ErrorCode JOB_COMPLETED_WITH_ERRORS = new ErrorCode(1, "Job completed with some errors."); /** ! * Represents the configuration error used to invoke the job. Error code is 10. */ public static final ErrorCode JOB_INVOKATION_CONFIGURAION_ERROR = new ErrorCode(10,"Error in configuraion passed to invoke job."); /** ! * Represents the framework configuration error. Error code is 11. */ public static final ErrorCode FRAMEWORK_CONFIGURATION_ERROR = new ErrorCode(11,"Error while accessing or parsing the framework configuration file."); /** ! * Represents the job config factory configuration error. Error code is 12. */ public static final ErrorCode JOB_CONFIG_FACTORY_CONFIGURATION_ERROR = new ErrorCode(12,"Job configuration factory cannot be created by the given factory configuration."); /** ! * Represents the job configuration error. Error code is 13. ! */ public static final ErrorCode JOB_CONFIGURATION_ERROR = new ErrorCode(13,"Error while loading the job configuration from the defined factory."); /** ! * Represents the job is not configured error. Error code is 14. ! */ public static final ErrorCode JOB_IS_NOT_CONFIGURED = new ErrorCode(14,"Job is not configured"); /** ! * Represents the job controller configuration error. Error code is 15. ! */ ! public static final ErrorCode JOB_CONTROLLER_CONFIGURATION_ERROR = new ErrorCode(15,"Job controller configuration is not defined properly."); /** ! * Represents the logging configuration error. Error code is 16. ! */ ! public static final ErrorCode JOB_LOGGING_CONFIGURATION_ERROR = new ErrorCode(16,"Job logging configuration is not defined properly."); /** ! * Represents the repository configuration error. Error code is 17. ! */ ! public static final ErrorCode JOB_REPOSITORY_CONFIGURATION_ERROR = new ErrorCode(17,"Repository configuration in framework configuration is not defined properly."); /** ! * Represents the connector configuration error. Error code is 18. ! */ ! public static final ErrorCode JOB_CONNECTOR_CONFIGURATION_ERROR = new ErrorCode(18,"Repository configuration in framework configuration is not defined properly."); /** ! * Represents the unknown configuration error. Error code is 19. ! */ ! public static final ErrorCode UNKNOWN_CONFIGURATION_ERROR = new ErrorCode(19,"Configuration error related to unknown component."); /** ! * Represents error because of the exception in basic job processor. Error code is 20. */ public static final ErrorCode BASIC_JOB_PROCESSOR_EXCEPTION = new ErrorCode(20,"Basic Job Controller caught exception while executing process method on basic job processor."); /** ! * Represents error because of the exception in pool job loader. Error code is 21. */ public static final ErrorCode POOL_JOB_LOADER_EXCEPTION = new ErrorCode(21,"Exception while executing the loader to load the pool."); /** ! * Represents error because of the exception in pool job processor. Error code is 22. ! */ public static final ErrorCode POOL_JOB_PROCESSOR_EXCEPTION = new ErrorCode(22,"Exception while executing the processor to process the pool."); ! } --- 126,194 ---- StringBuffer stringValue=new StringBuffer("{ErrorCode "); stringValue.append("[code = " + this.code + "]"); ! stringValue.append("[message = " + this.message + "]"); stringValue.append("}"); return stringValue.toString(); ! } ! ! /** ! * Represents job got completed successfully. Error code is 0. */ public static final ErrorCode JOB_COMPLETED_SUCCESSFULLY = new ErrorCode(0,"Job completed successfully."); ! /** ! * Represents job got completed with errors. This represents the partial success. Error code is 1. */ public static final ErrorCode JOB_COMPLETED_WITH_ERRORS = new ErrorCode(1, "Job completed with some errors."); /** ! * Represents the configuration error used to invoke the job. Error code is 10. */ public static final ErrorCode JOB_INVOKATION_CONFIGURAION_ERROR = new ErrorCode(10,"Error in configuraion passed to invoke job."); /** ! * Represents the framework configuration error. Error code is 11. */ public static final ErrorCode FRAMEWORK_CONFIGURATION_ERROR = new ErrorCode(11,"Error while accessing or parsing the framework configuration file."); /** ! * Represents the job config factory configuration error. Error code is 12. */ public static final ErrorCode JOB_CONFIG_FACTORY_CONFIGURATION_ERROR = new ErrorCode(12,"Job configuration factory cannot be created by the given factory configuration."); /** ! * Represents the job configuration error. Error code is 13. ! */ public static final ErrorCode JOB_CONFIGURATION_ERROR = new ErrorCode(13,"Error while loading the job configuration from the defined factory."); /** ! * Represents the job is not configured error. Error code is 14. ! */ public static final ErrorCode JOB_IS_NOT_CONFIGURED = new ErrorCode(14,"Job is not configured"); /** ! * Represents the job controller configuration error. Error code is 15. ! */ ! public static final ErrorCode JOB_CONTROLLER_CONFIGURATION_ERROR = new ErrorCode(15,"Job controller configuration is not defined properly."); /** ! * Represents the logging configuration error. Error code is 16. ! */ ! public static final ErrorCode JOB_LOGGING_CONFIGURATION_ERROR = new ErrorCode(16,"Job logging configuration is not defined properly."); /** ! * Represents the repository configuration error. Error code is 17. ! */ ! public static final ErrorCode JOB_REPOSITORY_CONFIGURATION_ERROR = new ErrorCode(17,"Repository configuration in framework configuration is not defined properly."); /** ! * Represents the connector configuration error. Error code is 18. ! */ ! public static final ErrorCode JOB_CONNECTOR_CONFIGURATION_ERROR = new ErrorCode(18,"Repository configuration in framework configuration is not defined properly."); /** ! * Represents the unknown configuration error. Error code is 19. ! */ ! public static final ErrorCode UNKNOWN_CONFIGURATION_ERROR = new ErrorCode(19,"Configuration error related to unknown component."); /** ! * Represents error because of the exception in basic job processor. Error code is 20. */ public static final ErrorCode BASIC_JOB_PROCESSOR_EXCEPTION = new ErrorCode(20,"Basic Job Controller caught exception while executing process method on basic job processor."); /** ! * Represents error because of the exception in pool job loader. Error code is 21. */ public static final ErrorCode POOL_JOB_LOADER_EXCEPTION = new ErrorCode(21,"Exception while executing the loader to load the pool."); /** ! * Represents error because of the exception in pool job processor. Error code is 22. ! */ public static final ErrorCode POOL_JOB_PROCESSOR_EXCEPTION = new ErrorCode(22,"Exception while executing the processor to process the pool."); ! } Index: JobStatistics.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/JobStatistics.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JobStatistics.java 13 Sep 2006 04:49:46 -0000 1.6 --- JobStatistics.java 13 Sep 2006 05:01:34 -0000 1.7 *************** *** 4,9 **** /** ! * This represents all the statistics related to the job. ! * * @author Suresh Pragada * @version 1.0 --- 4,13 ---- /** ! * <p> ! * JobStatistics holds the statistics of the job. These statistics will be ! * start and end time of the job, records have been processed, memory has ! * been utilized and exit code of the job. ! * </p> ! * * @author Suresh Pragada * @version 1.0 *************** *** 36,40 **** */ private ErrorCode exitCode=null; ! /** * Constructor takes the job name and build the skelton. --- 40,44 ---- */ private ErrorCode exitCode=null; ! /** * Constructor takes the job name and build the skelton. *************** *** 52,56 **** /** * Sets the startime of the job. ! * * @param startTime Starting time of the job. */ --- 56,60 ---- /** * Sets the startime of the job. ! * * @param startTime Starting time of the job. */ *************** *** 62,66 **** /** * Sets the endtime of the job. ! * * @param endTime Ending time of the job. */ --- 66,70 ---- /** * Sets the endtime of the job. ! * * @param endTime Ending time of the job. */ *************** *** 72,76 **** /** * Sets the number of the records processed in this job. ! * * @param recordCount Sets the number of records got processed. */ --- 76,80 ---- /** * Sets the number of the records processed in this job. ! * * @param recordCount Sets the number of records got processed. */ *************** *** 82,86 **** /** * Sets the maximum memory used for the job. ! * * @param memoryUsaeg Sets the memory usage by the job. */ --- 86,90 ---- /** * Sets the maximum memory used for the job. ! * * @param memoryUsaeg Sets the memory usage by the job. */ *************** *** 92,96 **** /** * Gets the start time of this job. ! * * @return Returns the starting time of this job. */ --- 96,100 ---- /** * Gets the start time of this job. ! * * @return Returns the starting time of this job. */ *************** *** 102,106 **** /** * Gets the ending time of this job. ! * * @return Gets the end time of this job. */ --- 106,110 ---- /** * Gets the ending time of this job. ! * * @return Gets the end time of this job. */ *************** *** 112,116 **** /** * Gets the number of records processed. ! * * @return Returns the number of records got processed. */ --- 116,120 ---- /** * Gets the number of records processed. ! * * @return Returns the number of records got processed. */ *************** *** 122,126 **** /** * Gets the maximum memory used by this job. ! * * @return Returns the max memory used by this job. */ --- 126,130 ---- /** * Gets the maximum memory used by this job. ! * * @return Returns the max memory used by this job. */ *************** *** 132,136 **** /** * Gets the job name ! * * @return Returns the name of this job. */ --- 136,140 ---- /** * Gets the job name ! * * @return Returns the name of this job. */ *************** *** 149,153 **** this.exitCode=exitCode; } ! /** * Gets the exit code. --- 153,157 ---- this.exitCode=exitCode; } ! /** * Gets the exit code. *************** *** 157,164 **** return this.exitCode; } ! /** * <p> ! * Returns the string representation of JobStatistics class in the format * <br> {JobStatistics [jobName = value] [startTime = value] [endTime = value]} * </p> --- 161,168 ---- return this.exitCode; } ! /** * <p> ! * Returns the string representation of JobStatistics class in the format * <br> {JobStatistics [jobName = value] [startTime = value] [endTime = value]} * </p> *************** *** 171,181 **** 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("[exitCode = " + this.exitCode.toString() + "]"); stringValue.append("}"); return stringValue.toString(); ! } ! } --- 175,185 ---- 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("[exitCode = " + this.exitCode.toString() + "]"); stringValue.append("}"); return stringValue.toString(); ! } ! } |
From: Suresh <sur...@us...> - 2006-09-13 04:51:54
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21674/framework/repository Modified Files: RepositoryTest.java Log Message: no message Index: RepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/RepositoryTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RepositoryTest.java 12 Sep 2006 23:25:05 -0000 1.8 --- RepositoryTest.java 13 Sep 2006 04:51:14 -0000 1.9 *************** *** 3,23 **** * JUnit based test * ! * Created on March 14, 2006, 3:54 PM */ package org.jmonks.batchserver.framework.repository; - import java.util.ArrayList; - import java.util.Calendar; import junit.framework.*; - import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.config.*; - - /** * ! * @author w951h8m */ public class RepositoryTest extends TestCase --- 3,18 ---- * JUnit based test * ! * Created on September 12, 2006, 10:16 PM */ package org.jmonks.batchserver.framework.repository; import junit.framework.*; import org.jmonks.batchserver.framework.config.*; /** * ! * @author Suresh Pragada */ public class RepositoryTest extends TestCase *************** *** 39,45 **** public static Test suite() { ! TestSuite suite = new TestSuite(RepositoryTest.class); ! //TestSuite suite=new TestSuite(); ! //suite.addTest(new RepositoryTest("testJobControllerHolder")); return suite; } --- 34,40 ---- public static Test suite() { ! TestSuite suite = new TestSuite(); ! suite.addTest(new RepositoryTest("testInstantiation")); ! suite.addTest(new RepositoryTest("testCreateReport")); return suite; } *************** *** 69,178 **** } ! /** ! * Test to make sure this is not returning null. ! */ ! public void testGetRepository() ! { ! Repository repository=Repository.getRepository(); ! assertNotNull(repository); ! } ! ! /** ! * Test method to test the logJobStatistics API of repository. ! */ ! public void testLogJobStatistics() ! { ! Repository repository=Repository.getRepository(); ! assertNotNull(repository); ! JobStatistics statistics=new JobStatistics("process_file_xyz"); ! statistics.setStartTime(Calendar.getInstance().getTime()); ! statistics.setEndTime(Calendar.getInstance().getTime()); ! statistics.setMaxMemeoryUsage(1000); ! statistics.setRecordsProcessed(50000); ! boolean logged=repository.logStatistics(statistics); ! assertTrue(logged); ! } ! ! public void testJobDataTransfer() ! { ! FrameworkConfig.RepositoryConfig config=FrameworkConfig.getInstance().getRepositoryConfig(); ! Repository.createRepository("process_file_abc", config); ! Repository repository=Repository.getRepository(); ! assertNotNull(repository); ! ! String id1="first_data"; ! String targetJob="process_file_xyz"; ! ! boolean sent=repository.sendDataToNextJob(id1, targetJob, Calendar.getInstance()); ! assertTrue(sent); ! Calendar cal1=(Calendar)repository.getDataFromPreviousJob(id1, targetJob); ! assertNotNull(cal1); ! boolean cleared=repository.clearDataTransferredFromThisJob(); ! assertTrue(cleared); ! Calendar cal2=(Calendar)repository.getDataFromPreviousJob(id1, targetJob); ! assertNull(cal2); ! ! sent=repository.sendDataToNextJob(id1, targetJob, Calendar.getInstance()); ! assertTrue(sent); ! sent=repository.sendDataToNextJob(id1, targetJob, new ArrayList()); ! assertTrue(sent); ! ArrayList list=(ArrayList)repository.getDataFromPreviousJob(id1, targetJob); ! assertNotNull(cal1); ! cleared=repository.clearDataTransferredFromThisJob(); ! assertTrue(cleared); ! } ! ! public void testJobMgmtMntrInfoHolder() { ! FrameworkConfig.RepositoryConfig config=FrameworkConfig.getInstance().getRepositoryConfig(); ! Repository.createRepository("process_file_abc", config); ! Repository repository=Repository.getRepository(); ! assertNotNull(repository); ! ! boolean unregistered=repository.unregisterJobMgmtMntrInfo(); ! assertFalse(unregistered); ! ! boolean registered=repository.registerJobMgmtMntrInfo(Calendar.getInstance()); ! assertTrue(registered); ! unregistered=repository.unregisterJobMgmtMntrInfo(); ! assertTrue(unregistered); ! ! registered=repository.registerJobMgmtMntrInfo(Calendar.getInstance()); ! assertTrue(registered); ! registered=repository.registerJobMgmtMntrInfo(new ArrayList()); ! assertTrue(registered); ! unregistered=repository.unregisterJobMgmtMntrInfo(); ! assertTrue(unregistered); ! } - public void testJobControllerHolder() - { - /* Repository repository=Repository.getRepository(); - assertNotNull(repository); - - String jobName="process_file_abc"+Calendar.getInstance().getTimeInMillis(); - - JobController controller=repository.loadController(jobName); - assertNull(controller); - boolean released=repository.releaseController(jobName); - assertFalse(released); - - boolean saved=repository.saveController(jobName, new PoolJobController()); - assertTrue(saved); - controller=(JobController)repository.loadController(jobName); - assertNotNull(controller); - released=repository.releaseController(jobName); - assertTrue(released); - - saved=repository.saveController(jobName, new PoolJobController()); - assertTrue(saved); - saved=repository.saveController(jobName, new BasicJobController()); - assertTrue(saved); - BasicJobController basicController=(BasicJobController)repository.loadController(jobName); - assertNotNull(basicController); - released=repository.releaseController(jobName); - assertTrue(released); */ - - } } --- 64,94 ---- } ! public void testCreateReport() { ! FrameworkConfig.RepositoryConfig repositoryConfig=FrameworkConfig.getInstance().getRepositoryConfig(); ! if(repositoryConfig!=null) ! { ! Repository.createRepository("process_file_abc", repositoryConfig); ! try ! { ! Repository.createRepository("process_file_abc", repositoryConfig); ! fail("No shout when trying to create the repository second time."); ! } ! catch(IllegalStateException exception) ! { ! } ! } ! else ! { ! try ! { ! Repository.createRepository("process_file_abc", null); ! fail("Repository has been created with no repository config."); ! } ! catch(ConfigurationException exception) ! { ! } ! } } } |
From: Suresh <sur...@us...> - 2006-09-13 04:51:54
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21674/framework/repository/db4o Added Files: Db4oRepositoryTest.java Log Message: no message --- NEW FILE: Db4oRepositoryTest.java --- /* * Db4oRepositoryTest.java * JUnit based test * * Created on March 14, 2006, 3:54 PM */ package org.jmonks.batchserver.framework.repository.db4o; import com.db4o.ObjectSet; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.JobStatistics; /** * * @author w951h8m */ public class Db4oRepositoryTest extends TestCase { public Db4oRepositoryTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new Db4oRepositoryTest("testInit")); suite.addTest(new Db4oRepositoryTest("testLogJobStatistics")); suite.addTest(new Db4oRepositoryTest("testJobDataTransfer")); suite.addTest(new Db4oRepositoryTest("testJobMgmtMntrInfoHolder")); return suite; } /** * Test to make sure this is not returning null. */ public void testInit() { try { TestDb4oRepository repository=new TestDb4oRepository(); repository.init(getDb4oConfigMap()); assertNotNull(repository); } catch(Exception exception) { fail("Unable to initialize the db4o repository."); } } /** * Test method to test the logJobStatistics API of repository. */ public void testLogJobStatistics() { TestDb4oRepository repository=new TestDb4oRepository(); repository.init(getDb4oConfigMap()); repository.setJobName("process_file_xyz"); JobStatistics statistics=new JobStatistics("process_file_xyz"); statistics.setStartTime(Calendar.getInstance().getTime()); statistics.setEndTime(Calendar.getInstance().getTime()); statistics.setExitCode(ErrorCode.createErrorCode(10001, "This is my error code")); statistics.setMaxMemeoryUsage(1000); statistics.setRecordsProcessed(50000); boolean logged=repository.logStatistics(statistics); assertTrue(logged); JobStatistics[] loggedStats=repository.getStatistics(); assertNotNull(loggedStats); assertTrue(loggedStats.length>=1); } public void testJobDataTransfer() { TestDb4oRepository repository1=new TestDb4oRepository(); repository1.init(getDb4oConfigMap()); repository1.setJobName("process_file_abc"); Map data=new HashMap(); data.put("author", "Suresh"); boolean sent=repository1.sendDataToNextJob("first_data", "process_file_xyz", data); assertTrue(sent); TestDb4oRepository repository2=new TestDb4oRepository(); repository2.init(getDb4oConfigMap()); repository2.setJobName("process_file_xyz"); Object receivedData=repository2.getDataFromPreviousJob("first_data", "process_file_abc"); assertNotNull(receivedData); Map verifyMap=(Map)receivedData; assertEquals("Suresh",(String)verifyMap.get("author")); boolean cleared=repository1.clearDataTransferredFromThisJob(); assertTrue(cleared); receivedData=repository2.getDataFromPreviousJob("first_data", "process_file_abc"); assertNull(receivedData); } public void testJobMgmtMntrInfoHolder() { TestDb4oRepository repository1=new TestDb4oRepository(); repository1.init(getDb4oConfigMap()); repository1.setJobName("process_file_abc"); Map data=new HashMap(); data.put("author", "Suresh"); boolean registered=repository1.registerJobMgmtMntrInfo(data); assertTrue(registered); Object lookupData=repository1.lookupJobMgmtMntrInfo(); assertNotNull(lookupData); Map verifyMap=(Map)lookupData; assertEquals("Suresh",(String)verifyMap.get("author")); boolean unregistered=repository1.unregisterJobMgmtMntrInfo(); assertTrue(unregistered); lookupData=repository1.lookupJobMgmtMntrInfo(); assertNull(lookupData); } private Map getDb4oConfigMap() { Map configMap=new HashMap(); configMap.put(Db4oRepository.PROPERTY_REPOSIOTRY_LOCATION, "/batchserver/repository"); return configMap; } class TestDb4oRepository extends Db4oRepository { TestDb4oRepository() { } public void init(Map configMap) { super.init(configMap); } public void setJobName(String jobName) { this.jobName=jobName; } public Object lookupJobMgmtMntrInfo() { // 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(this.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; } public JobStatistics[] getStatistics() { // 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."); JobStatistics[] statistics=null; if(container==null) statistics=new JobStatistics[0]; else { ObjectSet statisticsResultSet=container.query(new Db4oJobStatisticsPredicate(this.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; } } } |
From: Suresh <sur...@us...> - 2006-09-13 04:51:54
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21674/framework/controller/basic Modified Files: TestBasicJobProcessor.java Log Message: no message Index: TestBasicJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/controller/basic/TestBasicJobProcessor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestBasicJobProcessor.java 6 Sep 2006 22:09:01 -0000 1.5 --- TestBasicJobProcessor.java 13 Sep 2006 04:51:14 -0000 1.6 *************** *** 32,36 **** } ! public int getProcessedRecordsCount() { return 10; --- 32,36 ---- } ! public long getProcessedRecordsCount() { return 10; *************** *** 42,46 **** } ! public int getTotalRecordsCount() { return 50; --- 42,46 ---- } ! public long getTotalRecordsCount() { return 50; |