Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Package Functions

alma.acs.exceptions.AcsJException Class Reference

Inheritance diagram for alma.acs.exceptions.AcsJException:
alma.acs.exceptions.DefaultAcsJException

List of all members.

Public Member Functions

 AcsJException ()
 AcsJException (String message)
 AcsJException (String message, Throwable cause)
 AcsJException (ErrorTrace etCause)
 AcsJException (String message, ErrorTrace etCause)
String toString ()
String getShortDescription ()
abstract UserException toCorbaException ()
AcsJCompletion toAcsJCompletion ()
void setSeverity ()
Severity getSeverity ()
Object setProperty (String key, String value)
String getProperty (String key)
NameValue[] getNameValueArray ()
long getTimestampMillis ()
ErrorTrace getErrorTrace ()
void log (Logger logger)
int getTraceDepth ()
String getFile ()
String getHost ()
int getLine ()
String getMethod ()
String getProcess ()
String getThreadName ()
String getSourceObject ()

Static Public Member Functions

static void setProcessName (String name)
static ErrorTrace createSingleErrorTrace (Throwable thr, long defaultTimeMilli)

Protected Member Functions

abstract int getErrorType ()
abstract int getErrorCode ()
ErrorTrace createSingleErrorTrace ()

Protected Attributes

String m_host
String m_process
int m_line
String m_method
String m_file
String m_sourceObject
String m_threadName
Severity m_severity
Properties m_properties
long m_timeMilli

Package Functions

LogRecord createSingleErrorTraceLogRecord (ErrorTrace et, String stackID, int stackLevel)

Detailed Description

Base class for any checked exceptions defined in ALMA Java code. Allows these Java exceptions to be interoperable with the ACS error system, i.e. that they can be converted to and from ErrorTrace or ACSException objects. See AcsJException(ErrorTrace), getErrorTrace, getACSException.

Not to be confused with alma.ACSErr.ACSException, which is a CORBA user exception with an alma.ACSErr.ErrorTrace inside. ACSException is declared as final, so that it's not an option to make our AcsJException a subclass of it. (todo check if that's due to OMG spec or JacORB).

