cz.cuni.amis.pogamut.ut2004.factory.guice.remoteagent
Class UT2004CommunicationModule<PARAMS extends UT2004AgentParameters>

java.lang.Object
  extended by com.google.inject.AbstractModule
      extended by cz.cuni.amis.pogamut.base.factory.guice.GuiceAgentModule<PARAMS>
          extended by cz.cuni.amis.pogamut.base.factory.guice.GuiceCommunicationModule<PARAMS>
              extended by cz.cuni.amis.pogamut.base.factory.guice.GuiceRemoteAgentModule<PARAMS>
                  extended by cz.cuni.amis.pogamut.ut2004.factory.guice.remoteagent.UT2004CommunicationModule<PARAMS>
All Implemented Interfaces:
com.google.inject.Module
Direct Known Subclasses:
UT2004BotModule, UT2004ObserverModule, UT2004ServerModule

public class UT2004CommunicationModule<PARAMS extends UT2004AgentParameters>
extends GuiceRemoteAgentModule<PARAMS>

Module extending RemoteGuiceAgentModule for the purpose of UT2004 communication specification.

Newly binded classes:

Mapped class Target Description
IWorldConnection -> SocketConnection Agent bus synchronizing starting/stopping/etc. events.
SocketConnection dependencies -> connectionDependenciesProvider
SocketConnection address-> UT2004BotModule#getAddressProvider()
{@link IWorldMessageParser} -> {@link UT2004Parser} Wrapper for the yylex parser of the messages coming from GameBots2004.
{@link IYylex} -> {@link IUT2004Yylex} Specifying yylex further.
{@link IUT2004Yylex} -> {@link Yylex} Specifying yylex further.
{@link IYylexObserver} -> {@link IYylexObserver.LogObserver} Yylex observer reporting errors.
{@link IUT2004Yylex} -> {@link Yylex} Concrete Yylex implementations that parses the messages coming from GameBots2004.
{@link ItemTranslator} -> {@link ItemTranslator} Object handling translation of INV messages.
{@link UT2004AgentParameters} -> {@link UT2004CommunicationModule#getAgentParamsProvider()} Agent parameters passed by the factory, contains additional runtime dependencies.

To have successful module the descendant must specify these missing bindings:
Mapped class Description
{@link IWorldView} Binds world view as vision world view.
{@link IWorldMessageTranslator} Protocol-validating translator of {@link InfoMessage}s of GameBots2004.
{@link IAgent}
... plus all newly introduced dependencies (by various implementors of mentioned interfaces).

... don't forget to call super.configureModules() in the subclasses ;-)

See Also:
GuiceRemoteAgentModule, GuiceAgentModule

Field Summary
protected  AdaptableProvider<ComponentDependencies> connectionDependenciesProvider
           
 
Constructor Summary
UT2004CommunicationModule()
           
 
Method Summary
protected  void configureModules()
          Override to create new module with your own bindings adding it into GuiceAgentModule.modules using GuiceCommunicationModule#addModule(Module).
 void prepareNewAgent(PARAMS agentParameters)
          Binds runtime dependencies to the module/Injector.
 
Methods inherited from class cz.cuni.amis.pogamut.base.factory.guice.GuiceRemoteAgentModule
getAddressProvider
 
Methods inherited from class cz.cuni.amis.pogamut.base.factory.guice.GuiceAgentModule
addModule, configure, createAgentScope, getAgentIdProvider, getAgentParamsProvider, getAgentScope
 
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
 

Field Detail

connectionDependenciesProvider

protected AdaptableProvider<ComponentDependencies> connectionDependenciesProvider
Constructor Detail

UT2004CommunicationModule

public UT2004CommunicationModule()
Method Detail

prepareNewAgent

public void prepareNewAgent(PARAMS agentParameters)
Binds runtime dependencies to the module/Injector.

Must be called before the new agent is instantiated with Injector.

Overrides:
prepareNewAgent in class GuiceRemoteAgentModule<PARAMS extends UT2004AgentParameters>
Parameters:
agentId -
address -

configureModules

protected void configureModules()
Description copied from class: GuiceCommunicationModule
Override to create new module with your own bindings adding it into GuiceAgentModule.modules using GuiceCommunicationModule#addModule(Module).

See GuiceCommunicationModule.configureModules() source code for the example (utilizes anonymous class, instantiating AbstractModule).

Overrides:
configureModules in class GuiceRemoteAgentModule<PARAMS extends UT2004AgentParameters>