Class PayloadParserRegistry


  • public class PayloadParserRegistry
    extends java.lang.Object
    Class 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 interface  PayloadParserRegistry.ConfigurationCallback
      Configuration Callback that should be implemented by CSMessageParser that is in charge of managing all registrered pay load parsers.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      static void deregister​(java.lang.String namespace)
      Method to remove a given pay load parser from the registry along with cached instance of the parser.
      static PayloadParser getParser​(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 void register​(java.lang.String namespace, java.lang.Class<? extends PayloadParser> payLoadParser)
      Method to register a pay load parser as available for processing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PayloadParserRegistry

        public PayloadParserRegistry()
    • 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 MessageProcessingException
        Method to register a pay load parser as available for processing.
        Parameters:
        namespace - the name space of the payLoadParser to
        payLoadParser - the class path of the pay load parser to register.
        Throws:
        MessageProcessingException
      • deregister

        public static void deregister​(java.lang.String namespace)
                               throws MessageProcessingException
        Method 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