net.larsan.urd.impl
Class Standalone

java.lang.Object
  |
  +--net.larsan.urd.impl.Standalone
All Implemented Interfaces:
UrdServerListener

public class Standalone
extends java.lang.Object
implements UrdServerListener

The standalone is a Urd server which prepares the environment before starting. It asumes that class loading is taken care of and if it have not been explicitly told otherwise it will use it's own class loader as the parent class loader for subservices.

Immediate startup information needed by this standalone can be garthered in a CmdOptions object.

This server prepares the JNDI context for later use. It reservers the subcontext 'urd' which is one of the prerequisites inherited from the UrdServer. In preparation it binds the following objects in the context:

      /urd/root (installation root, file object)
      /urd/config (configuration file object)
      /urd/handler (current error handler)
      /urd/classloader/system (system framework class loader)
      /urd/classloader/service (service root classloader)
      /urd/classloader/shared (shared services class loader)
      /urd/threads (the framework thread pool)
 
When the above objects have sucessfully started the server will be startable. The proper invocation chain for this standalone is:
      prepare -> start (-> destroy)
 
Server shutdown is handled by the base server. Destruction will be called when the UrdServer shuts down.

This class is not thread safe.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Constructor Summary
Standalone()
           
Standalone(CmdOptions options)
           
Standalone(CmdOptions options, java.lang.ClassLoader serviceLoader)
           
 
Method Summary
 void destroy()
          Clean up all available resources.
 void prepare()
          Prepare the server before a startup.
 void serverStarted()
          Urd server has started, this does not interest us.
 void serverStopped()
          Urd server has stopped, close and destroy
 void start()
          Start the execution of this server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Standalone

public Standalone(CmdOptions options,
                  java.lang.ClassLoader serviceLoader)
           throws java.io.IOException

Standalone

public Standalone(CmdOptions options)
           throws java.io.IOException

Standalone

public Standalone()
           throws java.io.IOException
Method Detail

prepare

public void prepare()
             throws java.io.IOException,
                    ConfigurationException,
                    javax.naming.NamingException
Prepare the server before a startup. This method will intialize all shared objects for the framework. In particular it will: Since all objects mentioned above will live in memory it is vital that a call to destroy is made after server execution to clean up resources.

Throws:
java.io.IOException - On read I/O errors
ConfigurationException - On configuration errors
javax.naming.NamingException - On fatal JNDI errors

start

public void start()
Start the execution of this server. Execution logic is handled by the UrdServer and this method will return immediately.

Should prepared not have been called before this method is invoked an IllegalStateException will be thrown.

Throws:
java.lang.IllegalStateException - If the server is not ready

destroy

public void destroy()
Clean up all available resources. This include closing the JNDI root context, releasing the thread pool and commiting the preferences.

Should prepared not have been called before this method is invoked an IllegalStateException will be thrown.


serverStarted

public void serverStarted()
Urd server has started, this does not interest us.

Specified by:
serverStarted in interface UrdServerListener

serverStopped

public void serverStopped()
Urd server has stopped, close and destroy

Specified by:
serverStopped in interface UrdServerListener