com.lyrisoft.chat.server.local
Class ChatServerLocal

java.lang.Object
  |
  +--com.lyrisoft.chat.server.local.ChatServerLocal
All Implemented Interfaces:
IChatServer, ICommands, IConnectionListener

public class ChatServerLocal
extends java.lang.Object
implements IChatServer, IConnectionListener, ICommands

This is a view of the ChatServer that lives on the client side. When the client talks to the server, no fancy work has to be done; instead direct method calls are invoked on this object, and this object sees to it that the message gets to the server in a way that the server can understand. Similarly, when a raw message comes in from the server, it is processed, then a direct method call is invoked on the Client. The CommandMakerLocal class is used to construct the messages that are sent over the wire

2000-04-15: Added code so that a connection falls back to an http-tunneling scheme.

See Also:
CommandMakerLocal

Field Summary
protected  boolean _alwaysTunnel
           
protected  boolean _attemptToTunnel
           
protected  CommandProcessorLocal _commandProcessor
           
protected  boolean _connected
           
protected  IConnectionHandler _connectionHandler
           
protected  java.lang.String _host
           
protected  int _port
           
protected  java.lang.String _readUrl
           
protected  IChatClient _responseInterface
           
protected  SocketOpener _socketOpener
           
protected  java.lang.String _writeUrl
           
 
Fields inherited from interface com.lyrisoft.chat.ICommands
ACCESS_DENIED, ACK_KILL, ALREADY_SIGNED_ON, DELIMITER, EMOTE_TO_ROOM, EMOTE_TO_USER, ERROR, GET_ROOMS, GET_USERS_IN_ROOM, GET_USERS_ON_SERVER, HELP, HYPERLINK, IGNORE, INVALID_CHARACTER, INVITE, JOIN_ROOM, JOIN_ROOM_ACK, KICK, KILL, NO_INVITE, NO_SUCH_USER, OP, PART_ROOM, PART_ROOM_ACK, PING, PONG, REMOTE_CLIENT_MESSAGE, ROOM_ACCESS_DENIED, ROOM_DIFF, ROOM_MSG, ROOM_USER_DIFF, SAY_TO_ROOM, SAY_TO_USER, SHUTDOWN, SIGNOFF, SIGNON, SIGNON_ACK, STATS, UNIGNORE, UNINVITE, USER_DIFF, VERSION, WHOIS
 
Constructor Summary
ChatServerLocal(java.lang.String host, int port, IChatClient responseInterface)
           
ChatServerLocal(java.lang.String host, int port, java.lang.String readUrl, java.lang.String writeUrl, IChatClient responseInterface)
           
ChatServerLocal(java.lang.String readUrl, java.lang.String writeUrl, IChatClient responseInterface)
           
 
Method Summary
 void deop(java.lang.String userId, java.lang.String room)
           
 void emoteToRoom(java.lang.String room, java.lang.String message)
          Construct and queue an outgoing message.
 void emoteToUser(java.lang.String userId, java.lang.String message)
          Construct and queue an outgoing message.
 void help(java.lang.String command)
          Construct and queue an outgoing help request
 void ignore(java.lang.String userId, java.lang.String message)
          Construct and queue an outgoing message.
 void incomingMessage(java.lang.String message)
          This method is called by ConnectionHandlerLocal when a new message comes in from the server.
 void init()
           
 boolean isConnected()
           
 void joinRoom(java.lang.String room, java.lang.String password)
          Construct and queue an outgoing message.
 void kick(java.lang.String userId, java.lang.String room)
           
 void kill(java.lang.String userId, java.lang.String message)
          Construct and queue an outgoing message.
 void op(java.lang.String userId, java.lang.String room)
           
 void partRoom(java.lang.String room)
          Construct and queue an outgoing message.
 void reportVersion(java.lang.String version)
           
 void requestRoomList()
          Construct and queue an outgoing message.
 void requestStats()
          Construct and queue an outgoing message.
 void requestUserInfo(java.lang.String user)
          Construct and queue an outgoing message.
 void requestUserList()
          Construct and queue an outgoing message.
 void requestUsersInRoomList(java.lang.String room)
          Construct and queue an outgoing message.
 void sayToRoom(java.lang.String room, java.lang.String message)
          Construct and queue an outgoing message.
 void sayToUser(java.lang.String userId, java.lang.String message)
          Construct and queue an outgoing message.
 void sendPing(java.lang.String user, java.lang.String arg)
          Construct and queue an outgoing message.
 void sendPong(java.lang.String user, java.lang.String arg)
          Construct and queue an outgoing message.
 void signOff()
          Construct and queue an outgoing message.
 void signOn(java.lang.String userId, java.lang.String password)
          Construct and queue an outgoing message.
 void socketClosed()
          This method is called by ConnectionHandlerLocal when the connect to the server is lost.
 void unignore(java.lang.String userId)
          Construct and queue an outgoing message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_host

protected java.lang.String _host

_port

protected int _port

_connected

protected boolean _connected

_connectionHandler

protected IConnectionHandler _connectionHandler

_responseInterface

protected IChatClient _responseInterface

_socketOpener

protected SocketOpener _socketOpener

