repserver
Class RepGroup

java.lang.Object
  |
  +--repserver.RepGroup
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class RepGroup
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class represents a Replicant Group A replicant group consists of a list of RepAgentIDs, the latest serialized state, a pointer to an active agent, and a message proxy (RepProxy).

See Also:
Serialized Form

Constructor Summary
RepGroup()
          Constructs a blank RepGroup.
RepGroup(java.lang.String platform, java.lang.String n, java.lang.String type)
          Constructs a RepGroup with the given name
 
Method Summary
 void addAgent(RepAgentID aid)
          Add an agent to this replicant group.
 int countReps()
          return the number of replicants in this replicant group
 void delAgent(RepAgentID aid)
          Delete an agent from this replicant group.
 RepAgentID getActive()
          get the Active Agent
 RepAgentID[] getAgents()
          Return an array of the agents in this group.
 java.lang.String getName()
          Returns the name of this repgroup
 boolean getPing(RepAgentID raid)
          Return the ping flag for the given agent.
 RepProxy getProxy()
          Get the message proxy
 fipaos.ont.fipa.fipaman.AgentID getProxyAID()
          Get the agentID of the mail proxy
 java.lang.String getReplicationType()
           
 byte[] getState()
          return the most recent value of the _state vector
 java.util.Date getUpdateTime(RepAgentID raid)
          get the updatetime for the given agent.
 void removeDead()
          remove any dead agents from the rep group.
 boolean setActive()
          Set the active agent to be the first agent found alive Return true if one is found, false otherwise.
 boolean setActive(RepAgentID aid)
          Set the active agent to be the agent named by aid.
 void setName(java.lang.String name)
          Sets the name of this RepGroup
 void setPing(RepAgentID raid, boolean val)
          Set the ping flag for the given agent.
 void setReplicationType(java.lang.String reptype)
           
 void setState(byte[] state)
          add the state to the stack.
 void setUpdateTime(RepAgentID raid, java.util.Date d)
          set the updatetime for the given agent.
 java.lang.String toString()
          convert this repgroup to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RepGroup

public RepGroup()
Constructs a blank RepGroup.

RepGroup

public RepGroup(java.lang.String platform,
                java.lang.String n,
                java.lang.String type)
Constructs a RepGroup with the given name
Parameters:
n - string name to name this repgroup
Method Detail

setReplicationType

public void setReplicationType(java.lang.String reptype)

getReplicationType

public java.lang.String getReplicationType()

setName

public void setName(java.lang.String name)
Sets the name of this RepGroup
Parameters:
name - The name to set

getName

public java.lang.String getName()
Returns the name of this repgroup

addAgent

public void addAgent(RepAgentID aid)
Add an agent to this replicant group.
Parameters:
aid - - the agent to add

delAgent

public void delAgent(RepAgentID aid)
Delete an agent from this replicant group.
Parameters:
aid - - the agent to delete

getActive

public RepAgentID getActive()
get the Active Agent

setActive

public boolean setActive()
Set the active agent to be the first agent found alive Return true if one is found, false otherwise.

setActive

public boolean setActive(RepAgentID aid)
Set the active agent to be the agent named by aid. Return true if aid is found and is alive, false otherwise.

getProxy

public RepProxy getProxy()
Get the message proxy

getProxyAID

public fipaos.ont.fipa.fipaman.AgentID getProxyAID()
Get the agentID of the mail proxy

toString

public java.lang.String toString()
convert this repgroup to a string.
Overrides:
toString in class java.lang.Object

getAgents

public RepAgentID[] getAgents()
Return an array of the agents in this group.

setPing

public void setPing(RepAgentID raid,
                    boolean val)
Set the ping flag for the given agent.
Parameters:
raid - the agent in question.
val - what to set the flag to.

getPing

public boolean getPing(RepAgentID raid)
Return the ping flag for the given agent.
Parameters:
raid - the agent in question.

setState

public void setState(byte[] state)
add the state to the stack.
Parameters:
state - a byte stream containing the agent state

getState

public byte[] getState()
return the most recent value of the _state vector

countReps

public int countReps()
return the number of replicants in this replicant group

setUpdateTime

public void setUpdateTime(RepAgentID raid,
                          java.util.Date d)
set the updatetime for the given agent.

getUpdateTime

public java.util.Date getUpdateTime(RepAgentID raid)
get the updatetime for the given agent.

removeDead

public void removeDead()
remove any dead agents from the rep group.