[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework ErrorCode.java, 1.3, 1.4 JobStat
Brought to you by:
suresh_pragada
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; |