mandala.jacob.remote
Class AbstractRemote

java.lang.Object
  extended bymandala.jacob.remote.AbstractRemote
All Implemented Interfaces:
Remote, java.io.Serializable
Direct Known Subclasses:
AbstractLocalReferenceRetriever, AbstractRemoteProxy, mandala.jacob.remote.rmi.RMIAbstractRemoteProxy

public abstract class AbstractRemote
extends java.lang.Object
implements Remote

Abstract base class for remote implementation.

This class defines the behavior subclasses must implement when a remote exception occurs during a remote method invocation:
First, a RemoteExceptionInfo must be created and given in argument to the method ExceptionHandler.handleException(Object) of the ExceptionHandler returned by getExceptionHandler().
Then, the object returned is used to known what to further do:

The handler must be able to return a value conforming to the return type of the method which throws the original exception. If the type is a primitive type, it must be wrapped in the corresponding wrapper class, implementation will convert it to the necessary primitive corresponding type.

Note that on deserialization, the exceptionHandler field is set to defaultExceptionHandler if the one written on serialization is not serializable.

Since:
1.0
Version:
1.0
Author:
eipi
See Also:
RemoteExceptionInfo, ExceptionHandler, Remote, Serialized Form

Field Summary
protected static ExceptionHandler defaultExceptionHandler
          The exception handler used when none are specified.
protected  ExceptionHandler exceptionHandler
          The ExceptionHandler instance to use when a remote exception occurs.
protected static Syslog syslog
          Message logger.
 
Constructor Summary
protected AbstractRemote()
          Creates a new AbstractRemote.
protected AbstractRemote(ExceptionHandler exceptionHandler)
          Creates a new AbstractRemote.
 
Method Summary
static ExceptionHandler getDefaultExceptionHandler()
          Get the DefaultExceptionHandler value.
 ExceptionHandler getExceptionHandler()
          Returns the RemoteExceptionHandler which manage network related exceptions.
static Syslog getSyslog()
          Returns the Syslog object facility.
static void handleException(java.lang.Throwable throwable)
          Check that the given throwable is a RuntimeException or an Error and throws it.
static void setDefaultExceptionHandler(ExceptionHandler handler)
          Set the DefaultExceptionHandler value.
 void setExceptionHandler(ExceptionHandler exceptionHandler)
          Set the RemoteExceptionHandler which manage network related exceptions.
static void setSyslog(Syslog syslog)
          Sets the Syslog object facility.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

syslog

protected static Syslog syslog

Message logger.

Each message (debug, log, warning, error, ...) are wrote to this message logger.

See Also:
Syslog

defaultExceptionHandler

protected static ExceptionHandler defaultExceptionHandler

The exception handler used when none are specified.


exceptionHandler

protected transient ExceptionHandler exceptionHandler

The ExceptionHandler instance to use when a remote exception occurs.

See Also:
ExceptionHandler
Constructor Detail

AbstractRemote

protected AbstractRemote()

Creates a new AbstractRemote.

The ExceptionHandler to use when an exception occurs is set to a new SyslogExceptionHandler instance.

See Also:
SyslogExceptionHandler

AbstractRemote

protected AbstractRemote(ExceptionHandler exceptionHandler)

Creates a new AbstractRemote.

Parameters:
exceptionHandler - The ExceptionHandler to use when a remote exception occurs.
See Also:
ExceptionHandler
Method Detail

getSyslog

public static Syslog getSyslog()

Returns the Syslog object facility.

Each message (debug, log, warning, error, ...) are wrote to this message logger.

Returns:
the Syslog object
See Also:
Syslog

setSyslog

public static void setSyslog(Syslog syslog)

Sets the Syslog object facility.

Each message (debug, log, warning, error, ...) are wrote to this message logger.

See Also:
Syslog

getExceptionHandler

public ExceptionHandler getExceptionHandler()
Description copied from interface: Remote

Returns the RemoteExceptionHandler which manage network related exceptions.

Specified by:
getExceptionHandler in interface Remote
Returns:
the RemoteExceptionHandler which manage network related exceptions

setExceptionHandler

public void setExceptionHandler(ExceptionHandler exceptionHandler)
Description copied from interface: Remote

Set the RemoteExceptionHandler which manage network related exceptions.

Specified by:
setExceptionHandler in interface Remote
Parameters:
exceptionHandler - the RemoteExceptionHandler which should manage network related exceptions

getDefaultExceptionHandler

public static ExceptionHandler getDefaultExceptionHandler()

Get the DefaultExceptionHandler value.

Returns:
the DefaultExceptionHandler value.

setDefaultExceptionHandler

public static void setDefaultExceptionHandler(ExceptionHandler handler)

Set the DefaultExceptionHandler value.

Parameters:
handler - The new default exception handler value.

handleException

public static void handleException(java.lang.Throwable throwable)

Check that the given throwable is a RuntimeException or an Error and throws it.

Parameters:
throwable - a Throwable value

toString

public java.lang.String toString()


Mandala help mailing list