Package org.apache.solr.core
Class XmlConfigFile
java.lang.Object
org.apache.solr.core.XmlConfigFile
Wrapper around an XML DOM object to provide convenient accessors to it. Intended for XML config
files.
-
Constructor Summary
ConstructorsConstructorDescriptionXmlConfigFile(SolrResourceLoader loader, String name, InputSource is, String prefix, Properties substituteProps) XmlConfigFile(SolrResourceLoader loader, Function<String, InputStream> fileSupplier, String name, InputSource is, String prefix, Properties substituteProps) Builds a config. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertWarnOrFail(String reason, boolean assertCondition, boolean failCondition) voidcomplainAboutUnknownAttributes(String elementXpath, String... knownAttributes) Logs an error and throws an exception if any of the element(s) at the given elementXpath contains an attribute name that is not among knownAttributes.booleanbooleandoubledoublefloatfloatintintgetName()getNodeList(String path, boolean errIfMissing) protected PropertiesReturns non-null props to substitute.getUnknownAttributes(Element element, String... knownAttributes) Returns the set of attributes on the given element that are not among the given knownAttributes, or null if all attributes are known.getXPath()intIf this config is loaded from zk the version is relevant otherwise -1 is returned
-
Constructor Details
-
XmlConfigFile
public XmlConfigFile(SolrResourceLoader loader, String name, InputSource is, String prefix, Properties substituteProps) throws IOException - Throws:
IOException
-
XmlConfigFile
public XmlConfigFile(SolrResourceLoader loader, Function<String, InputStream> fileSupplier, String name, InputSource is, String prefix, Properties substituteProps) throws IOExceptionBuilds a config.Note that the 'name' parameter is used to obtain a valid input stream if no valid one is provided through 'is'. If no valid stream is provided, a valid SolrResourceLoader instance should be provided through 'loader' so the resource can be opened (@see SolrResourceLoader#openResource); if no SolrResourceLoader instance is provided, a default one will be created.
Consider passing a non-null 'name' parameter in all use-cases since it is used for logging & exception reporting.
- Parameters:
loader- the resource loader used to obtain an input stream if 'is' is nullname- the resource name used if the input stream 'is' is nullis- the resource as a SAX InputSourceprefix- an optional prefix that will be prepended to all non-absolute xpath expressionssubstituteProps- optional property substitution- Throws:
IOException
-
-
Method Details
-
assertWarnOrFail
-
getSubstituteProperties
Returns non-null props to substitute. Param is the base/default set, also non-null. -
getResourceLoader
- Since:
- solr 1.3
-
getResourceName
- Since:
- solr 1.3
-
getName
-
getDocument
-
getXPath
-
evaluate
-
getNode
-
getNode
-
getNodeList
-
getUnknownAttributes
Returns the set of attributes on the given element that are not among the given knownAttributes, or null if all attributes are known. -
complainAboutUnknownAttributes
Logs an error and throws an exception if any of the element(s) at the given elementXpath contains an attribute name that is not among knownAttributes. -
getVal
-
get
-
get
-
getInt
-
getInt
-
getBool
-
getBool
-
getFloat
-
getFloat
-
getDouble
-
getDouble
-
getZnodeVersion
public int getZnodeVersion()If this config is loaded from zk the version is relevant otherwise -1 is returned
-