org.jboss.kernel
Class KernelFactory

java.lang.Object
  extended by org.jboss.kernel.KernelFactory

public class KernelFactory
extends Object

A KernelFactory is an implementation of the Factory design pattern that can construct new instances of Kernel objects.

If no KernelConfig is given to the KernelFactory, the KernelFactory will attempt to construct a KernelConfig object by using System properties (i.e. System.getProperties()).

Version:
$Revision: 1.5 $
Author:
Les A. Hazlewood

Field Summary
protected  org.jboss.logging.Logger log
          The logger
 
Method Summary
protected  Kernel assembleNewKernel(KernelConfig cfg)
          Instantiates, configures, and initializes a new Kernel instance according to the specified KernelConfig parameter.
protected  void configureKernel(Kernel kernel, KernelConfig cfg)
          Configures the specified Kernel according to the specified KernelConfig parameter.
protected  Kernel createKernel()
          Constructs and returns a new, unconfigured, uninitialized Kernel instance.
protected  KernelInitializer createKernelInitializer(KernelConfig config)
          Constructs a KernelInitializer based on the specified KernelConfig parameter.
protected  void initializeKernel(Kernel kernel, KernelInitializer initializer)
          Initializes the specified Kernel according to the specified KernelInitializer parameter.
static Kernel newInstance(KernelConfig cfg)
          Returns a new instance of a Kernel based on the specified KernelConfig parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.jboss.logging.Logger log
The logger

Method Detail

newInstance

public static Kernel newInstance(KernelConfig cfg)
Returns a new instance of a Kernel based on the specified KernelConfig parameter.

Parameters:
cfg - the configuration used to construct a new Kernel object.
Returns:
a new Kernel instance constructed according to the specified configuration.

assembleNewKernel

protected Kernel assembleNewKernel(KernelConfig cfg)
                            throws RuntimeException
Instantiates, configures, and initializes a new Kernel instance according to the specified KernelConfig parameter.

Parameters:
cfg - the KernelConfig that will be used in constructing a new Kernel.
Returns:
a newly constructed Kernel object configured according to the specified KernelConfig parameter.
Throws:
RuntimeException

createKernel

protected Kernel createKernel()
Constructs and returns a new, unconfigured, uninitialized Kernel instance. Configuration and initialization will be done explicitly in the construction process via the configureKernel and initializeKernel methods, respectively.

Returns:
An unconfigured, uninitialized Kernel instance.

createKernelInitializer

protected KernelInitializer createKernelInitializer(KernelConfig config)
Constructs a KernelInitializer based on the specified KernelConfig parameter. This initializer is used in the initializeKernel method during Kernel construction.

Parameters:
config - the configuration with which to construct a new KernelInitializer instance.
Returns:
a new KernelInitializer instance based on the specified KernelConfig.
Throws:
RuntimeException - if the config object cannot properly construct a new KernelInitializer

configureKernel

protected void configureKernel(Kernel kernel,
                               KernelConfig cfg)
Configures the specified Kernel according to the specified KernelConfig parameter.

Parameters:
kernel - a new, unconfigured Kernel instance.
cfg - the KernelConfig to use to configure the specified Kernel parameter.
Throws:
RuntimeException - if the KernelConfig cannot be updated with the Kernel object.

initializeKernel

protected void initializeKernel(Kernel kernel,
                                KernelInitializer initializer)
Initializes the specified Kernel according to the specified KernelInitializer parameter.

Parameters:
kernel - a new, uninitialized Kernel instance.
initializer - the KernelInitializer to use to initialize the specified Kernel parameter.
Throws:
RuntimeException - if the KernelInitializer cannot initialize the given Kernel parameter.


Copyright © 2004 JBoss Inc. All Rights Reserved.