|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.inject.AbstractModule cz.cuni.amis.pogamut.base.factory.guice.GuiceAgentModule<PARAMS> cz.cuni.amis.pogamut.base.factory.guice.GuiceCommunicationModule<PARAMS> cz.cuni.amis.pogamut.base.factory.guice.GuiceRemoteAgentModule<PARAMS>
public abstract class GuiceRemoteAgentModule<PARAMS extends IRemoteAgentParameters>
Module extending GuiceAgentModule
for the purpose of remote agents (those communicating with the world using
IWorldConnection
).
Introducing getAddressProvider()
that allows you to specify IWorldConnectionAddress
at runtime.
To have successful module the descendant must specify these missing bindings:
Mapped class | Description |
---|---|
IAgent | Agent that should be instantiated |
IWorldConnection | Connection to the agent's world. |
IYylex | World message parser implementation. |
IWorldMessageTranslator | World-dependent implementation of InfoMessage s translator into IWorldChangeEvent that can be consumed by IWorldView . |
IWorldView | World view processing {@link IWorldChangeEvent}s into {@link IWorldEvent}s that should be consumed by {@link IAgent} implementation. |
... don't forget to call super.configure() in the subclasses ;-) NOTE> that the module is defining bindings for {@link IWorldReaderProvider} and {@link IWorldWriterProvider} which might not be suitable for {@link INativeAgentFactory}s - fear not as those bindings might be rebind thanks to Guice v2.
GuiceAgentModule
Constructor Summary | |
---|---|
GuiceRemoteAgentModule()
|
Method Summary | |
---|---|
protected void |
configureModules()
Override to create new module with your own bindings adding it into GuiceAgentModule.modules using GuiceCommunicationModule#addModule(Module) . |
protected AdaptableProvider |
getAddressProvider()
|
void |
prepareNewAgent(PARAMS agentParameters)
Must be called before another agent instance can be created. |
Methods inherited from class cz.cuni.amis.pogamut.base.factory.guice.GuiceAgentModule |
---|
addModule, configure, createAgentScope, createAgentTeamScope, getAgentIdProvider, getAgentParamsProvider, getAgentScope, getAgentTeamScope |
Methods inherited from class com.google.inject.AbstractModule |
---|
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GuiceRemoteAgentModule()
Method Detail |
---|
protected AdaptableProvider getAddressProvider()
public void prepareNewAgent(PARAMS agentParameters)
GuiceAgentModule
GuiceAgentModule.agentScope
and binds IAgentParameters.getAgentId()
to the GuiceAgentModule.agentIdProvider
.
Whenever you create your own IAgentParameters
you may need to override this method to utilize your new
run-time dependencies. In such case, always call super.prepareNewAgent(agentParameters) as a first command.
prepareNewAgent
in class GuiceAgentModule<PARAMS extends IRemoteAgentParameters>
protected void configureModules()
GuiceCommunicationModule
GuiceAgentModule.modules
using GuiceCommunicationModule#addModule(Module)
.
See GuiceCommunicationModule.configureModules()
source code for the example (utilizes anonymous class, instantiating AbstractModule
).
configureModules
in class GuiceCommunicationModule<PARAMS extends IRemoteAgentParameters>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |