org.arm4.arm40.transaction
Class ArmInterface

java.lang.Object
  extended by org.arm4.arm40.transaction.ArmInterface
All Implemented Interfaces:
ArmInterface
Direct Known Subclasses:
ArmApplication, ArmApplicationDefinition, ArmFactory, ArmIdentityProperties, ArmMetric, ArmMetricDefinition, ArmMetricGroup, ArmMetricGroupDefinition, ArmToken, ArmTransaction, ArmTransactionDefinition, ArmUser

public class ArmInterface
extends java.lang.Object
implements ArmInterface

ArmInterface implementation provides a common way to handle errors. If a method invocation on any ARM object causes an error, the error code returned by the objects getErrorCode() will be negative. If no error occurs, the error code is zero. Several methods also return the error code as an int return value. If an error occurs in a factory method (e.g., a method in ArmTransactionFactory), the error code is set in both the factory object and the newly created object. The error code may change any time a method of the object is executed. Executing a method overrides the previous error code value. The only methods that will never change the error code are getErrorCode() and getErrorMessage(). If multiple threads are processing the same object simultaneously, the results are unpredictable. For any non-zero error code returned by an object, the application can request from the same object a string message describing the error using getErrorMessage(). If the object does not support the function or does not recognize the error code, it returns null.

Version:
$Revision$ $Date$
Author:
dcarter

Field Summary
protected  int m_errorCode
           
protected  ArmFactory m_factory
           
 
Constructor Summary
ArmInterface()
           
 
Method Summary
 int getErrorCode()
           
 java.lang.String getErrorMessage(int errorCode)
           
 ArmFactory getFactory()
          Return the Arm Factory that created this ARM Object.
 int setErrorCode(int errorCode)
           
 void setFactory(ArmFactory factory)
          Set the Arm Factory that created this ARM Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_errorCode

protected int m_errorCode

m_factory

protected ArmFactory m_factory
Constructor Detail

ArmInterface

public ArmInterface()
Method Detail

getErrorCode

public int getErrorCode()
Specified by:
getErrorCode in interface ArmInterface
Returns:
last error code set for this object as a negative value. Zero, if no error code is set.

setErrorCode

public int setErrorCode(int errorCode)
Specified by:
setErrorCode in interface ArmInterface
Parameters:
errorCode - the error code to be set for this object.
Returns:
the error code provided in errorCode.

getFactory

public ArmFactory getFactory()
Return the Arm Factory that created this ARM Object.

Returns:
the the Arm Factory that created this ARM Object. If NULL is returned, then this object is a factory itself.

setFactory

public void setFactory(ArmFactory factory)
Set the Arm Factory that created this ARM Object.

Parameters:
factory - the Arm Factory that created this ARM Object.

getErrorMessage

public java.lang.String getErrorMessage(int errorCode)
Specified by:
getErrorMessage in interface ArmInterface
Parameters:
errorCode - an error code retrieved from this object.
Returns:
a string describing the error for errorCode, or null.