com.radekzitek.userver
Class UServer

java.lang.Object
  extended bycom.radekzitek.userver.UServer

public class UServer
extends java.lang.Object

Main class of the UServer framework. When run it loads the configuration (from its default location bin/userver.properties for the time being). It creates the HandlerPool, based on the configuration instantiates all thge listeners and after that starts all the listeners as a threads. Ant that's where the job of the class finishes.

Author:
rzitek

Field Summary
private  Configuration cfg
          Configuration object.
(package private)  HandlerPool hp
          HandlerPool object.
(package private)  java.util.Hashtable listeners
          Repository for the listeners.
private static org.apache.log4j.Logger LOG
          Log4j logger.
 
Constructor Summary
UServer()
          Default constructor.
 
Method Summary
private  ListenerThread createListener(java.lang.String name)
          Creates (instantoates and configures) the listeners.
static void main(java.lang.String[] args)
          Entry point for the execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG
Log4j logger.


cfg

private Configuration cfg
Configuration object.


hp

HandlerPool hp
HandlerPool object.


listeners

java.util.Hashtable listeners
Repository for the listeners. Listener name is the key into the table, the elements are the listeners themselves.

Constructor Detail

UServer

public UServer()
        throws java.io.FileNotFoundException,
               java.io.IOException,
               ListenerConfigurationException,
               java.lang.InstantiationException,
               java.lang.IllegalAccessException,
               java.lang.ClassNotFoundException
Default constructor. Does the job described above.

Throws:
java.io.FileNotFoundException - Thrown when the configuartion file can not be found.
java.io.IOException - Thrown when there is problem reading configuartion file.
java.lang.InstantiationException - Thrown when there is a poroblem instantiating the listener class.
java.lang.IllegalAccessException - Thrown when there is a poroblem instantiating the listener class.
java.lang.ClassNotFoundException - Thrown when the class for the listener to be instantiated can not be found.
ListenerConfigurationException - Thrown by the implementing class in case of problems with configuration.
Method Detail

createListener

private ListenerThread createListener(java.lang.String name)
                               throws ListenerConfigurationException,
                                      java.lang.InstantiationException,
                                      java.lang.IllegalAccessException,
                                      java.lang.ClassNotFoundException
Creates (instantoates and configures) the listeners.

Parameters:
name - the name of the listener to be created
Throws:
java.io.IOException - Thrown when there is problem reading configuartion file.
java.lang.InstantiationException - Thrown when there is a poroblem instantiating the listener class.
java.lang.IllegalAccessException - Thrown when there is a poroblem instantiating the listener class.
java.lang.ClassNotFoundException - Thrown when the class for the listener to be instantiated can not be found.
ListenerConfigurationException - Thrown by the implementing class in case of problems with configuration.

main

public static void main(java.lang.String[] args)
Entry point for the execution.

Parameters:
args - command line arguments