Expresso 5-6

com.jcorporate.expresso.kernel
Class SystemFactory

java.lang.Object
  extended bycom.jcorporate.expresso.kernel.SystemFactory

public class SystemFactory
extends Object

This class is the focalpoint class that constructs the Expresso Runtime system. It loads the Expresso Services files, Metadata files and constructs everything as needed.

Typical Usage for loading the expresso services configuration from the classpath:

 globalContainer = SystemFactory.buildExpressoComponentSystem(
 this.getClass().getResource("Test1ExpressoServices.xml"),
 this.getClass().getResource("TestLog4jConfig.xml"),
 "/My/Log/Location");
 

Author:
Michael Rimov

Field Summary
static String DEFAULT_EXPRESSO_SERVICES
          Default filename to look for in classloader if all else fails.
 
Constructor Summary
protected SystemFactory()
          Default constructor.... should not be accessed directly.
 
Method Summary
 void buildAndInitializeComponents(RootContainerInterface root, ExpressoServicesConfig esc)
          Goes through and initializes the individual Expresso Components
static RootContainerInterface buildExpressoComponentSystem(String servicesFile, String loggingConfiguration, String logDir)
          Basic initialization system.
static RootContainerInterface buildExpressoComponentSystem(URL servicesFile, URL loggingConfiguration, String logDir)
          Classloader compatable version of the factory system.
 ComponentContainer constructComponentContainer()
          Single location that constructs all the Container Implementation classes.
static SystemFactory getInstance()
          Factory Method.
protected  RootContainerInterface initialize(String servicesFile, String loggingConfiguration, String logDir)
          Protected initialization.
protected  RootContainerInterface initialize(URL servicesFile, URL loggingConfiguration, String logDir)
          Internal usage of the initialization system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EXPRESSO_SERVICES

public static final String DEFAULT_EXPRESSO_SERVICES
Default filename to look for in classloader if all else fails.

See Also:
Constant Field Values
Constructor Detail

SystemFactory

protected SystemFactory()
Default constructor.... should not be accessed directly.

Method Detail

getInstance

public static SystemFactory getInstance()
Factory Method.

Returns:
an instantiated SystemFactory object

buildExpressoComponentSystem

public static RootContainerInterface buildExpressoComponentSystem(String servicesFile,
                                                                  String loggingConfiguration,
                                                                  String logDir)
                                                           throws ConfigurationException
Basic initialization system.

Parameters:
servicesFile - The path location of the services file. If null, the system will attempt to use the ClassLoader to locate an expresso-services file.
loggingConfiguration - The location of the logging configuration file. If null, the system will be initialized via a log4j.xml file in the classpath.
logDir - the location where Expresso wants to use as a logging directory.
Returns:
an instantiated Root container.
Throws:
ConfigurationException

buildExpressoComponentSystem

public static RootContainerInterface buildExpressoComponentSystem(URL servicesFile,
                                                                  URL loggingConfiguration,
                                                                  String logDir)
                                                           throws ConfigurationException
Classloader compatable version of the factory system.

Parameters:
servicesFile - A URL to the services file. (Might be from a Class.loadResource() call.
loggingConfiguration - A URL to the logging configuration file (Might also be from a Class.loadResource() file
logDir - the path location of the log files (optional)
Returns:
A built RootContainer implementation.
Throws:
ConfigurationException

buildAndInitializeComponents

public void buildAndInitializeComponents(RootContainerInterface root,
                                         ExpressoServicesConfig esc)
                                  throws ConfigurationException
Goes through and initializes the individual Expresso Components

Parameters:
root - the Root container to populate
esc - the services config file that contains what components should be initialized into the
Throws:
ConfigurationException

constructComponentContainer

public ComponentContainer constructComponentContainer()
Single location that constructs all the Container Implementation classes. This can be extended here to allow for loading of other 'pluggable' implementations at a later time

Returns:
a ComponentContainer implementation.

initialize

protected RootContainerInterface initialize(URL servicesFile,
                                            URL loggingConfiguration,
                                            String logDir)
                                     throws ConfigurationException
Internal usage of the initialization system. It is synchronized so there is only one runtime parsed and added to a particular Virtual Machine at a time [should help solve any weird initialization race conditions and we aren't quite so worried about startup time]

Parameters:
servicesFile - A URL to the services file. (Might be from a Class.loadResource() call.
loggingConfiguration - A URL to the logging configuration file (Might also be from a Class.loadResource() file
logDir - the path location of the log files (optional)
Returns:
A built RootContainer implementation.
Throws:
ConfigurationException

initialize

protected RootContainerInterface initialize(String servicesFile,
                                            String loggingConfiguration,
                                            String logDir)
                                     throws ConfigurationException
Protected initialization.

Parameters:
servicesFile - The path location of the services file. If null, the system will attempt to use the ClassLoader to locate an expresso-services file.
loggingConfiguration - The location of the logging configuration file. If null, the system will be initialized via a log4j.xml file in the classpath.
logDir - the location where Expresso wants to use as a logging directory.
Returns:
an instantiated RootContainerInterface instance
Throws:
ConfigurationException - upon configuration startup error

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.