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 theConfigurationParserinterface. A registry of available parsers is built using theServiceLoadersystem. Implementations ofConfigurationParsershould 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 classParserRegistry.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 ConfigurationBuilderHolderparse(InputStream is)voidparse(InputStream is, ConfigurationBuilderHolder holder)ConfigurationBuilderHolderparse(String s)voidparse(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder)voidparseElement(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder)Recursively parses the current element of an XML stream using an appropriateConfigurationParserdepending on the element's namespace.ConfigurationBuilderHolderparseFile(String filename)voidserialize(OutputStream os, String name, Configuration configuration)Serializes a single configuration to an OutputStreamvoidserialize(OutputStream os, GlobalConfiguration globalConfiguration, Map<String,Configuration> configurations)Serializes a full configuration to anOutputStreamStringserialize(String name, Configuration configuration)Serializes a single configuration to a Stringvoidserialize(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:NamespaceMappingParserRecursively parses the current element of an XML stream using an appropriateConfigurationParserdepending on the element's namespace.- Specified by:
parseElementin 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
-
-