org.basex.server
Class ClientListener

java.lang.Object
  extended by java.lang.Thread
      extended by org.basex.server.ClientListener
All Implemented Interfaces:
java.lang.Runnable

public final class ClientListener
extends java.lang.Thread

Server-side client session in the client-server architecture.

Author:
BaseX Team 2005-12, BSD License, Andreas Weiler, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 java.util.Timer auth
          Timer for authentication time out.
 long last
          Timestamp of last interaction.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ClientListener(java.net.Socket s, Context c, BaseXServer srv)
          Constructor.
 
Method Summary
 java.lang.String address()
          Returns the host and port of a client.
 Context context()
          Returns the context of this session.
 void notify(byte[] name, byte[] msg)
          Sends a notification to the client.
 void quit()
          Exits the session.
 void quitAuth()
          Quits the authentication.
 void register(java.net.Socket s)
          Registers the event socket.
 void run()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

auth

public final java.util.Timer auth
Timer for authentication time out.


last

public long last
Timestamp of last interaction.

Constructor Detail

ClientListener

public ClientListener(java.net.Socket s,
                      Context c,
                      BaseXServer srv)
Constructor.

Parameters:
s - socket
c - database context
srv - server reference
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

quitAuth

public void quitAuth()
Quits the authentication.


quit

public void quit()
Exits the session.


context

public Context context()
Returns the context of this session.

Returns:
user reference

register

public void register(java.net.Socket s)
              throws java.io.IOException
Registers the event socket.

Parameters:
s - socket
Throws:
java.io.IOException - I/O exception

notify

public void notify(byte[] name,
                   byte[] msg)
            throws java.io.IOException
Sends a notification to the client.

Parameters:
name - event name
msg - event message
Throws:
java.io.IOException - I/O exception

address

public java.lang.String address()
Returns the host and port of a client.

Returns:
string representation

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Thread