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
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
Modifier and TypeFieldDescriptionprivate String
private static final Logger
Log signals processing.private URI
private Collection<Signal>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
generateSignalMessage
(Signal signal) Generate a signal message string for the given signal.protected String
Get the raw ID string that was passed to theinit(String)
method.protected String
Get the local handler ID part of the signal URI.protected String
Get the receiverId part of the signal URI.protected URI
Get the URI representation of the global signal ID.Get a collection containing the signals supported, by the signal handler.void
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
Log 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:
-
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
-