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 voidaddCloseable(AutoCloseable closeable)Add a closeable object to the map.static Objectget(String key)Get a context scripting object.static booleanisValid()Check whether the facade is valid.static voidremove(String key)Remove a context scripting object.static voidremoveCloseable(AutoCloseable closeable)Remove a closeable object.static Stringset(Object value)Set a context scripting object.static voidset(String key, Object value)Set a context 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
public static void setUp()Initializes the context. This has to be called at the very first (as possible) place at the service entry point -
tearDown
public static void tearDown()IMPORTANT! This have to be added at the finally block to clean up objects after the execution of the service. -
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
-
addCloseable
Add a closeable object to the map.- Parameters:
closeable- the closeable object
-
removeCloseable
Remove a closeable object.- Parameters:
closeable- the closeable object
-