cz.cuni.amis.pogamut.base.component.controller
Class SharedComponentControlHelper

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.component.controller.SharedComponentControlHelper
All Implemented Interfaces:
IComponentControlHelper, ISharedComponentControlHelper

public class SharedComponentControlHelper
extends java.lang.Object
implements ISharedComponentControlHelper

Provides empty implementations of life-cycle methods defined by ISharedComponentControlHelper - override only these that you need.


Constructor Summary
SharedComponentControlHelper()
           
 
Method Summary
 void kill()
          Kills the component in ruthless way.
 void localKill(IAgentId agentId)
          Kills the component for the agent identified by 'agentId'.
 void localPause(IAgentId agentId)
          Pauses the component for agent identified by 'agentId'.
 void localPrePause(IAgentId agentId)
          Called before the IPausingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.
 void localPreResume(IAgentId agentId)
          Called before the IResumingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.
 void localPreStart(IAgentId agentId)
          Called before the IStartingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.
 void localPreStartPaused(IAgentId agentId)
          Called before IStartingPausedEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.
 void localPreStop(IAgentId agentId)
          Called before the IStoppingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.
 void localReset(IAgentId agentId)
          Called whenever IResetEvent is caught at the ILifecycleBus of the agent identified by 'agentId'.
 void localResume(IAgentId agentId)
          Resumes the component for the agent identified by 'agentId'.
 void localStart(IAgentId agentId)
          The component is being started inside the ILifecycleBus of the agent identified by 'agentId'.
 void localStartPaused(IAgentId agentId)
          Starts the component for the agent identified by 'agentId' but it assumes that the component just prepares whatever data structures it needs / make connections / handshake whatever it needs with the environment / etc.
 void localStop(IAgentId agentId)
          Stops the component for the agent identified by 'agentId'.
 void pause()
          Pauses the component.
 void prePause()
          Called whenever there is no running dependencies and the rest is going to be paused or is paused.
 void preResume()
          Called whenever some of paused dependencies is starting / is started.
 void preStart()
          Called whenever starting dependencies of some (first) agent becomes satisfied.
 void preStartPaused()
          Called whenever starting dependencies of some (first) agent becomes satisfied, should start the component into paused state.
 void preStop()
          Called whenever there is no running dependencies and the rest is going to be stopped.
 void reset()
          Called whenever IResetEvent is caught in any of stopped bus.
 void resume()
          Resumes the component.
 void start()
          Called to start the component whenever starting dependencies of some (first) agent becomes satisfied.
 void startPaused()
          Starts the component whenever starting dependencies of some (first) agent becomes satisfied.
 void stop()
          Stops the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedComponentControlHelper

public SharedComponentControlHelper()
Method Detail

localKill

public void localKill(IAgentId agentId)
Description copied from interface: ISharedComponentControlHelper
Kills the component for the agent identified by 'agentId'. It must be non-blocking method.

Called whenever IFatalErrorEvent is caught for a given agent.

Must not throw any exception whatsoever.

Specified by:
localKill in interface ISharedComponentControlHelper

localPause

public void localPause(IAgentId agentId)
                throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Pauses the component for agent identified by 'agentId'.

Called whenever IPausingEvent is caught from one of the dependencies of the given agent.

Specified by:
localPause in interface ISharedComponentControlHelper
Throws:
PogamutException

localPrePause

public void localPrePause(IAgentId agentId)
                   throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called before the IPausingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.

You may need to pre-clean some stuff.

Specified by:
localPrePause in interface ISharedComponentControlHelper
Throws:
PogamutException

localPreResume

public void localPreResume(IAgentId agentId)
                    throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called before the IResumingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.

You may need to pre-clean some stuff.

Specified by:
localPreResume in interface ISharedComponentControlHelper
Throws:
PogamutException

localPreStart

public void localPreStart(IAgentId agentId)
                   throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called before the IStartingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.

You may need to prepare some stuff before starting event is generated

