|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--swpchat.server.ClientConnection
This class embeds the protocol handling class into the server.
Field Summary | |
protected ChannelCollection |
channelCollection
|
(package private) static java.lang.String |
CLS
|
protected ConnectedClientCollection |
connectedClientCollection
|
protected ControlServer |
controlHandler
|
protected ProtocolHandler |
handlerTmp
|
private java.io.InputStream |
inputStream
|
protected NickNameCollection |
nickCollection
|
protected ReceiverServer |
receiverHandler
|
protected SenderServer |
senderHandler
|
protected java.net.Socket |
socket
|
Fields inherited from class java.lang.Thread |
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ |
Fields inherited from interface swpchat.protocol.ProtocolTokens |
STR_CONTROL, STR_CONTROL_PROTOCOL_ID, STR_FILE_SEND, STR_FILE_SEND_PROTOCOL_ID, STR_PROTOCOL, STR_PROTOCOL_ID_BEGIN, STR_RECEIVER, STR_RECEIVER_PROTOCOL_ID, STR_SENDER, STR_SENDER_PROTOCOL_ID |
Fields inherited from interface swpchat.protocol.ChatTokens |
CHAR_ARG_SEP, CHAR_MSG_END, CHAR_MSG_EOL, CHAR_QUOTE, CHAR_STRING_DELIMITER, STR_ARG_SEP, STR_AUTHORIZE, STR_MSG_END, STR_MSG_EOL, STR_NEG_ARG, STR_NEGATIVE, STR_POS_ARG, STR_POSITIVE, STR_QUOTE, STR_REPLY, STR_STRING_DELIMITER, STR_WAIT |
Constructor Summary | |
ClientConnection(ChannelCollection channelCollection,
NickNameCollection nickCollection,
ConnectedClientCollection connectedClientCollection,
java.net.Socket socket)
constructor maps the given parameters channelCollection to the local ChannelCollection and the tempsock to the socket we use in this context |
Method Summary | |
void |
disconnect()
|
void |
emotion(java.lang.String channel,
java.lang.String from,
java.lang.String target,
java.lang.String emo)
method to send emotion |
private ProtocolHandler |
getCorrectHandler(java.net.Socket socket)
get matching handler depending on what Protocol ID is sent |
java.lang.String |
getIdentifier()
Implementation of the method declared in ListenerBase to support the interface ChannelListener . |
java.lang.String |
getNickName(boolean sender)
|
void |
notify(java.lang.String nick,
java.lang.String state,
java.lang.String channels)
Notify ClientConnection that 'nick' assumed 'state' concerning 'channels'. |
void |
play(java.lang.String channel,
java.lang.String from,
java.lang.String audioKey)
method to invoke the playing procedure |
void |
receive(java.lang.String channel,
java.lang.String from,
java.lang.String message)
method to invoke the receiving procedure |
void |
receiveUserInfo(java.lang.String nickName,
java.lang.String strInfo)
send back userInfo of the given nickName |
void |
run()
overwrites run-method: open new ProtocolHandler for Client and call upon serve-method |
void |
sendControlMessage(java.lang.String control,
java.lang.String message1,
java.lang.String message2)
sends a control message to ControlProtocolHandler |
void |
sendRequestMessage(java.lang.String request,
java.lang.String info1,
java.lang.String info2,
java.lang.String info3)
sends a request message to ControlProtocolHandler |
void |
ship(java.lang.String channel,
java.lang.String from,
java.lang.String receiver,
boolean status)
method ship is used for shiping |
void |
topicChanged(java.lang.String channel,
java.lang.String from,
java.lang.String topic)
method to pass topicChanged |
void |
whispreceive(java.lang.String channel,
java.lang.String from,
java.lang.String message)
method to invoke the whisper-receiving procedure |
Methods inherited from class java.lang.Thread |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final java.lang.String CLS
protected ProtocolHandler handlerTmp
protected ReceiverServer receiverHandler
protected SenderServer senderHandler
protected ControlServer controlHandler
protected java.net.Socket socket
protected ChannelCollection channelCollection
protected NickNameCollection nickCollection
protected ConnectedClientCollection connectedClientCollection
private java.io.InputStream inputStream
Constructor Detail |
public ClientConnection(ChannelCollection channelCollection, NickNameCollection nickCollection, ConnectedClientCollection connectedClientCollection, java.net.Socket socket)
channelCollection,
- nickCollection, connectedClientCollection, socketMethod Detail |
public void run()
run
in class java.lang.Thread
public void receive(java.lang.String channel, java.lang.String from, java.lang.String message)
receive
in interface ChannelListener
channel
- the Channel in which the message should be distributedfrom
- the client's nick, which is sendingmessage
- the message to receivepublic void whispreceive(java.lang.String channel, java.lang.String from, java.lang.String message)
whispreceive
in interface ChannelListener
channel
- the Channel in which the message should be distributedfrom
- the client's nick, which is whisperingmessage
- the message to receivepublic void ship(java.lang.String channel, java.lang.String from, java.lang.String receiver, boolean status)
ship
in interface ChannelListener
channel
- the Channel in which the message should be distributedfrom
- the client's nick, which is sendingmessage
- the message to receivestatus
- on/offpublic void topicChanged(java.lang.String channel, java.lang.String from, java.lang.String topic)
topicChanged
in interface ChannelListener
channel
- the channel which distributes the topicChanged commandfrom
- the client's nick, who changed the topicaudioKey
- the topicpublic void play(java.lang.String channel, java.lang.String from, java.lang.String audioKey)
play
in interface ChannelListener
channel
- the channel which distributes the play commandfrom
- the client's nick, which is making noiseaudioKey
- the audio-file's associated audioKeypublic void emotion(java.lang.String channel, java.lang.String from, java.lang.String target, java.lang.String emo)
emotion
in interface ChannelListener
channel
- the channel which distributes the play commandfrom
- the client's nicktarget
- the target of the emotionemo
- the emotion to be sendpublic void receiveUserInfo(java.lang.String nickName, java.lang.String strInfo)
nickName
- the nickNamestrInfo
- the userInfo as a stringpublic void notify(java.lang.String nick, java.lang.String state, java.lang.String channels)
nick
- String
specifying the nickname of the concerning
the messagestate
- String
specifying the state 'nick' assumed. The
valid states can be found in NotificationTokens
.channels
- String
specifying the channels joined or left devided
by ';'s. Example: 'nick' joined 'test' and 'swp' up to now. Then channels
can be "test;swp".public void sendControlMessage(java.lang.String control, java.lang.String message1, java.lang.String message2)
ControlProtocolHandler
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 messagepublic void sendRequestMessage(java.lang.String request, java.lang.String info1, java.lang.String info2, java.lang.String info3)
ControlProtocolHandler
control
- is the {@java.lang.String} that identifys the request
to do in the ControlProtocolHandlerinfo1
- is a {@java.lang.String} specifying part1 of messageinfo2
- is a {@java.lang.String} specifying part2 of messageinfo3
- is a {@java.lang.String} specifying part3 of messageprivate ProtocolHandler getCorrectHandler(java.net.Socket socket) throws java.net.ProtocolException
socket
- the socket that contains the input stream with the "protocolMsg"public void disconnect()
public java.lang.String getNickName(boolean sender)
public java.lang.String getIdentifier()
ListenerBase
to support the interface ChannelListener
.getIdentifier
in interface ListenerBase
swpchat.server.ListenerBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |