public class AgentContextImpl extends java.lang.Object implements AgentContext
Modifier and Type | Field and Description |
---|---|
static java.lang.Class<?>[] |
KNOWN_HANDLERS |
Constructor and Description |
---|
AgentContextImpl(java.io.File workDir) |
Modifier and Type | Method and Description |
---|---|
void |
addComponent(java.lang.Object component)
Adds a component to this context.
|
<T> T |
getHandler(java.lang.Class<T> iface)
Return the handler for a specified interface.
|
java.io.File |
getWorkDir()
Return the work directory.
|
void |
setController(java.lang.Object controller)
Sets the controller to use for the agent.
|
<T> void |
setHandler(java.lang.Class<T> iface,
T handler)
Set a handler on the context.
|
void |
start()
Start the context.
|
void |
stop()
Stop the context.
|
public void addComponent(java.lang.Object component)
component
- The component to add, cannot be null
.public <T> T getHandler(java.lang.Class<T> iface)
AgentContext
getHandler
in interface AgentContext
iface
- An interfacenull
public java.io.File getWorkDir()
AgentContext
getWorkDir
in interface AgentContext
public void setController(java.lang.Object controller)
controller
- the controller to use, cannot be null
.public <T> void setHandler(java.lang.Class<T> iface, T handler)
iface
- The handler interfacehandler
- The handler implementationpublic void start() throws java.lang.Exception
java.lang.Exception
- On failure.public void stop() throws java.lang.Exception
java.lang.Exception
- On failure.