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, Properties properties)
-
Method Summary
-
-
-
Constructor Detail
-
ParserRegistry
public ParserRegistry()
-
ParserRegistry
public ParserRegistry(ClassLoader classLoader)
-
ParserRegistry
public ParserRegistry(ClassLoader classLoader, boolean defaultOnly, Properties properties)
-
-
Method Detail
-
parse
public ConfigurationBuilderHolder parse(URL url) throws IOException
- Throws:
IOException
-
parseFile
public ConfigurationBuilderHolder parseFile(String filename) throws IOException
- Throws:
IOException
-
parseFile
public ConfigurationBuilderHolder parseFile(File file) throws IOException
- Throws:
IOException
-
parse
public ConfigurationBuilderHolder parse(String s)
-
parse
public ConfigurationBuilderHolder parse(InputStream is, XMLResourceResolver resourceResolver)
Parses the suppliedInputStreamreturning a newConfigurationBuilderHolder- Parameters:
is- anInputStreampointing to a configuration fileresourceResolver- an optional resolver for Xinclude- Returns:
- a new
ConfigurationBuilderHolderwhich contains the parsed configuration
-
parse
public ConfigurationBuilderHolder parse(URL url, ConfigurationBuilderHolder holder) throws IOException, XMLStreamException
- Throws:
IOExceptionXMLStreamException
-
parse
public ConfigurationBuilderHolder parse(InputStream is, ConfigurationBuilderHolder holder, XMLResourceResolver resourceResolver) throws XMLStreamException
- Throws:
XMLStreamException
-
parse
public ConfigurationBuilderHolder 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
-
-