|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.kosi.chat.ChatChannelImpl
This class implements a chat channel.
ChangeLog:
$Log: ChatChannelImpl.java,v $ Revision 1.4 2001/08/30 12:03:04 jiriki Fixed Bug 440380 Revision 1.3 2001/06/04 14:21:10 jiriki Made source more comliant to coding guidelines. Revision 1.2 2001/05/22 10:16:02 jiriki - Removed old unused Client class - Removed unused import statements. Revision 1.1.1.1 2001/04/29 18:05:16 jiriki Imported sources from zola. Revision 1.19 2001/04/11 18:08:14 wombat Client can now write into the table chat. Revision 1.18 2001/04/11 16:54:04 wombat Removed some bugs when joining table and immidiatly leaving again. Revision 1.17 2001/04/09 13:03:10 wombat Removed timeout from threadpool (did not work) Revision 1.16 2001/03/20 18:17:31 wombat Added logging support Revision 1.15 2001/02/25 23:16:05 wombat - deadlock vermeidung umgestellt. - ListenerList erstellt Revision 1.14 2001/02/09 21:21:18 login completed docs for de.kosi.chat Revision 1.13 2001/02/09 19:23:20 login Updated the javadocs. Revision 1.12 2001/02/06 15:04:36 wombat Updated documentation
Field Summary | |
static java.lang.Boolean |
DEFAULT
Constant indicating default access to the chat channel. |
static java.lang.Boolean |
READ_ONLY
Constant indicating read only access to the chat channel. |
static java.lang.Boolean |
READ_WRITE
Constant indicating read/write access to the chat channel. |
Fields inherited from interface de.kosi.chat.ChatChannel |
ACTION, SAY |
Constructor Summary | |
ChatChannelImpl(java.lang.Boolean defaultPermission)
Creates a new ChatChannelImpl instance with the given default read/write permissions. |
Method Summary | |
void |
addChatListener(ChatListener listener)
Implements the methode inherited from ChatChannel. |
void |
close()
Closes this chat channel instance. |
void |
destroyed(UserImpl user)
Called when a UserImpl Object is about to be destroyed. |
protected void |
fireChatEvent(ChatEvent event)
Sends a chat event to all registered listeners. |
java.lang.String[] |
getUserNames()
Returns an array that contains the login names of all users that are currently on this chat channel. |
void |
onlineChange(UserImpl user,
boolean isOnline)
This method is called when the online status of the user changes. |
void |
removeChatListener(ChatListener listener,
java.lang.String reason)
Removes the given ChatListener off the listener list. |
void |
removeUser(UserImpl user,
java.lang.String reason)
Remove a user from the chat. |
void |
sendMessage(java.lang.String msg,
int type)
Sends a message to the chat channel. |
void |
setUserPermission(UserImpl user,
java.lang.Boolean permission)
Sets the permission of the given user to read only respectively read/write. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.Boolean READ_ONLY
public static final java.lang.Boolean READ_WRITE
public static final java.lang.Boolean DEFAULT
Constructor Detail |
public ChatChannelImpl(java.lang.Boolean defaultPermission) throws java.rmi.RemoteException
defaultPermission
- The default permission. If a user joins
this channel, his read/write permission will be set to the value
of this argument.java.rmi.RemoteException
- If RMI detects an error.Method Detail |
public void setUserPermission(UserImpl user, java.lang.Boolean permission)
user
- The user whos permission is to be changed.permission
- The new permission. Must be one of the values
of the constants READ_ONLY or READ_WRITE.public void close() throws java.rmi.RemoteException
java.rmi.RemoteException
- If RMI runs into trouble.public java.lang.String[] getUserNames()
getUserNames
in interface ChatChannel
public void addChatListener(ChatListener listener) throws java.rmi.RemoteException, InvalidSessionException
addChatListener
in interface ChatChannel
listener
- The ChatListener that is to be added.java.rmi.RemoteException
- If there was something amiss about
RMI.InvalidSessionException
- ???public void removeChatListener(ChatListener listener, java.lang.String reason)
removeChatListener
in interface ChatChannel
listener
- The listener that is to be removed.reason
- The reason for leaving the channel.public void removeUser(UserImpl user, java.lang.String reason)
user
- User to remove.reason
- Reason for the removal.public void sendMessage(java.lang.String msg, int type) throws java.rmi.RemoteException, ChatException, InvalidSessionException
sendMessage
in interface ChatChannel
msg
- The message that is sent by the client.type
- The message type. This should be one of the constants
ChatChannel.ACTION and ChatChannel.SAY. If an ACTION message is
sent the client should display it in a way that indicates that
the user who sent the message "did" it. If a SAY message is sent
the client should display it in a way that indicates that the
user "said" it.java.rmi.RemoteException
- If RMI doesn't get along.ChatException
- If the user either didn't join the
channel before sending a message or isn't permitted to send
anything.InvalidSessionException
- If the session was invalid?!?protected void fireChatEvent(ChatEvent event)
event
- The chat event that is to be sent.public void onlineChange(UserImpl user, boolean isOnline)
onlineChange
in interface UserListener
user
- user whose state changed.isOnline
- wether the user is online.public void destroyed(UserImpl user)
destroyed
in interface UserListener
user
- UserImpl object to be destroyed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |