bootstrapP
Class ManagedMessageServer

java.lang.Object
  extended by common.MessageServer
      extended by bootstrapP.ManagedMessageServer
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ManagedMessageServer>

public class ManagedMessageServer
extends MessageServer
implements java.lang.Comparable<ManagedMessageServer>

A representation of a Message Server managed by the Bootstrap server.

Author:
Marco Cornolti
See Also:
Serialized Form

Field Summary
private  int load
           
private  java.lang.String password
           
 SafeMSForBSInterface safeInt
           
private static long serialVersionUID
           
private  int UDPPort
           
 
Constructor Summary
ManagedMessageServer(java.net.InetAddress ip, int RMIPort, int UDPPort, java.lang.String password)
           
 
Method Summary
 int compareTo(ManagedMessageServer ms)
          Compares the load of two message servers
 boolean equals(ManagedMessageServer ms)
          Checks if a message server is equal to another, witch means that it tests the RMI ports, UDP ports, IP addresses.
 int getLoad()
           
 java.lang.String getPw()
           
 int getRMIPort()
           
 int getUDPPort()
           
 void refreshLoad(java.lang.String dataS)
          Calculate and sets the load of a server from a received string.
 
Methods inherited from class common.MessageServer
equals, getIP, getPort
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

load

private int load

UDPPort

private int UDPPort

password

private java.lang.String password

safeInt

public SafeMSForBSInterface safeInt
Constructor Detail

ManagedMessageServer

public ManagedMessageServer(java.net.InetAddress ip,
                            int RMIPort,
                            int UDPPort,
                            java.lang.String password)
                     throws java.rmi.RemoteException
Parameters:
ip - the MS IP address
RMIPort - the MS RMI port.
UDPPort - the MS UDP port.
password - the MS password.
Throws:
java.rmi.RemoteException - if the server could not be reached.
Method Detail

getPw

public java.lang.String getPw()
Returns:
the MS password.

getUDPPort

public int getUDPPort()
Returns:
the MS UDP port.

getRMIPort

public int getRMIPort()
Returns:
the MS RMI port

getLoad

public int getLoad()
Returns:
the current MS load (higher values mean higher load).

refreshLoad

public void refreshLoad(java.lang.String dataS)
Calculate and sets the load of a server from a received string.

Parameters:
dataS - the string containing the data of the server load.

compareTo

public int compareTo(ManagedMessageServer ms)
Compares the load of two message servers

Specified by:
compareTo in interface java.lang.Comparable<ManagedMessageServer>
Parameters:
ms - the managed message server to compare to.
Returns:
>0 if this server is more loaded than the given one, 0 if the servers' loads are the same, <0 otherwise.

equals

public boolean equals(ManagedMessageServer ms)
Checks if a message server is equal to another, witch means that it tests the RMI ports, UDP ports, IP addresses.

Parameters:
ms - the ms to check this one againts.
Returns:
true if the two message servers are the same.