org.jmonks.batch.framework
Class ErrorCode

java.lang.Object
  extended byorg.jmonks.batch.framework.ErrorCode

public final class ErrorCode
extends java.lang.Object

The ErrorCode represents the error condition that can generate in the system. It consists of the code which uniquely identifies the ErrorCode and message which explains the error in the system. This is also used to represent the status code for any processor/controller/job. This provides the flexibility to create new custom ErrorCodes and append the message to the existing ErrorCode. Codes ranging from 0 to 100 are reserved for framework purposes. Use the codes above 100 to create the custom error codes.

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Field Summary
static ErrorCode BASIC_JOB_PROCESSOR_EXCEPTION
          Represents error because of the exception in basic job processor.
static ErrorCode FRAMEWORK_CONFIGURATION_ERROR
          Represents the framework configuration error.
static ErrorCode JOB_COMPLETED_SUCCESSFULLY
          Represents job got completed successfully.
static ErrorCode JOB_COMPLETED_WITH_ERRORS
          Represents job got completed with errors.
static ErrorCode JOB_CONFIG_FACTORY_CONFIGURATION_ERROR
          Represents the job config factory configuration error.
static ErrorCode JOB_CONFIGURATION_ERROR
          Represents the job configuration error.
static ErrorCode JOB_CONNECTOR_CONFIGURATION_ERROR
          Represents the connector configuration error.
static ErrorCode JOB_CONTROLLER_CONFIGURATION_ERROR
          Represents the job controller configuration error.
static ErrorCode JOB_INVOKATION_CONFIGURAION_ERROR
          Represents the configuration error used to invoke the job.
static ErrorCode JOB_IS_NOT_CONFIGURED
          Represents the job is not configured error.
static ErrorCode JOB_LOGGING_CONFIGURATION_ERROR
          Represents the logging configuration error.
static ErrorCode JOB_REPOSITORY_CONFIGURATION_ERROR
          Represents the repository configuration error.
static ErrorCode POOL_JOB_LOADER_EXCEPTION
          Represents error because of the exception in pool job loader.
static ErrorCode POOL_JOB_PROCESSOR_EXCEPTION
          Represents error because of the exception in pool job processor.
static ErrorCode UNKNOWN_CONFIGURATION_ERROR
          Represents the unknown configuration error.
 
Method Summary
 ErrorCode appendMessage(java.lang.String messageToBeAppended)
          Creates a new ErrorCode object with the same error code and appends the given message to the existing message and returns new ErrorCode.
static ErrorCode createErrorCode(int newCode, java.lang.String newMessage)
          Creates a new error code instance by accepting the code and message.
 boolean equals(java.lang.Object errorCode)
          Equality will be based on the code the two ErrorCodes contains.
 int getCode()
          Returns the error code represents the error.
 java.lang.String getMessage()
          Returns the error message illustrates the exit code.
 int hashCode()
          Code represented by ErrorCode will be returned as a hash code.
 java.lang.String toString()
           Returns the string representation of ErrorCode class in the format
{ErrorCode [code = value] [message = value]}
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

JOB_COMPLETED_SUCCESSFULLY

public static final ErrorCode JOB_COMPLETED_SUCCESSFULLY
Represents job got completed successfully. Error code is 0.


JOB_COMPLETED_WITH_ERRORS

public static final ErrorCode JOB_COMPLETED_WITH_ERRORS
Represents job got completed with errors. This represents the partial success. Error code is 1.


JOB_INVOKATION_CONFIGURAION_ERROR

public static final ErrorCode JOB_INVOKATION_CONFIGURAION_ERROR
Represents the configuration error used to invoke the job. Error code is 10.


FRAMEWORK_CONFIGURATION_ERROR

public static final ErrorCode FRAMEWORK_CONFIGURATION_ERROR
Represents the framework configuration error. Error code is 11.


JOB_CONFIG_FACTORY_CONFIGURATION_ERROR

public static final ErrorCode JOB_CONFIG_FACTORY_CONFIGURATION_ERROR
Represents the job config factory configuration error. Error code is 12.


JOB_CONFIGURATION_ERROR

public static final ErrorCode JOB_CONFIGURATION_ERROR
Represents the job configuration error. Error code is 13.


JOB_IS_NOT_CONFIGURED

public static final ErrorCode JOB_IS_NOT_CONFIGURED
Represents the job is not configured error. Error code is 14.


JOB_CONTROLLER_CONFIGURATION_ERROR

public static final ErrorCode JOB_CONTROLLER_CONFIGURATION_ERROR
Represents the job controller configuration error. Error code is 15.


JOB_LOGGING_CONFIGURATION_ERROR

public static final ErrorCode JOB_LOGGING_CONFIGURATION_ERROR
Represents the logging configuration error. Error code is 16.


JOB_REPOSITORY_CONFIGURATION_ERROR

public static final ErrorCode JOB_REPOSITORY_CONFIGURATION_ERROR
Represents the repository configuration error. Error code is 17.


JOB_CONNECTOR_CONFIGURATION_ERROR

public static final ErrorCode JOB_CONNECTOR_CONFIGURATION_ERROR
Represents the connector configuration error. Error code is 18.


UNKNOWN_CONFIGURATION_ERROR

public static final ErrorCode UNKNOWN_CONFIGURATION_ERROR
Represents the unknown configuration error. Error code is 19.


BASIC_JOB_PROCESSOR_EXCEPTION

public static final ErrorCode BASIC_JOB_PROCESSOR_EXCEPTION
Represents error because of the exception in basic job processor. Error code is 20.


POOL_JOB_LOADER_EXCEPTION

public static final ErrorCode POOL_JOB_LOADER_EXCEPTION
Represents error because of the exception in pool job loader. Error code is 21.


POOL_JOB_PROCESSOR_EXCEPTION

public static final ErrorCode POOL_JOB_PROCESSOR_EXCEPTION
Represents error because of the exception in pool job processor. Error code is 22.

Method Detail

getCode

public int getCode()
Returns the error code represents the error.

Returns:
Returns the error code represents the error.

getMessage

public java.lang.String getMessage()
Returns the error message illustrates the exit code.

Returns:
Returns the error message.

appendMessage

public ErrorCode appendMessage(java.lang.String messageToBeAppended)
Creates a new ErrorCode object with the same error code and appends the given message to the existing message and returns new ErrorCode.

Parameters:
messageToBeAppended - Message that needs to be appended to the existing message.
Returns:
Returns a new error code contains the same error code and appended message.

createErrorCode

public static ErrorCode createErrorCode(int newCode,
                                        java.lang.String newMessage)
Creates a new error code instance by accepting the code and message. The newMessage should not be null or empty message.

Parameters:
newCode - Code to be used to construct the ErrorCode.
newMessage - Mesage to be used to construct the ErrorCode.
Throws:
java.lang.IllegalArgumentException - If given message is null or empty.

equals

public boolean equals(java.lang.Object errorCode)
Equality will be based on the code the two ErrorCodes contains.

See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Code represented by ErrorCode will be returned as a hash code.

See Also:
Object.hashCode()

toString

public java.lang.String toString()

Returns the string representation of ErrorCode class in the format
{ErrorCode [code = value] [message = value]}

Returns:
Returns the string representation of ErrorCode.