Specified by:
localPreStart in interface ISharedComponentControlHelper
Throws:
PogamutException

localPreStartPaused

public void localPreStartPaused(IAgentId agentId)
                         throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called before IStartingPausedEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.

You may need to prepare some stuff before starting event is generated.

Specified by:
localPreStartPaused in interface ISharedComponentControlHelper
Throws:
PogamutException

localPreStop

public void localPreStop(IAgentId agentId)
                  throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called before the IStoppingEvent of the component is broadcast into ILifecycleBus of the agent identified by 'agentId'.

You may need to pre-clean some stuff.

Specified by:
localPreStop in interface ISharedComponentControlHelper
Throws:
PogamutException

localReset

public void localReset(IAgentId agentId)
Description copied from interface: ISharedComponentControlHelper
Called whenever IResetEvent is caught at the ILifecycleBus of the agent identified by 'agentId'.

It should reinitialize data structures of the component so it can be usable by the given agent again.

Should throw an exception in case that the component can't be reseted for a given agent.

Specified by:
localReset in interface ISharedComponentControlHelper

localResume

public void localResume(IAgentId agentId)
                 throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Resumes the component for the agent identified by 'agentId'.

Called whenever IPausingEvent is caught from one of the dependencies of the given agent.

Specified by:
localResume in interface ISharedComponentControlHelper
Throws:
PogamutException

localStart

public void localStart(IAgentId agentId)
                throws PogamutException
Description copied from interface: ISharedComponentControlHelper
The component is being started inside the ILifecycleBus of the agent identified by 'agentId'. It should throw exception, if it can not start for the particular agent.

Specified by:
localStart in interface ISharedComponentControlHelper
Throws:
PogamutException

localStartPaused

public void localStartPaused(IAgentId agentId)
                      throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Starts the component for the agent identified by 'agentId' but it assumes that the component just prepares whatever data structures it needs / make connections / handshake whatever it needs with the environment / etc.

It should not let the agent to perform designers work (i.e., UT2004 bots should not start playing in the game).

After this call, the component should behave as it would have been paused with IComponentControlHelper.pause().

Specified by:
localStartPaused in interface ISharedComponentControlHelper
Throws:
PogamutException

localStop

public void localStop(IAgentId agentId)
               throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Stops the component for the agent identified by 'agentId'.

It should throw an exception if the component can't be stopped for the given agent.

Specified by:
localStop in interface ISharedComponentControlHelper
Throws:
PogamutException

kill

public void kill()
Description copied from interface: ISharedComponentControlHelper
Kills the component in ruthless way. It must be non-blocking method.

Called whenever IFatalErrorEvent is caught in any agent's bus.

Must not throw any exception whatsoever.

Similar to IComponentControlHelper.kill() (sort of a global version).

Specified by:
kill in interface IComponentControlHelper
Specified by:
kill in interface ISharedComponentControlHelper

pause

public void pause()
           throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Pauses the component. Called whenever there is no running dependencies and the rest is going to be paused or is paused.

Called whenever IPausingEvent is caught from one of the dependencies.

Similar to IComponentControlHelper.pause() (sort of a global version).

Specified by:
pause in interface IComponentControlHelper
Specified by:
pause in interface ISharedComponentControlHelper
Throws:
PogamutException

prePause

public void prePause()
              throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called whenever there is no running dependencies and the rest is going to be paused or is paused.

Similar to IComponentControlHelper.prePause() (sort of a global version).

NOTE: this method does not have much meaning for ISharedComponent as method ISharedComponentControlHelper.pause() is called right after ... nothing is taking place between these two calls.

Specified by:
prePause in interface IComponentControlHelper
Specified by:
prePause in interface ISharedComponentControlHelper
Throws:
PogamutException

preResume

public void preResume()
               throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called whenever some of paused dependencies is starting / is started.

Similar to IComponentControlHelper.preResume() (sort of a global version).

