darx
Class ReplicationGroupInfo

java.lang.Object
  extended by darx.ReplicationGroupInfo
All Implemented Interfaces:
java.io.Serializable

public class ReplicationGroupInfo
extends java.lang.Object
implements java.io.Serializable

This object contains the information concerning a specific replication group handled by DARX. It provides the leader of the replication group, as well as the list of all the members.

See Also:
Serialized Form

Constructor Summary
ReplicationGroupInfo()
          Constructs an empty information container.
ReplicationGroupInfo(java.lang.String task_id, int leader_id, java.util.Hashtable member_list)
          Constructs an information container.
 
Method Summary
 void addLeader(ReplicantInfo new_leader)
           
 void addMember(ReplicantInfo new_member)
           
 boolean contains(ReplicantInfo rep_info)
          Checks whether the given replicant info belongs to the group.
 void displayReplicants()
          Displays the DARX path of every replicant in the group.
 ReplicantInfo getLeaderInfo()
           
 ReplicantInfo getLocatedMemberInfo(java.lang.String url, int port_nb)
          Returns information about a replica at a specific location.
 java.util.Enumeration getMembers()
           
 int getSize()
           
 java.lang.String getTaskName()
           
 void removeMember(ReplicantInfo doomed_member)
          Removes a member from the replication group information.
 ReplicantInfo selectNewLeader()
          Selects a new leader within the current replication group.
 void setLeader(int new_leader_id)
           
 void setLeader(ReplicantInfo new_leader)
           
 void setTaskName(java.lang.String new_task_name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationGroupInfo

public ReplicationGroupInfo()
Constructs an empty information container.


ReplicationGroupInfo

public ReplicationGroupInfo(java.lang.String task_id,
                            int leader_id,
                            java.util.Hashtable member_list)
Constructs an information container.

Method Detail

getTaskName

public java.lang.String getTaskName()
Returns:
the name of the task represented by the group

contains

public boolean contains(ReplicantInfo rep_info)
Checks whether the given replicant info belongs to the group.

Returns:
true if it does belong to the group, false otherwise

getLeaderInfo

public ReplicantInfo getLeaderInfo()
                            throws NoMoreReplicantsException
Returns:
the info concerning the current leader of the group
Throws:
NoMoreReplicantsException

getLocatedMemberInfo

public ReplicantInfo getLocatedMemberInfo(java.lang.String url,
                                          int port_nb)
                                   throws UnknownReplicantException
Returns information about a replica at a specific location.

Returns:
the info concerning a given replica within the group
Throws:
UnknownReplicantException

getMembers

public java.util.Enumeration getMembers()

getSize

public int getSize()

setTaskName

public void setTaskName(java.lang.String new_task_name)

setLeader

public void setLeader(int new_leader_id)

setLeader

public void setLeader(ReplicantInfo new_leader)
               throws UnknownReplicantException
Throws:
UnknownReplicantException

addMember

public void addMember(ReplicantInfo new_member)

addLeader

public void addLeader(ReplicantInfo new_leader)

removeMember

public void removeMember(ReplicantInfo doomed_member)
                  throws IllegalLeaderRemovalException,
                         NoMoreReplicantsException
Removes a member from the replication group information. Information on the leader cannot be removed unless it is the last replica in the group.

Parameters:
doomed_member - the info regarding the removed replica
Throws:
IllegalLeaderRemovalException
NoMoreReplicantsException

selectNewLeader

public ReplicantInfo selectNewLeader()
                              throws NoMoreReplicantsException
Selects a new leader within the current replication group. BEWARE: calling this method implies that the current leader is considered faulty; the previous leader will automatically be removed from the replication group.

Throws:
NoMoreReplicantsException

displayReplicants

public void displayReplicants()
Displays the DARX path of every replicant in the group.