ecologylab.services.distributed.impl
Class NIOServerBase

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.services.distributed.impl.NIOServerBase
All Implemented Interfaces:
StartAndStoppable, SessionObjects, Shutdownable, NIOServerFrontend, java.lang.Runnable
Direct Known Subclasses:
DoubleThreadedNIOServer

public abstract class NIOServerBase
extends Debug
implements NIOServerFrontend, java.lang.Runnable, StartAndStoppable, SessionObjects, Shutdownable

Combines an NIOServerBackend and NIOServerFrontend

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

Field Summary
protected  Scope registry
           
protected  TranslationSpace translationSpace
           
 
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 NIOServerBase(int portNumber, java.net.InetAddress[] inetAddress, TranslationSpace requestTranslationSpace, Scope objectRegistry, int idleConnectionTimeout)
          Creates an instance of an NIOServer of some flavor.
protected NIOServerBase(int portNumber, java.net.InetAddress inetAddress, TranslationSpace requestTranslationSpace, Scope objectRegistry, int idleConnectionTimeout)
          Creates an instance of an NIOServer of some flavor.
 
Method Summary
static TranslationSpace composeTranslations(java.lang.Class[] newTranslations, java.lang.String prefix, int portNumber, java.lang.String inetAddress, TranslationSpace requestTranslationSpace)
           
static TranslationSpace composeTranslations(int portNumber, java.net.InetAddress inetAddress, TranslationSpace requestTranslationSpace)
           
protected  NIOServerBackend generateBackend(int portNumber, java.net.InetAddress[] inetAddresses, TranslationSpace requestTranslationSpace, Scope objectRegistry, int idleConnectionTimeout)
           
protected abstract  AbstractClientManager generateContextManager(java.lang.Object token, java.nio.channels.SelectionKey sk, TranslationSpace translationSpace, Scope registry)
           
 NIOServerBackend getBackend()
           
 Scope getRegistry()
           
 TranslationSpace getTranslationSpace()
           
 void start()
           
 void stop()
           
 
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
 
Methods inherited from interface ecologylab.services.distributed.server.NIOServerFrontend
invalidate, processRead, restoreContextManagerFromSessionId
 
Methods inherited from interface java.lang.Runnable
run
 
Methods inherited from interface ecologylab.services.distributed.impl.Shutdownable
shutdown
 

Field Detail

translationSpace

protected TranslationSpace translationSpace

registry

protected Scope registry
Constructor Detail

NIOServerBase

protected NIOServerBase(int portNumber,
                        java.net.InetAddress[] inetAddress,
                        TranslationSpace requestTranslationSpace,
                        Scope objectRegistry,
                        int idleConnectionTimeout)
                 throws java.io.IOException,
                        java.net.BindException
Creates an instance of an NIOServer of some flavor. Creates the backend using the information in the arguments. Registers itself as the MAIN_START_AND_STOPPABLE in the object registry.

Parameters:
portNumber -
inetAddress -
translationSpace -
objectRegistry -
Throws:
java.io.IOException
java.net.BindException

NIOServerBase

protected NIOServerBase(int portNumber,
                        java.net.InetAddress inetAddress,
                        TranslationSpace requestTranslationSpace,
                        Scope objectRegistry,
                        int idleConnectionTimeout)
                 throws java.io.IOException,
                        java.net.BindException
Creates an instance of an NIOServer of some flavor. Creates the backend using the information in the arguments. Registers itself as the MAIN_START_AND_STOPPABLE in the object registry.

Parameters:
portNumber -
inetAddress -
translationSpace -
objectRegistry -
Throws:
java.io.IOException
java.net.BindException
Method Detail

getBackend

public NIOServerBackend getBackend()
Returns:
the backend

getRegistry

public Scope getRegistry()
Returns:
the registry

getTranslationSpace

public TranslationSpace getTranslationSpace()
Returns:
the translationSpace

composeTranslations

public static TranslationSpace composeTranslations(int portNumber,
                                                   java.net.InetAddress inetAddress,
                                                   TranslationSpace requestTranslationSpace)

composeTranslations

public static TranslationSpace composeTranslations(java.lang.Class[] newTranslations,
                                                   java.lang.String prefix,
                                                   int portNumber,
                                                   java.lang.String inetAddress,
                                                   TranslationSpace requestTranslationSpace)

generateBackend

protected NIOServerBackend generateBackend(int portNumber,
                                           java.net.InetAddress[] inetAddresses,
                                           TranslationSpace requestTranslationSpace,
                                           Scope objectRegistry,
                                           int idleConnectionTimeout)
                                    throws java.net.BindException,
                                           java.io.IOException
Throws:
java.net.BindException
java.io.IOException

generateContextManager

protected abstract AbstractClientManager generateContextManager(java.lang.Object token,
                                                                java.nio.channels.SelectionKey sk,
                                                                TranslationSpace translationSpace,
                                                                Scope registry)

start

public void start()
Specified by:
start in interface StartAndStoppable
See Also:
StartAndStoppable.start()

stop

public void stop()
Specified by:
stop in interface StartAndStoppable
See Also:
StartAndStoppable.stop()