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 Details

  • 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

      public static Object get​(String key) throws ContextException
      Get a context scripting object.
      Parameters:
      key - the key
      Returns:
      the value by this key
      Throws:
      ContextException - in case of an error
    • set

      public static String set​(Object value) throws ContextException
      Set a context scripting object.
      Parameters:
      value - the value
      Returns:
      the UUID of the object
      Throws:
      ContextException - in case of an error
    • set

      public static void set​(String key, Object value) throws ContextException
      Set a context scripting object. If object with with this key exists, it will be replaced with the new object
      Parameters:
      key - the key
      value - the value
      Throws:
      ContextException - in case of an error
    • remove

      public static void remove​(String key) throws ContextException
      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

      public static void addCloseable​(AutoCloseable closeable)
      Add a closeable object to the map.
      Parameters:
      closeable - the closeable object
    • removeCloseable

      public static void removeCloseable​(AutoCloseable closeable)
      Remove a closeable object.
      Parameters:
      closeable - the closeable object