Purple Code

com.purpletech.message.server
Class MessageServer

java.lang.Object
  |
  +--com.purpletech.message.server.MessageServer
Direct Known Subclasses:
ChatServer

public class MessageServer
extends java.lang.Object

Version:
$Id: MessageServer.java,v 1.3 2002/11/24 05:32:55 alex Exp $
Author:
Alex

Field Summary
static java.lang.String[][] defaults
           
 
Constructor Summary
MessageServer()
           
MessageServer(Options options)
           
 
Method Summary
 int addClient(Client c)
          Add a new client.
 void addMessageListener(MessageListener x)
           
 void addMessageServerListener(MessageServerListener x)
           
 void connect()
           
 void disconnect()
           
 Queue getClients()
          Returns a copy of the current list of clients.
 boolean isRunning()
          is the server running yet?
static void main(java.lang.String[] args)
           
 void removeMessageListener(MessageListener x)
           
 void removeMessageServerListener(MessageServerListener x)
           
 void sendMessage(Message m)
          directly inject a message into the queue for processing
 void start()
           
 void stop()
          stop the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaults

public static final java.lang.String[][] defaults
Constructor Detail

MessageServer

public MessageServer()

MessageServer

public MessageServer(Options options)
Method Detail

start

public void start()

stop

public void stop()
stop the server. Waits for all threads to exit.


connect

public void connect()

disconnect

public void disconnect()

isRunning

public boolean isRunning()
is the server running yet?


addClient

public int addClient(Client c)
Add a new client. A client is a MessageListener that only gets messages that are addressed to it.

If the client does not yet have an ID, a fresh ID is assigned to it.

Note that the server (via the acceptor thread) is adding and removing clients as needed all the time without calling this method.


sendMessage

public void sendMessage(Message m)
directly inject a message into the queue for processing


getClients

public Queue getClients()
Returns a copy of the current list of clients.


addMessageListener

public void addMessageListener(MessageListener x)

removeMessageListener

public void removeMessageListener(MessageListener x)

addMessageServerListener

public void addMessageServerListener(MessageServerListener x)

removeMessageServerListener

public void removeMessageServerListener(MessageServerListener x)

main

public static void main(java.lang.String[] args)

Documentation generated March 5 2003