org.ow2.bonita.pvm.internal.env
Class BasicEnvironment

java.lang.Object
  extended by org.ow2.bonita.pvm.env.Environment
      extended by org.ow2.bonita.pvm.internal.env.BasicEnvironment
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ExecutionEnvironment, PvmEnvironment, SpringEnvironment

public class BasicEnvironment
extends Environment

Author:
Tom Baeyens
See Also:
Serialized Form

Field Summary
protected  java.lang.ClassLoader classLoader
           
protected  java.util.Map<java.lang.String,Context> contexts
           
protected  java.lang.String[] defaultSearchOrder
           
protected  java.util.ArrayList<java.lang.String> defaultSearchOrderList
           
protected  java.lang.Throwable exception
           
protected  java.lang.String userId
           
 
Constructor Summary
BasicEnvironment()
           
 
Method Summary
 void addContext(Context context)
           
 void close()
          closes the Environment by removing all its contexts.
<T> T
get(java.lang.Class<T> type)
          searches an object based on type.
<T> T
get(java.lang.Class<T> type, java.lang.String[] searchOrder)
          searches an object based on type.
 java.lang.Object get(java.lang.String name)
          searches a named object in all the contexts in the default search order.
 java.lang.Object get(java.lang.String name, java.lang.String[] searchOrder)
          searches a named object in all the contexts in the given search order.
 java.lang.ClassLoader getClassLoader()
           
 Context getContext(java.lang.String contextName)
           
protected  java.lang.String[] getDefaultSearchOrder()
           
 Context getEnvironmentContext()
           
 Context getEnvironmentFactoryContext()
           
 java.lang.String getUserId()
          get the authenticated user id
 void removeContext(Context context)
           
 void setClassLoader(java.lang.ClassLoader classLoader)
           
 void setUserId(java.lang.String userId)
          set the authenticated user id
 
Methods inherited from class org.ow2.bonita.pvm.env.Environment
getCurrent, getFromCurrent, getFromCurrent, getFromCurrent, getFromCurrent, popEnvironment, pushEnvironment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userId

protected java.lang.String userId

contexts

protected java.util.Map<java.lang.String,Context> contexts

defaultSearchOrderList

protected java.util.ArrayList<java.lang.String> defaultSearchOrderList

defaultSearchOrder

protected java.lang.String[] defaultSearchOrder

exception

protected java.lang.Throwable exception

classLoader

protected transient java.lang.ClassLoader classLoader
Constructor Detail

BasicEnvironment

public BasicEnvironment()
Method Detail

getContext

public Context getContext(java.lang.String contextName)
Specified by:
getContext in class Environment

addContext

public void addContext(Context context)
Specified by:
addContext in class Environment

removeContext

public void removeContext(Context context)
Specified by:
removeContext in class Environment

getEnvironmentFactoryContext

public Context getEnvironmentFactoryContext()

getEnvironmentContext

public Context getEnvironmentContext()

getUserId

public java.lang.String getUserId()
Description copied from class: Environment
get the authenticated user id

Specified by:
getUserId in class Environment

setUserId

public void setUserId(java.lang.String userId)
Description copied from class: Environment
set the authenticated user id

Specified by:
setUserId in class Environment

getClassLoader

public java.lang.ClassLoader getClassLoader()
Specified by:
getClassLoader in class Environment

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Specified by:
setClassLoader in class Environment

get

public java.lang.Object get(java.lang.String name)
Description copied from class: Environment
searches a named object in all the contexts in the default search order.

Specified by:
get in class Environment
Returns:
the object if it exists in the environment, null if there is no object with the given name in the environment.

get

public java.lang.Object get(java.lang.String name,
                            java.lang.String[] searchOrder)
Description copied from class: Environment
searches a named object in all the contexts in the given search order. The given search order doesn't have to include all contexts. It can be a subset of the contexts available.

Specified by:
get in class Environment
searchOrder - list of contexts names. The object will be searched in these contexts, in the given order.
Returns:
the object if it exists in the environment, null if there is no object with the given name in the specified searchOrder contexts.

get

public <T> T get(java.lang.Class<T> type)
Description copied from class: Environment
searches an object based on type. The search doesn take superclasses of the context elements into account.

Specified by:
get in class Environment
Returns:
the first object of the given type or null in case no such element was found.

get

public <T> T get(java.lang.Class<T> type,
                 java.lang.String[] searchOrder)
Description copied from class: Environment
searches an object based on type. The search doesn take superclasses of the context elements into account.

Specified by:
get in class Environment
Returns:
the first object of the given type or null in case no such element was found.

close

public void close()
Description copied from class: Environment
closes the Environment by removing all its contexts.

Specified by:
close in class Environment

getDefaultSearchOrder

protected java.lang.String[] getDefaultSearchOrder()


Copyright © 2009 OW2 Consortium. All Rights Reserved.