Package org.objectweb.joram.mom.util
Class InterceptorsHelper
- java.lang.Object
-
- org.objectweb.joram.mom.util.InterceptorsHelper
-
public class InterceptorsHelper extends Object
Helper class to handle interceptors in destination and user's proxy.
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanDEBUGstatic StringINTERCEPTOR_CLASS_NAME_SEPARATORprivate static Loggerloggerlogger
-
Constructor Summary
Constructors Constructor Description InterceptorsHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddInterceptors(String agentId, String agentName, String interceptorsKey, List<Properties> list, List<MessageInterceptor> interceptors)re-create all interceptorsstatic voidaddInterceptors(String agentId, String agentName, String interceptorsKey, Properties prop, List<MessageInterceptor> interceptors)Add the specified interceptors in the list.static StringgetListInterceptors(List<MessageInterceptor> interceptors)get the interceptors list.private static booleanremoveInterceptor(String interceptorClassName, List<MessageInterceptor> interceptors)Remove the first occurrence of interceptorClassName.static voidremoveInterceptors(String listInterceptorClassName, List<MessageInterceptor> interceptors)Remove the first occurrence of interceptorClassName.static booleanreplaceInterceptor(String agentId, String agentName, String interceptorKeyNew, String interceptorKeyOld, List<MessageInterceptor> interceptors, Properties prop)Replace the first occurrence of oldInterceptor by the newInterceptor.
-
-
-
Field Detail
-
logger
private static final Logger logger
logger
-
DEBUG
private static final boolean DEBUG
-
INTERCEPTOR_CLASS_NAME_SEPARATOR
public static final String INTERCEPTOR_CLASS_NAME_SEPARATOR
- See Also:
- Constant Field Values
-
-
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 agentIdagentName- the agent nameinterceptorsKey- the interceptors key properties see AdminCommandConstantprop- Properties contains the string className interceptorinterceptors- 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 agentIdagentName- the agent nameinterceptorsKey- the interceptors key properties see AdminCommandConstantlist- properties listinterceptors- 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 agentIdagentName- the agent nameinterceptorKeyNew- the new interceptor key properties see AdminCommandConstantinterceptorKeyOld- the old interceptor key properties see AdminCommandConstantinterceptors- the list of the MessageInterceptor instanceprop- 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
-
-