public class AgentCommandDictionaryService extends Object implements ServiceLifecycle, AgentService, BusMessagePreProcessor
Command annotation. It also provides an API that can be used to
add commands to a given path from objects that are not on the lookup tree.
- client side command dictionary record keeping: for Consoles only. It listens
to the buses for the presence of Agents and it keeps an online snapshot
of the currently available dictionaries on the buses.
Rules to add command dictionaries:
- dictionaries can only be added in the HasLifecycle:init phase. All other
attempts will fail with a RuntimeException.
Dictionary publication on the status bus:
this service is responsible for publishing an Agent's command dictionary:
- every time a CONSOLE is connected to the buses
- upon startup as soon as the full dictionary is ready
the dictionary is published in a StatusCommandDicionary status message.| Modifier and Type | Class and Description |
|---|---|
class |
AgentCommandDictionaryService.AgentCommandDictionaryCommands |
static class |
AgentCommandDictionaryService.AgentCommandDictionaryEvent
An event fired to
AgentCommandDictionaryListeners when an agent
command dictionary has changed. |
static interface |
AgentCommandDictionaryService.AgentCommandDictionaryListener
A Listener to receive notifications of CommandDictionary changes.
|
| Modifier and Type | Field and Description |
|---|---|
static SupportedOption |
withLockOption |
| Constructor and Description |
|---|
AgentCommandDictionaryService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAgentCommandDictionaryListener(AgentCommandDictionaryService.AgentCommandDictionaryListener listener) |
void |
addCommandSetToObject(Object obj,
Object objectToAddTo)
Adds a
CommandSet to extend the set of commands recognized by this Agent. |
void |
afterBuild() |
void |
afterInit() |
HashMap<String,Dictionary> |
getAgentCommandDictionary() |
HashMap<String,Dictionary> |
getAgentCommandDictionaryWithoutAgentName() |
AgentDictionaryCommand |
getAgentDictionaryCommand(String destination,
String commandName,
int nArgs)
Deprecated.
This method is unused and is being removed.
|
String |
getAgentServiceName()
Get the name of this service.
|
Bus |
getBus()
The Bus this BusMessagePreProcessor applies to.
|
CommandSet |
getCommandSet(String name) |
long |
getDictionaryChecksum() |
void |
preBuild() |
BusMessage |
preProcessMessage(BusMessage msg)
Pre-process the incoming BusMessage and return the message to be
forwarded to the bus message listeners.
|
void |
removeAgentCommandDictionaryListener(AgentCommandDictionaryService.AgentCommandDictionaryListener listener) |
boolean |
startForAgent(AgentInfo agentInfo)
This method is invoked after an agent service is created to see if
this service is to be started for the tiven Agent.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitafterStart, preInit, preShutdown, preStartpublic static final SupportedOption withLockOption
public String getAgentServiceName()
AgentServicegetAgentServiceName in interface AgentServicepublic boolean startForAgent(AgentInfo agentInfo)
AgentServicestartForAgent in interface AgentServicepublic void preBuild()
preBuild in interface ServiceLifecyclepublic void afterBuild()
afterBuild in interface ServiceLifecyclepublic void afterInit()
afterInit in interface ServiceLifecyclepublic long getDictionaryChecksum()
public CommandSet getCommandSet(String name)
public void addCommandSetToObject(Object obj, Object objectToAddTo)
CommandSet to extend the set of commands recognized by this Agent.obj - The object with the commandsobjectToAddTo - the object to add the commands to.public HashMap<String,Dictionary> getAgentCommandDictionary()
public HashMap<String,Dictionary> getAgentCommandDictionaryWithoutAgentName()
@Deprecated public AgentDictionaryCommand getAgentDictionaryCommand(String destination, String commandName, int nArgs)
destination - Target component, including the subsystem name.commandName - Command name.nArgs - Number of arguments the command takes.AgentDictionaryCommand.RuntimeException - If the dictionary is not available, or a matching command is not found.public void addAgentCommandDictionaryListener(AgentCommandDictionaryService.AgentCommandDictionaryListener listener)
public void removeAgentCommandDictionaryListener(AgentCommandDictionaryService.AgentCommandDictionaryListener listener)
public Bus getBus()
BusMessagePreProcessorgetBus in interface BusMessagePreProcessorpublic BusMessage preProcessMessage(BusMessage msg)
BusMessagePreProcessorpreProcessMessage in interface BusMessagePreProcessormsg - The incoming BusMessageCopyright © 2023 LSST. All rights reserved.