org.jbpm.env.impl
Class DefaultEnvironmentFactory

java.lang.Object
  extended by org.jbpm.env.EnvironmentFactory
      extended by org.jbpm.env.impl.DefaultEnvironmentFactory
All Implemented Interfaces:
java.io.Serializable, Context

public class DefaultEnvironmentFactory
extends EnvironmentFactory
implements Context

an environment factory that also is the application context.

This environment factory will produce environments with 2 contexts: the application context and the block context.

An application context is build from two wire definitions: the application wire definition and the environment wire definition.

The application context itself is build from the application wire definition. So all objects that are created in this context remain cached for the lifetime of this application context object.

This application context is also a environment factory. The produced environments contain 2 contexts: the application context itself and a new environment context, build from the environment wire definition. For each created environment, a new environment context will be created from the same environment wire definition. Objects in the environment context will live for as long as the environment.

Author:
Tom Baeyens
See Also:
Serialized Form

Field Summary
protected  WireContext applicationWireContext
           
protected  WireDefinition blockWireDefinition
           
protected static EnvironmentParser environmentParser
           
protected  java.util.List<java.lang.Class<?>> hiddenExceptionTypes
           
 
Fields inherited from class org.jbpm.env.EnvironmentFactory
parser
 
Constructor Summary
DefaultEnvironmentFactory()
           
 
Method Summary
 void close()
          closes this environment factory and cleans any allocated resources.
<T> T
get(java.lang.Class<T> type)
           
 java.lang.Object get(java.lang.String key)
           
 WireContext getApplicationWireContext()
           
 WireDefinition getBlockContextDefinition()
           
 WireDefinition getBlockWireDefinition()
           
 java.util.List<java.lang.Class<?>> getHiddenExceptionTypes()
           
 java.lang.String getName()
           
 void handleException(DefaultEnvironment defaultEnvironment, java.lang.Throwable exception)
           
 boolean has(java.lang.String key)
           
 java.util.Set<java.lang.String> keys()
           
protected  boolean mustBeLogged(java.lang.Throwable exception)
           
 Environment openEnvironment()
          open a new Environment.
 java.lang.Object set(java.lang.String key, java.lang.Object value)
           
 void setApplicationWireContext(WireContext applicationWireContext)
           
 void setBlockWireDefinition(WireDefinition blockWireDefinition)
           
 void setEnvironment(Environment environment)
          invoked by the environment when this context is added.
 void setHiddenExceptionTypes(java.util.List<java.lang.Class<?>> hiddenExceptionTypes)
           
 
Methods inherited from class org.jbpm.env.EnvironmentFactory
getParser, parse, push, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

environmentParser

protected static EnvironmentParser environmentParser

applicationWireContext

protected WireContext applicationWireContext

blockWireDefinition

protected WireDefinition blockWireDefinition

hiddenExceptionTypes

protected java.util.List<java.lang.Class<?>> hiddenExceptionTypes
Constructor Detail

DefaultEnvironmentFactory

public DefaultEnvironmentFactory()
Method Detail

openEnvironment

public Environment openEnvironment()
Description copied from class: EnvironmentFactory
open a new Environment. The client is responsible for closing the environment with Environment.close().

Specified by:
openEnvironment in class EnvironmentFactory

setEnvironment

public void setEnvironment(Environment environment)
Description copied from interface: Context
invoked by the environment when this context is added.

Specified by:
setEnvironment in interface Context

close

public void close()
Description copied from class: EnvironmentFactory
closes this environment factory and cleans any allocated resources.

Specified by:
close in class EnvironmentFactory

handleException

public void handleException(DefaultEnvironment defaultEnvironment,
                            java.lang.Throwable exception)

mustBeLogged

protected boolean mustBeLogged(java.lang.Throwable exception)

get

public java.lang.Object get(java.lang.String key)
Specified by:
get in interface Context

get

public <T> T get(java.lang.Class<T> type)
Specified by:
get in interface Context

getName

public java.lang.String getName()
Specified by:
getName in interface Context

has

public boolean has(java.lang.String key)
Specified by:
has in interface Context

keys

public java.util.Set<java.lang.String> keys()
Specified by:
keys in interface Context

set

public java.lang.Object set(java.lang.String key,
                            java.lang.Object value)
Specified by:
set in interface Context

getBlockContextDefinition

public WireDefinition getBlockContextDefinition()

setBlockWireDefinition

public void setBlockWireDefinition(WireDefinition blockWireDefinition)

getHiddenExceptionTypes

public java.util.List<java.lang.Class<?>> getHiddenExceptionTypes()

setHiddenExceptionTypes

public void setHiddenExceptionTypes(java.util.List<java.lang.Class<?>> hiddenExceptionTypes)

getApplicationWireContext

public WireContext getApplicationWireContext()

setApplicationWireContext

public void setApplicationWireContext(WireContext applicationWireContext)

getBlockWireDefinition

public WireDefinition getBlockWireDefinition()