autohit.server
Class SimpleSystemContext

java.lang.Object
  extended byautohit.server.SimpleSystemContext
All Implemented Interfaces:
SystemContext

public class SimpleSystemContext
extends java.lang.Object
implements SystemContext

A simple system context for a server or invoker.

 It includes:
 a basic log manager (@see #logger)
 a root logger
 a basic properties set (@see #prop)
 a single script SIM compiler (@see #compiler)
 a universe factory (@see #uf)
 a LOCAL universe server
 a Kernel (uninitialized!)
 a root loader (uninitialized!)
 

It requires the root property be set.

Version:
1.0 Version History EPG - Initial - 25Apr03
Author:
Erich P. Gatejen

Field Summary
 Controller cc
          Channel controller
 SimCompiler compiler
          Script compiler.
 boolean debug
          Debugging flag
 org.apache.commons.collections.ExtendedProperties invokerprop
          Invoker properties set
 Kernel k
          Kernel
 AutohitLogInjectorWrapper logger
          Root log injector
 AutohitBasicLogManager logManager
          Primary log manager
 org.apache.commons.collections.ExtendedProperties prop
          The system properties set
 java.lang.String root
          Root path
 UniverseFactory uf
          Universe factory
 Universe uni
          Our simple little universe.
static int uniqueN
          Unique number counter -- it will be unique for all instances of SimpleSystemContext.
 
Constructor Summary
SimpleSystemContext()
          Default Constructor.
 
Method Summary
 boolean debuggingState()
          Get debugging state
 CommandRegistry getCommandRegistry()
          Get the command registry as a properties set.
 XmlCompiler getCompiler()
          Get the XML compiler
 Injector getEventDispatcher()
          Cheat.
 org.apache.commons.collections.ExtendedProperties getInvokerProperties()
          Get a reference to the invoker properties set.
 Kernel getKernel()
          Get the Kernel
 VMLoader getLoader()
          Get the VM Loader
 AutohitBasicLogManager getLogManager()
          Get log manager reference
 org.apache.commons.collections.ExtendedProperties getPropertiesSet()
          Get properties set
 AutohitLogInjectorWrapper getRootLogger()
          Get a reference to a generic, root log injector
 Universe getUniverse()
          Get the default universe
 Universe getUniverse(java.lang.String handle)
          Get a universe service by handle.
 void init(org.apache.commons.collections.ExtendedProperties props)
          Properties constructor.
 void loadProperties(org.apache.commons.collections.ExtendedProperties props)
          Load properties.
 int uniqueInteger()
          Unique number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logManager

public AutohitBasicLogManager logManager
Primary log manager


logger

public AutohitLogInjectorWrapper logger
Root log injector


compiler

public SimCompiler compiler
Script compiler. Keep at least one around.


uni

public Universe uni
Our simple little universe.


prop

public org.apache.commons.collections.ExtendedProperties prop
The system properties set


invokerprop

public org.apache.commons.collections.ExtendedProperties invokerprop
Invoker properties set


uf

public UniverseFactory uf
Universe factory


cc

public Controller cc
Channel controller


k

public Kernel k
Kernel


debug

public boolean debug
Debugging flag


root

public java.lang.String root
Root path


uniqueN

public static int uniqueN
Unique number counter -- it will be unique for all instances of SimpleSystemContext.

Constructor Detail

SimpleSystemContext

public SimpleSystemContext()
                    throws java.lang.Exception
Default Constructor.

Method Detail

init

public void init(org.apache.commons.collections.ExtendedProperties props)
          throws java.lang.Exception
Properties constructor. Give it a full path to the properties file.

Specified by:
init in interface SystemContext
Parameters:
props - properties set
Throws:
java.lang.Exception

loadProperties

public void loadProperties(org.apache.commons.collections.ExtendedProperties props)
                    throws java.lang.Exception
Load properties. It will delete any previously loaded properties.

Specified by:
loadProperties in interface SystemContext
Parameters:
props - a properties set
Throws:
java.lang.Exception

getUniverse

public Universe getUniverse()
Get the default universe

Specified by:
getUniverse in interface SystemContext
Returns:
Universe service interface

getUniverse

public Universe getUniverse(java.lang.String handle)
Get a universe service by handle. This implementation ignores the handle and returns the only universe we have.

Specified by:
getUniverse in interface SystemContext
Parameters:
handle - handle to the universe
Returns:
Universe service interface

getCompiler

public XmlCompiler getCompiler()
Get the XML compiler

Specified by:
getCompiler in interface SystemContext
Returns:
XmlCompiler base class

getRootLogger

public AutohitLogInjectorWrapper getRootLogger()
Get a reference to a generic, root log injector

Specified by:
getRootLogger in interface SystemContext
Returns:
XmlCompiler base class

getEventDispatcher

public Injector getEventDispatcher()
Cheat. The logger will be our even dispacter

Specified by:
getEventDispatcher in interface SystemContext
Returns:
Injector reference

getPropertiesSet

public org.apache.commons.collections.ExtendedProperties getPropertiesSet()
Get properties set

Specified by:
getPropertiesSet in interface SystemContext
Returns:
reference to the properties set

getLogManager

public AutohitBasicLogManager getLogManager()
Get log manager reference

Specified by:
getLogManager in interface SystemContext
Returns:
reference to the properties set

getKernel

public Kernel getKernel()
Get the Kernel

Specified by:
getKernel in interface SystemContext
Returns:
reference to the kernel

getLoader

public VMLoader getLoader()
Get the VM Loader

Specified by:
getLoader in interface SystemContext
Returns:
reference to the kernel

getCommandRegistry

public CommandRegistry getCommandRegistry()
Get the command registry as a properties set. It is not cached. this implementation will always return the default set.

Specified by:
getCommandRegistry in interface SystemContext
Returns:
properties set representing the registry. it will return null if it cannot be loaded

uniqueInteger

public int uniqueInteger()
Unique number

Specified by:
uniqueInteger in interface SystemContext
Returns:
an integer number unique (at least) to this Context

debuggingState

public boolean debuggingState()
Get debugging state

Specified by:
debuggingState in interface SystemContext
Returns:
true if debugging active

getInvokerProperties

public org.apache.commons.collections.ExtendedProperties getInvokerProperties()
Get a reference to the invoker properties set. Generally, only invokers should add anything to the set. It should be safe for anyone to read from it. It is up to the invoker to maintain its contents.

Specified by:
getInvokerProperties in interface SystemContext
Returns:
reference to the invoker properties set


Test.