@Component public class AgentManager extends Object
| Constructor and Description |
|---|
AgentManager() |
| Modifier and Type | Method and Description |
|---|---|
AbstractAgent |
findAgentByName(String name)
Searches and returns the agent with the specified name in this manager's scope.
|
Collection<AbstractAgent> |
getAgents() |
String |
getAgentStatusStr(String name)
Returns a string containing agent status information for reporting.
|
static AgentManager |
getInstance()
Returns the managed instance of this component.
|
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.
|
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 getInstance()
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 getAgentStatusStr(String name)
name - the identifier of the agent to be reportedIllegalArgumentException - if no agent with the given name was foundpublic void startAllAgents()
Copyright © 2021. All rights reserved.