@Component public class AgentManager extends Object
| Modifier and Type | Method and Description |
|---|---|
static AgentManager |
defaultInstance()
Returns the default instance of this component.
|
AbstractAgent |
findAgentByName(String name)
Searches and returns the agent with the specified name in this manager's scope.
|
Collection<AbstractAgent> |
getAgents() |
String |
getAgentStatusJson(String name)
Returns a JSON string containing agent status information for reporting.
|
boolean |
isAgentRunning(String name)
Returns a flag indicating whether an agent is running or not.
|
boolean |
isAgentStarted(String name)
Returns a flag indicating whether an agent is started or not.
|
void |
removeAgent(String name)
Removes an agent identified by the given name, if it is not started
|
void |
resetAgent(String name)
Creates a new instance of the agent identified by the given name.
|
void |
runNow(String name)
Posts immediate execution of the agent identified by the given name.
|
void |
scanPackage(String basePackage)
Scans the specified base package for agent candidates, then looks for higher precedence
configuration sources and, finally, instantiates the agents, and keeps theirs reference
for management purposes.
|
void |
startAgent(String name)
Starts the agent identified by the given name.
|
void |
startAllAgents() |
void |
stopAgent(String name)
Posts a graceful stop request for the agent identified by the given name.
|
public static AgentManager defaultInstance()
AgentManagerpublic void scanPackage(String basePackage)
basePackage - the base package to search for agent candidatespublic AbstractAgent findAgentByName(String name)
name - the agent name to search for, not nullIllegalArgumentException - if no agent with the given name found, or if the
specified string is either null or emptypublic void removeAgent(String name)
name - the identifier of the agent to be removedIllegalArgumentException - if no agent with the given name was foundIllegalStateException - if the requested agent is startedpublic void resetAgent(String name)
name - the identifier of the agent to be resetIllegalArgumentException - if no agent with the given name was foundIllegalStateException - if the agent is either started or runningpublic void startAgent(String name)
name - the identifier of the agent to be startedIllegalArgumentException - if no agent with the given name was foundIllegalStateException - if the requested agent is already startedpublic void runNow(String name)
name - the identifier of the agent to be runIllegalArgumentException - if no agent with the given name was foundpublic void stopAgent(String name)
name - the identifier of the agent to be stoppedIllegalArgumentException - if no agent with the given name was foundpublic Collection<AbstractAgent> getAgents()
public boolean isAgentRunning(String name)
name - the identifier of the agent to be resettrue if the agent is running, otherwise falseIllegalArgumentException - if no agent with the given name was foundpublic boolean isAgentStarted(String name)
name - the identifier of the agent to be resettrue if the agent is started, otherwise falseIllegalArgumentException - if no agent with the given name was foundpublic String getAgentStatusJson(String name)
name - the identifier of the agent to be reportedIllegalArgumentException - if no agent with the given name was foundpublic void startAllAgents()
Copyright © 2022. All rights reserved.