NOTE: this method does not have much meaning for ISharedComponent as method ISharedComponentControlHelper.resume() is called right after ... nothing is taking place between these two calls.

Specified by:
preResume in interface IComponentControlHelper
Specified by:
preResume in interface ISharedComponentControlHelper
Throws:
PogamutException

preStart

public void preStart()
              throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called whenever starting dependencies of some (first) agent becomes satisfied.

Similar to IComponentControlHelper.preStart() (sort of a global version).

This method or ISharedComponentControlHelper.preStartPaused() method is called prior to any localXXX() methods are called. Which means that you are always informed that your component should start before it "accepts" starts from respective agents.

NOTE: this method does not have much meaning for ISharedComponent as method ISharedComponentControlHelper.start() is called right after ... nothing is taking place between these two calls.

Specified by:
preStart in interface IComponentControlHelper
Specified by:
preStart in interface ISharedComponentControlHelper
Throws:
PogamutException

preStartPaused

public void preStartPaused()
                    throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called whenever starting dependencies of some (first) agent becomes satisfied, should start the component into paused state.

You may need to prepare some stuff before starting event is generated.

Similar to IComponentControlHelper.preStartPaused() (sort of a global version).

NOTE: this method does not have much meaning for ISharedComponent as method ISharedComponentControlHelper.startPaused() is called right after ... nothing is taking place between these two calls.

Specified by:
preStartPaused in interface IComponentControlHelper
Specified by:
preStartPaused in interface ISharedComponentControlHelper
Throws:
PogamutException

preStop

public void preStop()
             throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called whenever there is no running dependencies and the rest is going to be stopped.

Similar to IComponentControlHelper.preStop() (sort of a global version).

Specified by:
preStop in interface IComponentControlHelper
Specified by:
preStop in interface ISharedComponentControlHelper
Throws:
PogamutException

reset

public void reset()
           throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called whenever IResetEvent is caught in any of stopped bus. It should reinitialize data structures of the component so it can be started again.

Should throw an exception in case that the component can't be reseted.

Similar to IComponentControlHelper.reset() (sort of a global version).

Specified by:
reset in interface IComponentControlHelper
Specified by:
reset in interface ISharedComponentControlHelper
Throws:
PogamutException

resume

public void resume()
            throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Resumes the component. Called whenever some of paused dependencies is starting / is started.

Similar to IComponentControlHelper.resume() (sort of a global version).

Specified by:
resume in interface IComponentControlHelper
Specified by:
resume in interface ISharedComponentControlHelper
Throws:
PogamutException

start

public void start()
           throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Called to start the component whenever starting dependencies of some (first) agent becomes satisfied.

Similar to IComponentControlHelper.start() (sort of a global version).

This method or ISharedComponentControlHelper.startPaused() method is called prior to any localXXX() methods are called. Which means that you are always informed that your component should start before it "accepts" starts from respective agents.

Specified by:
start in interface IComponentControlHelper
Specified by:
start in interface ISharedComponentControlHelper
Throws:
PogamutException

startPaused

public void startPaused()
                 throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Starts the component whenever starting dependencies of some (first) agent becomes satisfied. But it assumes that the component just prepares whatever data structures it needs / make connections / handshake whatever it needs with the environment / etc.

Similar to IComponentControlHelper.startPaused() (sort of a global version).

Specified by:
startPaused in interface IComponentControlHelper
Specified by:
startPaused in interface ISharedComponentControlHelper
Throws:
PogamutException

stop

public void stop()
          throws PogamutException
Description copied from interface: ISharedComponentControlHelper
Stops the component. Called whenever there is no running dependencies and the rest is going to be stopped.

Similar to IComponentControlHelper.stop() (sort of a global version).

NOTE: this method does not have much meaning for ISharedComponent as method ISharedComponentControlHelper.stop() is called right after ... nothing is taking place between these two calls.

Specified by:
stop in interface IComponentControlHelper
Specified by:
stop in interface ISharedComponentControlHelper
Throws:
PogamutException