messageServerP
Class MyselfMessageServer
java.lang.Object
common.MessageServer
messageServerP.MyselfMessageServer
- All Implemented Interfaces:
- java.io.Serializable
public class MyselfMessageServer
- extends MessageServer
A self-representation of a message server.
- Author:
- Marco Cornolti
- See Also:
- Serialized Form
Constructor Summary |
private |
MyselfMessageServer(java.net.InetAddress ip,
int port,
java.lang.String password)
private constructor to not let anyone create two MyselfMessageServers |
Method Summary |
boolean |
checkPassword(java.lang.String pw)
|
static MyselfMessageServer |
makeMyselfMessageServer(java.net.InetAddress ip,
int port,
java.lang.String password)
A constructor that works just once, to avoid creating two MyselfMessageServers. |
static boolean |
setPassword(java.lang.String oldPw,
java.lang.String newPw)
change the administration password |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
password
private java.lang.String password
created
private static boolean created
myself
public static MyselfMessageServer myself
MyselfMessageServer
private MyselfMessageServer(java.net.InetAddress ip,
int port,
java.lang.String password)
- private constructor to not let anyone create two MyselfMessageServers
- Parameters:
ip
- the ip addressport
- the service portpassword
- the administration password
checkPassword
public boolean checkPassword(java.lang.String pw)
- Parameters:
pw
- the password to check
- Returns:
- true if and only if the given password is right
setPassword
public static boolean setPassword(java.lang.String oldPw,
java.lang.String newPw)
- change the administration password
- Parameters:
oldPw
- the old passwordnewPw
- the new password
- Returns:
- true if the password has been changed, false if the given old password was not right
makeMyselfMessageServer
public static MyselfMessageServer makeMyselfMessageServer(java.net.InetAddress ip,
int port,
java.lang.String password)
- A constructor that works just once, to avoid creating two MyselfMessageServers.
- Parameters:
ip
- the ip addressport
- the service portpassword
- the administration password
- Returns:
- the new MyselfMessageServer if not yet created, null otherwise.