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 final void setUp() throws ContextException
      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

      public static final void tearDown() throws ContextException
      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

      public static final 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 final 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 final 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 final 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
    • getProxy

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

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

      public static final void setProxy​(String key, Object value) throws ContextException
      Set a proxy scripting object. If proxy object 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
    • removeProxy

      public static final void removeProxy​(String key) throws ContextException
      Remove a proxy scripting object.
      Parameters:
      key - the key
      Throws:
      ContextException - in case of an error