_alwaysTunnel

protected boolean _alwaysTunnel

_attemptToTunnel

protected boolean _attemptToTunnel

_readUrl

protected java.lang.String _readUrl

_writeUrl

protected java.lang.String _writeUrl

_commandProcessor

protected CommandProcessorLocal _commandProcessor
Constructor Detail

ChatServerLocal

public ChatServerLocal(java.lang.String readUrl,
                       java.lang.String writeUrl,
                       IChatClient responseInterface)

ChatServerLocal

public ChatServerLocal(java.lang.String host,
                       int port,
                       IChatClient responseInterface)

ChatServerLocal

public ChatServerLocal(java.lang.String host,
                       int port,
                       java.lang.String readUrl,
                       java.lang.String writeUrl,
                       IChatClient responseInterface)
Method Detail

isConnected

public boolean isConnected()
Specified by:
isConnected in interface IChatServer

init

public void init()
Specified by:
init in interface IChatServer

incomingMessage

public void incomingMessage(java.lang.String message)
This method is called by ConnectionHandlerLocal when a new message comes in from the server. Control is delegated to CommandProcessorLocal.process(), and eventually one of the CommandProcessors will make a direct method call on the Client.
Specified by:
incomingMessage in interface IConnectionListener
See Also:
ConnectionHandlerLocal, CommandProcessorLocal.process(java.lang.String, com.lyrisoft.chat.client.IChatClient)

socketClosed

public void socketClosed()
This method is called by ConnectionHandlerLocal when the connect to the server is lost. connectionLost() is called on the client to inform it that the connection is lost.
Specified by:
socketClosed in interface IConnectionListener
See Also:
ConnectionHandlerLocal, Client.connectionLost()

help

public void help(java.lang.String command)
Construct and queue an outgoing help request
Specified by:
help in interface IChatServer
Parameters:
command - the command you want help on (optional)

signOn

public void signOn(java.lang.String userId,
                   java.lang.String password)
Construct and queue an outgoing message.
Specified by:
signOn in interface IChatServer

signOff

public void signOff()
Construct and queue an outgoing message.
Specified by:
signOff in interface IChatServer

requestRoomList

public void requestRoomList()
Construct and queue an outgoing message.
Specified by:
requestRoomList in interface IChatServer

requestUserList

public void requestUserList()
Construct and queue an outgoing message.
Specified by:
requestUserList in interface IChatServer

requestUsersInRoomList

public void requestUsersInRoomList(java.lang.String room)
Construct and queue an outgoing message.
Specified by:
requestUsersInRoomList in interface IChatServer

joinRoom

public void joinRoom(java.lang.String room,
                     java.lang.String password)
Construct and queue an outgoing message.
Specified by:
joinRoom in interface IChatServer

partRoom

public void partRoom(java.lang.String room)
Construct and queue an outgoing message.
Specified by:
partRoom in interface IChatServer

sayToRoom

public void sayToRoom(java.lang.String room,
                      java.lang.String message)
Construct and queue an outgoing message.
Specified by:
sayToRoom in interface IChatServer

sayToUser

public void sayToUser(java.lang.String userId,
                      java.lang.String message)
Construct and queue an outgoing message.
Specified by:
sayToUser in interface IChatServer

emoteToRoom

public void emoteToRoom(java.lang.String room,
                        java.lang.String message)
Construct and queue an outgoing message.
Specified by:
emoteToRoom in interface IChatServer

emoteToUser

public void emoteToUser(java.lang.String userId,
                        java.lang.String message)
Construct and queue an outgoing message.
Specified by:
emoteToUser in interface IChatServer

kill

public void kill(java.lang.String userId,
                 java.lang.String message)
Construct and queue an outgoing message.
Specified by:
kill in interface IChatServer

sendPing

public void sendPing(java.lang.String user,
                     java.lang.String arg)
Construct and queue an outgoing message.
Specified by:
sendPing in interface IChatServer

sendPong

public void sendPong(java.lang.String user,
                     java.lang.String arg)
Construct and queue an outgoing message.
Specified by:
sendPong in interface IChatServer

requestStats

public void requestStats()
Construct and queue an outgoing message.
Specified by:
requestStats in interface IChatServer

requestUserInfo

public void requestUserInfo(java.lang.String user)
Construct and queue an outgoing message.
Specified by:
requestUserInfo in interface IChatServer

ignore

public void ignore(java.lang.String userId,
                   java.lang.String message)
Construct and queue an outgoing message.
Specified by:
ignore in interface IChatServer

unignore

public void unignore(java.lang.String userId)
Construct and queue an outgoing message.
Specified by:
unignore in interface IChatServer

reportVersion

public void reportVersion(java.lang.String version)
Specified by:
reportVersion in interface IChatServer

op

public void op(java.lang.String userId,
               java.lang.String room)
Specified by:
op in interface IChatServer

deop

public void deop(java.lang.String userId,
                 java.lang.String room)
Specified by:
deop in interface IChatServer

kick

public void kick(java.lang.String userId,
                 java.lang.String room)
Specified by:
kick in interface IChatServer


Copyright © 2000-2002 Taso Lyristis