org.jdtaus.core.container
Class ContextFactory

java.lang.Object
  extended by org.jdtaus.core.container.ContextFactory

public abstract class ContextFactory
extends Object

Factory for the Context singleton.

Version:
$Id: ContextFactory.java 8044 2009-07-02 01:29:05Z schulte2005 $
Author:
Christian Schulte

Constructor Summary
ContextFactory()
           
 
Method Summary
static Context getContext()
          Gets the Context singleton.
static Context newContext()
          Creates a new instance of the configured Context implementation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextFactory

public ContextFactory()
Method Detail

getContext

public static Context getContext()
Gets the Context singleton.

By default this class will instantiate a new context and hold it in a static class variable as the singleton to return for other calls. This behaviour can be changed by setting a system property with key org.jdtaus.core.container.ContextFactory to the name of a class defining a public static Context getContext() method returning the singleton instance of Context.

Returns:
the singleton Context instance.
Throws:
ContextError - for unrecoverable context errors.
See Also:
newContext()

newContext

public static Context newContext()
Creates a new instance of the configured Context implementation.

The context implementation to be used can be controlled via a system property with key org.jdtaus.core.container.Context set to a class name to be loaded as the context implementation.

This method should be used by getContext() implementors to retrieve a new Context instance.

Returns:
a new instance of the configured Context implementation.
Throws:
ContextError - for unrecoverable context errors.


Copyright © 2005-2009 jDTAUS. All Rights Reserved.