ecologylab.services.logging
Class NIOLoggingServer

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.services.distributed.impl.NIOServerBase
          extended by ecologylab.services.distributed.server.DoubleThreadedNIOServer
              extended by ecologylab.services.logging.NIOLoggingServer
All Implemented Interfaces:
StartAndStoppable, NetworkingConstants, ServerConstants, ServicesHostsAndPorts, SessionObjects, Shutdownable, NIOServerFrontend, java.lang.Runnable

public class NIOLoggingServer
extends DoubleThreadedNIOServer
implements ServicesHostsAndPorts

A server that automatically records any incoming log data to a local file. The file is specified by the Prologue provided by the Logging client.

Author:
Zachary O. Toups (toupsz@cs.tamu.edu)
See Also:
Logging

Field Summary
static java.lang.Class[] LOGGING_CLASSES
           
 
Fields inherited from class ecologylab.services.distributed.server.DoubleThreadedNIOServer
maxPacketSize
 
Fields inherited from class ecologylab.services.distributed.impl.NIOServerBase
registry, translationSpace
 
Fields inherited from interface ecologylab.services.distributed.common.ServicesHostsAndPorts
BROWSER_SERVICES_PORT, CF_SERVICES_PORT, CSDLL_HOST, LOGGING_HOST, LOGGING_PORT, PHYSI_ROGUE_UDP_PORT, ROGUE_OSC_SOUND_PATCH_LISTENER_PORT, ROGUE_OSC_SOUND_RECORDER_ACKNOWLEDGE_PORT, ROGUE_PORT, WEB_START_APP_SERVICES_PORT
 
Fields inherited from interface ecologylab.services.distributed.common.ServerConstants
GARBAGE_CONNECTION_CLEANUP_TIMEOUT, MAX_CONNECTIONS, MAXIMUM_TRANSMISSION_ERRORS
 
Fields inherited from interface ecologylab.services.distributed.common.NetworkingConstants
CHARACTER_ENCODING, CONTENT_LENGTH_STRING, CONTENT_LENGTH_STRING_LENGTH, ENCODER, HTTP_HEADER_LINE_DELIMITER, HTTP_HEADER_TERMINATOR, MAX_HTTP_HEADER_LENGTH, MAX_PACKET_SIZE_BYTES, MAX_PACKET_SIZE_CHARACTERS, UNIQUE_IDENTIFIER_STRING
 
Fields inherited from interface ecologylab.services.distributed.common.SessionObjects
BROWSER_SERVICES_CLIENT, BROWSER_SERVICES_TRANSLATIONS, LOGGING, MAIN_SHUTDOWNABLE, MAIN_START_AND_STOPPABLE, TOP_LEVEL
 
Constructor Summary
protected NIOLoggingServer(int portNumber, java.net.InetAddress[] inetAddress, TranslationSpace requestTranslationSpace, Scope objectRegistry, int idleConnectionTimeout, int maxPacketSize)
           
 
Method Summary
protected  LoggingClientManager generateContextManager(java.lang.Object token, java.nio.channels.SelectionKey sk, TranslationSpace translationSpaceIn, Scope registryIn)
          Hook method to allow changing the ContextManager to enable specific extra functionality.
static NIOLoggingServer getInstance(java.net.InetAddress[] inetAddress, Scope objectRegistry, int idleConnectionTimeout, int maxPacketSize)
          This is the actual way to create an instance of this.
static NIOLoggingServer getInstance(java.net.InetAddress inetAddress, Scope objectRegistry, int idleConnectionTimeout, int maxPacketSize)
          This is the actual way to create an instance of this.
 java.lang.String getLogFilesPath()
           
static void main(java.lang.String[] args)
          Launches an instance of the logging server.
 void setLogFilesPath(java.lang.String path)
          Sets the directory to which to write log files.
 void start()
          Displays some information about the logging server, then calls super.start()
 
Methods inherited from class ecologylab.services.distributed.server.DoubleThreadedNIOServer
addressToAddresses, getInstance, getInstance, invalidate, isRunning, processRead, restoreContextManagerFromSessionId, run, shutdown, stop
 
Methods inherited from class ecologylab.services.distributed.impl.NIOServerBase
composeTranslations, composeTranslations, generateBackend, getBackend, getRegistry, getTranslationSpace
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOGGING_CLASSES

public static final java.lang.Class[] LOGGING_CLASSES
Constructor Detail

NIOLoggingServer

protected NIOLoggingServer(int portNumber,
                           java.net.InetAddress[] inetAddress,
                           TranslationSpace requestTranslationSpace,
                           Scope objectRegistry,
                           int idleConnectionTimeout,
                           int maxPacketSize)
                    throws java.io.IOException,
                           java.net.BindException
Throws:
java.io.IOException
java.net.BindException
Method Detail

getInstance

public static NIOLoggingServer getInstance(java.net.InetAddress inetAddress,
                                           Scope objectRegistry,
                                           int idleConnectionTimeout,
                                           int maxPacketSize)
This is the actual way to create an instance of this.

Parameters:
portNumber -
translationSpace -
objectRegistry -
authListFilename - - a file name indicating the location of the authentication list; this should be an XML file of an AuthenticationList object.
Returns:
A server instance, or null if it was not possible to open a ServerSocket on the port on this machine.

getInstance

public static NIOLoggingServer getInstance(java.net.InetAddress[] inetAddress,
                                           Scope objectRegistry,
                                           int idleConnectionTimeout,
                                           int maxPacketSize)
This is the actual way to create an instance of this.

Parameters:
portNumber -
translationSpace -
objectRegistry -
authListFilename - - a file name indicating the location of the authentication list; this should be an XML file of an AuthenticationList object.
Returns:
A server instance, or null if it was not possible to open a ServerSocket on the port on this machine.

main

public static void main(java.lang.String[] args)
                 throws java.net.UnknownHostException
Launches an instance of the logging server.

Parameters:
args - the parameters for the server instance: first argument is the local directory to which to write files; second argument is the maximum packet size to accept from the client.
Throws:
java.net.UnknownHostException

setLogFilesPath

public void setLogFilesPath(java.lang.String path)
Sets the directory to which to write log files.

Parameters:
path -

getLogFilesPath

public java.lang.String getLogFilesPath()
Returns:
the log file path.

generateContextManager

protected LoggingClientManager generateContextManager(java.lang.Object token,
                                                      java.nio.channels.SelectionKey sk,
                                                      TranslationSpace translationSpaceIn,
                                                      Scope registryIn)
Description copied from class: DoubleThreadedNIOServer
Hook method to allow changing the ContextManager to enable specific extra functionality.

Overrides:
generateContextManager in class DoubleThreadedNIOServer

start

public void start()
Displays some information about the logging server, then calls super.start()

Specified by:
start in interface StartAndStoppable
Overrides:
start in class DoubleThreadedNIOServer
See Also:
DoubleThreadedNIOServer.start()