|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--PaP.Actor | +--PaP.ApplicationActor | +--Chat.v1_1.ChatClient
A ChatClient is an Actor that can connect to and disconnect from a ChatServer.
Each ChatClient has an instance of ChatClientWindow which is the Graphical
User Interface (GUI). A ChatClient connects to a ChatServer by sending a
RoleFigurePlugIn request to the Director. He then creates a RoleSession
between the ChatClient and the specified ChatServer. Once a RoleSession is
created the ChatClient can send ApplicationMessages of one of the predefined
types to the ChatServer.
Each ChatClient has a username used by the user. This can be set through the
GUI. chatServerGAI is the GAI of the ChatServer this ChatClient last connected
to. Both the usernam and the chatServerGAI is stored in the actor's state when
he is suspended.
Inner Class Summary | |
class |
ChatClient.CloseWindowThread
This thread is started when an ActorPlugOut request is received. |
Field Summary | |
private java.lang.String |
CHAT_MESSAGE
Used when a ChatClient wants to send a message to the ChatServer. |
private java.lang.String |
chatServerGAI
The GAI of the last used ChatServer |
private RoleSession |
chatServerRoleSession
RoleSession to the ChatServer. |
private java.lang.String |
CONNECT_USER
Used when a ChatClient wants to connect to a ChatServer. |
private java.lang.String |
DISCONNECT_USER
Used when a ChatClient wants to disconnect to a ChatServer. |
private java.lang.String |
GET_USERLIST
Used when a ChatClient wants a list of all the ChatClients currently connected to the ChatServer. |
private boolean |
initiated
Indicates wether initial ActorPlugIn has been performed or not |
private java.lang.String |
username
The username of this ChatClient. |
private ChatClientWindow |
window
Reference to the GUI. |
Fields inherited from class PaP.Actor |
bf, context, fh |
Constructor Summary | |
ChatClient()
Creates a new ChatClient. |
Method Summary | |
RequestResult |
applicationActorEntry(RequestPars rpars)
This method is the common entry point for all external requests to this actor. |
void |
closeApplication()
This method is used by the ChatClientWindow to notify that the user wants to close the application. |
void |
connect(java.lang.String serverGAI)
Sends a RoleFigurePlugIn request to the Director to plugin a RoleSession between this ChatClient and the specified ChatServer. |
private void |
dbg(java.lang.String dbg)
Sends debug information to this actor's BaseFrame window, which is an interactive debug client window for several entities. |
void |
disconnect()
Sends a request to the ChatServer to disconnect this ChatClient from the ChatServer. |
java.lang.String |
getChatServerGAI()
Returns the value of ChatServerGAI which is the GAI of the last ChatServer this ChatClient connected to. |
void |
getUserlist()
Sends the a request to the ChatServer for a list of all the ChatClients currently connected to the ChatServer. |
java.lang.String |
getUsername()
Returns the username. |
void |
sendMessage(java.lang.String message)
Sends the specified message to the ChatServer as a RoleSessionAction request of type CHAT_MESSAGE. |
void |
setChatServerGAI(java.lang.String gai)
Sets the value of chatServerGAI which is the GAI of the last ChatServer this ChatClient connected to. |
void |
setUsername(java.lang.String newUsername)
Sets the username that the user will use to logg into a ChatServer. |
Methods inherited from class PaP.Actor |
findRoleSession, getGAI, start, status, term |
Methods inherited from class java.lang.Object |
|
Field Detail |
private final java.lang.String CHAT_MESSAGE
private final java.lang.String CONNECT_USER
private final java.lang.String DISCONNECT_USER
private final java.lang.String GET_USERLIST
private ChatClientWindow window
private RoleSession chatServerRoleSession
private java.lang.String username
private java.lang.String chatServerGAI
private boolean initiated
Constructor Detail |
public ChatClient()
Method Detail |
public RequestResult applicationActorEntry(RequestPars rpars) throws java.lang.Exception
applicationActorEntry
in class ApplicationActor
rpars
- Instance of RequestPars which specifies type of request and
additional parametres to the request.java.lang.Exception
- public void closeApplication()
public void connect(java.lang.String serverGAI) throws java.lang.Exception
serverGAI
- String form of the ChatServer's GAI.java.lang.Exception
- if something goes wrong.public void disconnect() throws java.lang.Exception
java.lang.Exception
- if something goes wrong.public java.lang.String getChatServerGAI()
public void getUserlist() throws java.lang.Exception
java.lang.Exception
- if something goes wrong.public java.lang.String getUsername()
public void sendMessage(java.lang.String message) throws java.lang.Exception
message
- The message to be sent.java.lang.Exception
- if something goes wrong.public void setChatServerGAI(java.lang.String gai)
gai
- The new chatServerGAI.public void setUsername(java.lang.String newUsername)
newUsername
- The new username.private void dbg(java.lang.String dbg)
dbg
in class ApplicationActor
dbg
- The debug information to be sent.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |