public final class Act extends Object implements IComponent, IAct, IJMXEnabled
Ignores IComponentControlHelper.startPaused()
, performs IComponentControlHelper.start()
in both start cases.
Modifier and Type | Field and Description |
---|---|
static cz.cuni.amis.utils.token.Token |
COMPONENT_ID |
static String |
DEFAULT_LINE_END
Default termination of commands.
|
Constructor and Description |
---|
Act(IWorldWriterProvider writerProvider,
ICommandSerializer serializer,
IComponentBus eventBus,
IAgentLogger logger) |
Modifier and Type | Method and Description |
---|---|
void |
act(CommandMessage command)
Sends command through the writer.
|
void |
addCommandListener(Class commandClass,
ICommandListener listener)
Attach listener to outgoing commands from body.
|
void |
enableJMX(MBeanServer mBeanServer,
ObjectName parent)
Method for starting the JMX extension of the class.
|
cz.cuni.amis.utils.token.Token |
getComponentId()
Unique identification of the component.
|
LogCategory |
getLog() |
boolean |
isCommandListening(Class commandClass,
ICommandListener listener)
Whether the listener is listening for commands of commandClass.
|
void |
removeCommandListener(Class commandClass,
ICommandListener listener)
Remove the listener to outgoing commands.
|
protected void |
sendCommand(CommandMessage command)
Provides the implementation how to send 'command' through 'this.writer'.
|
String |
toString() |
public static final cz.cuni.amis.utils.token.Token COMPONENT_ID
public static final String DEFAULT_LINE_END
@Inject public Act(IWorldWriterProvider writerProvider, ICommandSerializer serializer, IComponentBus eventBus, IAgentLogger logger)
public cz.cuni.amis.utils.token.Token getComponentId()
IComponent
getComponentId
in interface IComponent
public LogCategory getLog()
protected void sendCommand(CommandMessage command)
public void act(CommandMessage command)
act
in interface IAct
command
- CommunicationException
public void addCommandListener(Class commandClass, ICommandListener listener)
IAct
After the command is sent to the world, listener will be notified.
addCommandListener
in interface IAct
commandClass
- which command you want to listen topublic boolean isCommandListening(Class commandClass, ICommandListener listener)
IAct
isCommandListening
in interface IAct
public void removeCommandListener(Class commandClass, ICommandListener listener)
IAct
removeCommandListener
in interface IAct
commandClass
- which command you want to listen topublic void enableJMX(MBeanServer mBeanServer, ObjectName parent)
IJMXEnabled
Object should register whatever objects it wants to expose via JMX.
enableJMX
in interface IJMXEnabled
mBeanServer
- server where the MBean of agent is registeredparent
- parent's ObjectName, should be used as base of name of
the registered MBeanCopyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.