Package com.hazelcast.config
Class XmlConfigBuilder
- java.lang.Object
-
- com.hazelcast.config.AbstractConfigBuilder
-
- com.hazelcast.config.AbstractXmlConfigHelper
-
- com.hazelcast.config.AbstractXmlConfigBuilder
-
- com.hazelcast.config.XmlConfigBuilder
-
- All Implemented Interfaces:
ConfigBuilder
public class XmlConfigBuilder extends AbstractXmlConfigBuilder implements ConfigBuilder
A XMLConfigBuilder
implementation.Unlike
Config.load()
and its variants, a configuration constructed viaXmlConfigBuilder
does not apply overrides found in environment variables/system properties.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.hazelcast.config.AbstractXmlConfigBuilder
AbstractXmlConfigBuilder.ConfigType
-
-
Field Summary
-
Fields inherited from class com.hazelcast.config.AbstractXmlConfigHelper
domLevel3
-
-
Constructor Summary
Constructors Constructor Description XmlConfigBuilder()
Constructs a XmlConfigBuilder that tries to find a usable XML configuration file.XmlConfigBuilder(com.hazelcast.internal.config.XmlConfigLocator locator)
Constructs aXmlConfigBuilder
that loads the configuration with the providedXmlConfigLocator
.XmlConfigBuilder(java.io.InputStream inputStream)
Constructs a XmlConfigBuilder that reads from the given InputStream.XmlConfigBuilder(java.lang.String xmlFileName)
Constructs a XmlConfigBuilder that reads from the provided XML file.XmlConfigBuilder(java.net.URL url)
Constructs a XMLConfigBuilder that reads from the given URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Config
build()
Builds Config object.protected AbstractXmlConfigBuilder.ConfigType
getConfigType()
protected org.w3c.dom.Document
parse(java.io.InputStream is)
Reads XML from InputStream and parses.XmlConfigBuilder
setProperties(java.util.Properties properties)
Sets the used properties.-
Methods inherited from class com.hazelcast.config.AbstractXmlConfigBuilder
getProperties, process, setPropertiesInternal
-
Methods inherited from class com.hazelcast.config.AbstractXmlConfigHelper
appendToken, getNamespaceType, getReleaseVersion, loadSchemaFile, schemaValidation, xmlToJavaName
-
Methods inherited from class com.hazelcast.config.AbstractConfigBuilder
shouldValidateTheSchema
-
-
-
-
Constructor Detail
-
XmlConfigBuilder
public XmlConfigBuilder(java.lang.String xmlFileName) throws java.io.FileNotFoundException
Constructs a XmlConfigBuilder that reads from the provided XML file.- Parameters:
xmlFileName
- the name of the XML file that the XmlConfigBuilder reads from- Throws:
java.io.FileNotFoundException
- if the file can't be found
-
XmlConfigBuilder
public XmlConfigBuilder(java.io.InputStream inputStream)
Constructs a XmlConfigBuilder that reads from the given InputStream.- Parameters:
inputStream
- the InputStream containing the XML configuration- Throws:
java.lang.IllegalArgumentException
- if inputStream isnull
-
XmlConfigBuilder
public XmlConfigBuilder(java.net.URL url) throws java.io.IOException
Constructs a XMLConfigBuilder that reads from the given URL.- Parameters:
url
- the given url that the XMLConfigBuilder reads from- Throws:
java.io.IOException
- if URL is invalid
-
XmlConfigBuilder
public XmlConfigBuilder()
Constructs a XmlConfigBuilder that tries to find a usable XML configuration file.
-
XmlConfigBuilder
@PrivateApi public XmlConfigBuilder(com.hazelcast.internal.config.XmlConfigLocator locator)
Constructs aXmlConfigBuilder
that loads the configuration with the providedXmlConfigLocator
.If the provided
XmlConfigLocator
isnull
, a new instance is created and the config is located in every possible places. For these places, please seeXmlConfigLocator
.If the provided
XmlConfigLocator
is notnull
, it is expected that it already located the configuration XML to load from. No further attempt to locate the configuration XML is made if the configuration XML is not located already.- Parameters:
locator
- the configured locator to use
-
-
Method Detail
-
setProperties
public XmlConfigBuilder setProperties(java.util.Properties properties)
Sets the used properties. Can be null if no properties should be used.Properties are used to resolve ${variable} occurrences in the XML file.
- Parameters:
properties
- the new properties- Returns:
- the XmlConfigBuilder
-
getConfigType
protected AbstractXmlConfigBuilder.ConfigType getConfigType()
- Specified by:
getConfigType
in classAbstractXmlConfigBuilder
- Returns:
- ConfigType of current config class as enum value
-
build
public Config build()
Description copied from interface:ConfigBuilder
Builds Config object.- Specified by:
build
in interfaceConfigBuilder
- Returns:
- Built Config object
-
parse
protected org.w3c.dom.Document parse(java.io.InputStream is) throws java.lang.Exception
Description copied from class:AbstractXmlConfigBuilder
Reads XML from InputStream and parses.- Specified by:
parse
in classAbstractXmlConfigBuilder
- Parameters:
is
-InputStream
to read from- Returns:
- Document after parsing XML
- Throws:
java.lang.Exception
- if the XML configuration cannot be parsed or is invalid
-
-