Package net.sf.basedb.core.signal
Class AbstractSignalTransporter
java.lang.Object
net.sf.basedb.core.signal.AbstractSignalTransporter
- All Implemented Interfaces:
SignalTransporter
- Direct Known Subclasses:
ExtensionSignalTransporter
,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: 2014-04-09 14:21:20 +0200 (on, 09 apr 2014) $
-
Field Summary
Fields Modifier and Type Field Description private String
globalSignalId
private static org.slf4j.Logger
logger
Log signals processing.private URI
signalHandlerURI
private Collection<Signal>
signals
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSignalTransporter()
-
Method Summary
Modifier and Type Method Description 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 theinit(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 Details
-
logger
private static final org.slf4j.Logger loggerLog signals processing. -
globalSignalId
-
signalHandlerURI
-
signals
-
-
Constructor Details
-
AbstractSignalTransporter
protected AbstractSignalTransporter()
-
-
Method Details
-
init
Initialise the transporter. We expect the parameter to be the one returned fromAbstractSignalReceiver.getGlobalSignalId(SignalHandler)
. If the receiver subclass overrided that method, the corresponding transporter subclass should override this method.- Specified by:
init
in interfaceSignalTransporter
- Parameters:
params
- The initialisation string- See Also:
for a description of the format expected
-
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 interfaceSignalTransporter
- Returns:
- A collections with the signals, or null
-
generateSignalMessage
Generate a signal message string for the given signal. The string will have the following format:signal://handlerId@receiverId/?signal
-
getGlobalSignalId
Get the raw ID string that was passed to theinit(String)
method. -
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
Get the receiverId part of the signal URI.- Returns:
- The ID of the receiver
-
getHandlerId
Get the local handler ID part of the signal URI.- Returns:
- The local ID of the signal handler
-