|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--arlut.csd.ganymede.client.ClientBase
The core of a client. Provides all the logic necessary to establish a connection to the server and get logged in. By using this class, the server will only need an RMI stub for this class, regardless of what client is written.
| Field Summary | |
private boolean |
connected
|
private static boolean |
debug
|
private java.util.Vector |
listeners
|
private java.lang.String |
loginRefuseMessage
|
private java.lang.String |
password
|
private Server |
server
RMI reference to a Ganymede server |
private Session |
session
RMI reference to a client session on a Ganymede server |
private java.lang.String |
username
|
private XMLSession |
xSession
RMI reference to a client XMLSession on a Ganymede server |
| Fields inherited from class java.rmi.server.UnicastRemoteObject |
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf |
| Fields inherited from class java.rmi.server.RemoteServer |
log, logname |
| Fields inherited from class java.rmi.server.RemoteObject |
ref |
| Constructor Summary | |
ClientBase(java.lang.String serverURL,
ClientListener listener)
This constructor takes a URL for the Ganymede server to connect to, a reference to an object implementing the ClientListener interface to report problems. |
|
| Method Summary | |
void |
addClientListener(ClientListener l)
Register a client listener. |
void |
disconnect()
Calls the logout() method on the Session object. |
void |
forceDisconnect(java.lang.String reason)
Allows the server to force us off when it goes down. |
java.lang.String |
getName()
Allows the server to retrieve the username. |
java.lang.String |
getPassword()
Allows the server to retrieve the password. |
Session |
getSession()
This method can be used to retrieve a handle to the client's login session. |
XMLSession |
getXSession()
This method can be used to retrieve a handle to the client's login session. |
boolean |
isConnected()
This method returns true if the client holds a valid reference to the server. |
boolean |
isLoggedIn()
This method returns true if the client has already logged in. |
Session |
login(java.lang.String username,
java.lang.String password)
This method is used by a client to actually get logged into the server. |
void |
removeClientListener(ClientListener l)
Remove a client listener. |
private void |
sendErrorMessage(java.lang.String message)
Private method to inform clientListeners if we get an error from the server after construction.. |
void |
sendMessage(int messageType,
java.lang.String status)
Allows the server to send an asynchronous message to the client.. |
XMLSession |
xmlLogin(java.lang.String username,
java.lang.String password)
This method is used by a client to actually get logged into the server. |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
|
| Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub, writeObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
| Field Detail |
private static final boolean debug
private Server server
private Session session
private XMLSession xSession
private java.lang.String username
private java.lang.String password
private boolean connected
private java.util.Vector listeners
private java.lang.String loginRefuseMessage
| Constructor Detail |
public ClientBase(java.lang.String serverURL,
ClientListener listener)
throws java.rmi.RemoteException
This constructor takes a URL for the Ganymede server to connect to, a reference to an object implementing the ClientListener interface to report problems. The constructor will establish an initial connection to the server and prepare itself for subsequent login before returning.
serverURL - An rmi:// URL for a Ganymede server.listener - A ClientListener to report problems and disconnection to.| Method Detail |
public Session login(java.lang.String username,
java.lang.String password)
throws java.rmi.RemoteException
This method is used by a client to actually get logged into the
server. The Session handle
returned is then used to do all server operations appropriate
for a normal client. Calling the Session logout() method will
end the client's connection to the server.
Session
public XMLSession xmlLogin(java.lang.String username,
java.lang.String password)
throws java.rmi.RemoteException
This method is used by a client to actually get logged into the
server. The Session handle
returned is then used to do all server operations appropriate
for a normal client. Calling the Session logout() method will
end the client's connection to the server.
Sessionpublic boolean isLoggedIn()
public Session getSession()
This method can be used to retrieve a handle to the client's login session. This simply returns the same handle that login() returned, in case the client forgets it or something.
public XMLSession getXSession()
This method can be used to retrieve a handle to the client's login session. This simply returns the same handle that login() returned, in case the client forgets it or something.
public boolean isConnected()
This method returns true if the client holds a valid reference to the server. This will always return true unless the server has forced a disconnect.
public void addClientListener(ClientListener l)
Register a client listener. A client listener is an object that is to be notified if we get an asynchronous callback from the Ganymede server, such as a forced log-off, or if we need to report an error during login.
public void removeClientListener(ClientListener l)
Remove a client listener.
public void disconnect()
throws java.rmi.RemoteException
Calls the logout() method on the Session object. This could be done by the client using the Session reference returned by the login() method, but using this method allows us to reflect login status internally.
public java.lang.String getName()
Allows the server to retrieve the username.
getName in interface ClientClientpublic java.lang.String getPassword()
Allows the server to retrieve the password.
getPassword in interface ClientClientpublic void forceDisconnect(java.lang.String reason)
Allows the server to force us off when it goes down.
forceDisconnect in interface ClientClient
public void sendMessage(int messageType,
java.lang.String status)
Allows the server to send an asynchronous message to the client.. Used by the server to tell the client when a build is/is not being performed on the server.
sendMessage in interface ClientClientprivate void sendErrorMessage(java.lang.String message)
Private method to inform clientListeners if we get an error from the server after construction..
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||