Class PayloadParserRegistry
- java.lang.Object
-
- org.certificateservices.messages.csmessages.PayloadParserRegistry
-
public class PayloadParserRegistry extends java.lang.ObjectClass in charge of maintaining available PayLoadParsers for different pay load content in CS Messages.It contains methods for plug-ins of new pay load to register and de-register its handlers.
Important: before any call to getParser() is done must configure() with an appropriate callback implementation be called.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePayloadParserRegistry.ConfigurationCallbackConfiguration Callback that should be implemented by CSMessageParser that is in charge of managing all registrered pay load parsers.
-
Constructor Summary
Constructors Constructor Description PayloadParserRegistry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidconfigure(PayloadParserRegistry.ConfigurationCallback callback, boolean registerBuiltInPayloads)Setup method that should be called from the CSMessageParser or eqvivalent, and set a ConfigurationCallback implementation in charge of initializing respective payload parser.static voidderegister(java.lang.String namespace)Method to remove a given pay load parser from the registry along with cached instance of the parser.static PayloadParsergetParser(java.lang.String namespace)Method to fetch a initialized PayloadParser for a given name space.static java.util.Set<java.lang.String>getRegistredNamespaces()Method to fetch a set of registered name spaces.static voidregister(java.lang.String namespace, java.lang.Class<? extends PayloadParser> payLoadParser)Method to register a pay load parser as available for processing.
-
-
-
Method Detail
-
configure
public static void configure(PayloadParserRegistry.ConfigurationCallback callback, boolean registerBuiltInPayloads)
Setup method that should be called from the CSMessageParser or eqvivalent, and set a ConfigurationCallback implementation in charge of initializing respective payload parser. Important: This method must be called before any getParser() calls are performed.- Parameters:
callback- the configuration callback to use when initializing created payload providers.registerBuiltInPayloads- if build in payload parsers should be registered when configuring.
-
getParser
public static PayloadParser getParser(java.lang.String namespace) throws MessageProcessingException
Method to fetch a initialized PayloadParser for a given name space.- Parameters:
namespace- the name space to fetch PayloadParser for.- Returns:
- related PayloadParser, never null.
- Throws:
MessageProcessingException- if parser for given name space couldn't be found or internal problems occurred generating the parser.
-
getRegistredNamespaces
public static java.util.Set<java.lang.String> getRegistredNamespaces()
Method to fetch a set of registered name spaces.- Returns:
- set of registered name spaces.
-
register
public static void register(java.lang.String namespace, java.lang.Class<? extends PayloadParser> payLoadParser) throws MessageProcessingExceptionMethod to register a pay load parser as available for processing.- Parameters:
namespace- the name space of the payLoadParser topayLoadParser- the class path of the pay load parser to register.- Throws:
MessageProcessingException
-
deregister
public static void deregister(java.lang.String namespace) throws MessageProcessingExceptionMethod to remove a given pay load parser from the registry along with cached instance of the parser.- Parameters:
namespace- pay load parser to remove.- Throws:
MessageProcessingException
-
-