Class InterceptorsHelper


  • public class InterceptorsHelper
    extends Object
    Helper class to handle interceptors in destination and user's proxy.
    • Field Detail

      • logger

        private static final Logger logger
        logger
      • DEBUG

        private static final boolean DEBUG
    • Constructor Detail

      • InterceptorsHelper

        public InterceptorsHelper()
    • Method Detail

      • addInterceptors

        public static void addInterceptors​(String agentId,
                                           String agentName,
                                           String interceptorsKey,
                                           Properties prop,
                                           List<MessageInterceptor> interceptors)
                                    throws Exception
        Add the specified interceptors in the list.
        Parameters:
        agentId - the string representation of agentId
        agentName - the agent name
        interceptorsKey - the interceptors key properties see AdminCommandConstant
        prop - Properties contains the string className interceptor
        interceptors - the list of the MessageInterceptor instance
        Throws:
        Exception
      • addInterceptors

        public static void addInterceptors​(String agentId,
                                           String agentName,
                                           String interceptorsKey,
                                           List<Properties> list,
                                           List<MessageInterceptor> interceptors)
                                    throws Exception
        re-create all interceptors
        Parameters:
        agentId - the string representation of agentId
        agentName - the agent name
        interceptorsKey - the interceptors key properties see AdminCommandConstant
        list - properties list
        interceptors - the list of the MessageInterceptor instance
        Throws:
        Exception
      • removeInterceptor

        private static boolean removeInterceptor​(String interceptorClassName,
                                                 List<MessageInterceptor> interceptors)
        Remove the first occurrence of interceptorClassName.
        Parameters:
        interceptorClassName - the interceptor to remove.
        interceptors - the list of the MessageInterceptor instance
        Returns:
        true if removed.
      • removeInterceptors

        public static void removeInterceptors​(String listInterceptorClassName,
                                              List<MessageInterceptor> interceptors)
                                       throws Exception
        Remove the first occurrence of interceptorClassName.
        Parameters:
        listInterceptorClassName - list of string className interceptors (separate by INTERCEPTOR_CLASS_NAME_SEPARATOR)
        interceptors - the list of the MessageInterceptor instance
        Throws:
        Exception
      • replaceInterceptor

        public static boolean replaceInterceptor​(String agentId,
                                                 String agentName,
                                                 String interceptorKeyNew,
                                                 String interceptorKeyOld,
                                                 List<MessageInterceptor> interceptors,
                                                 Properties prop)
                                          throws Exception
        Replace the first occurrence of oldInterceptor by the newInterceptor.
        Parameters:
        agentId - the string representation of agentId
        agentName - the agent name
        interceptorKeyNew - the new interceptor key properties see AdminCommandConstant
        interceptorKeyOld - the old interceptor key properties see AdminCommandConstant
        interceptors - the list of the MessageInterceptor instance
        prop - Properties contains the string className interceptor
        Returns:
        true if replaced.
        Throws:
        Exception
      • getListInterceptors

        public static String getListInterceptors​(List<MessageInterceptor> interceptors)
        get the interceptors list.
        Parameters:
        interceptors - the interceptors List.
        Returns:
        string representation of interceptors List separate by INTERCEPTOR_CLASS_NAME_SEPARATOR