2.17.2: 2011-06-17

net.sf.basedb.core.signal
Class AbstractSignalTransporter

java.lang.Object
  extended by net.sf.basedb.core.signal.AbstractSignalTransporter
All Implemented Interfaces:
SignalTransporter
Direct Known Subclasses:
LocalSignalTransporter, SocketSignalTransporter

public abstract class AbstractSignalTransporter
extends Object
implements SignalTransporter

Abstract base class that is useful when implementing signal transporters.

Version:
2.6
Author:
nicklas
Last modified
$Date: 2008-09-11 22:09:17 +0200 (Thu, 11 Sep 2008) $

Field Summary
private  String globalSignalId
           
private static Logger logger
          Log signals processing.
private  URI signalHandlerURI
           
private  Collection<Signal> signals
           
 
Constructor Summary
protected AbstractSignalTransporter()
           
 
Method Summary
protected  String generateSignalMessage(Signal signal)
          Generate a signal message string for the given signal.
protected  String getGlobalSignalId()
          Get the raw ID string that was passed to the init(String) method.
protected  String getHandlerId()
          Get the local handler ID part of the signal URI.
protected  String getReceiverId()
          Get the receiverId part of the signal URI.
protected  URI getSignalURI()
          Get the URI representation of the global signal ID.
 Collection<Signal> getSupportedSignals()
          Get a collection containing the signals supported, by the signal handler.
 void init(String params)
          Initialise the transporter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.signal.SignalTransporter
send
 

Field Detail

logger

private static final Logger logger
Log signals processing.


globalSignalId

private String globalSignalId

signalHandlerURI

private URI signalHandlerURI

signals

private Collection<Signal> signals
Constructor Detail

AbstractSignalTransporter

protected AbstractSignalTransporter()
Method Detail

init

public void init(String params)
Initialise the transporter. We expect the parameter to be the one returned from AbstractSignalReceiver.getGlobalSignalId(SignalHandler). If the receiver subclass overrided that method, the corresponding transporter subclass should override this method.

Specified by:
init in interface SignalTransporter
Parameters:
params - The initialisation string
See Also:
for a description of the format expected

getSupportedSignals

public Collection<Signal> getSupportedSignals()
Description copied from interface: SignalTransporter
Get a collection containing the signals supported, by the signal handler. A null return value means that the transporter just doesn't know about which signals are supported and which are not.

Specified by:
getSupportedSignals in interface SignalTransporter
Returns:
A collections with the signals, or null

generateSignalMessage

protected String generateSignalMessage(Signal signal)
Generate a signal message string for the given signal. The string will have the following format: signal://handlerId@receiverId/?signal

See Also:
AbstractSignalReceiver.processSignalMessage(String)

getGlobalSignalId

protected String getGlobalSignalId()
Get the raw ID string that was passed to the init(String) method.


getSignalURI

protected URI getSignalURI()
Get the URI representation of the global signal ID.

Returns:
An URI
Throws:
SignalException - If the signal ID is not a valid URI.

getReceiverId

protected String getReceiverId()
Get the receiverId part of the signal URI.

Returns:
The ID of the receiver

getHandlerId

protected String getHandlerId()
Get the local handler ID part of the signal URI.

Returns:
The local ID of the signal handler

2.17.2: 2011-06-17