public class PasswordClient extends java.lang.Object implements ClientListener
The core of a user password changing applet / application, whether command line or GUI.
This class can be invoked from the command line to act as an interactive CLI password change client.
| Modifier and Type | Field and Description |
|---|---|
(package private) ClientBase |
client
A ClientBase object forms the core of any Ganymede
client.
|
(package private) static boolean |
debug |
(package private) static TranslationService |
ts
TranslationService object for handling string localization in
the Ganymede server.
|
private static java.lang.String |
url
URL of the Ganymede server's RMI port to connect to.
|
| Constructor and Description |
|---|
PasswordClient(java.lang.String serverURL) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changePassword(java.lang.String username,
java.lang.String oldPassword,
java.lang.String newPassword)
This method actually does the work of logging into the server,
changing the password, committing the transaction, and
disconnecting.
|
void |
disconnected(ClientEvent e)
Called when the server forces a disconnect.
|
void |
error(java.lang.String message)
Send output to this.
|
private static boolean |
loadProperties(java.lang.String filename)
Load the properties file that we use to identify the Ganymede
server and port for the command line client.
|
static void |
main(java.lang.String[] argv)
If this class is run from the command line, it will act as a
text-mode password client.
|
void |
messageReceived(ClientEvent e)
Called when the ClientBase needs to report something to the
client.
|
static final boolean debug
static final TranslationService ts
private static java.lang.String url
ClientBase client
A ClientBase object forms the core of any Ganymede client. It does the work to get us connected and logged into the server, and serves as a reference point for the server to talk to if something unusual happens.
public PasswordClient(java.lang.String serverURL)
throws java.rmi.RemoteException
java.rmi.RemoteExceptionpublic boolean changePassword(java.lang.String username,
java.lang.String oldPassword,
java.lang.String newPassword)
This method actually does the work of logging into the server, changing the password, committing the transaction, and disconnecting.
There are three basic steps involved in changing the password. First, the client must log on to the system, getting a handle on the Session object. Next, we get a handle on the password field of the user object, and change the value. Finally, we commit the transaction.
public void error(java.lang.String message)
Send output to this.
This just prints out the message, but could be directed to a dialog or something later.
public void disconnected(ClientEvent e)
Called when the server forces a disconnect.
Call getMessage() on the ClientEvent to get the reason for the disconnect.
disconnected in interface ClientListenerClientListener,
ClientEventpublic void messageReceived(ClientEvent e)
Called when the ClientBase needs to report something to the client. The client is expected to then put up a dialog or do whatever else is appropriate.
Call getMessage() on the ClientEvent to get the message.
messageReceived in interface ClientListenerClientListener,
ClientEventpublic static void main(java.lang.String[] argv)
If this class is run from the command line, it will act as a text-mode password client.
private static boolean loadProperties(java.lang.String filename)
Load the properties file that we use to identify the Ganymede server and port for the command line client.