aa.core
Class ActorManager

java.lang.Object
  extended byaa.core.ActorManager

public class ActorManager
extends java.lang.Object

This class represents Actor Manager to handle the state information about actors that are working or created on this platform.

History:

Version:
$Date: 2008/01/01 00:23:48 $ $Revision: 1.1 $
Author:
Myeong-Wuk Jang

Field Summary
static java.lang.Integer ACTIVE
          An actor state to indicate that an actor is working, and hence it can receive and process a message.
static int IDX_AGENT
          Index for the actor field in the actor infromation array.
static int IDX_AN
          Index for the actor name field in the actor infromation array.
static int IDX_LOC
          Index for the actor location field in the actor infromation array.
static int IDX_STATE
          Index for the actor state field in the actor infromation array.
static java.lang.Integer IN_TRANSIT
          An actor state to indicate that an actor is moving from one platform to another.
private  DelayedMessageManager m_dmmDelayedMessageManager
           
private  MigrationManager m_mmMigrationManager
           
private  Platform m_pPlatform
           
private  java.lang.String m_strHostAddress
           
private static java.lang.String[] m_strState
          String names about actor states.
private  java.util.TreeMap m_tmActors
           
private  java.util.TreeMap m_tmMobileActors
           
private  View m_viewMain
           
static java.lang.Integer SUSPENDED
          An actor state to indicate that an actor is suspended by the platform.
static java.lang.Integer TRANSIT
          An actor state to indicate that an actor moved to another platform.
static java.lang.Integer UNKNOWN
          An actor state to indicate that the state of an actor is unknown.
 
Constructor Summary
ActorManager(Platform p_platform, View p_viewMain)
          Creates an Actor Manager.
 
Method Summary
protected  void changeToActor(ActorThread p_athread, java.lang.Integer p_intState)
          Deregisters the specified actor form the mobile actor list, and registers an actor into the working actors list.
protected  void changeToMobileActor(ActorName p_anActor, java.net.InetAddress p_iaDestHost)
          Deregisters the specified actor form the working actor list, and registers an actor into the mobile actors list.
protected  java.lang.Object[] deregisterActor(ActorName p_anActor)
          Deregisters the specified actor from this platform.
protected  java.lang.Object[] deregisterMobileActor(ActorName p_anActor)
          Deregisters a mobile actor.
protected  java.lang.Object[] getActor(ActorName p_anActor)
          Returns information about the actor with the given actor name.
 java.lang.String[][] getActorData(ActorName p_anActor)
          Returns information about the actor specifiey its actor name.
protected  java.lang.Object[] getActorInfo(ActorName p_anActor)
          Returns information about the actor with the given actor name.
 java.lang.Integer getActorState(ActorName p_anActor)
          Returns the state of the specified actor.
protected  ActorThread getActorThread(ActorName p_anActor)
          Returns the reference to the actor with the given actor name.
 java.lang.String[][] getAllActorData()
          Returns information about the actors registered.
protected  java.lang.String getMobileActorLocation(ActorName p_anActor)
          Returns the reference to the mobile actor with the given actor name.
protected  java.lang.Integer getMobileActorState(ActorName p_anActor)
          Returns the state of the specified mobile actor.
 void killActor(ActorName p_anActor)
          Tries to kill an actor.
protected  void registerActor(ActorThread p_athread, java.lang.Integer p_intState)
          Registers a new actor into this actor platform.
protected  void registerMobileActor(ActorName p_anActor, java.net.InetAddress p_iaDestHost)
          Registers an actor into the mobile actors list.
protected  void removeActor(ActorName p_anActor)
          Removes information about the specified actor from the actor list.
 void resumeActor(ActorName p_anActor)
          Resumes the specified actor.
protected  void setMigrationManager(MigrationManager p_mmMigrationManager)
          Sets the reference of a Migration Manager.
protected  void setMobileActorState(ActorName p_anActor, java.lang.Integer pintNewState, java.lang.String p_strHostAddress)
          Changes the state of a mobile actor with the new state.
 void suspendActor(ActorName p_anActor)
          Suspends the specified actor.
protected  void uninit()
          Uninitializes this program.
protected  void updateActor(ActorThread p_athread, java.lang.Integer p_intState)
          Updates the old reference to an actor with new one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final java.lang.Integer UNKNOWN
An actor state to indicate that the state of an actor is unknown.


ACTIVE

public static final java.lang.Integer ACTIVE
An actor state to indicate that an actor is working, and hence it can receive and process a message.


SUSPENDED

public static final java.lang.Integer SUSPENDED
An actor state to indicate that an actor is suspended by the platform. Therefore, even though an actor receives a message, the actor cannot process the message.


IN_TRANSIT

public static final java.lang.Integer IN_TRANSIT
An actor state to indicate that an actor is moving from one platform to another. During actor migration, the actor cannot receive a message.


TRANSIT

public static final java.lang.Integer TRANSIT
An actor state to indicate that an actor moved to another platform. The current platform is different from the platform where the actor was created.


IDX_STATE

public static final int IDX_STATE
Index for the actor state field in the actor infromation array.

See Also:
Constant Field Values

IDX_AGENT

public static final int IDX_AGENT
Index for the actor field in the actor infromation array.

See Also:
Constant Field Values

IDX_AN

public static final int IDX_AN
Index for the actor name field in the actor infromation array.

See Also:
Constant Field Values

IDX_LOC

public static final int IDX_LOC
Index for the actor location field in the actor infromation array.

See Also:
Constant Field Values

m_strState

private static final java.lang.String[] m_strState
String names about actor states.


m_tmActors

private java.util.TreeMap m_tmActors

m_tmMobileActors

private java.util.TreeMap m_tmMobileActors