For the conversion to and from the CORBA exception types, two ErrorTrace properties (i.e. NameValue objects referenced from ErrorTrace#data) are added:

Author:
hsommer Jun 18, 2003 1:07:38 PM

Constructor & Destructor Documentation

alma.acs.exceptions.AcsJException.AcsJException (  ) 
alma.acs.exceptions.AcsJException.AcsJException ( String  message  ) 
alma.acs.exceptions.AcsJException.AcsJException ( String  message,
Throwable  cause 
)

Constructor from another exception, with a message. Subclass ctors call this ctor even if the message is null, to avoid the Throwable.ctor taking the cause.toString() as the message.

If cause is a CORBA exception generated by the ACS error system, then its ErrorTrace is automatically converted to a chain of AcsJ-style exceptions.

Parameters:
cause the causing exception
See also:
CorbaExceptionConverter.convertHiddenErrorTrace(Throwable)
alma.acs.exceptions.AcsJException.AcsJException ( ErrorTrace  etCause  ) 
alma.acs.exceptions.AcsJException.AcsJException ( String  message,
ErrorTrace  etCause 
)

Creates a new exception, with the chain of causing exceptions derived from etCause.

Parameters:
message 
etCause 

Member Function Documentation

static ErrorTrace alma.acs.exceptions.AcsJException.createSingleErrorTrace ( Throwable  thr,
long  defaultTimeMilli 
) [static]

Converts a Throwable that may not be an AcsJException to an ErrorTrace.

For example, thr could be a NullPointerException thrown in the same process and thus not yet converted to DefaultAcsJException, but wrapped by some subclass of AcsJException which contains the NPE as its cause.

Parameters:
defaultTimeMilli Java-time (1970-based) used to estimate a time stamp if none is available, in order to avoid something from October 1582 in the new ErrorTrace. Typically the timestamp from the wrapping AcsJException.
See also:
createSingleErrorTrace()
LogRecord alma.acs.exceptions.AcsJException.createSingleErrorTraceLogRecord ( ErrorTrace  et,
String  stackID,
int  stackLevel 
) [package]

Creates a LogRecord with the data from the given ErrorTrace object. Some data such as thread name, line of code, user-defined properties etc which do not correspond to any field of LogRecord are stored inside a Map that is set as a parameter of the LogRecord. Later when the ACS logging system will process this LogRecord, it will recognize the special data and turn them into the XML attributes of elements like <Debug>

Parameters:
et the ErrorTrace input object
stackID the stackID that must be the same for all linked ErrorTrace objects.
stackLevel 0-based index for LogRecords from an ErrorTrace chain.
Returns:
the LogRecord that contains the data from the input parameters.

Referenced by alma.acs.exceptions.AcsJException.log().

abstract int alma.acs.exceptions.AcsJException.getErrorCode (  )  [protected, pure virtual]

Forces a subclass to choose an ACS error code.

Returns:
the error code

Implemented in alma.acs.exceptions.DefaultAcsJException.

Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace(), and alma.acs.exceptions.AcsJCompletion.init().

ErrorTrace alma.acs.exceptions.AcsJException.getErrorTrace (  ) 

Converts this exception (and all "caused-by" throwables it might have) to an ErrorTrace that links to its caused-by ErrorTrace objects.

To be used whenever the Corba wall is hit and the Java exception must be converted to an ACS-Corba-exception.

References alma.acs.exceptions.AcsJException.m_timeMilli.

Referenced by alma.demo.LampCallbackImpl.LampCallbackImpl.acsExceptionMethodVoid(), alma.ACS.jbaci.CompletionUtil.generateCompletion(), alma.acs.exceptions.AcsJCompletion.toCorbaCompletion(), and alma.acs.exceptions.DefaultAcsJException.toCorbaException().

abstract int alma.acs.exceptions.AcsJException.getErrorType (  )  [protected, pure virtual]

Forces a subclass to choose an ACS error type.

Returns:
the error type

Implemented in alma.acs.exceptions.DefaultAcsJException.

Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace(), and alma.acs.exceptions.AcsJCompletion.init().

String alma.acs.exceptions.AcsJException.getFile (  ) 
Returns:
Returns the m_file.

References alma.acs.exceptions.AcsJException.m_file.

String alma.acs.exceptions.AcsJException.getHost (  ) 
Returns:
Returns the m_host.

References alma.acs.exceptions.AcsJException.m_host.

int alma.acs.exceptions.AcsJException.getLine (  ) 
Returns:
Returns the m_line.

References alma.acs.exceptions.AcsJException.m_line.

String alma.acs.exceptions.AcsJException.getMethod (  ) 
Returns:
Returns the m_method.

References alma.acs.exceptions.AcsJException.m_method.

NameValue [] alma.acs.exceptions.AcsJException.getNameValueArray (  ) 

To be used by getErrorTrace() or whoever else cares about a NameValue[].

References alma.acs.exceptions.AcsJException.m_properties.

Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace().

String alma.acs.exceptions.AcsJException.getProcess (  ) 
Returns:
Returns the m_process.

References alma.acs.exceptions.AcsJException.m_process.

String alma.acs.exceptions.AcsJException.getProperty ( String  key  ) 
Severity alma.acs.exceptions.AcsJException.getSeverity (  ) 

Returns the Severity level currently associated with this exception instance.

Returns:
Severity

References alma.acs.exceptions.AcsJException.m_severity.

Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace().

String alma.acs.exceptions.AcsJException.getShortDescription (  ) 

Returns the short description which is a hardcoded text particular for a (type, code) combination. The subclass that represents the exception code will have to override this method. This method is not abstract because the exception class that corresponds to an error type (but not an error code) would otherwise have to overload it with returning an empty string.

Returns:
an empty string, unless overloaded for an error code.

Reimplemented in alma.acs.exceptions.DefaultAcsJException.

Referenced by alma.acs.exceptions.AcsJException.createSingleErrorTrace().

String alma.acs.exceptions.AcsJException.getSourceObject (  ) 
Returns:
Returns the m_sourceObject.

References alma.acs.exceptions.AcsJException.m_sourceObject.

String alma.acs.exceptions.AcsJException.getThreadName (  ) 
Returns:
Returns the m_threadName.

References alma.acs.exceptions.AcsJException.m_threadName.

long alma.acs.exceptions.AcsJException.getTimestampMillis (  ) 

Gets the timestamp when this exception was created.

Returns:
timestamp in milliseconds (Java-UTC time, 1970)

References alma.acs.exceptions.AcsJException.m_timeMilli.

Referenced by alma.acs.exceptions.AcsJCompletion.init().

int alma.acs.exceptions.AcsJException.getTraceDepth (  ) 

Gets the total number of linked ("caused-by") exceptions including this one.

Not to be confused with the length of Throwable#getStackTrace(), which refers to the call stack for the current exception, and not to linked causing exception.

Referenced by alma.acs.exceptions.AcsJException.log().

void alma.acs.exceptions.AcsJException.log ( Logger  logger  ) 

Logs this exception and all causing exceptions. For each such exception, a separate log entry is created, in accordance with the ACS error logging specification.

Parameters:
logger the JDK logger to be used for logging this exception.

References alma.acs.exceptions.AcsJException.createSingleErrorTrace(), alma.acs.exceptions.AcsJException.createSingleErrorTraceLogRecord(), alma.acs.exceptions.AcsJException.getTraceDepth(), and alma.acs.exceptions.AcsJException.m_timeMilli.

Referenced by alma.demo.client.XmlComponentClient.testException().

static void alma.acs.exceptions.AcsJException.setProcessName ( String  name  )  [static]

If we have some better name than "java", for example the unique name of the java container.

Parameters:
name 
Object alma.acs.exceptions.AcsJException.setProperty ( String  key,
String  value 
)

Allows extra information to be attached to the exception.

Returns:
the previous value of the specified key in this property list, or null if it did not have one.

References alma.acs.exceptions.AcsJException.m_properties.

Referenced by alma.acs.exceptions.AcsJCompletion.setProperty().

void alma.acs.exceptions.AcsJException.setSeverity (  ) 

Sets the default severity level to Severity#Error. May be overridden by a subclass to set the default severity for that exception, or may be called from application code to set it for a specific exception instance.

References alma.acs.exceptions.AcsJException.m_severity.

AcsJCompletion alma.acs.exceptions.AcsJException.toAcsJCompletion (  ) 

Creates an AcsJCompletion that contains this exception.

Returns:
A completion object for which AcsJCompletion#getAcsJException() will yield this exception.

Referenced by alma.acs.container.AcsContainer.activate_component_async(), and com.cosylab.acs.maci.plug.ManagerProxyImpl.release_component_async().

abstract UserException alma.acs.exceptions.AcsJException.toCorbaException (  )  [pure virtual]

Creates a CORBA UserException from this exception.

Subclasses must return their associated UserException with an ErrorTrace member.

By convention, subclasses must also implement another method that returns the correct subtype of UserException. No problem with a code generator of course...

Implemented in alma.acs.exceptions.DefaultAcsJException.

String alma.acs.exceptions.AcsJException.toString (  ) 

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties