Class ParserRegistry

  • All Implemented Interfaces:
    NamespaceMappingParser

    public class ParserRegistry
    extends java.lang.Object
    implements NamespaceMappingParser
    ParserRegistry is a namespace-mapping-aware meta-parser which provides a way to delegate the parsing of multi-namespace XML files to appropriate parsers, defined by the ConfigurationParser interface. A registry of available parsers is built using the ServiceLoader system. Implementations of ConfigurationParser should include a META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser file containing a list of available parsers.
    Since:
    5.2
    Author:
    Tristan Tarrant
    • Constructor Detail

      • ParserRegistry

        public ParserRegistry()
      • ParserRegistry

        public ParserRegistry​(java.lang.ClassLoader classLoader)
      • ParserRegistry

        public ParserRegistry​(java.lang.ClassLoader classLoader,
                              boolean defaultOnly,
                              java.util.Properties properties)
    • Method Detail

      • parseFile

        public ConfigurationBuilderHolder parseFile​(java.lang.String filename)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFile

        public ConfigurationBuilderHolder parseFile​(java.io.File file)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • serialize

        public void serialize​(java.io.OutputStream os,
                              GlobalConfiguration globalConfiguration,
                              java.util.Map<java.lang.String,​Configuration> configurations)
                       throws javax.xml.stream.XMLStreamException
        Serializes a full configuration to an OutputStream
        Parameters:
        os - the output stream where the configuration should be serialized to
        globalConfiguration - the global configuration. Can be null
        configurations - a map of named configurations
        Throws:
        javax.xml.stream.XMLStreamException
      • serialize

        public void serialize​(XMLExtendedStreamWriter writer,
                              GlobalConfiguration globalConfiguration,
                              java.util.Map<java.lang.String,​Configuration> configurations)
                       throws javax.xml.stream.XMLStreamException
        Serializes a full configuration to an XMLExtendedStreamWriter
        Parameters:
        writer - the writer where the configuration should be serialized to
        globalConfiguration - the global configuration. Can be null
        configurations - a map of named configurations
        Throws:
        javax.xml.stream.XMLStreamException
      • serialize

        public void serialize​(java.io.OutputStream os,
                              java.lang.String name,
                              Configuration configuration)
                       throws javax.xml.stream.XMLStreamException
        Serializes a single configuration to an OutputStream
        Parameters:
        os -
        name -
        configuration -
        Throws:
        javax.xml.stream.XMLStreamException
      • serialize

        public java.lang.String serialize​(java.lang.String name,
                                          Configuration configuration)
        Serializes a single configuration to a String
        Parameters:
        name - the name of the configuration
        configuration - the Configuration
        Returns:
        the XML representation of the specified configuration