|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--swpchat.server.ProtocolHandler
Used for communication with the client, the server part of the chat protocol
Field Summary | |
(package private) static java.lang.String |
CLS
|
Fields inherited from interface swpchat.protocol.SenderReceiverTokens |
STR_JOIN, STR_JOINPASSWD, STR_LEAVE, STR_OFF, STR_ON, STR_PLAY, STR_PLAY_BEGIN, STR_PLAY_RE_BEGIN, STR_RECEIVE, STR_RECEIVE_BEGIN, STR_RECEIVE_USERINFO, STR_REQUEST_USERINFO, STR_SEND, STR_SEND_BEGIN, STR_SEND_RE_BEGIN, STR_SETTOPIC, STR_SETTOPIC_BEGIN, STR_SHIP, STR_SHIP_BEGIN, STR_TOPICCHANGED, STR_WHISPER, STR_WHISPRECEIVE |
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 | |
ProtocolHandler()
constuctor of this class |
Method Summary | |
abstract void |
disconnect()
|
protected static boolean |
isEmotion(java.util.Vector tokenlist)
true, if tokenlist contains valid Emotion command |
protected boolean |
isJoin(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid join command. |
protected boolean |
isJoinPasswd(java.util.Vector tokenlist)
Returns true, iffffffff the tokenlist contains a valid joinPasswd command. |
protected boolean |
isLeave(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid leave command. |
protected boolean |
isLogin(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid Login command. |
protected boolean |
isLogout(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid logout command. |
protected static boolean |
isMemberRequest(java.util.Vector tokenlist)
true, if tokenlist contains valid MemberRequest |
protected static boolean |
isNewChannel(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid newChannel command. |
protected static boolean |
isNewChannelReply(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid newChannel reply. |
protected static boolean |
isNotificationRequest(java.util.Vector tokenlist)
true, iff tokenlist contains valid notificationRequest message. |
protected boolean |
isPlay(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid play command. |
protected static boolean |
isPutShip(java.util.Vector tokenlist)
true, iff tokenlist contains valid putShip command |
protected static boolean |
isRemoveChannel(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid removeChannel command. |
protected static boolean |
isRemoveChannelReply(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid removeChannel reply. |
protected static boolean |
isRenameChannel(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid renameChannel command. |
protected static boolean |
isRenameChannelReply(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid renameChannel reply. |
protected static boolean |
isRequestIPAddress(java.util.Vector tokenlist)
true, iff tokenlist contains valid requestIPAddress command. |
protected static boolean |
isRequestIPAddressReply(java.util.Vector tokenlist)
true, iff tokenlist contains valid requestIPAddress reply. |
protected static boolean |
isRequestUserInfo(java.util.Vector tokenlist)
true, iff tokenlist contains valid requestUserInfo command |
protected boolean |
isSend(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid send command. |
protected static boolean |
isSendTelephoneRequest(java.util.Vector tokenlist)
true, iff tokenlist contains valid sendTelephoneRequest command. |
protected static boolean |
isSendTelephoneRequestReply(java.util.Vector tokenlist)
true, iff tokenlist contains valid sendTelephoneRequest reply. |
protected static boolean |
isSendUserInfo(java.util.Vector tokenlist)
true, iff tokenlist contains valid sendUserInfo command |
protected static boolean |
isSetNick(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid setNickCommand command. |
protected boolean |
isSetSessionKey(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid setSessionKey command. |
protected boolean |
isSetTopic(java.util.Vector tokenlist)
Returns true, if the tokenlist contains a valid settopic command. |
protected static boolean |
isStopNotification(java.util.Vector tokenlist)
true, iff tokenlist contains valid stopNotification message. |
protected boolean |
isWhisper(java.util.Vector tokenlist)
Returns true, iff the tokenlist contains a valid whisper command. |
protected java.util.Vector |
readCommand(ChatStreamTokenizer tokenizer,
java.net.Socket sourceSocket)
|
protected static void |
reply(java.io.BufferedWriter ostream,
java.lang.String command,
java.lang.String information)
Generate an reply answer for a given command. |
protected static void |
send(java.io.BufferedWriter ostream,
java.lang.String command,
java.lang.String information)
Generate an answer for a given command. |
protected static void |
send(java.io.BufferedWriter ostream,
java.lang.String command,
java.lang.String information1,
java.lang.String information2)
Generate an answer for a given command. |
protected static void |
send(java.io.BufferedWriter ostream,
java.lang.String command,
java.lang.String information1,
java.lang.String information2,
java.lang.String information3)
Generate an answer for a given command. |
protected static void |
send(java.io.BufferedWriter ostream,
java.lang.String command,
java.lang.String information1,
java.lang.String information2,
java.lang.String information3,
java.lang.String information4)
Generate an answer for a given command. |
protected static void |
send(java.io.BufferedWriter ostream,
java.lang.String command,
java.lang.String information1,
java.lang.String information2,
java.lang.String information3,
java.lang.String information4,
java.lang.String information5)
Send a given command. |
abstract void |
serve(java.net.Socket clientSocket,
ClientConnection clientConnection,
java.io.InputStream inputStream)
serves the client: parses commands from the client and sends appropiate replies (protocol violations are ignored for now) |
private static void |
writeLine(java.io.BufferedWriter ostream,
java.lang.String message)
Method to send the a String to the outgoing Stream |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final java.lang.String CLS
Constructor Detail |
public ProtocolHandler()
Method Detail |
public abstract void serve(java.net.Socket clientSocket, ClientConnection clientConnection, java.io.InputStream inputStream) throws TimeoutException, java.io.IOException, java.security.InvalidParameterException
clientSocket
- Socket used for communication between
client and server .inputStream
- The input stream of clientSocket. There
were reports of problems with opening multiple streams on a
socket.TimeoutException
- thrown if connection to the client
is lost or too slow.java.io.IOException
- thrown for any I/O error.java.security.InvalidParameterException
- possibly usefulpublic abstract void disconnect()
protected static boolean isSetNick(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isSetSessionKey(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isLogin(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isLogout(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isJoin(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isLeave(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isSetTopic(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isSend(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isPlay(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected boolean isJoinPasswd(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isNewChannelReply(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isRemoveChannelReply(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isRenameChannelReply(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isNewChannel(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isRemoveChannel(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isRenameChannel(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isPutShip(java.util.Vector tokenlist)
tokenlist
- the vector to be analysedprotected static boolean isEmotion(java.util.Vector tokenlist)
tokenlist
- the vector to be analysedprotected boolean isWhisper(java.util.Vector tokenlist)
tokenlist
- The Vector which is to be analysedprotected static boolean isSendUserInfo(java.util.Vector tokenlist)
tokenlist
- the vector to be analysedprotected static boolean isRequestUserInfo(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprotected static boolean isRequestIPAddress(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprotected static boolean isRequestIPAddressReply(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprotected static boolean isSendTelephoneRequest(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprotected static boolean isSendTelephoneRequestReply(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprotected static boolean isMemberRequest(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprotected static boolean isNotificationRequest(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprotected static boolean isStopNotification(java.util.Vector tokenlist)
tokenlist
- the tokenlist to be analysedprivate static void writeLine(java.io.BufferedWriter ostream, java.lang.String message) throws java.io.IOException
ostream
- The outgoing Streammessage
- String which has to be sendprotected static void reply(java.io.BufferedWriter ostream, java.lang.String command, java.lang.String information) throws java.io.IOException
ostream
- The outgoing Streamcommand
- which has to be sendinformation
- first parameterprotected static void send(java.io.BufferedWriter ostream, java.lang.String command, java.lang.String information) throws java.io.IOException
ostream
- The outgoing Streamcommand
- which has to be sendinformation
- first parameterprotected static void send(java.io.BufferedWriter ostream, java.lang.String command, java.lang.String information1, java.lang.String information2) throws java.io.IOException
ostream
- The outgoing Streamcommand
- which has to be sendinformation1
- first parameterinformation2
- second parameterprotected static void send(java.io.BufferedWriter ostream, java.lang.String command, java.lang.String information1, java.lang.String information2, java.lang.String information3) throws java.io.IOException
ostream
- The outgoing Streamcommand
- which has to be sendinformation1
- first parameterinformation2
- second parameterinformation3
- third parameterprotected static void send(java.io.BufferedWriter ostream, java.lang.String command, java.lang.String information1, java.lang.String information2, java.lang.String information3, java.lang.String information4) throws java.io.IOException
ostream
- The outgoing Streamcommand
- which has to be sendinformation1
- first parameterinformation2
- second parameterinformation3
- third parameterinformation4
- fourth parameterprotected java.util.Vector readCommand(ChatStreamTokenizer tokenizer, java.net.Socket sourceSocket) throws TimeoutException, java.io.IOException
tokenizer
- The tokenizer to usesourceSocket
- The socket to useTimeoutException,IOException
- Fetch one command from the input.
Used to simplify the usage of the ChatStreamTokenizer
as it reads until a CHAR_MSG_EOL is receiveprotected static void send(java.io.BufferedWriter ostream, java.lang.String command, java.lang.String information1, java.lang.String information2, java.lang.String information3, java.lang.String information4, java.lang.String information5) throws java.io.IOException
ostream
- The outgoing Streamcommand
- which has to be sendinformation1
- first parameterinformation2
- second parameterinformation3
- s÷rd parameter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |