EclipseLink 1.1.4, build 'v20100812-r7860' API Reference

org.eclipse.persistence.sessions.coordination
Interface CommandProcessor

All Known Implementing Classes:
org.eclipse.persistence.internal.sessions.AbstractSession, ClientSession, org.eclipse.persistence.internal.sessions.DatabaseSessionImpl, DistributedSession, RemoteSession, ServerSession, SessionBroker

public interface CommandProcessor

Purpose: Defines a pluggable interface for TopLink sessions and non-TopLink applications to be able to be on the receiving end of TopLink command objects.

Description: This interface represents the entity that both initiates (on the sending end) and processes (on the receiving end) remote commands. The implementation classes of this interface should be set on the CommandManager so that it can be invoked to process command messages as they get received from other remote command managers in the TopLink cluster. When the implementing class wants to send a remote command to other CommandProcessors then it invokes the CommandManager to do so. When running this remote command service in a TopLink application then the the Session class should be used as the implementation class for this interface. When running in a non-TopLink application then the application should provide the implementation class.

See Also:
Command, CommandManager
Author:
Steven Vo
Since:
OracleAS TopLink 10g (9.0.4)

Field Summary
static int LOG_DEBUG
           
static int LOG_ERROR
           
static int LOG_INFO
           
static int LOG_WARNING
           
 
Method Summary
 CommandManager getCommandManager()
          PUBLIC: Return the CommandManager that will invoke this CommandProcessor to process a command, and can be used to send remote commands out to other CommandProcessors in the cluster.
 java.lang.Object handleException(java.lang.RuntimeException exception)
          PUBLIC: Allow the implementation class to handle an exception thrown in in the remote command service.
 void logMessage(int logLevel, java.lang.String message)
          PUBLIC: Log a message to the application log output stream.
 void processCommand(java.lang.Object command)
          PUBLIC: Invoked by the CommandManager after it has received a Command object and has converted it to the application command format.
 void setCommandManager(CommandManager commandManager)
          PUBLIC: Set the CommandManager that will invoke this CommandProcessor to process a command, and can be used to send remote commands out to other CommandProcessors in the cluster.
 boolean shouldLogMessages(int logLevel)
          PUBLIC: Determine whether messages at the specified log level should be logged.
 

Field Detail

LOG_DEBUG

static final int LOG_DEBUG
See Also:
Constant Field Values

LOG_INFO

static final int LOG_INFO
See Also:
Constant Field Values

LOG_WARNING

static final int LOG_WARNING
See Also:
Constant Field Values

LOG_ERROR

static final int LOG_ERROR
See Also:
Constant Field Values
Method Detail

processCommand

void processCommand(java.lang.Object command)
PUBLIC: Invoked by the CommandManager after it has received a Command object and has converted it to the application command format.

Parameters:
command - Application formatted command to be processed

getCommandManager

CommandManager getCommandManager()
PUBLIC: Return the CommandManager that will invoke this CommandProcessor to process a command, and can be used to send remote commands out to other CommandProcessors in the cluster.

Returns:
The remote command manager responsible for this CommandProcessor

setCommandManager

void setCommandManager(CommandManager commandManager)
PUBLIC: Set the CommandManager that will invoke this CommandProcessor to process a command, and can be used to send remote commands out to other CommandProcessors in the cluster.

Parameters:
commandManager - The remote command manager responsible for this CommandProcessor

shouldLogMessages

boolean shouldLogMessages(int logLevel)
PUBLIC: Determine whether messages at the specified log level should be logged. This will be invoked by the CommandManager as a short-circuiting mechanism to calling logMessage().

Parameters:
logLevel - A log constant that is one of LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG
Returns:
True if a message at the specified level should be logged and false if it should not

logMessage

void logMessage(int logLevel,
                java.lang.String message)
PUBLIC: Log a message to the application log output stream. If the specified log level is lower than the level configured in the CommandProcessor then the message should not be logged. The implementation class must map its logging system to the four supported levels: Error, Warning, Info and Debug.

Parameters:
logLevel - A log constant that is one of LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG
message - The message String that is to be logged

handleException

java.lang.Object handleException(java.lang.RuntimeException exception)
PUBLIC: Allow the implementation class to handle an exception thrown in in the remote command service. The implementation may choose to simply rethrow the exception if it does not want to handle it. NOTE: Handlers that simply ignore exceptions may cause unexpected behavior that can be detrimental to the application and difficult to debug.

Parameters:
exception - The exception being thrown
Returns:
An object that is not currently used

EclipseLink 1.1.4, build 'v20100812-r7860' API Reference