batchserver-cvs Mailing List for Enterprise Batch Server (Page 10)
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-13 04:51:54
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21674/framework Modified Files: ErrorCodeTest.java FrameworkTestSuite.java Log Message: no message Index: FrameworkTestSuite.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/FrameworkTestSuite.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FrameworkTestSuite.java 6 Sep 2006 22:08:43 -0000 1.8 --- FrameworkTestSuite.java 13 Sep 2006 04:51:14 -0000 1.9 *************** *** 9,13 **** import junit.framework.*; ! import org.jmonks.batchserver.framework.ErrorCodeTest; import org.jmonks.batchserver.framework.util.FrameworkUtilTest; import org.jmonks.batchserver.framework.config.BasicJobControllerConfigTest; --- 9,14 ---- import junit.framework.*; ! import org.jmonks.batchserver.framework.repository.jdbc.MySQLJdbcRepositoryTest; ! import org.jmonks.batchserver.framework.repository.jdbc.OracleJdbcRepositoryTest; import org.jmonks.batchserver.framework.util.FrameworkUtilTest; import org.jmonks.batchserver.framework.config.BasicJobControllerConfigTest; *************** *** 19,22 **** --- 20,25 ---- 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; /** *************** *** 51,54 **** --- 54,58 ---- mainSuite.addTest(LoggingManagerTest.suite()); mainSuite.addTest(FrameworkUtilTest.suite()); + mainSuite.addTest(JdbcConnectionHelperTest.suite()); mainSuite.addTest(ErrorCodeTest.suite()); mainSuite.addTest(FrameworkConfigTest.suite()); *************** *** 60,63 **** --- 64,70 ---- mainSuite.addTest(PoolJobControllerConfigTest.suite()); mainSuite.addTest(RepositoryTest.suite()); + mainSuite.addTest(Db4oRepositoryTest.suite()); + mainSuite.addTest(MySQLJdbcRepositoryTest.suite()); + mainSuite.addTest(OracleJdbcRepositoryTest.suite()); mainSuite.addTest(MainTest.suite()); Index: ErrorCodeTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/ErrorCodeTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ErrorCodeTest.java 5 Sep 2006 18:06:43 -0000 1.1 --- ErrorCodeTest.java 13 Sep 2006 04:51:14 -0000 1.2 *************** *** 45,51 **** public void testGetCode() { ! ErrorCode errorCode=ErrorCode.FRAMEWORK_CONFIGURATION_ERROR; ! int code=errorCode.getCode(); ! assertEquals(1001,code); } --- 45,50 ---- public void testGetCode() { ! ErrorCode errorCode=ErrorCode.JOB_COMPLETED_SUCCESSFULLY; ! assertEquals(0,errorCode.getCode()); } *************** *** 55,61 **** public void testGetMessage() { ! ErrorCode errorCode=ErrorCode.FRAMEWORK_CONFIGURATION_ERROR; ! String message=errorCode.getMessage(); ! assertNotNull(message); } --- 54,59 ---- public void testGetMessage() { ! ErrorCode errorCode=ErrorCode.JOB_COMPLETED_SUCCESSFULLY; ! assertNotNull(errorCode.getMessage()); } *************** *** 85,87 **** --- 83,96 ---- } + public void testCreateErrorCode() + { + ErrorCode errorCode=ErrorCode.createErrorCode(10001,"This is my error code."); + assertNotNull(errorCode); + assertEquals(10001, errorCode.getCode()); + assertEquals("This is my error code.",errorCode.getMessage()); + + errorCode=errorCode.appendMessage("New Message"); + assertTrue(errorCode.getMessage().startsWith("This is my error code.")); + assertTrue(errorCode.getMessage().endsWith("New Message")); + } } |
From: Suresh <sur...@us...> - 2006-09-13 04:51:54
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/util In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21674/framework/util Modified Files: JdbcConnectionHelperTest.java Log Message: no message Index: JdbcConnectionHelperTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/util/JdbcConnectionHelperTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JdbcConnectionHelperTest.java 12 Sep 2006 04:08:14 -0000 1.2 --- JdbcConnectionHelperTest.java 13 Sep 2006 04:51:14 -0000 1.3 *************** *** 37,41 **** public static Test suite() { ! TestSuite suite = new TestSuite(JdbcConnectionHelperTest.class); return suite; } --- 37,43 ---- public static Test suite() { ! TestSuite suite = new TestSuite(); ! suite.addTest(new JdbcConnectionHelperTest("testGetConnection")); ! suite.addTest(new JdbcConnectionHelperTest("testCloseConnection")); return suite; } |
From: Suresh <sur...@us...> - 2006-09-13 04:51:54
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21674/framework/repository/jdbc Modified Files: MySQLJdbcRepositoryTest.java OracleJdbcRepositoryTest.java Log Message: no message Index: OracleJdbcRepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc/OracleJdbcRepositoryTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OracleJdbcRepositoryTest.java 12 Sep 2006 23:25:23 -0000 1.1 --- OracleJdbcRepositoryTest.java 13 Sep 2006 04:51:14 -0000 1.2 *************** *** 8,13 **** --- 8,20 ---- package org.jmonks.batchserver.framework.repository.jdbc; + import java.io.InputStream; + import java.sql.Connection; + import java.sql.PreparedStatement; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; + import java.util.List; import java.util.Map; import junit.framework.*; *************** *** 43,49 **** { TestSuite suite = new TestSuite(); ! //suite.addTest(new OracleJdbcRepositoryTest("testInit")); ! //suite.addTest(new OracleJdbcRepositoryTest("testJobDataTransfer")); suite.addTest(new OracleJdbcRepositoryTest("testLogStatistics")); return suite; } --- 50,57 ---- { TestSuite suite = new TestSuite(); ! suite.addTest(new OracleJdbcRepositoryTest("testInit")); ! suite.addTest(new OracleJdbcRepositoryTest("testJobDataTransfer")); suite.addTest(new OracleJdbcRepositoryTest("testLogStatistics")); + suite.addTest(new OracleJdbcRepositoryTest("testJobMgmtMntrInfo")); return suite; } *************** *** 120,123 **** --- 128,135 ---- boolean logged=repository1.logStatistics(stats); assertTrue(logged); + + JobStatistics[] loggedStats=repository1.getStatistics(); + assertNotNull(loggedStats); + assertTrue(loggedStats.length>=1); } catch(Exception exception) *************** *** 133,136 **** --- 145,174 ---- public void testJobMgmtMntrInfo() { + try + { + OracleJdbcRepository repository1=new OracleJdbcRepository(); + repository1.init(getOracleConfigMap()); + repository1.setJobName("process_file_abc"); + List list=new ArrayList(); + list.add(0, "Suresh"); + boolean registered=repository1.registerJobMgmtMntrInfo(list); + assertTrue(registered); + + Object registeredInfo=repository1.lookupJobMgmtMntrInfo(); + assertNotNull(registeredInfo); + List retrievedList=(List)registeredInfo; + assertTrue(retrievedList.size()>=1); + String savedValue=(String)retrievedList.get(0); + assertEquals("Suresh",savedValue); + + boolean unregistered=repository1.unregisterJobMgmtMntrInfo(); + assertTrue(unregistered); + registeredInfo=repository1.lookupJobMgmtMntrInfo(); + assertNull(registeredInfo); + } + catch(Exception exception) + { + fail("Oracle Jdbc Repository testLogStatistics was failed."); + } } *************** *** 166,169 **** --- 204,309 ---- this.jobName=jobName; } + 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; + List jobStatisticsList=null; + Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); + if(connection==null) + statistics=new JobStatistics[]{}; + else + { + try + { + PreparedStatement statement=connection.prepareStatement("select job_start_time,job_end_time,job_exit_code,job_exit_reason,records_processed,memory_usage from job_statistics where job_name=?"); + statement.setString(1, this.jobName); + ResultSet rs=statement.executeQuery(); + jobStatisticsList=new ArrayList(); + while(rs.next()) + { + JobStatistics statistic=new JobStatistics(jobName); + statistic.setStartTime(new java.util.Date(rs.getTimestamp(1).getTime())); + statistic.setEndTime(new java.util.Date(rs.getTimestamp(2).getTime())); + int exitCode=rs.getInt(3); + String exitReason=rs.getString(4); + ErrorCode errorCode=ErrorCode.createErrorCode(exitCode, exitReason==null?"":exitReason); + statistic.setExitCode(errorCode); + statistic.setRecordsProcessed(rs.getLong(5)); + statistic.setMaxMemeoryUsage(rs.getLong(6)); + jobStatisticsList.add(statistic); + } + rs.close(); + statement.close(); + } + catch(SQLException exception) + { + exception.printStackTrace(); + //logger.error("Exception while trying to get the job statistics for the job = " + this.jobName + ". Message = " + exception.getMessage(), exception); + } + finally + { + JdbcConnectionHelper.closeConnection(connection); + if(jobStatisticsList!=null) + { + statistics=new JobStatistics[jobStatisticsList.size()]; + jobStatisticsList.toArray(statistics); + } + else + statistics=new JobStatistics[]{}; + } + } + //logger.trace("Exiting getStatistics"); + return statistics; + } + + 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 registredInfo=null; + Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); + if(connection==null) + registredInfo=null; + else + { + try + { + PreparedStatement statement=connection.prepareStatement("select job_info from job_mgmt_mntr_info where job_name=?"); + statement.setString(1, this.jobName); + ResultSet rs=statement.executeQuery(); + if(rs.next()) + { + InputStream inputStream=rs.getBinaryStream(1); + registredInfo=deserializeObjectFromInputStream(inputStream); + } + else + registredInfo=null; + rs.close(); + statement.close(); + } + catch(SQLException exception) + { + exception.printStackTrace(); + //logger.error("Exception while trying to lookup mgmt and mntr info = " + this.jobName); + registredInfo=null; + } + finally + { + JdbcConnectionHelper.closeConnection(connection); + } + } + //logger.trace("Exiting lookupJobMgmtMntrInfo"); + return registredInfo; + } + } } Index: MySQLJdbcRepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc/MySQLJdbcRepositoryTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MySQLJdbcRepositoryTest.java 12 Sep 2006 23:25:23 -0000 1.2 --- MySQLJdbcRepositoryTest.java 13 Sep 2006 04:51:14 -0000 1.3 *************** *** 8,14 **** --- 8,24 ---- package org.jmonks.batchserver.framework.repository.jdbc; + import java.io.InputStream; + import java.sql.Connection; + import java.sql.PreparedStatement; + import java.sql.ResultSet; + import java.sql.SQLException; + import java.util.ArrayList; + import java.util.Calendar; import java.util.HashMap; + import java.util.List; import java.util.Map; import junit.framework.*; + import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.util.JdbcConnectionHelper; *************** *** 39,43 **** TestSuite suite = new TestSuite(); suite.addTest(new MySQLJdbcRepositoryTest("testInit")); ! suite.addTest(new MySQLJdbcRepositoryTest("testSendDataToNextJob")); return suite; } --- 49,55 ---- TestSuite suite = new TestSuite(); suite.addTest(new MySQLJdbcRepositoryTest("testInit")); ! suite.addTest(new MySQLJdbcRepositoryTest("testJobDataTransfer")); ! suite.addTest(new MySQLJdbcRepositoryTest("testLogStatistics")); ! suite.addTest(new MySQLJdbcRepositoryTest("testJobMgmtMntrInfo")); return suite; } *************** *** 60,101 **** /** ! * Test of clearDataTransferredFromThisJob method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. ! */ ! public void testClearDataTransferredFromThisJob() ! { ! } ! ! /** ! * Test of sendDataToNextJob method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ ! public void testSendDataToNextJob() { try { ! MySQLJdbcRepository repository=new MySQLJdbcRepository(); ! repository.init(getMySQLConfigMap()); ! repository.setJobName("process_file_abc"); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); ! boolean sendStatus=repository.sendDataToNextJob("ID1", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); ! Object dataSent=repository.getDataFromPreviousJob("ID1", "process_file_xyz"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; String author=(String)dataSentMap.get("author"); assertEquals("suresh",author); } catch(Exception exception) { ! fail("MySQL Jdbc Repository testSendDataToNextJob was failed."); } } - /** - * Test of getDataFromPreviousJob method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. - */ - public void testGetDataFromPreviousJob() - { - } /** --- 72,108 ---- /** ! * Test of testJobDataTransfer covers all the cases for the job data transfer. */ ! public void testJobDataTransfer() { try { ! MySQLJdbcRepository repository1=new MySQLJdbcRepository(); ! repository1.init(getMySQLConfigMap()); ! repository1.setJobName("process_file_abc"); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); ! boolean sendStatus=repository1.sendDataToNextJob("ID1", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); ! ! MySQLJdbcRepository repository2=new MySQLJdbcRepository(); ! repository2.init(getMySQLConfigMap()); ! repository2.setJobName("process_file_xyz"); ! Object dataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; String author=(String)dataSentMap.get("author"); assertEquals("suresh",author); + + repository1.clearDataTransferredFromThisJob(); + Object clearedDataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); + assertNull(clearedDataSent); } catch(Exception exception) { ! fail("MySQL Jdbc Repository testJobDataTransfer was failed."); } } /** *************** *** 104,122 **** public void testLogStatistics() { } /** ! * Test of unregisterJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. ! */ ! public void testUnregisterJobMgmtMntrInfo() ! { ! } ! ! /** ! * Test of registerJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ ! public void testRegisterJobMgmtMntrInfo() { } --- 111,172 ---- public void testLogStatistics() { + try + { + MySQLJdbcRepository repository1=new MySQLJdbcRepository(); + repository1.init(getMySQLConfigMap()); + repository1.setJobName("process_file_abc"); + + 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(123456); + stats.setRecordsProcessed(123456); + + boolean logged=repository1.logStatistics(stats); + assertTrue(logged); + + JobStatistics[] loggedStats=repository1.getStatistics(); + assertNotNull(loggedStats); + assertTrue(loggedStats.length>=1); + } + catch(Exception exception) + { + fail("MySQL Jdbc Repository testLogStatistics was failed."); + } } /** ! * Test of testJobMgmtMntrInfo covers all the cases for the job mgmt and mntr updates. */ ! public void testJobMgmtMntrInfo() { + try + { + MySQLJdbcRepository repository1=new MySQLJdbcRepository(); + repository1.init(getMySQLConfigMap()); + repository1.setJobName("process_file_abc"); + List list=new ArrayList(); + list.add(0, "Suresh"); + boolean registered=repository1.registerJobMgmtMntrInfo(list); + assertTrue(registered); + + Object registeredInfo=repository1.lookupJobMgmtMntrInfo(); + assertNotNull(registeredInfo); + List retrievedList=(List)registeredInfo; + assertTrue(retrievedList.size()>=1); + String savedValue=(String)retrievedList.get(0); + assertEquals("Suresh",savedValue); + + boolean unregistered=repository1.unregisterJobMgmtMntrInfo(); + assertTrue(unregistered); + registeredInfo=repository1.lookupJobMgmtMntrInfo(); + assertNull(registeredInfo); + } + catch(Exception exception) + { + fail("MySQL Jdbc Repository testLogStatistics was failed."); + } } *************** *** 134,141 **** class MySQLJdbcRepository extends JdbcRepository { - - /** - * Creates a new instance of MySQLJdbcRepository - */ public MySQLJdbcRepository() { --- 184,187 ---- *************** *** 151,154 **** --- 197,303 ---- this.jobName=jobName; } + + 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; + List jobStatisticsList=null; + Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); + if(connection==null) + statistics=new JobStatistics[]{}; + else + { + try + { + PreparedStatement statement=connection.prepareStatement("select job_start_time,job_end_time,job_exit_code,job_exit_reason,records_processed,memory_usage from job_statistics where job_name=?"); + statement.setString(1, this.jobName); + ResultSet rs=statement.executeQuery(); + jobStatisticsList=new ArrayList(); + while(rs.next()) + { + JobStatistics statistic=new JobStatistics(jobName); + statistic.setStartTime(new java.util.Date(rs.getTimestamp(1).getTime())); + statistic.setEndTime(new java.util.Date(rs.getTimestamp(2).getTime())); + int exitCode=rs.getInt(3); + String exitReason=rs.getString(4); + ErrorCode errorCode=ErrorCode.createErrorCode(exitCode, exitReason==null?"":exitReason); + statistic.setExitCode(errorCode); + statistic.setRecordsProcessed(rs.getLong(5)); + statistic.setMaxMemeoryUsage(rs.getLong(6)); + jobStatisticsList.add(statistic); + } + rs.close(); + statement.close(); + } + catch(SQLException exception) + { + exception.printStackTrace(); + //logger.error("Exception while trying to get the job statistics for the job = " + this.jobName + ". Message = " + exception.getMessage(), exception); + } + finally + { + JdbcConnectionHelper.closeConnection(connection); + if(jobStatisticsList!=null) + { + statistics=new JobStatistics[jobStatisticsList.size()]; + jobStatisticsList.toArray(statistics); + } + else + statistics=new JobStatistics[]{}; + } + } + //logger.trace("Exiting getStatistics"); + return statistics; + } + + 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 registredInfo=null; + Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); + if(connection==null) + registredInfo=null; + else + { + try + { + PreparedStatement statement=connection.prepareStatement("select job_info from job_mgmt_mntr_info where job_name=?"); + statement.setString(1, this.jobName); + ResultSet rs=statement.executeQuery(); + if(rs.next()) + { + InputStream inputStream=rs.getBinaryStream(1); + registredInfo=deserializeObjectFromInputStream(inputStream); + } + else + registredInfo=null; + rs.close(); + statement.close(); + } + catch(SQLException exception) + { + exception.printStackTrace(); + //logger.error("Exception while trying to lookup mgmt and mntr info = " + this.jobName); + registredInfo=null; + } + finally + { + JdbcConnectionHelper.closeConnection(connection); + } + } + //logger.trace("Exiting lookupJobMgmtMntrInfo"); + return registredInfo; + } + } } |
From: Suresh <sur...@us...> - 2006-09-13 04:50:48
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21292/db4o Log Message: Directory /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/db4o added to the repository |
From: Suresh <sur...@us...> - 2006-09-13 04:49:51
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20831/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.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BasicJobProcessor.java 29 Aug 2006 02:01:32 -0000 1.10 --- BasicJobProcessor.java 13 Sep 2006 04:49:46 -0000 1.11 *************** *** 166,170 **** * @return Returns the number of records/jobs this processor is going to process. */ ! public abstract int getTotalRecordsCount(); /** --- 166,170 ---- * @return Returns the number of records/jobs this processor is going to process. */ ! public abstract long getTotalRecordsCount(); /** *************** *** 174,177 **** * @return Returns the number of records/jobs this processor has finished processing. */ ! public abstract int getProcessedRecordsCount(); } --- 174,177 ---- * @return Returns the number of records/jobs this processor has finished processing. */ ! public abstract long getProcessedRecordsCount(); } Index: BasicJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/basic/BasicJobController.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** BasicJobController.java 10 Sep 2006 17:58:07 -0000 1.13 --- BasicJobController.java 13 Sep 2006 04:49:46 -0000 1.14 *************** *** 100,107 **** * @return Returns the total number of records the job going to process. */ ! public int getExpectedRecordsCount() { logger.trace("Entering getExpectedRecordsCount"); ! int expectedRecordsCount=0; for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) --- 100,107 ---- * @return Returns the total number of records the job going to process. */ ! public long getExpectedRecordsCount() { logger.trace("Entering getExpectedRecordsCount"); ! long expectedRecordsCount=0; for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) *************** *** 120,127 **** * @return Returns the count of processed records. */ ! public int getProcessedRecordsCount() { logger.trace("Entering getProcessedRecordsCount"); ! int processedRecordsCount=0; for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) --- 120,127 ---- * @return Returns the count of processed records. */ ! public long getProcessedRecordsCount() { logger.trace("Entering getProcessedRecordsCount"); ! long processedRecordsCount=0; for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) |
From: Suresh <sur...@us...> - 2006-09-13 04:49:51
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20831/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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JdbcRepository.java 12 Sep 2006 23:23:46 -0000 1.3 --- JdbcRepository.java 13 Sep 2006 04:49:47 -0000 1.4 *************** *** 23,32 **** import java.sql.Timestamp; import java.sql.Types; - import java.util.ArrayList; import java.util.HashMap; - import java.util.List; import java.util.Map; import org.apache.log4j.Logger; - import org.jmonks.batchserver.framework.ErrorCode; import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.config.ConfigurationException; --- 23,29 ---- *************** *** 67,76 **** public class JdbcRepository extends Repository { /** * Map holds the jdbc configuration. */ protected Map jdbcConfigMap=null; - - private static Logger logger=Logger.getLogger(JdbcRepository.class); /** --- 64,73 ---- public class JdbcRepository extends Repository { + private static Logger logger=Logger.getLogger(JdbcRepository.class); + /** * Map holds the jdbc configuration. */ protected Map jdbcConfigMap=null; /** *************** *** 140,144 **** /** ! * @see org.jmonks.batchserver.framework.repository Repository#sendDataToNextJob(String,String,Object) */ public boolean sendDataToNextJob(String dataIdentifier, String nextJobName, final Object data) --- 137,141 ---- /** ! * @see org.jmonks.batchserver.framework.repository Repository#sendDataToNextJob(String,String,Object) */ public boolean sendDataToNextJob(String dataIdentifier, String nextJobName, final Object data) *************** *** 170,174 **** insertStatement.setString(2, nextJobName); insertStatement.setString(3, dataIdentifier); ! byte[] objectByteArray=this.getByteArrayFromObject(data); insertStatement.setBinaryStream(4, new ByteArrayInputStream(objectByteArray), objectByteArray.length); insertStatement.executeUpdate(); --- 167,171 ---- insertStatement.setString(2, nextJobName); insertStatement.setString(3, dataIdentifier); ! byte[] objectByteArray=this.serializeObjectIntoByteArray(data); insertStatement.setBinaryStream(4, new ByteArrayInputStream(objectByteArray), objectByteArray.length); insertStatement.executeUpdate(); *************** *** 223,227 **** { InputStream inputStream=rs.getBinaryStream(1); ! data=getObjectFromByteArray(inputStream); } else --- 220,224 ---- { InputStream inputStream=rs.getBinaryStream(1); ! data=deserializeObjectFromInputStream(inputStream); } else *************** *** 277,282 **** else statement.setNull(5,Types.VARCHAR); ! statement.setInt(6, statistics.getRecordsProcessed()); ! statement.setInt(7, statistics.getMaxMemoryUsage()); statement.executeUpdate(); statement.close(); --- 274,279 ---- else statement.setNull(5,Types.VARCHAR); ! statement.setLong(6, statistics.getRecordsProcessed()); ! statement.setLong(7, statistics.getMaxMemoryUsage()); statement.executeUpdate(); statement.close(); *************** *** 364,368 **** PreparedStatement insertStatement=connection.prepareStatement("insert into job_mgmt_mntr_info (job_name,job_info) values (?,?)"); insertStatement.setString(1, this.jobName); ! byte[] objectByteArray=this.getByteArrayFromObject(registrationInfo); insertStatement.setBinaryStream(2, new ByteArrayInputStream(objectByteArray), objectByteArray.length); insertStatement.executeUpdate(); --- 361,365 ---- PreparedStatement insertStatement=connection.prepareStatement("insert into job_mgmt_mntr_info (job_name,job_info) values (?,?)"); insertStatement.setString(1, this.jobName); ! byte[] objectByteArray=this.serializeObjectIntoByteArray(registrationInfo); insertStatement.setBinaryStream(2, new ByteArrayInputStream(objectByteArray), objectByteArray.length); insertStatement.executeUpdate(); *************** *** 395,399 **** * @return Returns the serialized data as byte array. */ ! private byte[] getByteArrayFromObject(Object object) { try --- 392,396 ---- * @return Returns the serialized data as byte array. */ ! protected byte[] serializeObjectIntoByteArray(Object object) { try *************** *** 422,426 **** * @return Returns the deserialized object. */ ! private Object getObjectFromByteArray(InputStream inputStream) { try --- 419,423 ---- * @return Returns the deserialized object. */ ! protected Object deserializeObjectFromInputStream(InputStream inputStream) { try |
From: Suresh <sur...@us...> - 2006-09-13 04:49:51
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20831/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.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Db4oRepository.java 12 Sep 2006 23:23:31 -0000 1.9 --- Db4oRepository.java 13 Sep 2006 04:49:46 -0000 1.10 *************** *** 42,58 **** * Property identifies the repository location. */ ! private static final String PROPERTY_REPOSIOTRY_LOCATION = "repository-location"; /** * Name of the db40 datbase file used as the repository. */ ! private static final String REPOSITORY_FILENAME = "batchserver_repository.db"; /** * Map holds the configuration properties of repository. */ ! private Map repositoryConfigProperties=null; /** * Db4o container object. */ ! private ObjectContainer container=null; /** --- 42,58 ---- * Property identifies the repository location. */ ! public static final String PROPERTY_REPOSIOTRY_LOCATION = "repository-location"; /** * Name of the db40 datbase file used as the repository. */ ! public static final String REPOSITORY_FILENAME = "batchserver_repository.db"; /** * Map holds the configuration properties of repository. */ ! protected Map repositoryConfigProperties=null; /** * Db4o container object. */ ! protected ObjectContainer container=null; /** |
From: Suresh <sur...@us...> - 2006-09-13 04:49:49
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20831/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.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PoolJobLoader.java 29 Aug 2006 02:01:32 -0000 1.7 --- PoolJobLoader.java 13 Sep 2006 04:49:46 -0000 1.8 *************** *** 69,73 **** * @return Returns the number of records this loader is going to load. */ ! public int getTotalJobDataCount(); /** * Gets the loader state as object which can be understan by the monitoring --- 69,73 ---- * @return Returns the number of records this loader is going to load. */ ! public long getTotalJobDataCount(); /** * Gets the loader state as object which can be understan by the monitoring Index: JobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/JobPool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JobPool.java 16 May 2006 03:15:28 -0000 1.5 --- JobPool.java 13 Sep 2006 04:49:46 -0000 1.6 *************** *** 50,53 **** * @return Returns the number of job data objects being loaded into the pool. */ ! public int getLoadedJobDataCount(); } --- 50,53 ---- * @return Returns the number of job data objects being loaded into the pool. */ ! public long getLoadedJobDataCount(); } Index: PoolJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobProcessor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PoolJobProcessor.java 29 Aug 2006 02:01:32 -0000 1.6 --- PoolJobProcessor.java 13 Sep 2006 04:49:46 -0000 1.7 *************** *** 67,70 **** * @return Returns the number of job data objects processed. */ ! public int getProcessedJobDataCount(); } --- 67,70 ---- * @return Returns the number of job data objects processed. */ ! public long getProcessedJobDataCount(); } Index: AbstractPoolJobProcessor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/AbstractPoolJobProcessor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractPoolJobProcessor.java 29 Aug 2006 02:01:32 -0000 1.5 --- AbstractPoolJobProcessor.java 13 Sep 2006 04:49:46 -0000 1.6 *************** *** 24,28 **** * Counts the number of job data objects processed. */ ! private int processedJobDataCount=0; /** * Signal to stop the processor. --- 24,28 ---- * Counts the number of job data objects processed. */ ! private long processedJobDataCount=0; /** * Signal to stop the processor. *************** *** 203,207 **** * @see org.jmonks.batchserver.framework.controller.pool.PoolJobProcessor#getProcessedJobDataCount() */ ! public int getProcessedJobDataCount() { return processedJobDataCount; --- 203,207 ---- * @see org.jmonks.batchserver.framework.controller.pool.PoolJobProcessor#getProcessedJobDataCount() */ ! public long getProcessedJobDataCount() { return processedJobDataCount; Index: AbstractPoolJobLoader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/AbstractPoolJobLoader.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractPoolJobLoader.java 29 Aug 2006 02:01:32 -0000 1.8 --- AbstractPoolJobLoader.java 13 Sep 2006 04:49:46 -0000 1.9 *************** *** 241,244 **** * @return Return the number of job data object its going to load. */ ! public abstract int getTotalJobDataCount(); } --- 241,244 ---- * @return Return the number of job data object its going to load. */ ! public abstract long getTotalJobDataCount(); } Index: PoolJobController.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/PoolJobController.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PoolJobController.java 10 Sep 2006 17:58:07 -0000 1.13 --- PoolJobController.java 13 Sep 2006 04:49:46 -0000 1.14 *************** *** 160,168 **** * @return Returns the number of records this job goint to process. */ ! public int getExpectedRecordsCount() { logger.trace("Entering getExpectedRecordsCount"); ! int expectedRecordsCount=0; String jobLoaderName=super.getJobName()+"_Loader"; PoolJobLoader jobLoader=(PoolJobLoader)this.jobProcessorsMap.get(jobLoaderName); --- 160,168 ---- * @return Returns the number of records this job goint to process. */ ! public long getExpectedRecordsCount() { logger.trace("Entering getExpectedRecordsCount"); ! long expectedRecordsCount=0; String jobLoaderName=super.getJobName()+"_Loader"; PoolJobLoader jobLoader=(PoolJobLoader)this.jobProcessorsMap.get(jobLoaderName); *************** *** 179,187 **** * @return Returns the number of records processed so far. */ ! public int getProcessedRecordsCount() { logger.trace("Entering getProcessedRecordsCount"); ! int processedRecordsCount=0; for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) { --- 179,187 ---- * @return Returns the number of records processed so far. */ ! public long getProcessedRecordsCount() { logger.trace("Entering getProcessedRecordsCount"); ! long processedRecordsCount=0; for(Iterator iterator=this.jobProcessorsMap.values().iterator();iterator.hasNext();) { Index: CollectionJobPool.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/controller/pool/CollectionJobPool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CollectionJobPool.java 16 May 2006 03:15:28 -0000 1.6 --- CollectionJobPool.java 13 Sep 2006 04:49:46 -0000 1.7 *************** *** 44,48 **** * Holds the number of job data objects have been loaded by job loader. */ ! protected int loadedJobsCount=0; /** * Object to be pushed to the bounded buffer to denote the end of the pool. --- 44,48 ---- * Holds the number of job data objects have been loaded by job loader. */ ! protected long loadedJobsCount=0; /** * Object to be pushed to the bounded buffer to denote the end of the pool. *************** *** 173,177 **** * @see org.jmonks.batchserver.framework.controller.pool.JobPool#getLoadedJobDataCount */ ! public int getLoadedJobDataCount() { return this.loadedJobsCount; --- 173,177 ---- * @see org.jmonks.batchserver.framework.controller.pool.JobPool#getLoadedJobDataCount */ ! public long getLoadedJobDataCount() { return this.loadedJobsCount; |
From: Suresh <sur...@us...> - 2006-09-13 04:49:49
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20831/framework Modified Files: ErrorCode.java JobStatistics.java Main.java Log Message: no message Index: Main.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/Main.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Main.java 6 Sep 2006 22:07:22 -0000 1.17 --- Main.java 13 Sep 2006 04:49:46 -0000 1.18 *************** *** 4,10 **** import java.util.Map; import org.apache.log4j.Logger; - import org.jmonks.batchserver.framework.util.FrameworkUtil; 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; --- 4,10 ---- import java.util.Map; import org.apache.log4j.Logger; 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; *************** *** 114,117 **** --- 114,127 ---- 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); *************** *** 119,122 **** --- 129,135 ---- 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"); Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/ErrorCode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ErrorCode.java 10 Sep 2006 17:56:13 -0000 1.3 --- ErrorCode.java 13 Sep 2006 04:49:46 -0000 1.4 *************** *** 5,11 **** * 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 is like a enum class to make sure ! * the exit codes being passed around the application are valid (defined) and ! * allows the flexibility to append the context specific messages to the error codes. * </p> * --- 5,12 ---- * 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> * *************** *** 16,20 **** public final class ErrorCode { - public static final int FRAMEWORK_MAX_ERROR_CODE = 9999; /** * Code represents the error. --- 17,20 ---- *************** *** 76,97 **** /** ! * Creates a new error code by accepting the code and message. The code ! * should be greater than the value "9999", maximum range being used by the framework. * * @param newCode Code to be used to construct the ErrorCode. * @param newMessage Mesage to be used to construct the ErrorCode. * ! * @throws java.lang.IllegalArgumentException If given code is not greater than 9999 or newMessage is null. */ public static ErrorCode createErrorCode(int newCode, String newMessage) { ! if(newMessage==null) ! throw new IllegalArgumentException("Message to create new ErrorCode should not be null."); ! ! if(newCode>ErrorCode.FRAMEWORK_MAX_ERROR_CODE) return new ErrorCode(newCode,newMessage); else ! throw new IllegalArgumentException("Code to create new ErrorCode should be greater than " + ! ErrorCode.FRAMEWORK_MAX_ERROR_CODE); } --- 76,93 ---- /** ! * 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. * @param newMessage Mesage to be used to construct the ErrorCode. * ! * @throws java.lang.IllegalArgumentException If given message is null or empty. */ public static ErrorCode createErrorCode(int newCode, String newMessage) { ! if(newMessage!=null && !"".equals(newMessage.trim())) return new ErrorCode(newCode,newMessage); else ! throw new IllegalArgumentException("Message to create new ErrorCode should not be null or empty."); } *************** *** 135,197 **** /** ! * Represents job got completed successfully. */ public static final ErrorCode JOB_COMPLETED_SUCCESSFULLY = new ErrorCode(0,"Job completed successfully."); /** ! * Represents job got completed with errors. This represents the partial success. */ 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. */ ! public static final ErrorCode JOB_INVOKATION_CONFIGURAION_ERROR = new ErrorCode(1000,"Error in configuraion passed to invoke job."); /** ! * Represents the framework configuration error. */ ! public static final ErrorCode FRAMEWORK_CONFIGURATION_ERROR = new ErrorCode(1001,"Error while accessing or parsing the framework configuration file."); /** ! * Represents the job config factory configuration error. */ ! public static final ErrorCode JOB_CONFIG_FACTORY_CONFIGURATION_ERROR = new ErrorCode(1002,"Job configuration factory cannot be created by the given factory configuration."); /** ! * Represents the job configuration error. */ ! public static final ErrorCode JOB_CONFIGURATION_ERROR = new ErrorCode(1003,"Error while loading the job configuration from the defined factory."); /** ! * Represents the job is not configured error. */ ! public static final ErrorCode JOB_IS_NOT_CONFIGURED = new ErrorCode(1004,"Job is not configured"); /** ! * Represents the job controller configuration error. */ ! public static final ErrorCode JOB_CONTROLLER_CONFIGURATION_ERROR = new ErrorCode(1005,"Job controller configuration is not defined properly."); /** ! * Represents the logging configuration error. */ ! public static final ErrorCode JOB_LOGGING_CONFIGURATION_ERROR = new ErrorCode(1006,"Job logging configuration is not defined properly."); /** ! * Represents the repository configuration error. */ ! public static final ErrorCode JOB_REPOSITORY_CONFIGURATION_ERROR = new ErrorCode(1007,"Repository configuration in framework configuration is not defined properly."); /** ! * Represents the connector configuration error. */ ! public static final ErrorCode JOB_CONNECTOR_CONFIGURATION_ERROR = new ErrorCode(1008,"Repository configuration in framework configuration is not defined properly."); /** ! * Represents the unknown configuration error. */ ! public static final ErrorCode UNKNOWN_CONFIGURATION_ERROR = new ErrorCode(1009,"Configuration error related to unknown component."); /** ! * Represents error because of the exception in basic job processor. */ ! public static final ErrorCode BASIC_JOB_PROCESSOR_EXCEPTION = new ErrorCode(1102,"Basic Job Controller caught exception while executing process method on basic job processor."); /** ! * Represents error because of the exception in pool job loader. */ ! public static final ErrorCode POOL_JOB_LOADER_EXCEPTION = new ErrorCode(1201,"Exception while executing the loader to load the pool."); /** ! * Represents error because of the exception in pool job processor. */ ! public static final ErrorCode POOL_JOB_PROCESSOR_EXCEPTION = new ErrorCode(1202,"Exception while executing the processor to process the pool."); } --- 131,193 ---- /** ! * 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.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JobStatistics.java 10 Sep 2006 17:56:13 -0000 1.5 --- JobStatistics.java 13 Sep 2006 04:49:46 -0000 1.6 *************** *** 23,31 **** * Number of records processed in this job. */ ! private int recordsProcessed; /** * Maximum memory usage of this job. */ ! private int maxMemoryUsage; /** * Name of the job. --- 23,31 ---- * Number of records processed in this job. */ ! private long recordsProcessed; /** * Maximum memory usage of this job. */ ! private long maxMemoryUsage; /** * Name of the job. *************** *** 75,79 **** * @param recordCount Sets the number of records got processed. */ ! public void setRecordsProcessed(int recordCount) { this.recordsProcessed = recordCount; --- 75,79 ---- * @param recordCount Sets the number of records got processed. */ ! public void setRecordsProcessed(long recordCount) { this.recordsProcessed = recordCount; *************** *** 85,89 **** * @param memoryUsaeg Sets the memory usage by the job. */ ! public void setMaxMemeoryUsage(int memoryUsage) { this.maxMemoryUsage=memoryUsage; --- 85,89 ---- * @param memoryUsaeg Sets the memory usage by the job. */ ! public void setMaxMemeoryUsage(long memoryUsage) { this.maxMemoryUsage=memoryUsage; *************** *** 115,119 **** * @return Returns the number of records got processed. */ ! public int getRecordsProcessed() { return this.recordsProcessed; --- 115,119 ---- * @return Returns the number of records got processed. */ ! public long getRecordsProcessed() { return this.recordsProcessed; *************** *** 125,129 **** * @return Returns the max memory used by this job. */ ! public int getMaxMemoryUsage() { return this.maxMemoryUsage; --- 125,129 ---- * @return Returns the max memory used by this job. */ ! public long getMaxMemoryUsage() { return this.maxMemoryUsage; |
From: Suresh <sur...@us...> - 2006-09-13 04:49:49
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20831/framework/management Modified Files: JobMonitor.java JobMonitorMBean.java Log Message: no message Index: JobMonitor.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobMonitor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JobMonitor.java 14 May 2006 01:34:49 -0000 1.3 --- JobMonitor.java 13 Sep 2006 04:49:47 -0000 1.4 *************** *** 42,46 **** * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getExpectedRecordsCount */ ! public int getExpectedRecordsCount() { return this.jobMonitor.getExpectedRecordsCount(); --- 42,46 ---- * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getExpectedRecordsCount */ ! public long getExpectedRecordsCount() { return this.jobMonitor.getExpectedRecordsCount(); *************** *** 49,53 **** * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getProcessedRecordsCount */ ! public int getProcessedRecordsCount() { return this.jobMonitor.getProcessedRecordsCount(); --- 49,53 ---- * @see org.jmonks.batchserver.framework.management.JobMonitorMBean#getProcessedRecordsCount */ ! public long getProcessedRecordsCount() { return this.jobMonitor.getProcessedRecordsCount(); Index: JobMonitorMBean.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobMonitorMBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobMonitorMBean.java 14 May 2006 01:34:49 -0000 1.2 --- JobMonitorMBean.java 13 Sep 2006 04:49:47 -0000 1.3 *************** *** 19,23 **** * @return Returns the total number of records this job might try to process. */ ! public int getExpectedRecordsCount(); /** --- 19,23 ---- * @return Returns the total number of records this job might try to process. */ ! public long getExpectedRecordsCount(); /** *************** *** 26,30 **** * @return Returns the number of records processed by this job so far. */ ! public int getProcessedRecordsCount(); /** --- 26,30 ---- * @return Returns the number of records processed by this job so far. */ ! public long getProcessedRecordsCount(); /** |
From: Suresh <sur...@us...> - 2006-09-12 23:25:25
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22306 Modified Files: MySQLJdbcRepositoryTest.java Added Files: OracleJdbcRepositoryTest.java Log Message: no message --- NEW FILE: OracleJdbcRepositoryTest.java --- /* * MySQLJdbcRepositoryTest.java * JUnit based test * * Created on September 10, 2006, 12:53 PM */ package org.jmonks.batchserver.framework.repository.jdbc; 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; import org.jmonks.batchserver.framework.util.JdbcConnectionHelper; /** * * @author Suresh Pragada */ public class OracleJdbcRepositoryTest extends TestCase { public OracleJdbcRepositoryTest(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 OracleJdbcRepositoryTest("testInit")); //suite.addTest(new OracleJdbcRepositoryTest("testJobDataTransfer")); suite.addTest(new OracleJdbcRepositoryTest("testLogStatistics")); return suite; } /** * Test of init method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testInit() { try { OracleJdbcRepository repository=new OracleJdbcRepository(); repository.init(getOracleConfigMap()); } catch(Exception exception) { fail("Oracle Jdbc Repository testInit was failed."); } } /** * Test of testJobDataTransfer method covers all the test cases related to the job data transfer. */ public void testJobDataTransfer() { try { OracleJdbcRepository repository1=new OracleJdbcRepository(); repository1.init(getOracleConfigMap()); repository1.setJobName("process_file_abc"); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); boolean sendStatus=repository1.sendDataToNextJob("ID1", "process_file_xyz", dataGoingToBeSend); assertTrue(sendStatus); OracleJdbcRepository repository2=new OracleJdbcRepository(); repository2.init(getOracleConfigMap()); repository2.setJobName("process_file_xyz"); Object dataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; String author=(String)dataSentMap.get("author"); assertEquals("suresh",author); boolean cleared=repository1.clearDataTransferredFromThisJob(); assertTrue(cleared); Object clearedDataSent=repository2.getDataFromPreviousJob("ID1", "process_file_abc"); assertNull(clearedDataSent); } catch(Exception exception) { fail("Oracle Jdbc Repository testJobDataTransfer was failed."); } } /** * Test of logStatistics method covers all the test cases related to logging the statistics. */ public void testLogStatistics() { try { OracleJdbcRepository repository1=new OracleJdbcRepository(); repository1.init(getOracleConfigMap()); repository1.setJobName("process_file_abc"); 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(123456); stats.setRecordsProcessed(123456); boolean logged=repository1.logStatistics(stats); assertTrue(logged); } catch(Exception exception) { fail("Oracle Jdbc Repository testLogStatistics was failed."); } } /** * Test of testJobMgmtMntrInfo method covers all the test cases pertained to the registation of * job management and monitoring. */ public void testJobMgmtMntrInfo() { } private Map getOracleConfigMap() { Map configMap=new HashMap(); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_DRIVER_CLASS_NAME, "oracle.jdbc.driver.OracleDriver"); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_URL, "jdbc:oracle:thin:@himeros:1521:BRTST05"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_USER_NAME, "w951h8m"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_PASSWORD, "prag18"); return configMap; } class OracleJdbcRepository extends JdbcRepository { /** * Creates a new instance of OracleJdbcRepository */ public OracleJdbcRepository() { } public void init(Map configMap) { super.init(configMap); } public void setJobName(String jobName) { this.jobName=jobName; } } } Index: MySQLJdbcRepositoryTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc/MySQLJdbcRepositoryTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MySQLJdbcRepositoryTest.java 12 Sep 2006 04:08:46 -0000 1.1 --- MySQLJdbcRepositoryTest.java 12 Sep 2006 23:25:23 -0000 1.2 *************** *** 75,83 **** MySQLJdbcRepository repository=new MySQLJdbcRepository(); repository.init(getMySQLConfigMap()); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); ! boolean sendStatus=repository.sendDataToNextJob("ID1", "process_file_abc", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); ! Object dataSent=repository.getDataFromPreviousJob("ID1", "process_file_abc", "process_file_xyz"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; --- 75,84 ---- MySQLJdbcRepository repository=new MySQLJdbcRepository(); repository.init(getMySQLConfigMap()); + repository.setJobName("process_file_abc"); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); ! boolean sendStatus=repository.sendDataToNextJob("ID1", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); ! Object dataSent=repository.getDataFromPreviousJob("ID1", "process_file_xyz"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; *************** *** 107,124 **** /** - * Test of getStatistics method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. - */ - public void testGetStatistics() - { - } - - /** - * Test of lookupJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. - */ - public void testLookupJobMgmtMntrInfo() - { - } - - /** * Test of unregisterJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ --- 108,111 ---- *************** *** 134,144 **** } - /** - * Test of getAllRegisteredMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. - */ - public void testGetAllRegisteredMgmtMntrInfo() - { - } - private Map getMySQLConfigMap() { --- 121,124 ---- *************** *** 166,169 **** --- 146,154 ---- super.init(configMap); } + + public void setJobName(String jobName) + { + this.jobName=jobName; + } } } |
From: Suresh <sur...@us...> - 2006-09-12 23:25:07
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22240 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.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RepositoryTest.java 12 Sep 2006 04:09:02 -0000 1.7 --- RepositoryTest.java 12 Sep 2006 23:25:05 -0000 1.8 *************** *** 10,20 **** import java.util.ArrayList; import java.util.Calendar; - import java.util.Date; import junit.framework.*; import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.config.*; ! import org.jmonks.batchserver.framework.controller.JobController; ! import org.jmonks.batchserver.framework.controller.basic.BasicJobController; ! import org.jmonks.batchserver.framework.controller.pool.PoolJobController; --- 10,17 ---- import java.util.ArrayList; import java.util.Calendar; import junit.framework.*; import org.jmonks.batchserver.framework.JobStatistics; import org.jmonks.batchserver.framework.config.*; ! *************** *** 97,163 **** } - /** - * Test method to test the getJobStatistics API of repository. - */ - public void testGetJobStatistics() - { - Repository repository=Repository.getRepository(); - assertNotNull(repository); - - JobStatistics[] recvdStats=repository.getStatistics("not_valid_job_name"); - assertNotNull(recvdStats); - assertEquals(0,recvdStats.length); - - String jobName="process_"+Calendar.getInstance().getTimeInMillis(); - JobStatistics statistics1=this.getJobStatistics(jobName, Calendar.getInstance().getTime(), Calendar.getInstance().getTime() , 234, 5000); - JobStatistics statistics2=this.getJobStatistics(jobName, Calendar.getInstance().getTime(), Calendar.getInstance().getTime() , 236, 5004); - boolean logged=repository.logStatistics(statistics1); - assertTrue(logged); - logged=repository.logStatistics(statistics2); - assertTrue(logged); - - recvdStats=repository.getStatistics(jobName); - assertNotNull(recvdStats); - assertEquals(2,recvdStats.length); - for(int i=0;i<recvdStats.length;i++) - System.out.println(recvdStats[i]); - } - - private JobStatistics getJobStatistics(String jobName,Date startTime,Date endTime,int memory,int records) - { - JobStatistics statistics=new JobStatistics(jobName); - statistics.setStartTime(startTime); - statistics.setEndTime(endTime); - statistics.setMaxMemeoryUsage(memory); - statistics.setRecordsProcessed(records); - - return statistics; - } - public void testJobDataTransfer() { Repository repository=Repository.getRepository(); assertNotNull(repository); String id1="first_data"; - String sourceJob="process_file_abc"; String targetJob="process_file_xyz"; ! boolean sent=repository.sendDataToNextJob(id1, sourceJob, targetJob, Calendar.getInstance()); assertTrue(sent); ! Calendar cal1=(Calendar)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); assertNotNull(cal1); ! boolean cleared=repository.clearDataTransferredFromThisJob(sourceJob); assertTrue(cleared); ! Calendar cal2=(Calendar)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); assertNull(cal2); ! sent=repository.sendDataToNextJob(id1, sourceJob, targetJob, Calendar.getInstance()); assertTrue(sent); ! sent=repository.sendDataToNextJob(id1, sourceJob, targetJob, new ArrayList()); assertTrue(sent); ! ArrayList list=(ArrayList)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); assertNotNull(cal1); ! cleared=repository.clearDataTransferredFromThisJob(sourceJob); assertTrue(cleared); } --- 94,123 ---- } 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); } *************** *** 165,192 **** public void testJobMgmtMntrInfoHolder() { Repository repository=Repository.getRepository(); assertNotNull(repository); ! String jobName="process_file_abc"+Calendar.getInstance().getTimeInMillis(); ! ! Object object=repository.lookupJobMgmtMntrInfo(jobName); ! assertNull(object); ! boolean unregistered=repository.unregisterJobMgmtMntrInfo(jobName); assertFalse(unregistered); ! boolean registered=repository.registerJobMgmtMntrInfo(jobName, Calendar.getInstance()); assertTrue(registered); ! Calendar cal1=(Calendar)repository.lookupJobMgmtMntrInfo(jobName); ! assertNotNull(cal1); ! unregistered=repository.unregisterJobMgmtMntrInfo(jobName); assertTrue(unregistered); ! registered=repository.registerJobMgmtMntrInfo(jobName, Calendar.getInstance()); assertTrue(registered); ! registered=repository.registerJobMgmtMntrInfo(jobName, new ArrayList()); assertTrue(registered); ! ArrayList list=(ArrayList)repository.lookupJobMgmtMntrInfo(jobName); ! assertNotNull(cal1); ! unregistered=repository.unregisterJobMgmtMntrInfo(jobName); assertTrue(unregistered); --- 125,146 ---- 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); |
From: Suresh <sur...@us...> - 2006-09-12 23:24:50
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/oracle In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21902 Modified Files: create_job_statistics.sql Log Message: no message Index: create_job_statistics.sql =================================================================== RCS file: /cvsroot/batchserver/batchserver/bin/dbscripts/oracle/create_job_statistics.sql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** create_job_statistics.sql 10 Sep 2006 22:19:27 -0000 1.1 --- create_job_statistics.sql 12 Sep 2006 23:24:48 -0000 1.2 *************** *** 7,11 **** JOB_EXIT_CODE NUMBER not null, JOB_EXIT_REASON VARCHAR2(1024), ! RECORDS_PRCOESSED NUMBER, MEMORY_USAGE NUMBER ); --- 7,11 ---- JOB_EXIT_CODE NUMBER not null, JOB_EXIT_REASON VARCHAR2(1024), ! RECORDS_PROCESSED NUMBER, MEMORY_USAGE NUMBER ); *************** *** 21,25 **** comment on column JOB_STATISTICS.JOB_EXIT_REASON is 'Reason in case of job failure'; ! comment on column JOB_STATISTICS.RECORDS_PRCOESSED is 'Number of records processed.'; comment on column JOB_STATISTICS.MEMORY_USAGE --- 21,25 ---- comment on column JOB_STATISTICS.JOB_EXIT_REASON is 'Reason in case of job failure'; ! comment on column JOB_STATISTICS.RECORDS_PROCESSED is 'Number of records processed.'; comment on column JOB_STATISTICS.MEMORY_USAGE |
From: Suresh <sur...@us...> - 2006-09-12 23:24:41
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/mysql In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21886 Modified Files: create_job_statistics.sql Log Message: no message Index: create_job_statistics.sql =================================================================== RCS file: /cvsroot/batchserver/batchserver/bin/dbscripts/mysql/create_job_statistics.sql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** create_job_statistics.sql 12 Sep 2006 04:09:36 -0000 1.1 --- create_job_statistics.sql 12 Sep 2006 23:24:40 -0000 1.2 *************** *** 6,10 **** `JOB_EXIT_CODE` decimal(10,0) NOT NULL default '0' COMMENT 'Job exit code.', `JOB_EXIT_REASON` varchar(1024) default NULL COMMENT 'Reason in case of job failure', ! `RECORDS_PRCOESSED` decimal(10,0) NOT NULL default '0' COMMENT 'Number of records processed.', `MEMORY_USAGE` decimal(10,0) NOT NULL default '0' COMMENT 'Memory used by the job.', KEY `NUIDX_JOB_NAME_STATS` (`JOB_NAME`) --- 6,10 ---- `JOB_EXIT_CODE` decimal(10,0) NOT NULL default '0' COMMENT 'Job exit code.', `JOB_EXIT_REASON` varchar(1024) default NULL COMMENT 'Reason in case of job failure', ! `RECORDS_PROCESSED` decimal(10,0) NOT NULL default '0' COMMENT 'Number of records processed.', `MEMORY_USAGE` decimal(10,0) NOT NULL default '0' COMMENT 'Memory used by the job.', KEY `NUIDX_JOB_NAME_STATS` (`JOB_NAME`) |
From: Suresh <sur...@us...> - 2006-09-12 23:24:20
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/jmxmp In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21858 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RepositoryJMXMPConnectorHelper.java 7 Sep 2006 03:06:17 -0000 1.3 --- RepositoryJMXMPConnectorHelper.java 12 Sep 2006 23:24:18 -0000 1.4 *************** *** 59,65 **** throw new IllegalArgumentException("jmx connector server cannot be null to registerd jmx connector server."); ! JMXServiceURL jmxServiceURL=jmxConnectorServer.getAddress(); ! boolean registered=Repository.getRepository().registerJobMgmtMntrInfo(jobName, jmxServiceURL.toString()); logger.info(jobName + " with the service url " + jmxServiceURL.toString() + " registered in repository = " + registered); --- 59,67 ---- throw new IllegalArgumentException("jmx connector server cannot be null to registerd jmx connector server."); ! /** ! * By default repository will be associated with the job. So we can ignore the jobName here. ! */ JMXServiceURL jmxServiceURL=jmxConnectorServer.getAddress(); ! boolean registered=Repository.getRepository().registerJobMgmtMntrInfo(jmxServiceURL.toString()); logger.info(jobName + " with the service url " + jmxServiceURL.toString() + " registered in repository = " + registered); *************** *** 85,89 **** throw new IllegalArgumentException("job name cannot be null to unregister the service url."); ! boolean unregistered=Repository.getRepository().unregisterJobMgmtMntrInfo(jobName); logger.debug(jobName + " mgmt and mntr information unregistered = " + unregistered); --- 87,94 ---- 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); *************** *** 91,142 **** return unregistered; } - - /** - * Gets all the job names registered in the repository as a list. - * - * @return Returns the list of all the job names registered in repository. - */ - public List getRegisteredJobList() - { - return (List)Repository.getRepository().getAllRegisteredMgmtMntrInfo().keySet(); - } - - /** - * Returns the JMX connector client for the given job name. - * - * @return Returns the JXM connector client for the given job name, - * null, if it doesnt find or could not create the JMX connector client. - * - * @throws IllegalArgumentException If job name argument is null. - */ - public JMXConnector createConnector(String jobName) - { - if(jobName==null) - throw new IllegalArgumentException("job name cannot be null to create the connector."); - - String serviceURL=(String)Repository.getRepository().lookupJobMgmtMntrInfo(jobName); - JMXConnector jmxConnector=null; - if(serviceURL==null) - jmxConnector=null; - else - { - try - { - JMXServiceURL jmxServiceURL=new JMXServiceURL(serviceURL); - jmxConnector=JMXConnectorFactory.newJMXConnector(jmxServiceURL, new HashMap()); - } - catch(MalformedURLException exception) - { - exception.printStackTrace(); - logger.error(exception.getMessage(), exception); - } - catch(IOException exception) - { - exception.printStackTrace(); - logger.error(exception.getMessage(), exception); - } - } - return jmxConnector; - } - } --- 96,98 ---- |
From: Suresh <sur...@us...> - 2006-09-12 23:24:12
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21829 Modified Files: JobConnectorHelper.java Removed Files: JobManagementClient.java Log Message: no message --- JobManagementClient.java DELETED --- Index: JobConnectorHelper.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobConnectorHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JobConnectorHelper.java 6 Sep 2006 22:07:43 -0000 1.2 --- JobConnectorHelper.java 12 Sep 2006 23:24:09 -0000 1.3 *************** *** 154,171 **** public abstract boolean unregisterConnectorServer(String jobName); - /** - * Gets all the job names registered in the lookup location. - * - * @return Returns the list of all the job names registered in lookup location. - */ - public abstract List getRegisteredJobList(); - - /** - * Returns the JMX connector client for the given job name. - * - * @return Returns the JXM connector client for the given job name, - * null, if it doesnt find or could not create the JMX connector client. - */ - public abstract JMXConnector createConnector(String jobName); - } --- 154,156 ---- |
From: Suresh <sur...@us...> - 2006-09-12 23:23:50
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21451 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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JdbcRepository.java 12 Sep 2006 04:07:55 -0000 1.2 --- JdbcRepository.java 12 Sep 2006 23:23:46 -0000 1.3 *************** *** 102,114 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#clearDataTransferredToNextJob(String) */ ! public boolean clearDataTransferredFromThisJob(String jobName) { logger.trace("Entering clearDataTransferredToNextJob"); - logger.debug("clearDataTransferredToNextJob :: job name = " + jobName); - - if(jobName==null) - throw new IllegalArgumentException("job name cannot be null."); boolean dataCleared=false; --- 102,110 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#clearDataTransferredToNextJob() */ ! public boolean clearDataTransferredFromThisJob() { logger.trace("Entering clearDataTransferredToNextJob"); boolean dataCleared=false; *************** *** 121,125 **** { PreparedStatement statement=connection.prepareStatement("delete from job_data_transfer where source_job_name=?"); ! statement.setString(1, jobName); statement.executeUpdate(); statement.close(); --- 117,121 ---- { PreparedStatement statement=connection.prepareStatement("delete from job_data_transfer where source_job_name=?"); ! statement.setString(1, this.jobName); statement.executeUpdate(); statement.close(); *************** *** 131,135 **** exception.printStackTrace(); logger.error("Exception while trying to clear the data for requested job = " ! + jobName + ". Message = " + exception.getMessage(), exception); dataCleared=false; } --- 127,131 ---- exception.printStackTrace(); logger.error("Exception while trying to clear the data for requested job = " ! + this.jobName + ". Message = " + exception.getMessage(), exception); dataCleared=false; } *************** *** 144,155 **** /** ! * @see org.jmonks.batchserver.framework.repository Repository#sendDataToNextJob(String,String,String,Object) */ ! public boolean sendDataToNextJob(String dataIdentifier, String sourceJobName, String targetJobName, Object data) { logger.trace("Entering sendDataToNextJob);"); ! logger.debug("data identifier = " + dataIdentifier + " source job name = " + sourceJobName + " target job name = " + targetJobName + " data = " + data); ! if(dataIdentifier==null || sourceJobName==null || targetJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); --- 140,151 ---- /** ! * @see org.jmonks.batchserver.framework.repository Repository#sendDataToNextJob(String,String,Object) */ ! public boolean sendDataToNextJob(String dataIdentifier, String nextJobName, final Object data) { logger.trace("Entering sendDataToNextJob);"); ! logger.debug("data identifier = " + dataIdentifier + " next job name = " + nextJobName + " data = " + data); ! if(dataIdentifier==null || nextJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); *************** *** 163,176 **** { PreparedStatement deleteStatement=connection.prepareStatement("delete from job_data_transfer where source_job_name=? and destination_job_name=? and job_data_identifier=?"); ! deleteStatement.setString(1, sourceJobName); ! deleteStatement.setString(2, targetJobName); deleteStatement.setString(3, dataIdentifier); deleteStatement.executeUpdate(); deleteStatement.close(); ! logger.debug("Data has been cleared before loading = " + sourceJobName + " " + targetJobName + " " + dataIdentifier); PreparedStatement insertStatement=connection.prepareStatement("insert into job_data_transfer (source_job_name,destination_job_name,job_data_identifier,job_data) values (?,?,?,?)"); ! insertStatement.setString(1, sourceJobName); ! insertStatement.setString(2, targetJobName); insertStatement.setString(3, dataIdentifier); byte[] objectByteArray=this.getByteArrayFromObject(data); --- 159,172 ---- { PreparedStatement deleteStatement=connection.prepareStatement("delete from job_data_transfer where source_job_name=? and destination_job_name=? and job_data_identifier=?"); ! deleteStatement.setString(1, this.jobName); ! deleteStatement.setString(2, nextJobName); deleteStatement.setString(3, dataIdentifier); deleteStatement.executeUpdate(); deleteStatement.close(); ! logger.debug("Data has been cleared before loading = " + this.jobName + " " + nextJobName + " " + dataIdentifier); PreparedStatement insertStatement=connection.prepareStatement("insert into job_data_transfer (source_job_name,destination_job_name,job_data_identifier,job_data) values (?,?,?,?)"); ! insertStatement.setString(1, this.jobName); ! insertStatement.setString(2, nextJobName); insertStatement.setString(3, dataIdentifier); byte[] objectByteArray=this.getByteArrayFromObject(data); *************** *** 178,182 **** insertStatement.executeUpdate(); insertStatement.close(); ! logger.debug("Data has been loaded = " + sourceJobName + " " + targetJobName + " " + dataIdentifier); connection.commit(); --- 174,178 ---- insertStatement.executeUpdate(); insertStatement.close(); ! logger.debug("Data has been loaded = " + this.jobName + " " + nextJobName + " " + dataIdentifier); connection.commit(); *************** *** 186,191 **** { exception.printStackTrace(); ! logger.error("Exception while trying to send the data from " + sourceJobName + " to job = " ! + targetJobName + " with the identifier " + dataIdentifier + ". Message = " + exception.getMessage(), exception); dataSaved=false; } --- 182,187 ---- { exception.printStackTrace(); ! logger.error("Exception while trying to send the data from " + this.jobName + " to job = " ! + nextJobName + " with the identifier " + dataIdentifier + ". Message = " + exception.getMessage(), exception); dataSaved=false; } *************** *** 200,212 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getDataFromPreviousJob(String,String,String) */ ! public Object getDataFromPreviousJob(String dataIdentifier, String sourceJobName, String targetJobName) { logger.trace("Entering getDataFromPreviousJob"); ! logger.debug("data identifier = " + dataIdentifier + " source job name = " + sourceJobName + " target job name = " + targetJobName); ! if(dataIdentifier==null || sourceJobName==null || targetJobName==null) ! throw new IllegalArgumentException("Data identifer, source job name and target job name cannot be null " + "to get the data from previous job."); --- 196,208 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getDataFromPreviousJob(String,String) */ ! public Object getDataFromPreviousJob(String dataIdentifier, String previousJobName) { logger.trace("Entering getDataFromPreviousJob"); ! logger.debug("data identifier = " + dataIdentifier + " previous job name = " + previousJobName); ! if(dataIdentifier==null || previousJobName==null) ! throw new IllegalArgumentException("Data identifer and previous job name cannot be null " + "to get the data from previous job."); *************** *** 220,225 **** { PreparedStatement statement=connection.prepareStatement("select job_data from job_data_transfer where source_job_name=? and destination_job_name=? and job_data_identifier=?"); ! statement.setString(1, sourceJobName); ! statement.setString(2, targetJobName); statement.setString(3, dataIdentifier); ResultSet rs=statement.executeQuery(); --- 216,221 ---- { PreparedStatement statement=connection.prepareStatement("select job_data from job_data_transfer where source_job_name=? and destination_job_name=? and job_data_identifier=?"); ! statement.setString(1, previousJobName); ! statement.setString(2, this.jobName); statement.setString(3, dataIdentifier); ResultSet rs=statement.executeQuery(); *************** *** 237,242 **** { exception.printStackTrace(); ! logger.error("Exception while trying to send the data from " + sourceJobName + " to job = " ! + targetJobName + " with the identifier " + dataIdentifier + ". Message = " + exception.getMessage(), exception); data=null; } --- 233,238 ---- { exception.printStackTrace(); ! logger.error("Exception while trying to send the data from " + previousJobName + " to job = " ! + this.jobName + " with the identifier " + dataIdentifier + ". Message = " + exception.getMessage(), exception); data=null; } *************** *** 251,255 **** /** - * * @see org.jmonks.batchserver.framework.repository.Repository#logStatistics(org.jmonks.batchserver.framework.JobStatistics) */ --- 247,250 ---- *************** *** 260,265 **** if(statistics==null) throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); logger.debug("Logging = " + statistics.toString()); - boolean logged=false; Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); --- 255,262 ---- if(statistics==null) throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); + if(!statistics.getJobname().equals(this.jobName)) + throw new IllegalArgumentException("Statistics object is not related to the job configured for the repository."); + logger.debug("Logging = " + statistics.toString()); boolean logged=false; Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); *************** *** 303,421 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getStatistics(String) ! */ ! public JobStatistics[] getStatistics(String jobName) ! { ! logger.trace("Entering getStatistics"); ! logger.debug("getStatistics :: job name = " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); ! ! JobStatistics[] statistics=null; ! List jobStatisticsList=null; ! Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); ! if(connection==null) ! statistics=new JobStatistics[]{}; ! else ! { ! try ! { ! PreparedStatement statement=connection.prepareStatement("select job_start_time,job_end_time,job_exit_code,job_exit_reason,records_processed,memory_usage from job_statistics where job_name=?"); ! statement.setString(1, jobName); ! ResultSet rs=statement.executeQuery(); ! jobStatisticsList=new ArrayList(); ! while(rs.next()) ! { ! JobStatistics statistic=new JobStatistics(jobName); ! statistic.setStartTime(new java.util.Date(rs.getTimestamp(1).getTime())); ! statistic.setEndTime(new java.util.Date(rs.getTimestamp(2).getTime())); ! int exitCode=rs.getInt(3); ! String exitReason=rs.getString(4); ! ErrorCode errorCode=ErrorCode.createErrorCode(exitCode, exitReason==null?"":exitReason); ! statistic.setExitCode(errorCode); ! statistic.setRecordsProcessed(rs.getInt(5)); ! statistic.setMaxMemeoryUsage(rs.getInt(6)); ! jobStatisticsList.add(statistic); ! } ! rs.close(); ! statement.close(); ! } ! catch(SQLException exception) ! { ! exception.printStackTrace(); ! logger.error("Exception while trying to get the job statistics for the job = " + jobName + ". Message = " + exception.getMessage(), exception); ! } ! finally ! { ! JdbcConnectionHelper.closeConnection(connection); ! if(jobStatisticsList!=null) ! statistics=(JobStatistics[])jobStatisticsList.toArray(); ! else ! statistics=new JobStatistics[]{}; ! } ! } ! logger.trace("Exiting getStatistics"); ! return statistics; ! } ! ! /** ! * @see org.jmonks.batchserver.framework.repository.Repository#lookupJobMgmtMntrInfo(String) ! */ ! public Object lookupJobMgmtMntrInfo(String jobName) ! { ! logger.trace("Entering lookupJobMgmtMntrInfo"); ! logger.debug("lookupJobMgmtMntrInfo :: job name = " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("jobName cannot be null to lookup the mgmt and mntr information."); ! ! Object registredInfo=null; ! Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); ! if(connection==null) ! registredInfo=null; ! else ! { ! try ! { ! PreparedStatement statement=connection.prepareStatement("select job_info from job_mgmt_mntr_info where job_name=?"); ! statement.setString(1, jobName); ! ResultSet rs=statement.executeQuery(); ! if(rs.next()) ! { ! InputStream inputStream=rs.getBinaryStream(1); ! registredInfo=getObjectFromByteArray(inputStream); ! } ! else ! registredInfo=null; ! rs.close(); ! statement.close(); ! } ! catch(SQLException exception) ! { ! exception.printStackTrace(); ! logger.error("Exception while trying to lookup mgmt and mntr info = " + jobName); ! registredInfo=null; ! } ! finally ! { ! JdbcConnectionHelper.closeConnection(connection); ! } ! } ! logger.trace("Exiting lookupJobMgmtMntrInfo"); ! return registredInfo; ! } ! ! /** ! * @see org.jmonks.batchserver.framework.repository.Repository#unregisterJobMgmtMntrInfo(String) */ ! public boolean unregisterJobMgmtMntrInfo(String jobName) { logger.trace("Entering unregisterJobMgmtMntrInfo"); - logger.debug("unregisterJobMgmtMntrInfo :: job name = " + jobName); - - if(jobName==null) - throw new IllegalArgumentException("jobName cannot be null to unregister the mgmt and mntr information."); - boolean unregistered=false; --- 300,308 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#unregisterJobMgmtMntrInfo() */ ! public boolean unregisterJobMgmtMntrInfo() { logger.trace("Entering unregisterJobMgmtMntrInfo"); boolean unregistered=false; *************** *** 428,432 **** { PreparedStatement statement=connection.prepareStatement("delete from job_mgmt_mntr_info where job_name=?"); ! statement.setString(1, jobName); statement.executeUpdate(); statement.close(); --- 315,319 ---- { PreparedStatement statement=connection.prepareStatement("delete from job_mgmt_mntr_info where job_name=?"); ! statement.setString(1, this.jobName); statement.executeUpdate(); statement.close(); *************** *** 437,441 **** { exception.printStackTrace(); ! logger.error("Exception while trying to lookup mgmt and mntr info = " + jobName); unregistered=false; } --- 324,328 ---- { exception.printStackTrace(); ! logger.error("Exception while trying to lookup mgmt and mntr info = " + this.jobName); unregistered=false; } *************** *** 450,462 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#registerJobMgmtMntrInfo(String,Object) */ ! public boolean registerJobMgmtMntrInfo(String jobName, Object registrationInfo) { logger.trace("Entering registerJobMgmtMntrInfo"); ! logger.debug("job name = " + jobName + " registratinfo = " + registrationInfo); - if(jobName==null) - throw new IllegalArgumentException("Job name cannot be null to register the job in repository."); if(registrationInfo==null) throw new IllegalArgumentException("Job registration information cannot be null to register the job in repository."); --- 337,347 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#registerJobMgmtMntrInfo(Object) */ ! public boolean registerJobMgmtMntrInfo(final Object registrationInfo) { logger.trace("Entering registerJobMgmtMntrInfo"); ! logger.debug(" registratinfo = " + registrationInfo); if(registrationInfo==null) throw new IllegalArgumentException("Job registration information cannot be null to register the job in repository."); *************** *** 472,487 **** { PreparedStatement deleteStatement=connection.prepareStatement("delete from job_mgmt_mntr_info where job_name=?"); ! deleteStatement.setString(1, jobName); deleteStatement.executeUpdate(); deleteStatement.close(); ! logger.debug("Cleared the existing registration info = " + jobName); PreparedStatement insertStatement=connection.prepareStatement("insert into job_mgmt_mntr_info (job_name,job_info) values (?,?)"); ! insertStatement.setString(1, jobName); byte[] objectByteArray=this.getByteArrayFromObject(registrationInfo); insertStatement.setBinaryStream(2, new ByteArrayInputStream(objectByteArray), objectByteArray.length); insertStatement.executeUpdate(); insertStatement.close(); ! logger.debug("Registered mgmt mntr info = " + jobName); connection.commit(); --- 357,372 ---- { PreparedStatement deleteStatement=connection.prepareStatement("delete from job_mgmt_mntr_info where job_name=?"); ! deleteStatement.setString(1, this.jobName); deleteStatement.executeUpdate(); deleteStatement.close(); ! logger.debug("Cleared the existing registration info = " + this.jobName); PreparedStatement insertStatement=connection.prepareStatement("insert into job_mgmt_mntr_info (job_name,job_info) values (?,?)"); ! insertStatement.setString(1, this.jobName); byte[] objectByteArray=this.getByteArrayFromObject(registrationInfo); insertStatement.setBinaryStream(2, new ByteArrayInputStream(objectByteArray), objectByteArray.length); insertStatement.executeUpdate(); insertStatement.close(); ! logger.debug("Registered mgmt mntr info = " + this.jobName); connection.commit(); *************** *** 491,495 **** { exception.printStackTrace(); ! logger.error("Exception while trying to register the mgmt mntr info = " + jobName+ ". Message = " + exception.getMessage(), exception); registered=false; } --- 376,380 ---- { exception.printStackTrace(); ! logger.error("Exception while trying to register the mgmt mntr info = " + this.jobName+ ". Message = " + exception.getMessage(), exception); registered=false; } *************** *** 504,550 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getAllRegisteredMgmtMntrInfo() ! */ ! public Map getAllRegisteredMgmtMntrInfo() ! { ! logger.trace("Entering getAllRegisteredMgmtMntrInfo"); ! ! Map registeredJobs=null; ! ! Connection connection=JdbcConnectionHelper.getConnection(this.jdbcConfigMap); ! if(connection==null) ! registeredJobs=new HashMap(); ! else ! { ! try ! { ! PreparedStatement statement=connection.prepareStatement("select job_name, job_info from job_mgmt_mntr_info"); ! ResultSet rs=statement.executeQuery(); ! registeredJobs=new HashMap(); ! while(rs.next()) ! { ! String jobName=rs.getString(1); ! InputStream inputStream=rs.getBinaryStream(2); ! Object registredInfo=getObjectFromByteArray(inputStream); ! registeredJobs.put(jobName, registredInfo); ! } ! rs.close(); ! statement.close(); ! } ! catch(SQLException exception) ! { ! exception.printStackTrace(); ! logger.error("Exception while trying to get all the registered jobs"); ! registeredJobs=new HashMap(); ! } ! finally ! { ! JdbcConnectionHelper.closeConnection(connection); ! } ! } ! logger.trace("Exiting getAllRegisteredMgmtMntrInfo"); ! return registeredJobs; ! } ! private byte[] getByteArrayFromObject(Object object) { --- 389,398 ---- /** ! * Serializes the given object and return that serialized data as byte array. ! * ! * @param object Object to be serialized. ! * ! * @return Returns the serialized data as byte array. ! */ private byte[] getByteArrayFromObject(Object object) { *************** *** 566,570 **** } } ! private Object getObjectFromByteArray(InputStream inputStream) { --- 414,425 ---- } } ! ! /** ! * Deserializes the given inputstream and return the object. ! * ! * @param inputStream InputStream to be deserialized. ! * ! * @return Returns the deserialized object. ! */ private Object getObjectFromByteArray(InputStream inputStream) { *************** *** 588,607 **** return null; } ! } ! ! //////// Need to be implemented in the future. ! //////// public boolean releaseController(String jobName) ! //////// { ! //////// return false; ! //////// } ! //////// ! //////// public boolean saveController(String jobName, JobController controller) ! //////// { ! //////// return false; ! //////// } ! //////// ! //////// public JobController loadController(String jobName) ! //////// { ! //////// return null; ! //////// } } --- 443,446 ---- return null; } ! } } |
From: Suresh <sur...@us...> - 2006-09-12 23:23:34
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/db4o In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21429 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.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Db4oRepository.java 12 Sep 2006 04:07:55 -0000 1.8 --- Db4oRepository.java 12 Sep 2006 23:23:31 -0000 1.9 *************** *** 116,132 **** /** ! * @see org.jmonks.batchserver.framework.repository Repository#sendDataToNextJob(String,String,String,Object) */ ! public boolean sendDataToNextJob(String dataIdentifier, String sourceJobName, String targetJobName, final Object data) { logger.trace("Entering sendDataToNextJob);"); ! logger.debug("data identifier = " + dataIdentifier + " source job name = " + sourceJobName + " target job name = " + targetJobName + " data = " + data); ! if(dataIdentifier==null || sourceJobName==null || targetJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); final String finalDataIdentifier=dataIdentifier; ! final String finalSourceJobName=sourceJobName; ! final String finalTargetJobName=targetJobName; boolean dataSaved=false; --- 116,132 ---- /** ! * @see org.jmonks.batchserver.framework.repository Repository#sendDataToNextJob(String,String,Object) */ ! public boolean sendDataToNextJob(String dataIdentifier, String nextJobName, final Object data) { logger.trace("Entering sendDataToNextJob);"); ! logger.debug("data identifier = " + dataIdentifier + " next job name = " + nextJobName + " data = " + data); ! if(dataIdentifier==null || nextJobName==null || data==null) throw new IllegalArgumentException("No arguments cannot be null to the sendDataToNextJob method."); final String finalDataIdentifier=dataIdentifier; ! final String finalSourceJobName=this.jobName; ! final String finalNextJobName=nextJobName; boolean dataSaved=false; *************** *** 144,148 **** if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && finalSourceJobName.equals(jobDataTransfer.getSourceJobName()) && ! finalTargetJobName.equals(jobDataTransfer.getTargetJobName())) return true; else --- 144,148 ---- if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && finalSourceJobName.equals(jobDataTransfer.getSourceJobName()) && ! finalNextJobName.equals(jobDataTransfer.getTargetJobName())) return true; else *************** *** 155,167 **** } container.commit(); ! logger.trace("deleted the data identified by " + dataIdentifier + " from the job name " + sourceJobName); /** * Add the new entry. */ ! Db4oJobDataTransferHolder dataTransfer=new Db4oJobDataTransferHolder(dataIdentifier, sourceJobName, targetJobName, data); container.set(dataTransfer); container.commit(); ! logger.trace("data has been added with the identifier " + dataIdentifier + " from job name " + sourceJobName); dataSaved=true; } --- 155,167 ---- } container.commit(); ! logger.trace("deleted the data identified by " + dataIdentifier + " from the job name " + this.jobName + " to " + nextJobName); /** * Add the new entry. */ ! Db4oJobDataTransferHolder dataTransfer=new Db4oJobDataTransferHolder(dataIdentifier, this.jobName, nextJobName, data); container.set(dataTransfer); container.commit(); ! logger.trace("data has been added with the identifier " + dataIdentifier + " from job name " + this.jobName); dataSaved=true; } *************** *** 171,188 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getDataFromPreviousJob(String,String,String) */ ! public Object getDataFromPreviousJob(String dataIdentifier, String sourceJobName, String targetJobName) { logger.trace("Entering getDataFromPreviousJob"); ! logger.debug("data identifier = " + dataIdentifier + " source job name = " + sourceJobName + " target job name = " + targetJobName); ! if(dataIdentifier==null || sourceJobName==null || targetJobName==null) ! throw new IllegalArgumentException("Data identifer, source job name and target job name cannot be null " + "to get the data from previous job."); final String finalDataIdentifier=dataIdentifier; ! final String finalSourceJobName=sourceJobName; ! final String finalTargetJobName=targetJobName; Object data=null; --- 171,188 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#getDataFromPreviousJob(String,String) */ ! public Object getDataFromPreviousJob(String dataIdentifier, String previousJobName) { logger.trace("Entering getDataFromPreviousJob"); ! logger.debug("data identifier = " + dataIdentifier + " target job name = " + previousJobName); ! if(dataIdentifier==null || previousJobName==null) ! throw new IllegalArgumentException("Data identifer and previous job name cannot be null " + "to get the data from previous job."); final String finalDataIdentifier=dataIdentifier; ! final String finalPreviousJobName=previousJobName; ! final String finalTargetJobName=this.jobName; Object data=null; *************** *** 196,200 **** { if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && ! finalSourceJobName.equals(jobDataTransfer.getSourceJobName()) && finalTargetJobName.equals(jobDataTransfer.getTargetJobName())) { --- 196,200 ---- { if(finalDataIdentifier.equals(jobDataTransfer.getDataIdentifier()) && ! finalPreviousJobName.equals(jobDataTransfer.getSourceJobName()) && finalTargetJobName.equals(jobDataTransfer.getTargetJobName())) { *************** *** 209,213 **** { data=((Db4oJobDataTransferHolder)dataTransferResultSet.next()).getData(); ! logger.debug("data identified by " + dataIdentifier + " has been found from the source job name " + sourceJobName); } else --- 209,213 ---- { data=((Db4oJobDataTransferHolder)dataTransferResultSet.next()).getData(); ! logger.debug("data identified by " + dataIdentifier + " has been found from the source job name " + previousJobName); } else *************** *** 219,233 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#clearDataTransferredToNextJob(String) */ ! public boolean clearDataTransferredFromThisJob(String jobName) { logger.trace("Entering clearDataTransferredToNextJob"); - logger.debug("clearDataTransferredToNextJob :: job name = " + jobName); - - if(jobName==null) - throw new IllegalArgumentException("job name cannot be null."); ! final String finalJobName=jobName; boolean dataCleared=false; if(container==null) --- 219,229 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#clearDataTransferredToNextJob() */ ! public boolean clearDataTransferredFromThisJob() { logger.trace("Entering clearDataTransferredToNextJob"); ! final String finalJobName=this.jobName; boolean dataCleared=false; if(container==null) *************** *** 259,271 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#registerJobMgmtMntrInfo(String,Object) */ ! public boolean registerJobMgmtMntrInfo(String jobName, final Object registrationInfo) { logger.trace("Entering registerJobMgmtMntrInfo"); ! logger.debug("job name = " + jobName + " registratinfo = " + registrationInfo); - if(jobName==null) - throw new IllegalArgumentException("Job name cannot be null to register the job in repository."); if(registrationInfo==null) throw new IllegalArgumentException("Job registration information cannot be null to register the job in repository."); --- 255,265 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#registerJobMgmtMntrInfo(Object) */ ! public boolean registerJobMgmtMntrInfo(final Object registrationInfo) { logger.trace("Entering registerJobMgmtMntrInfo"); ! logger.debug("registratinfo = " + registrationInfo); if(registrationInfo==null) throw new IllegalArgumentException("Job registration information cannot be null to register the job in repository."); *************** *** 277,290 **** else { ! ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(jobName)); while(mgmtMntrInfoHolderResultSet.hasNext()) container.delete(mgmtMntrInfoHolderResultSet.next()); container.commit(); ! logger.trace(jobName + " previous mgmt and mntr information has been deleted"); ! container.set(new Db4oJobMgmtMntrInfoHolder(jobName, registrationInfo)); container.commit(); ! logger.trace(jobName + " mgmt and mntr information has been added to the repository"); registered=true; } --- 271,284 ---- else { ! ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(this.jobName)); while(mgmtMntrInfoHolderResultSet.hasNext()) container.delete(mgmtMntrInfoHolderResultSet.next()); container.commit(); ! logger.trace(this.jobName + " previous mgmt and mntr information has been deleted"); ! container.set(new Db4oJobMgmtMntrInfoHolder(this.jobName, registrationInfo)); container.commit(); ! logger.trace(this.jobName + " mgmt and mntr information has been added to the repository"); registered=true; } *************** *** 294,335 **** /** ! * @see org.jmonks.batchserver.framework.repository.Repository#lookupJobMgmtMntrInfo(String) ! */ ! public Object lookupJobMgmtMntrInfo(String jobName) ! { ! logger.trace("Entering lookupJobMgmtMntrInfo"); ! logger.debug("lookupJobMgmtMntrInfo :: job name = " + jobName); ! ! if(jobName==null) ! throw new IllegalArgumentException("jobName cannot be null to lookup the mgmt and mntr information."); ! ! Object registratInfo=null; ! if(container==null) ! registratInfo=null; ! else ! { ! ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(jobName)); ! if(mgmtMntrInfoHolderResultSet.hasNext()) ! { ! registratInfo=((Db4oJobMgmtMntrInfoHolder)mgmtMntrInfoHolderResultSet.next()).getMgmtMntrInfo(); ! logger.debug(jobName + " management and monitoring information has been found and being returned"); ! } ! else ! registratInfo=null; ! } ! logger.trace("Exiting lookupJobMgmtMntrInfo"); ! return registratInfo; ! } ! ! /** ! * @see org.jmonks.batchserver.framework.repository.Repository#unregisterJobMgmtMntrInfo(String) */ ! public boolean unregisterJobMgmtMntrInfo(String jobName) { logger.trace("Entering unregisterJobMgmtMntrInfo"); - logger.debug("unregisterJobMgmtMntrInfo :: job name = " + jobName); - - if(jobName==null) - throw new IllegalArgumentException("jobName cannot be null to unregister the mgmt and mntr information."); boolean unregistered=false; --- 288,296 ---- /** ! * @see org.jmonks.batchserver.framework.repository.Repository#unregisterJobMgmtMntrInfo() */ ! public boolean unregisterJobMgmtMntrInfo() { logger.trace("Entering unregisterJobMgmtMntrInfo"); boolean unregistered=false; *************** *** 339,348 **** else { ! ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(jobName)); if(mgmtMntrInfoHolderResultSet.hasNext()) { container.delete(mgmtMntrInfoHolderResultSet.next()); container.commit(); ! logger.debug(jobName + " mgmt and mntr information has been deleted."); unregistered=true; } --- 300,309 ---- else { ! ObjectSet mgmtMntrInfoHolderResultSet=container.query(new Db4oJobMgmtMntrInfoHolderPredicate(this.jobName)); if(mgmtMntrInfoHolderResultSet.hasNext()) { container.delete(mgmtMntrInfoHolderResultSet.next()); container.commit(); ! logger.debug(this.jobName + " mgmt and mntr information has been deleted."); unregistered=true; } *************** *** 355,383 **** /** - * @see org.jmonks.batchserver.framework.repository.Repository#getAllRegisteredMgmtMntrInfo() - */ - public Map getAllRegisteredMgmtMntrInfo() - { - logger.trace("Entering getAllRegisteredMgmtMntrInfo"); - - Map registeredJobs=new HashMap(); - if(container==null) - { - // ObjectContainer is not initialized properly. Return the empty map. - } - else - { - ObjectSet mgmtMntrInfoHolderResultSet=container.query(Db4oJobMgmtMntrInfoHolder.class); - while(mgmtMntrInfoHolderResultSet.hasNext()) - { - Db4oJobMgmtMntrInfoHolder mgmtMntrInfoHolder=((Db4oJobMgmtMntrInfoHolder)mgmtMntrInfoHolderResultSet.next()); - registeredJobs.put(mgmtMntrInfoHolder.getJobName(), mgmtMntrInfoHolder.getMgmtMntrInfo()); - } - } - logger.trace("Exiting getAllRegisteredMgmtMntrInfo"); - return registeredJobs; - } - - /** * * @see org.jmonks.batchserver.framework.repository.Repository#logStatistics(org.jmonks.batchserver.framework.JobStatistics) --- 316,319 ---- *************** *** 389,392 **** --- 325,330 ---- if(statistics==null) throw new IllegalArgumentException("Null statistic objects will not be saved in repository"); + if(!statistics.getJobname().equals(this.jobName)) + throw new IllegalArgumentException("Statistics object is not related to the job configured for this repository."); boolean logged=false; *************** *** 403,524 **** return logged; } - - /** - * @see org.jmonks.batchserver.framework.repository.Repository#getStatistics(String) - */ - public JobStatistics[] getStatistics(String jobName) - { - logger.trace("Entering getStatistics"); - logger.debug("getStatistics :: job name = " + jobName); - - if(jobName==null) - throw new IllegalArgumentException("job name cannot be null for querying the job statistics."); - - JobStatistics[] statistics=null; - - if(container==null) - statistics=new JobStatistics[0]; - else - { - ObjectSet statisticsResultSet=container.query(new Db4oJobStatisticsPredicate(jobName)); - logger.debug("Number of statistics objects = " + statisticsResultSet.size()); - statistics=new JobStatistics[statisticsResultSet.size()]; - for(int i=0;statisticsResultSet.hasNext();i++) - statistics[i]=(JobStatistics)statisticsResultSet.next(); - } - logger.trace("Exiting getStatistics"); - return statistics; - } - - //////// /** - //////// * @see org.jmonks.batchserver.framework.repository.Repository#saveController(String,org.jmonks.batchserver.framework.controller.JobController) - //////// */ - //////// public boolean saveController(String jobName, final JobController controller) - //////// { - //////// logger.trace("Entering saveController"); - //////// logger.debug("saveController :: job name = " + jobName + " controller = " + controller); - //////// if(jobName==null || controller==null) - //////// throw new IllegalArgumentException("job name and controller cannot be null to save the controller."); - //////// - //////// boolean saved=true; - //////// - //////// if(container==null) - //////// saved=false; - //////// else - //////// { - //////// ObjectSet jobControllerHolderResultSet=container.query(new Db4oJobControllerHolderPredicate(jobName)); - //////// - //////// while(jobControllerHolderResultSet.hasNext()) - //////// container.delete(jobControllerHolderResultSet.next()); - //////// container.commit(); - //////// - //////// container.set(new Db4oJobControllerHolder(jobName, controller)); - //////// container.commit(); - //////// logger.debug(jobName + " controller has been added to the repository."); - //////// saved=true; - //////// } - //////// logger.trace("Exiting saveController"); - //////// return saved; - //////// } - //////// - //////// /** - //////// * @see org.jmonks.batchserver.framework.repository.Repository#loadController(String) - //////// */ - //////// public JobController loadController(String jobName) - //////// { - //////// logger.trace("Entering loadController"); - //////// logger.debug(" loadController :: job name = " + jobName); - //////// - //////// if(jobName==null) - //////// throw new IllegalArgumentException("jobName cannot be null to load the controller."); - //////// - //////// JobController controller=null; - //////// if(container==null) - //////// controller=null; - //////// else - //////// { - //////// ObjectSet jobControllerHolderResultSet=container.query(new Db4oJobControllerHolderPredicate(jobName)); - //////// if(jobControllerHolderResultSet.hasNext()) - //////// { - //////// controller=((Db4oJobControllerHolder)jobControllerHolderResultSet.next()).getJobController(); - //////// logger.debug(jobName + " controller found and being returned"); - //////// } - //////// else - //////// controller=null; - //////// } - //////// logger.trace("Exiting loadController"); - //////// return controller; - //////// } - //////// - //////// /** - //////// * @see org.jmonks.batchserver.framework.repository.Repository#releaseController(String) - //////// */ - //////// public boolean releaseController(String jobName) - //////// { - //////// logger.trace("Entering releaseController"); - //////// logger.debug(" releaseController :: job name = " + jobName); - //////// - //////// if(jobName==null) - //////// throw new IllegalArgumentException("jobName cannot be null to release the controller."); - //////// - //////// boolean released=false; - //////// - //////// if(container==null) - //////// released=false; - //////// else - //////// { - //////// ObjectSet jobControllerHolderResultSet=container.query(new Db4oJobControllerHolderPredicate(jobName)); - //////// if(jobControllerHolderResultSet.hasNext()) - //////// { - //////// container.delete(jobControllerHolderResultSet.next()); - //////// container.commit(); - //////// logger.debug(jobName + " controller has been released"); - //////// released=true; - //////// } - //////// else - //////// released=false; - //////// } - //////// logger.trace("Exiting releaseController"); - //////// return released; - //////// } } --- 341,343 ---- |
From: Suresh <sur...@us...> - 2006-09-12 23:23:19
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21414 Modified Files: Repository.java Log Message: no message Index: Repository.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/repository/Repository.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Repository.java 12 Sep 2006 04:07:55 -0000 1.6 --- Repository.java 12 Sep 2006 23:23:14 -0000 1.7 *************** *** 16,24 **** * by the framework. There could be differnt implementations of the repository. * Framework configuration defines which implementation should be used for this framework. ! * This povides utility methods to logs the job statistics and persist job controllers, ! * transfer some information between the jobs and transfer some management and monitor ! * information between framework and server. Repository make sure only one instance ! * of the implementation class will be created (implements the singleton pattern) ! * and will be used through out the system/job. * </p> * <p> --- 16,24 ---- * 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> *************** *** 29,32 **** --- 29,33 ---- * this implementation from the factory method. * </p> + * * @author Suresh Pragada * @version 1.0 *************** *** 44,47 **** --- 45,58 ---- /** + * Flag tells that repository instance creation has been attempted or not. + */ + private static boolean isCreationAttempted=false; + + /** + * 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. *************** *** 56,79 **** /** ! * Factory method returns the specific implementation of repository based on the ! * repository configuration in framework configuration file. * ! * @throws ConfigurationException If repositoryClassName is missing or invalid ! * or it cannot be instantiated because of the lack of mandatory properties required ! * by the specific repository implementations. */ ! public static synchronized Repository getRepository() { ! logger.trace("Entering getRepository"); ! if(repository==null) { ! FrameworkConfig.RepositoryConfig repositoryConfig=FrameworkConfig.getInstance().getRepositoryConfig(); ! if(repositoryConfig==null) ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "repository configuration is not defined in framework configuration"); ! 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); --- 67,100 ---- /** ! * <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 synchronized void createRepository(String jobName, FrameworkConfig.RepositoryConfig repositoryConfig) { ! logger.trace("Entering createRepository"); ! if(isCreationAttempted) ! throw new IllegalStateException("Attempt to create the repsoitory has been done once."); ! else { ! if(jobName==null || "".equals(jobName)) ! throw new IllegalArgumentException("Job Name cannot be null or empty to create repository instance."); ! if(repositoryConfig==null) ! throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, "Repository configuration is not defined in framework configuration"); ! 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); *************** *** 82,85 **** --- 103,107 ---- repository=(Repository)Class.forName(repositoryClassName).newInstance(); repository.init(repositoryConfig.getRepositoryConfigProperties()); + repository.jobName=jobName; logger.debug("created the repository implemenation class"); } *************** *** 102,113 **** throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } } ! else ! { ! /** ! * Reposiotry instance has been initialized already. ! */ ! } ! logger.trace("Exiting getRepository " + (repository!=null)); return repository; } --- 124,145 ---- throw new ConfigurationException(ConfigurationException.REPOSITORY_CONFIG, exception.getMessage()); } + isCreationAttempted=true; } ! logger.trace("Exiting createRepository " + (repository!=null)); ! } ! ! /** ! * <p> ! * Returns the repository instance. ! * <br><br> ! * If repository is configured for the framework, it will create the ! * instance and associated this with the running job and then kick off the ! * controller. If repository is not configured, it returns null. ! * </p> ! * ! * @return Returns configured repository instance, null if it is not configured. ! */ ! public static Repository getRepository() ! { return repository; } *************** *** 121,127 **** * </p> * ! * @param dataIdentifier Identifier to be used to exchange the data between two jobs.. ! * @param sourceJobName Name of the source job. ! * @param targetJobName Name of the target job. * @param data Data that needs to be sent as the object. * --- 153,158 ---- * </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. * *************** *** 130,135 **** * @throws IllegalArgumentException If any one of the input values is null. */ ! public abstract boolean sendDataToNextJob(String dataIdentifier, String sourceJobName, ! String targetJobName, final Object data); /** --- 161,166 ---- * @throws IllegalArgumentException If any one of the input values is null. */ ! public abstract boolean sendDataToNextJob(String dataIdentifier, String nextJobName, ! final Object data); /** *************** *** 138,143 **** * * @param dataIdentifier Identifier tied to the data wants to be read. ! * @param sourceJobName Name of the source job. ! * @param sourceComponent Name of the source componenet. * * @return Returns the data, null, if it couldnt find any data. --- 169,173 ---- * * @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. *************** *** 145,150 **** * @throws IllegalArgumentException If any one of the input values is null. */ ! public abstract Object getDataFromPreviousJob(String dataIdentifier, String sourceJobName, ! String targetJobName); /** --- 175,179 ---- * @throws IllegalArgumentException If any one of the input values is null. */ ! public abstract Object getDataFromPreviousJob(String dataIdentifier, String previousJobName); /** *************** *** 152,216 **** * This method will clear all the data that has been put up by * this job. Usually, this will be called by startp of framework, ! * before kickoff the controller. * </p> - * - * @param jobName Name of job that put up the data. - * - * @throws IllegalArgumentException If input job name is null. */ ! public abstract boolean clearDataTransferredFromThisJob(String jobName); /** * <p> ! * Registers the job management and monitoring info with the given job name. ! * If there is an info association with this job name, that information ! * will be overriden. This could happen, if job forgot to unregister the ! * management and monitoring information. * </p> * ! * @param jobName Name of the job. ! * @param registrationInfo Information to be associated with this job name. * * @return Return true, if it could assosciate this information, false, otherwise. * ! * @throws IllegalArgumentException If input arguments jobname or registration information ! * values are null. ! */ ! public abstract boolean registerJobMgmtMntrInfo(String jobName, final Object registrationInfo); ! ! /** ! * Retrieves the management and monitoring information assosciated with this job. ! * ! * @param jobName Name of the job. ! * ! * @return Returns the registered information, null, if it doesnt find any information. ! * ! * @throws IllegalArgumentException If input argument job name is null. */ ! public abstract Object lookupJobMgmtMntrInfo(String jobName); /** ! * Unregisters the job management and monitoring info assosciated with the given job name. ! * ! * @param jobName Name of the job. * * @return Return true, it it could unregister the information, false, otherwise. - * - * @throws IllegalArgumentException If input argument job name is null. */ ! public abstract boolean unregisterJobMgmtMntrInfo(String jobName); /** - * Gets all the management and monitoring information registered in the repository - * as a map, where jobname represents the key and management and monitoring information as value. - * - * @return Returns the map contains the job names as keys and management and - * monitoring information as values. - */ - public abstract Map getAllRegisteredMgmtMntrInfo(); - - /** * Logs the job statistics given in the form of JobStatistics object ! * in the repository for further use/reference. * * @param statistics Job Statistics object which holds all the statistics related to that job. --- 181,215 ---- * 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. *************** *** 221,279 **** */ public abstract boolean logStatistics(final JobStatistics statistics); - - /** - * Gets the statistics related to that given job as a JobStatistics object array. - * - * @param jobName Name of the job for which statistics are required. - * - * @return Returns the array of JobStatistics object. zero length statistics array, if it doestnt find any. - * - * @throws IllegalArgumentException If input argument job name is null. - */ - public abstract JobStatistics[] getStatistics(String jobName); - - //////// Following APIs are for future use. - //////// /** - //////// * <p> - //////// * Persist the controller in repository with the given job name. - //////// * If there are any controller entries with this job name, it removes them - //////// * first and then saves this controller. This will be useful, when job wants to be restarted. - //////// * When controller receives stop signal from servier with restart flag, it persist itself into - //////// * the repository. - //////// * </p> - //////// * - //////// * @param jobName Name of the job - //////// * @param controller Controller object to be persisted. - //////// * - //////// * @return Returns true, if it could persist the controller, false, otherwise. - //////// * - //////// * @throws IllegalArgumentException If input arguments job name or controller is null. - //////// */ - //////// public abstract boolean saveController(String jobName, final JobController controller); - //////// - //////// /** - //////// * <p> - //////// * Loads the controller assosicated with this job name in the repsoitory. When controller starts - //////// * execution, always, it looks into the reposiotry for restart. This can be overriden by passing addition - //////// * configuration property. - //////// * </p> - //////// * - //////// * @param jobName Name of the job. - //////// * - //////// * @return Returns the controller object, null, if it couldnt find any. - //////// * - //////// * @throws IllegalArgumentException If input arguments job name is null. - //////// */ - //////// public abstract JobController loadController(String jobName); - //////// - //////// /** - //////// * Releases the persistedcontroller object from repository. - //////// * - //////// * @param jobName Name of the job. - //////// * - //////// * @return Returns true, if it could release the controller from repository, null, otherwise. - //////// * - //////// * @throws IllegalArgumentException If input arguments job name is null. - //////// */ - //////// public abstract boolean releaseController(String jobName); } --- 220,222 ---- |
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/oracle In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8673 Added Files: create_basic_job_controller_config.sql create_pool_job_controller_config.sql Removed Files: create_basic_job_controller.sql create_pool_job_controller.sql Log Message: no message --- create_pool_job_controller.sql DELETED --- --- NEW FILE: create_basic_job_controller_config.sql --- -- Create table basic_job_con create table BASIC_JOB_CONTROLLER_CONFIG ( JOB_NAME VARCHAR2(64) not null, BASIC_JOB_PROCESSOR_CLASS_NAME VARCHAR2(256) not null, BASIC_JOB_PROCESSOR_THREAD_CNT NUMBER not null, BASIC_JOB_PROCESSOR_PROPS VARCHAR2(1024) ); -- Add comments to the table comment on table BASIC_JOB_CONTROLLER_CONFIG is 'Table holds the basic job controller configuration.'; -- Add comments to the columns comment on column BASIC_JOB_CONTROLLER_CONFIG.JOB_NAME is 'Name of the job this controller configuration belongs to.'; comment on column BASIC_JOB_CONTROLLER_CONFIG.BASIC_JOB_PROCESSOR_CLASS_NAME is 'Class name of the basic job processor.'; comment on column BASIC_JOB_CONTROLLER_CONFIG.BASIC_JOB_PROCESSOR_THREAD_CNT is 'Number of basic job processor instances to be run.'; comment on column BASIC_JOB_CONTROLLER_CONFIG.BASIC_JOB_PROCESSOR_PROPS is 'Column holds basic job processor configuration properties in the format name1=value1:name2=value2'; -- Create/Recreate primary, unique and foreign key constraints alter table BASIC_JOB_CONTROLLER_CONFIG add constraint FK_JOB_CONFIG_JOB_NAME foreign key (JOB_NAME) references JOB_CONFIG (JOB_NAME) on delete cascade; -- Create/Recreate check constraints alter table BASIC_JOB_CONTROLLER_CONFIG add constraint CHK_BASIC_PRCR_THREAD_COUNT check (BASIC_JOB_PROCESSOR_THREAD_CNT >= 1); --- NEW FILE: create_pool_job_controller_config.sql --- -- Create table pool job controller config create table POOL_JOB_CONTROLLER_CONFIG ( JOB_NAME VARCHAR2(64) not null, POOL_JOB_LOADER_CLASS_NAME VARCHAR2(256) not null, POOL_JOB_LOADER_PROPS VARCHAR2(1024), POOL_JOB_PROCESSOR_CLASS_NAME VARCHAR2(256) not null, POOL_JOB_PROCESSOR_THREAD_CNT NUMBER not null, POOL_JOB_PROCESSOR_PROPS VARCHAR2(1024), JOB_POOL_CLASS_NAME VARCHAR2(256) not null, JOB_POOL_PROPS VARCHAR2(1024) ); -- Add comments to the columns comment on column POOL_JOB_CONTROLLER_CONFIG.JOB_NAME is 'Name of the job this controller configuration belongs to.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_LOADER_CLASS_NAME is 'Pool Job Loader class name.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_LOADER_PROPS is 'Column holds pool job loader configuration properties in the format name1=value1:name2=value2'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_PROCESSOR_CLASS_NAME is 'Pool job processor class name.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_PROCESSOR_THREAD_CNT is 'Number of processor instances needs to be run.'; comment on column POOL_JOB_CONTROLLER_CONFIG.POOL_JOB_PROCESSOR_PROPS is 'Column holds pool job processor configuration properties in the format name1=value1:name2=value2'; comment on column POOL_JOB_CONTROLLER_CONFIG.JOB_POOL_CLASS_NAME is 'Job pool class name.'; comment on column POOL_JOB_CONTROLLER_CONFIG.JOB_POOL_PROPS is 'Column holds job pool configuration properties in the format name1=value1:name2=value2'; -- Create/Recreate primary, unique and foreign key constraints alter table POOL_JOB_CONTROLLER_CONFIG add constraint FK_POOL_JC_CONFIG_JOB_CONFIG foreign key (JOB_NAME) references JOB_CONFIG (JOB_NAME) on delete cascade; -- Create/Recreate check constraints alter table POOL_JOB_CONTROLLER_CONFIG add constraint CHK_POOL_PRCR_THREAD_COUNT check (POOL_JOB_PROCESSOR_THREAD_CNT >= 1); --- create_basic_job_controller.sql DELETED --- |
From: Suresh <sur...@us...> - 2006-09-12 04:09:38
|
Update of /cvsroot/batchserver/batchserver/bin/dbscripts/mysql In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8326 Added Files: create_basic_job_controller_config.sql create_job_config.sql create_job_data_transfer.sql create_job_logging_config.sql create_job_mgmt_mntr_info.sql create_job_statistics.sql create_pool_job_controller_config.sql insert_sample_jobs.sql Log Message: no message --- NEW FILE: create_job_statistics.sql --- DROP TABLE IF EXISTS `batchserver`.`job_statistics`; CREATE TABLE `batchserver`.`job_statistics` ( `JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Job Name', `JOB_START_TIME` datetime NOT NULL default '0000-00-00 00:00:00' COMMENT 'Timestamp when job got started.', `JOB_END_TIME` datetime NOT NULL default '0000-00-00 00:00:00' COMMENT 'Timestamp when job got finished.', `JOB_EXIT_CODE` decimal(10,0) NOT NULL default '0' COMMENT 'Job exit code.', `JOB_EXIT_REASON` varchar(1024) default NULL COMMENT 'Reason in case of job failure', `RECORDS_PRCOESSED` decimal(10,0) NOT NULL default '0' COMMENT 'Number of records processed.', `MEMORY_USAGE` decimal(10,0) NOT NULL default '0' COMMENT 'Memory used by the job.', KEY `NUIDX_JOB_NAME_STATS` (`JOB_NAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Holds the statistics of all the jobs.'; --- NEW FILE: create_job_config.sql --- DROP TABLE IF EXISTS `batchserver`.`job_config`; CREATE TABLE `batchserver`.`job_config` ( `JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Column represents the job name.', `JOB_STATUS` decimal(10,0) NOT NULL default '1' COMMENT 'Column states whether the job is active or inactive. 1 - active 0 - inactive', `JOB_CONTROLLER_CLASS_NAME` varchar(256) NOT NULL default '' COMMENT 'Column holds the controller class name.', `JOB_CONTROLLER_PROPS` varchar(1024) default NULL COMMENT 'Column holds job controller configuration properties in the format name1=value1:name2=value2', PRIMARY KEY (`JOB_NAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Table holds the configuration of all the jobs.'; --- NEW FILE: insert_sample_jobs.sql --- insert into JOB_CONFIG (JOB_NAME, JOB_STATUS, JOB_CONTROLLER_CLASS_NAME, JOB_CONTROLLER_PROPS) values ('process_file_abc',1,'org.jmonks.batchserver.framework.controller.pool.PoolJobController','pool-job-controller-restart=false'); insert into JOB_CONFIG (JOB_NAME, JOB_STATUS, JOB_CONTROLLER_CLASS_NAME, JOB_CONTROLLER_PROPS) values ('process_file_xyz',1,'org.jmonks.batchserver.framework.controller.basic.BasicJobController','pool-job-controller-restart=false'); insert into POOL_JOB_CONTROLLER_CONFIG (JOB_NAME, POOL_JOB_LOADER_CLASS_NAME, POOL_JOB_LOADER_PROPS, POOL_JOB_PROCESSOR_CLASS_NAME, POOL_JOB_PROCESSOR_THREAD_CNT, POOL_JOB_PROCESSOR_PROPS, JOB_POOL_CLASS_NAME, JOB_POOL_PROPS) values ('process_file_abc','com.mycompany.batch.processfileabc.AbcJobLoader','pool-job-loader-key1=loader-value1','com.mycompany.batch.processfileabc.AbcJobProcessor',5,'pool-job-processor-key1=processor-value1','org.jmonks.batchserver.framework.controller.pool.DefaultJobPool','job-pool-size=5000'); insert into BASIC_JOB_CONTROLLER_CONFIG (JOB_NAME, BASIC_JOB_PROCESSOR_CLASS_NAME, BASIC_JOB_PROCESSOR_THREAD_CNT, BASIC_JOB_PROCESSOR_PROPS) values ('process_file_xyz', 'com.mycompany.batch.processfilexyz.XyzProcessor', 1, 'basic-job-processor-key1=processor-value1'); --- NEW FILE: create_job_data_transfer.sql --- DROP TABLE IF EXISTS `batchserver`.`job_data_transfer`; CREATE TABLE `batchserver`.`job_data_transfer` ( `SOURCE_JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Source job Name.', `DESTINATION_JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Destination Job Name', `JOB_DATA_IDENTIFIER` varchar(256) NOT NULL default '' COMMENT 'Identifier used to recognize the data.', `JOB_DATA` blob NOT NULL COMMENT 'Data to be transferred from source job to destination job.', PRIMARY KEY (`DESTINATION_JOB_NAME`,`source_job_name`,`JOB_DATA_IDENTIFIER`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Tables holds all the data being transferred between the jobs'; --- NEW FILE: create_pool_job_controller_config.sql --- DROP TABLE IF EXISTS `batchserver`.`pool_job_controller_config`; CREATE TABLE `batchserver`.`pool_job_controller_config` ( `JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Name of the job this controller configuration belongs to.', `POOL_JOB_LOADER_CLASS_NAME` varchar(256) NOT NULL default '' COMMENT 'Pool Job Loader class name.', `POOL_JOB_LOADER_PROPS` varchar(1024) default NULL COMMENT 'Column holds pool job loader configuration properties in the format name1=value1:name2=value2', `POOL_JOB_PROCESSOR_CLASS_NAME` varchar(256) NOT NULL default '' COMMENT 'Pool job processor class name.', `POOL_JOB_PROCESSOR_PROPS` varchar(1024) default NULL COMMENT 'Column holds pool job processor configuration properties in the format name1=value1:name2=value2', `POOL_JOB_PROCESSOR_THREAD_CNT` decimal(10,0) NOT NULL default '0' COMMENT 'Number of processor instances needs to be run.', `JOB_POOL_CLASS_NAME` varchar(256) NOT NULL default '' COMMENT 'Job pool class name.', `JOB_POOL_PROPS` varchar(1024) default NULL COMMENT 'Column holds job pool configuration properties in the format name1=value1:name2=value2', PRIMARY KEY (`JOB_NAME`), CONSTRAINT `FK_POOL_JC_CONFIG_JOB_CONFIG` FOREIGN KEY (`JOB_NAME`) REFERENCES `job_config` (`JOB_NAME`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Table holds the pool job controller configuration.; InnoDB f'; --- NEW FILE: create_job_logging_config.sql --- DROP TABLE IF EXISTS `batchserver`.`job_logging_config`; CREATE TABLE `batchserver`.`job_logging_config` ( `JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Column represents the job name.', `JOB_LOGGER_NAME` varchar(256) NOT NULL default '' COMMENT 'Column holds the logger name.', `JOB_LOGGER_LEVEL` varchar(32) NOT NULL default '' COMMENT 'Column holds the logger level.', PRIMARY KEY (`JOB_NAME`,`JOB_LOGGER_NAME`), CONSTRAINT `FK_JOB_LOGGING_CONFIG` FOREIGN KEY (`JOB_NAME`) REFERENCES `job_config` (`JOB_NAME`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Table holds the logging configuration of the job.'; --- NEW FILE: create_job_mgmt_mntr_info.sql --- DROP TABLE IF EXISTS `batchserver`.`job_mgmt_mntr_info`; CREATE TABLE `batchserver`.`job_mgmt_mntr_info` ( `JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Job Name.', `JOB_INFO` blob NOT NULL COMMENT 'Management and monitor information', PRIMARY KEY (`JOB_NAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Holds the jobs management and monitoring info.'; --- NEW FILE: create_basic_job_controller_config.sql --- DROP TABLE IF EXISTS `batchserver`.`basic_job_controller_config`; CREATE TABLE `batchserver`.`basic_job_controller_config` ( `JOB_NAME` varchar(64) NOT NULL default '' COMMENT 'Name of the job this controller configuration belongs to.', `BASIC_JOB_PROCESSOR_CLASS_NAME` varchar(256) NOT NULL default '' COMMENT 'Class name of the basic job processor.', `BASIC_JOB_PROCESSOR_THREAD_CNT` decimal(10,0) NOT NULL default '0' COMMENT 'Number of basic job processor instances to be run.', `BASIC_JOB_PROCESSOR_PROPS` varchar(1024) default NULL COMMENT 'Column holds basic job processor configuration properties in the format name1=value1:name2=value2', PRIMARY KEY (`JOB_NAME`), CONSTRAINT `FK_JOB_CONFIG_JOB_NAME` FOREIGN KEY (`JOB_NAME`) REFERENCES `job_config` (`JOB_NAME`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Table holds the basic job controller configuration.'; |
From: Suresh <sur...@us...> - 2006-09-12 04:09:05
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8006 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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RepositoryTest.java 10 Sep 2006 22:17:24 -0000 1.6 --- RepositoryTest.java 12 Sep 2006 04:09:02 -0000 1.7 *************** *** 148,152 **** Calendar cal1=(Calendar)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); assertNotNull(cal1); ! boolean cleared=repository.clearDataTransferredToNextJob(sourceJob); assertTrue(cleared); Calendar cal2=(Calendar)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); --- 148,152 ---- Calendar cal1=(Calendar)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); assertNotNull(cal1); ! boolean cleared=repository.clearDataTransferredFromThisJob(sourceJob); assertTrue(cleared); Calendar cal2=(Calendar)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); *************** *** 159,163 **** ArrayList list=(ArrayList)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); assertNotNull(cal1); ! cleared=repository.clearDataTransferredToNextJob(sourceJob); assertTrue(cleared); } --- 159,163 ---- ArrayList list=(ArrayList)repository.getDataFromPreviousJob(id1, sourceJob, targetJob); assertNotNull(cal1); ! cleared=repository.clearDataTransferredFromThisJob(sourceJob); assertTrue(cleared); } |
From: Suresh <sur...@us...> - 2006-09-12 04:08:50
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/repository/jdbc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7920 Added Files: MySQLJdbcRepositoryTest.java Removed Files: JdbcRepositoryTest.java MySQLJdbcRepository.java Log Message: no message --- JdbcRepositoryTest.java DELETED --- --- NEW FILE: MySQLJdbcRepositoryTest.java --- /* * MySQLJdbcRepositoryTest.java * JUnit based test * * Created on September 10, 2006, 12:53 PM */ package org.jmonks.batchserver.framework.repository.jdbc; import java.util.HashMap; import java.util.Map; import junit.framework.*; import org.jmonks.batchserver.framework.util.JdbcConnectionHelper; /** * * @author Suresh Pragada */ public class MySQLJdbcRepositoryTest extends TestCase { public MySQLJdbcRepositoryTest(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 MySQLJdbcRepositoryTest("testInit")); suite.addTest(new MySQLJdbcRepositoryTest("testSendDataToNextJob")); return suite; } /** * Test of init method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testInit() { try { MySQLJdbcRepository repository=new MySQLJdbcRepository(); repository.init(getMySQLConfigMap()); } catch(Exception exception) { fail("MySQL Jdbc Repository testInit was failed."); } } /** * Test of clearDataTransferredFromThisJob method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testClearDataTransferredFromThisJob() { } /** * Test of sendDataToNextJob method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testSendDataToNextJob() { try { MySQLJdbcRepository repository=new MySQLJdbcRepository(); repository.init(getMySQLConfigMap()); Map dataGoingToBeSend=new HashMap(); dataGoingToBeSend.put("author","suresh"); boolean sendStatus=repository.sendDataToNextJob("ID1", "process_file_abc", "process_file_xyz", dataGoingToBeSend); assertEquals(true, sendStatus); Object dataSent=repository.getDataFromPreviousJob("ID1", "process_file_abc", "process_file_xyz"); assertNotNull(dataSent); Map dataSentMap=(Map)dataSent; String author=(String)dataSentMap.get("author"); assertEquals("suresh",author); } catch(Exception exception) { fail("MySQL Jdbc Repository testSendDataToNextJob was failed."); } } /** * Test of getDataFromPreviousJob method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testGetDataFromPreviousJob() { } /** * Test of logStatistics method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testLogStatistics() { } /** * Test of getStatistics method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testGetStatistics() { } /** * Test of lookupJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testLookupJobMgmtMntrInfo() { } /** * Test of unregisterJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testUnregisterJobMgmtMntrInfo() { } /** * Test of registerJobMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testRegisterJobMgmtMntrInfo() { } /** * Test of getAllRegisteredMgmtMntrInfo method, of class org.jmonks.batchserver.framework.repository.jdbc.JdbcRepository. */ public void testGetAllRegisteredMgmtMntrInfo() { } private Map getMySQLConfigMap() { Map configMap=new HashMap(); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_DRIVER_CLASS_NAME, "com.mysql.jdbc.Driver"); configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_URL, "jdbc:mysql://localhost:3306/batchserver"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_USER_NAME, "root"); configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_PASSWORD, "ramesh"); return configMap; } class MySQLJdbcRepository extends JdbcRepository { /** * Creates a new instance of MySQLJdbcRepository */ public MySQLJdbcRepository() { } public void init(Map configMap) { super.init(configMap); } } } --- MySQLJdbcRepository.java DELETED --- |
From: Suresh <sur...@us...> - 2006-09-12 04:08:20
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/util In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7885 Modified Files: JdbcConnectionHelperTest.java Log Message: no message Index: JdbcConnectionHelperTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/util/JdbcConnectionHelperTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JdbcConnectionHelperTest.java 10 Sep 2006 22:19:02 -0000 1.1 --- JdbcConnectionHelperTest.java 12 Sep 2006 04:08:14 -0000 1.2 *************** *** 8,16 **** package org.jmonks.batchserver.framework.util; - import junit.framework.*; import java.sql.Connection; ! import java.sql.DriverManager; import java.util.Map; ! import org.apache.log4j.Logger; /** --- 8,17 ---- package org.jmonks.batchserver.framework.util; import java.sql.Connection; ! import java.sql.SQLException; ! import java.util.HashMap; ! import junit.framework.*; import java.util.Map; ! /** *************** *** 37,41 **** { TestSuite suite = new TestSuite(JdbcConnectionHelperTest.class); - return suite; } --- 38,41 ---- *************** *** 46,53 **** public void testGetConnection() { ! System.out.println("testGetConnection"); ! ! // TODO add your test code below by replacing the default call to fail. ! fail("The test case is empty."); } --- 46,66 ---- public void testGetConnection() { ! try ! { ! Map configMap=new HashMap(); ! configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_DRIVER_CLASS_NAME, "com.mysql.jdbc.Driver"); ! configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_URL, "jdbc:mysql://localhost:3306/batchserver"); ! configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_USER_NAME, "root"); ! configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_PASSWORD, "ramesh"); ! Connection connection=JdbcConnectionHelper.getConnection(configMap); ! assertNotNull(connection); ! assertEquals(false, connection.getAutoCommit()); ! assertEquals(false, connection.isClosed()); ! JdbcConnectionHelper.closeConnection(connection); ! } ! catch(SQLException exception) ! { ! fail("Exception while trying to test JdbcConnectionHelper :: " + exception.getMessage()); ! } } *************** *** 57,64 **** public void testCloseConnection() { ! System.out.println("testCloseConnection"); ! ! // TODO add your test code below by replacing the default call to fail. ! fail("The test case is empty."); } --- 70,91 ---- public void testCloseConnection() { ! try ! { ! Map configMap=new HashMap(); ! configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_DRIVER_CLASS_NAME, "com.mysql.jdbc.Driver"); ! configMap.put(JdbcConnectionHelper.PROPERTY_JDBC_URL, "jdbc:mysql://localhost:3306/batchserver"); ! configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_USER_NAME, "root"); ! configMap.put(JdbcConnectionHelper.PROPERTY_DATABASE_PASSWORD, "ramesh"); ! Connection connection=JdbcConnectionHelper.getConnection(configMap); ! assertNotNull(connection); ! assertEquals(false, connection.getAutoCommit()); ! assertEquals(false, connection.isClosed()); ! JdbcConnectionHelper.closeConnection(connection); ! assertEquals(true, connection.isClosed()); ! } ! catch(SQLException exception) ! { ! fail("Exception while trying to test JdbcConnectionHelper :: " + exception.getMessage()); ! } } |
From: Suresh <sur...@us...> - 2006-09-12 04:07:58
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/util In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7494/framework/util Modified Files: JdbcConnectionHelper.java Log Message: no message Index: JdbcConnectionHelper.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/util/JdbcConnectionHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JdbcConnectionHelper.java 10 Sep 2006 17:57:38 -0000 1.1 --- JdbcConnectionHelper.java 12 Sep 2006 04:07:55 -0000 1.2 *************** *** 82,85 **** --- 82,86 ---- Class.forName(driverClassName); connection=DriverManager.getConnection(databaseURL,userName, password); + connection.setAutoCommit(false); } catch(Exception exception) |