|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.lsst.ccs.bus.BusApplicationLayer
public class BusApplicationLayer
Calls a BusMessagingLayer and adds all that is necessary to handle messages following application layer concerns.
Each is bound to a subsystem.
This class is meant to be subclassed if there is a need to setup complex correlations between messages (or more generally for "application layer" concerns)
beware ThreadLocal objects may be changed in future releases: they may be moved to Context objects carried through thread creations.
| Nested Class Summary | |
|---|---|
protected class |
BusApplicationLayer.ForwarderToCommand
instances of this class will forward commands coming from the transport layer to the registered CommandListener. |
protected class |
BusApplicationLayer.ForwarderToLog
instances of this class will forward directly log messages to a log listener |
protected class |
BusApplicationLayer.ForwarderToStatus
instances of this class will forward directly status messages to statuslistener |
| Field Summary | |
|---|---|
protected BusMessagingLayer |
busMessagingLayer
|
protected ThreadLocal<org.lsst.ccs.bus.Command> |
localCommand
|
protected ThreadLocal<String> |
localCorrelID
|
protected ThreadLocal<String> |
localOrigin
|
protected static org.apache.log4j.Logger |
log
|
protected String |
subsystemName
|
| Constructor Summary | |
|---|---|
BusApplicationLayer(String subsystemName,
BusMessagingLayer busMessagingLayer)
creates an entry point to communication for the subsystem. |
|
| Method Summary | |
|---|---|
void |
addCommandListener(CommandListener l)
registers a CommandListener (in fact a ForwarderToCommand to the underlying transport) |
void |
addLogListener(LogListener l)
registers a LogListener (in fact a ForwarderToLog to the underlying transport) |
void |
addStatusListener(StatusListener l)
registers a StatusListener (in fact a ForwarderToStatus to the underlying transport) |
void |
close()
closes the underlying transport layer, stops the listening threads, after this call all other sending calls will fail. |
String |
getToken()
|
protected String[] |
parseDestination(String destination)
utility method: parse the destination string in Commands. |
void |
registerToCommand()
registers current subsystem to the Command bus |
void |
registerToLog()
registers current subsystem to the logging bus |
void |
registerToStatus()
registers current subsystem to the Status bus |
void |
removeCommandListener(CommandListener l)
removes a CommandListener: since this command is based on strict identity the listener should be exactly the same as the one registered. |
void |
removeLogListener(LogListener l)
|
void |
removeStatusListener(StatusListener l)
|
void |
reply(org.lsst.ccs.bus.CommandAckOrReply cmd)
sends a reply or an ack responding to a command. |
void |
sendCommand(org.lsst.ccs.bus.Command cmd)
sends a command message to all destinations. |
void |
sendLogEvent(org.lsst.ccs.bus.LogEvent evt)
broadcasts a log message. |
void |
sendStatus(org.lsst.ccs.bus.Status status)
broadcasts a status message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final String subsystemName
protected final BusMessagingLayer busMessagingLayer
protected static org.apache.log4j.Logger log
protected ThreadLocal<String> localCorrelID
protected ThreadLocal<String> localOrigin
protected ThreadLocal<org.lsst.ccs.bus.Command> localCommand
| Constructor Detail |
|---|
public BusApplicationLayer(String subsystemName,
BusMessagingLayer busMessagingLayer)
subsystemName - rules of naming applybusMessagingLayer - transport layer
NullPointerException - if busMessagingLayer is null| Method Detail |
|---|
public String getToken()
public void registerToCommand()
throws IOException
IOException
public void registerToStatus()
throws IOException
IOException
public void registerToLog()
throws IOException
IOExceptionprotected String[] parseDestination(String destination)
destination -
public void sendCommand(org.lsst.ccs.bus.Command cmd)
throws IOException
cmd -
IOException
DestinationsException - may be thrown if the transport layer is unable to find some of the
destination and has no broadcast policy in this case.for another way to signal
destinations exceptions
public void sendStatus(org.lsst.ccs.bus.Status status)
throws IOException
status -
IOException
public void sendLogEvent(org.lsst.ccs.bus.LogEvent evt)
throws IOException
evt -
IOException
public void reply(org.lsst.ccs.bus.CommandAckOrReply cmd)
throws IOException
cmd -
IOException
DestinationsException - may be thrown if the transport layer is unable to find some of the
destination and has no broadcast policy in this case.for another way to signal
destinations exceptionspublic void addCommandListener(CommandListener l)
l - public void removeCommandListener(CommandListener l)
l - public void addStatusListener(StatusListener l)
l - public void removeStatusListener(StatusListener l)
public void addLogListener(LogListener l)
l - public void removeLogListener(LogListener l)
public void close()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||