Class ContextBootstrap


  • public class ContextBootstrap
    extends Object
    The classes in this package were designed to facilitate the integration of the context propagation feature in a server. Through the use of inversion of control, we were able to abstract all the dependencies needed by context propagation thus making this feature easy to port to another server. In this way, we hope to encourage the use of context propagation on other servers.
    • Field Detail

      • IS_DEBUG

        public static boolean IS_DEBUG
    • Constructor Detail

      • ContextBootstrap

        public ContextBootstrap()
    • Method Detail

      • configure

        public static void configure​(LoggerAdapter aLoggerAdapter,
                                     WireAdapter aWireAdapter,
                                     ThreadLocalAccessor aThreadLocalAccessor,
                                     ContextAccessController aContextAccessController,
                                     String aGuid)
        This function must be called by the server prior to using context propagation.
        Parameters:
        loggerAdapter - An adaptor to the logger that is appropriate for context propagation messages.
        tla - An adaptor to the thread management system that allows safe storage of the ContextMap on the current thread.
        contextAccessController - An adaptor to the security manager that is used to determine access to particular work contexts by the user associated to the current thread.
        aGuid - a unique identifier for this process that is suitable for transmission over the wire.
      • getWireAdapter

        public static WireAdapter getWireAdapter()
        Returns:
        The bootstrapped WireAdapter
      • getLoggerAdapter

        public static LoggerAdapter getLoggerAdapter()
        Returns:
        The bootstrapped LoggerAdapter
      • debug

        public static void debug​(LoggerAdapter.MessageID messageID,
                                 Object... args)
        Parameters:
        messageID - a MessageID
        args - The objects to in the message
      • debug

        public static void debug​(Throwable t,
                                 LoggerAdapter.MessageID messageID,
                                 Object... args)
        Parameters:
        t - a Throwable to include in the debug message
        messageID - a MessageID
        args - The objects to in the message
      • getThreadLocalAccessor

        public static ThreadLocalAccessor getThreadLocalAccessor()
        Returns:
        The adaptor to access the ContextMap stored on the curren thread
      • getContextAccessController

        public static ContextAccessController getContextAccessController()
        Returns:
        The adapter that checks acccess permissions.
      • getGuid

        public static String getGuid()
        Returns:
        a String that uniquely identifies this process