Thread: [Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/common ErrorCode.java,1.1,1.2 Fra
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-04 04:40:33
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22365 Modified Files: ErrorCode.java FrameworkUtil.java StatusCode.java Log Message: no message Index: FrameworkUtil.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/FrameworkUtil.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FrameworkUtil.java 3 Mar 2006 04:19:56 -0000 1.2 --- FrameworkUtil.java 4 Mar 2006 04:40:28 -0000 1.3 *************** *** 3,27 **** /** ! * FramworkUtil contains utility methods required in the framework. * <p> * Note : This class does not maintain any state. Keep all the methods as static and make * sure taken appropriate steps in case of that method is accessed by mulitple threads. * ! * @author Suresh Pragada */ public final class FrameworkUtil { ! ! private FrameworkUtil() ! { ! /** ! * Just to make sure this class will not be instantiated. ! */ ! } ! ! public static void printMessage(String message) ! { ! System.out.println(message); ! } } \ No newline at end of file --- 3,29 ---- /** ! * <p> ! * FramworkUtil contains utility methods required by the framework. ! * </p> * <p> * Note : This class does not maintain any state. Keep all the methods as static and make * sure taken appropriate steps in case of that method is accessed by mulitple threads. + * </p> * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ public final class FrameworkUtil { ! /** ! * Private constructor to make sure it will not be instantiated. ! */ ! private FrameworkUtil() ! { ! /** ! * Just to make sure this class will not be instantiated. ! */ ! } } \ No newline at end of file Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/ErrorCode.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ErrorCode.java 3 Mar 2006 04:19:56 -0000 1.1 --- ErrorCode.java 4 Mar 2006 04:40:28 -0000 1.2 *************** *** 1,43 **** package org.jmonks.batchserver.framework.common; - import java.util.HashMap; - import java.util.Map; - /** * <p> ! * This class declares all the error codes framework can return and provides some utilities on method converting the error codes to string messages. * </p> * ! * @author : Suresh Pragada */ ! public class ErrorCode { - public static final int CONFIG_ERROR_JOB_NAME_NOT_EXIST = 1001; - - private static Map errorMessages=null; ! public static ErrorCode JOBNAME_NOT_EXISTS = new ErrorCode(1,""); ! static ! { ! errorMessages=new HashMap(); ! errorMessages.put(new Integer(ErrorCode.CONFIG_ERROR_JOB_NAME_NOT_EXIST), "Configurion is missing job-name parameter or key in config parameters or config map."); ! } private ErrorCode(int errorCode, String errorMsg) { } public int getCode() - { ! return 0; } public String getMessage() - { ! return null; } } --- 1,87 ---- package org.jmonks.batchserver.framework.common; /** * <p> ! * The ErrorCode represents the error condition can generate in the system ! * and holds code and message. This is like a enum class to make sure ! * the error codes being passed around the application are valid (defined). ! * No instances of this class can be created from outside and cannot be instantiated. * </p> * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 */ ! public final class ErrorCode { ! public final static ErrorCode JOBNAME_KEY_NOT_FOUND = new ErrorCode(1001,"job-name key not found in the startup properties"); ! public final static ErrorCode JOB_NOT_CONFIGURED = new ErrorCode(1002,"job is not configured in the job configuration file"); ! public final static ErrorCode INVALID_CONFIG_FACTORY = new ErrorCode(1003,"not a valid configuration factory"); ! public final static ErrorCode MISSING_PROPS_XML_CONFIG_FACTORY = new ErrorCode(1004,"required properties are missing in xml config factory configuration"); ! public final static ErrorCode UNABLE_TO_LOAD_XML_JOB_CONFIG_FILE = new ErrorCode(1005,"configured xml job configuration file cannot be loaded"); ! public final static ErrorCode INVALID_JOB_CONFIG_FILE_FORMAT = new ErrorCode(1006,"xml job configuration file is not in a valid format"); ! ! /** ! * Code represents the error. ! */ ! private int code; ! /** ! * Message illustrates the error code. ! */ ! private String message=null; + /** + * <p> + * Private constructor make sure no instances will be created of this class + * from outside of this class. + * </p> + * + * @param errorCode Code represents the error. + * @param errorMsg Message illustrates the error code. + */ private ErrorCode(int errorCode, String errorMsg) { + this.code=errorCode; + this.message=errorMsg; } + /** + * Returns the code represents the error. + * + * @return Returns the code represents the error. + */ public int getCode() { ! return this.code; ! } + /** + * Returns the message illustrates the error code. + * + * @return Returns the error message. + */ public String getMessage() { ! return this.message; } + /** + * <p> + * Returns the string representation of ErrorCode class in the format + * <br> {ErrorCode [code = value] [message = value]} + * </p> + * + * @return Returns the string representation of ErrorCode. + */ + public String toString() + { + StringBuffer stringValue=new StringBuffer("{ErrorCode "); + stringValue.append("[code = " + this.code + "]"); + stringValue.append("[message = " + this.message + "]"); + stringValue.append("}"); + return stringValue.toString(); + } } Index: StatusCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/StatusCode.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StatusCode.java 3 Mar 2006 04:19:56 -0000 1.1 --- StatusCode.java 4 Mar 2006 04:40:28 -0000 1.2 *************** *** 1,20 **** package org.jmonks.batchserver.framework.common; ! public class StatusCode { private int code; ! public static StatusCode SUCCESS = new StatusCode(1); ! ! public static StatusCode FAILURE = new StatusCode(-1); private StatusCode(int statusCode) { } public int getCode() { ! return 0; } } --- 1,69 ---- package org.jmonks.batchserver.framework.common; ! /** ! * <p> ! * The StatusCode represents the possible status of the processed in the system and holds ! * the code represents the status. This is like a status enum to make sure the proper (defined) ! * status is being passed/returned around the system. No instances of this status code can ! * be created from outside of this class. ! * </p> ! * ! * @author Suresh Pragada ! * @version 1.0 ! * @since 1.0 ! */ ! public final class StatusCode { + /** + * Represents the code of the status. + */ private int code; ! public final static StatusCode SUCCESS = new StatusCode(0); ! public final static StatusCode FAILURE = new StatusCode(1); ! ! /** ! * <p> ! * Private construction will make sure no instances of this class can be ! * created outside of this class. ! * </p> ! * ! * @param statusCode code repesents the status. ! */ private StatusCode(int statusCode) { + this.code=statusCode; } + /** + * <p> + * Returns the code represents the status. Defined status codes are + * <br> + * <br>SUCCESS - 0 + * <br>FAILURE - 1 + * </p> + * + * @return Returns the code represents the status. + */ public int getCode() + { + return this.code; + } + /** + * <p> + * Returns the string representation of StatusCode class in the format + * <br> {StatusCode [code = value]} + * </p> + * + * @return Returns the string representation of StatusCode. + */ + public String toString() { ! StringBuffer stringValue=new StringBuffer("{StatusCode "); ! stringValue.append("[code = " + this.code + "]"); ! stringValue.append("}"); ! return stringValue.toString(); } } |