    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Interface w3c.jigsaw.daemon.ServerClient

public interface ServerClient
extends Object
extends Runnable

##

bind(Socket)
  Bind this client to the given socket.
error(String)
  Emit an error message on behalf of this client.
getIdentifier()
  Get this client identifier.
getInetAddress()
  Get the internet address of the peer this client is handling.
getInputStream()
  Get this client's socket input stream.
getOutputStream()
  Get this client's socket output stream.
getServerHandler()
  Get the server this client is attached to.
getThread()
  Get this client thread.
initialize(ServerHandler, ClientFactory, int)
  Initialize this client, with the given parameters.
kill(boolean)
  Kill this client.
log(String)
  Emit a normal log entry on behalf of this client.
trace(String)
  Emit debugging trace on behalf of this client.

##

initialize

      public abstract void initialize(ServerHandler hdlr,
                                      ClientFactory factory,
                                      int id)

  Initialize this client, with the given parameters.
  Parameters:
    server - The server that created the client.
    factory - The factory that created this client.
    id - An integer identifing the client.

getServerHandler

      public abstract ServerHandler getServerHandler()

  Get the server this client is attached to.
  Returns:
    A Server instance, describing the server that created this client.

getThread

      public abstract Thread getThread()

  Get this client thread.
  Returns:
    The thread running this client, or null if no thread has been allocated for this client.

getIdentifier

      public abstract int getIdentifier()

  Get this client identifier.
  Returns:
    The identifier that this client received at initialization time.

error

      public abstract void error(String msg)

  Emit an error message on behalf of this client.
  Parameters:
    msg - The message to emit.

log

      public abstract void log(String msg)

  Emit a normal log entry on behalf of this client.
  Parameters:
    msg - The entry to be logged.

trace

      public abstract void trace(String msg)

  Emit debugging trace on behalf of this client.
  Parameters:
    msg - The trace to be emited.

kill

      public abstract void kill(boolean force)

  Kill this client.
  Parameters:
    force - Make all efforts to kill the client right now if true, otherwise, shutdown the client gracefully.

bind

      public abstract void bind(Socket socket)

  Bind this client to the given socket. The factory has been asked to run a client for a newly created connection. It wants to reuse this client instance to handle this new connection.
  Parameters:
    socket - The socket this client is to handle now.

getInetAddress

      public abstract InetAddress getInetAddress()

  Get the internet address of the peer this client is handling. This should be used only on bound clients (see the bind method), and returns the IP address of the client's peer.
  Returns:
    An InetAddress instance, or null if the client is not currently bound to a socket.

getInputStream

      public abstract InputStream getInputStream()

  Get this client's socket input stream. This should be used only on bound clients (see the bind method). If this method fails, the client is silently killed (unbound) and handed out to the factory as idle.
  Returns:
    An InputStream instance suitable for reading data from the client, or null if the client is not bound.

getOutputStream

      public abstract OutputStream getOutputStream()

  Get this client's socket output stream. This should be used only on bound clients (see the bind method). If the method fails, the client is silently killed (unbound) and handed out to the factory as idle.
  Returns:
    An OutputStream instance, suitable to send data back to the client, or null if the client is not bound.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index