ikrs.yuccasrv
Class Yucca

java.lang.Object
  extended by java.lang.Thread
      extended by ikrs.yuccasrv.Yucca
All Implemented Interfaces:
BindListener, java.lang.Runnable

public class Yucca
extends java.lang.Thread
implements BindListener

This is the main class of the Yucca server.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Yucca(Environment<java.lang.String,BasicType> environment)
           
 
Method Summary
 void finalize(long time, java.util.concurrent.TimeUnit unit)
          This method will be called if the SocketManager is going to terminate.
 AbstractCommandLine<Command> getCommandLine()
           
 java.util.logging.Logger getLogger()
          Get the global logger.
static void main(java.lang.String[] argv)
           
protected  void performAutoBind()
           
protected  void performAutoBind(Environment<java.lang.String,BasicType> server)
           
protected  boolean performAutoBind(Environment<java.lang.String,BasicType> server, Environment<java.lang.String,BasicType> listen, java.util.Map<java.lang.String,ConnectionHandler> sharedConnectionHandlers)
           
 void performListen(BasicType host, BasicType port, Environment<java.lang.String,BasicType> serverSettings)
           
 void performPrintLicense()
           
 void performPrintWarranty()
           
 void performQuit(boolean forceQuit)
           
 void performStatus()
           
 void performUnlisten(BasicType socketID)
           
static void printWarranty()
           
static java.lang.String processCustomizedFilePath(java.lang.String filePath)
           
 void run()
           
static Yucca runYucca(java.lang.String[] argv)
           
 void serverAcceptedTCPConnection(BindManager source, java.util.UUID socketID, java.net.Socket sock, ConnectionUserID userID)
           
 void serverAcceptedUDPConnection(BindManager source, java.util.UUID socketID, java.net.DatagramSocket sock, ConnectionUserID userID)
           
 void serverClosed(BindManager source, java.util.UUID socketID)
           
 void serverCreated(BindManager source, java.util.UUID socketID)
           
 void serverError(BindManager source, java.util.UUID socketID, java.lang.Exception e, boolean isTraumatic)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Yucca

public Yucca(Environment<java.lang.String,BasicType> environment)
      throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getLogger

public java.util.logging.Logger getLogger()
Get the global logger. This is the same logger as returned by LogManager.getLogger( Constants.DEFAULT_LOGGER_NAME );


getCommandLine

public AbstractCommandLine<Command> getCommandLine()

performQuit

public void performQuit(boolean forceQuit)

performStatus

public void performStatus()

performPrintLicense

public void performPrintLicense()

performPrintWarranty

public void performPrintWarranty()

printWarranty

public static void printWarranty()

serverCreated

public void serverCreated(BindManager source,
                          java.util.UUID socketID)
Specified by:
serverCreated in interface BindListener
Parameters:
source - The BindManager that reports the event.
socketID - A unique ID to identify the created socket by the use of BindManager.getServer*( socketID ).

serverError

public void serverError(BindManager source,
                        java.util.UUID socketID,
                        java.lang.Exception e,
                        boolean isTraumatic)
Specified by:
serverError in interface BindListener
Parameters:
source - The BindManager that reports the event.
socketID - The server's unique ID.
e - The reported exception.
isTraumatic - This flag tell if the server socket can still be used or if it's (probably) broken and should be restarted. In the second case the BindManager will automatically close and remove the socket to free the resources.

serverAcceptedTCPConnection

public void serverAcceptedTCPConnection(BindManager source,
                                        java.util.UUID socketID,
                                        java.net.Socket sock,
                                        ConnectionUserID userID)
Specified by:
serverAcceptedTCPConnection in interface BindListener
Parameters:
source - The BindManager that reports the event.
sockedID - The server socket's unique ID.
sock - The accepted connection socket.

serverAcceptedUDPConnection

public void serverAcceptedUDPConnection(BindManager source,
                                        java.util.UUID socketID,
                                        java.net.DatagramSocket sock,
                                        ConnectionUserID userID)
Specified by:
serverAcceptedUDPConnection in interface BindListener
Parameters:
source - The BindManager that reports the event.
sockedID - The server socket's unique ID.
sock - The accepted connection socket.

serverClosed

public void serverClosed(BindManager source,
                         java.util.UUID socketID)
Specified by:
serverClosed in interface BindListener
Parameters:
source - The BindManager that reports the event.
sockedID - The server socket's unique ID.

finalize

public void finalize(long time,
                     java.util.concurrent.TimeUnit unit)
This method will be called if the SocketManager is going to terminate. All associated BindListener MUST terminate within the given time.

Specified by:
finalize in interface BindListener
Parameters:
time - The time value all dependent child threads have to terminate in.
unit - The time unit.

performAutoBind

protected void performAutoBind()

performAutoBind

protected void performAutoBind(Environment<java.lang.String,BasicType> server)

performAutoBind

protected boolean performAutoBind(Environment<java.lang.String,BasicType> server,
                                  Environment<java.lang.String,BasicType> listen,
                                  java.util.Map<java.lang.String,ConnectionHandler> sharedConnectionHandlers)

performListen

public void performListen(BasicType host,
                          BasicType port,
                          Environment<java.lang.String,BasicType> serverSettings)
                   throws java.net.UnknownHostException,
                          BasicTypeException,
                          java.io.IOException,
                          java.security.GeneralSecurityException
Throws:
java.net.UnknownHostException
BasicTypeException
java.io.IOException
java.security.GeneralSecurityException

performUnlisten

public void performUnlisten(BasicType socketID)
                     throws BasicTypeException,
                            java.io.IOException
Throws:
BasicTypeException
java.io.IOException

run

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

processCustomizedFilePath

public static java.lang.String processCustomizedFilePath(java.lang.String filePath)

runYucca

public static Yucca runYucca(java.lang.String[] argv)

main

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