m_pPlatform

private Platform m_pPlatform

m_viewMain

private View m_viewMain

m_mmMigrationManager

private MigrationManager m_mmMigrationManager

m_dmmDelayedMessageManager

private DelayedMessageManager m_dmmDelayedMessageManager

m_strHostAddress

private java.lang.String m_strHostAddress
Constructor Detail

ActorManager

public ActorManager(Platform p_platform,
                    View p_viewMain)
Creates an Actor Manager.

Parameters:
p_platform - the reference to this platform.
p_viewMain - the reference to View.
Method Detail

setMigrationManager

protected void setMigrationManager(MigrationManager p_mmMigrationManager)
Sets the reference of a Migration Manager.

Parameters:
p_mmMigrationManager - the reference to a Migration Manager.

uninit

protected void uninit()
Uninitializes this program.
This method is called by the Platform.


registerActor

protected void registerActor(ActorThread p_athread,
                             java.lang.Integer p_intState)
Registers a new actor into this actor platform.

Parameters:
p_athread - the reference to the specified actor.
p_intState - an initial state of the actor.

updateActor

protected void updateActor(ActorThread p_athread,
                           java.lang.Integer p_intState)
Updates the old reference to an actor with new one.

Parameters:
p_athread - the reference to an actor thread.
p_intState - a new state of the actor.

deregisterActor

protected java.lang.Object[] deregisterActor(ActorName p_anActor)
Deregisters the specified actor from this platform.
This method is (should be) called by a Migration Manager or the 'removeActor' method.

Parameters:
p_anActor - the name of the selected actor.

removeActor

protected void removeActor(ActorName p_anActor)
Removes information about the specified actor from the actor list.
This method is (should be) called by this Platform.

Parameters:
p_anActor - the name of an actor.

getActorThread

protected ActorThread getActorThread(ActorName p_anActor)
Returns the reference to the actor with the given actor name.

Parameters:
p_anActor - the name of an actor.
Returns:
the pointer to the actor with the given actor name.

getActor

protected java.lang.Object[] getActor(ActorName p_anActor)
Returns information about the actor with the given actor name.

Parameters:
p_anActor - the name of an actor.
Returns:
information about the actor with the given actor name.

getActorState

public java.lang.Integer getActorState(ActorName p_anActor)
Returns the state of the specified actor.
This method is called the 'View' class.

Parameters:
p_anActor - the name of an actor.
Returns:
the state of the specified actor.

getActorData

public java.lang.String[][] getActorData(ActorName p_anActor)
Returns information about the actor specifiey its actor name.
This method is called by the 'View' class.

Parameters:
p_anActor - the name of an actor.
Returns:
infomation about the actor specified its actor name.

getAllActorData

public java.lang.String[][] getAllActorData()
Returns information about the actors registered.
This method is called by the 'View' class.

Returns:
infomation about the actors registered.

suspendActor

public void suspendActor(ActorName p_anActor)
Suspends the specified actor.
This method must be called by the 'View' class.

Parameters:
p_anActor - the name of the selected actor.

resumeActor

public void resumeActor(ActorName p_anActor)
Resumes the specified actor.
This method must be called by the 'View' class.

Parameters:
p_anActor - the name of the selected actor.

killActor

public void killActor(ActorName p_anActor)
Tries to kill an actor.
This method must be called by the 'View' class.

Parameters:
p_anActor - the name of the selected actor.

getActorInfo

protected java.lang.Object[] getActorInfo(ActorName p_anActor)
Returns information about the actor with the given actor name.

Parameters:
p_anActor - the name of an actor.
Returns:
information about the actor with the given actor name.

changeToMobileActor

protected void changeToMobileActor(ActorName p_anActor,
                                   java.net.InetAddress p_iaDestHost)
Deregisters the specified actor form the working actor list, and registers an actor into the mobile actors list.
This method is called by a Migration Manager.

Parameters:
p_anActor - the name of a mobile actor.
p_iaDestHost - the Inernet address of the destination host.

changeToActor

protected void changeToActor(ActorThread p_athread,
                             java.lang.Integer p_intState)
Deregisters the specified actor form the mobile actor list, and registers an actor into the working actors list.
This method is called by a Migration Manager.

Parameters:
p_athread - the reference to the specified actor.
p_intState - an initial state of the actor.

registerMobileActor

protected void registerMobileActor(ActorName p_anActor,
                                   java.net.InetAddress p_iaDestHost)
Registers an actor into the mobile actors list.
This method is called by a Migration Manager.

Parameters:
p_anActor - the name of a mobile actor.
p_iaDestHost - the Inernet address of the destination host.

deregisterMobileActor

protected java.lang.Object[] deregisterMobileActor(ActorName p_anActor)
Deregisters a mobile actor.
This method is (should be) called by Platform.

Parameters:
p_anActor - the name of a mobile actor.

setMobileActorState

protected void setMobileActorState(ActorName p_anActor,
                                   java.lang.Integer pintNewState,
                                   java.lang.String p_strHostAddress)
Changes the state of a mobile actor with the new state.

Parameters:
p_anActor - the name of a mobile actor.
pintNewState - a new state of the actor.
p_strHostAddress - the host address of the destination platform.

getMobileActorState

protected java.lang.Integer getMobileActorState(ActorName p_anActor)
Returns the state of the specified mobile actor.

Parameters:
p_anActor - the name of a mobile actor.
Returns:
the state of the specified mobile actor.

getMobileActorLocation

protected java.lang.String getMobileActorLocation(ActorName p_anActor)
Returns the reference to the mobile actor with the given actor name.

Parameters:
p_anActor - the name of a mobile actor.
Returns:
the reference to the mobile actor with the given actor name.