Class ParserRegistry
- java.lang.Object
-
- org.infinispan.configuration.parsing.ParserRegistry
-
- All Implemented Interfaces:
NamespaceMappingParser
public class ParserRegistry extends 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 theConfigurationParser
interface. A registry of available parsers is built using theServiceLoader
system. Implementations ofConfigurationParser
should include a META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser file containing a list of available parsers.- Since:
- 5.2
- Author:
- Tristan Tarrant
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ParserRegistry.NamespaceParserPair
-
Constructor Summary
Constructors Constructor Description ParserRegistry()
ParserRegistry(ClassLoader classLoader)
ParserRegistry(ClassLoader classLoader, boolean defaultOnly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationBuilderHolder
parse(InputStream is)
void
parse(InputStream is, ConfigurationBuilderHolder holder)
ConfigurationBuilderHolder
parse(String s)
void
parse(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder)
void
parseElement(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder)
Recursively parses the current element of an XML stream using an appropriateConfigurationParser
depending on the element's namespace.ConfigurationBuilderHolder
parseFile(String filename)
void
serialize(OutputStream os, String name, Configuration configuration)
Serializes a single configuration to an OutputStreamvoid
serialize(OutputStream os, GlobalConfiguration globalConfiguration, Map<String,Configuration> configurations)
Serializes a full configuration to anOutputStream
String
serialize(String name, Configuration configuration)
Serializes a single configuration to a Stringvoid
serialize(XMLExtendedStreamWriter writer, GlobalConfiguration globalConfiguration, Map<String,Configuration> configurations)
Serializes a full configuration to anXMLExtendedStreamWriter
-
-
-
Constructor Detail
-
ParserRegistry
public ParserRegistry()
-
ParserRegistry
public ParserRegistry(ClassLoader classLoader)
-
ParserRegistry
public ParserRegistry(ClassLoader classLoader, boolean defaultOnly)
-
-
Method Detail
-
parseFile
public ConfigurationBuilderHolder parseFile(String filename) throws IOException
- Throws:
IOException
-
parse
public ConfigurationBuilderHolder parse(String s)
-
parse
public ConfigurationBuilderHolder parse(InputStream is)
-
parse
public void parse(InputStream is, ConfigurationBuilderHolder holder) throws XMLStreamException
- Throws:
XMLStreamException
-
parse
public void parse(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException
- Throws:
XMLStreamException
-
parseElement
public void parseElement(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException
Description copied from interface:NamespaceMappingParser
Recursively parses the current element of an XML stream using an appropriateConfigurationParser
depending on the element's namespace.- Specified by:
parseElement
in interfaceNamespaceMappingParser
- Parameters:
reader
- the XML stream readerholder
- a configuration holder- Throws:
XMLStreamException
-
serialize
public void serialize(OutputStream os, GlobalConfiguration globalConfiguration, Map<String,Configuration> configurations) throws XMLStreamException
Serializes a full configuration to anOutputStream
- Parameters:
os
- the output stream where the configuration should be serialized toglobalConfiguration
- the global configuration. Can be nullconfigurations
- a map of named configurations- Throws:
XMLStreamException
-
serialize
public void serialize(XMLExtendedStreamWriter writer, GlobalConfiguration globalConfiguration, Map<String,Configuration> configurations) throws XMLStreamException
Serializes a full configuration to anXMLExtendedStreamWriter
- Parameters:
writer
- the writer where the configuration should be serialized toglobalConfiguration
- the global configuration. Can be nullconfigurations
- a map of named configurations- Throws:
XMLStreamException
-
serialize
public void serialize(OutputStream os, String name, Configuration configuration) throws XMLStreamException
Serializes a single configuration to an OutputStream- Parameters:
os
-name
-configuration
-- Throws:
XMLStreamException
-
serialize
public String serialize(String name, Configuration configuration)
Serializes a single configuration to a String- Parameters:
name
- the name of the configurationconfiguration
- theConfiguration
- Returns:
- the XML representation of the specified configuration
-
-