swpchat.server
Class ConnectedClientCollection
java.lang.Object
|
+--swpchat.server.ConnectedClientCollection
- public class ConnectedClientCollection
- extends java.lang.Object
This class saves all connected client, that means that these client have
an controlProcotocolHandler instantiated.
- Author:
- Andre Brunner, Christian Stuellenberg, Marc Sturm
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
CLS
private static final java.lang.String CLS
memberServerMark
private java.util.HashMap memberServerMark
controlCollection
private ConnectionCollection controlCollection
senderCollection
private ConnectionCollection senderCollection
receiverCollection
private ConnectionCollection receiverCollection
iterator
private java.util.Iterator iterator
channelCollection
private ChannelCollection channelCollection
ConnectedClientCollection
public ConnectedClientCollection(ChannelCollection channelCollection)
tryToAddConnection
public boolean tryToAddConnection(java.lang.String strgKey,
ClientConnection clientConnection)
- Method tries to add ClientConnection to hashtable and is threadsave
- Parameters:
strgKey
- connection
- - Returns:
- true if clientConnection was added, else false
removeConnection
public void removeConnection(java.lang.String strgNick)
throws NoSuchMemberException
- remove a
ClientConnection
from controlCollection
- Parameters:
strgNick
- the String
specifying the sessionKey
of the ClientConnection to remove
getControlConnection
public ClientConnection getControlConnection(java.lang.String sessionKey)
throws NoSuchMemberException
- Parameters:
sessionKey
- speifying the sessionKey of the requested ClientConnection- Returns:
- the connection that is specified by the sessionKey
sendControlMessage
public void sendControlMessage(java.lang.String control,
java.lang.String message1,
java.lang.String message2,
java.lang.String message3)
- sends to every
ClientConnection
from controlCollection
a message that is handled by the ControlProtocolHandler
- Parameters:
control
- is the {@java.lang.String} that identifys the command
to do in the ControlProtocolHandlermessage1
- is a {@java.lang.String} specifying part1 of messagemessage2
- is a {@java.lang.String} specifying part2 of message
The method is threadsave, because otherwise the iterator will be used
by several threads (gleichzeitig).
getKeyFromClientConnection
private java.lang.String getKeyFromClientConnection(ClientConnection myClientConnection)
setSenderConnection
public void setSenderConnection(java.lang.String sessionKey,
ClientConnection connection)
setReceiverConnection
public void setReceiverConnection(java.lang.String sessionKey,
ClientConnection connection)
getClientConnection
public ClientConnection getClientConnection(java.lang.String sessionKey)
throws NoSuchMemberException
- used by other handlers for receiving actions
- Parameters:
sessionKey
- the sessionKey of the connection- Returns:
- the ClientConnection linked with the unique sessionKey
disconnectSenderConnection
public void disconnectSenderConnection(java.lang.String sessionKey)
disconnectReceiverConnection
public void disconnectReceiverConnection(java.lang.String sessionKey)