Class ThreadContextFacade
java.lang.Object
org.eclipse.dirigible.commons.api.context.ThreadContextFacade
public class ThreadContextFacade extends Object
Scripting context facade is the centralized place where the different scripting facade providers
can register the request (sync) scoped objects.
-
Constructor Summary
Constructors Constructor Description ThreadContextFacade() -
Method Summary
Modifier and Type Method Description static Objectget(String key)Get a context scripting object.static ObjectgetProxy(String key)Get a proxy scripting object.static booleanisValid()Check whether the facade is valid.static voidremove(String key)Remove a context scripting object.static voidremoveProxy(String key)Remove a proxy scripting object.static Stringset(Object value)Set a context scripting object.static voidset(String key, Object value)Set a context scripting object.static StringsetProxy(Object value)Set a proxy scripting object.static voidsetProxy(String key, Object value)Set a proxy scripting object.static voidsetUp()Initializes the context.static voidtearDown()IMPORTANT! This have to be added at the finally block to clean up objects after the execution of the service.
-
Constructor Details
-
ThreadContextFacade
public ThreadContextFacade()
-
-
Method Details
-
setUp
Initializes the context. This has to be called at the very first (as possible) place at the service entry point- Throws:
ContextException- in case of an error
-
tearDown
IMPORTANT! This have to be added at the finally block to clean up objects after the execution of the service.- Throws:
ContextException- in case of an error
-
get
Get a context scripting object.- Parameters:
key- the key- Returns:
- the value by this key
- Throws:
ContextException- in case of an error
-
set
Set a context scripting object.- Parameters:
value- the value- Returns:
- the UUID of the object
- Throws:
ContextException- in case of an error
-
set
Set a context scripting object. If object with with this key exists, it will be replaced with the new object- Parameters:
key- the keyvalue- the value- Throws:
ContextException- in case of an error
-
remove
Remove a context scripting object.- Parameters:
key- the key- Throws:
ContextException- in case of an error
-
isValid
public static boolean isValid()Check whether the facade is valid.- Returns:
- yes, if it is valid
-
getProxy
Get a proxy scripting object.- Parameters:
key- the key- Returns:
- the value by this key
- Throws:
ContextException- in case of an error
-
setProxy
Set a proxy scripting object.- Parameters:
value- the value- Returns:
- the UUID of the object
- Throws:
ContextException- in case of an error
-
setProxy
Set a proxy scripting object. If proxy object with this key exists, it will be replaced with the new object- Parameters:
key- the keyvalue- the value- Throws:
ContextException- in case of an error
-
removeProxy
Remove a proxy scripting object.- Parameters:
key- the key- Throws:
ContextException- in case of an error
-