Class XmlConfigFile

  • Direct Known Subclasses:
    SolrConfig

    public class XmlConfigFile
    extends Object
    Wrapper around an XML DOM object to provide convenient accessors to it. Intended for XML config files.
    • Method Detail

      • assertWarnOrFail

        public static void assertWarnOrFail​(String reason,
                                            boolean assertCondition,
                                            boolean failCondition)
      • getSubstituteProperties

        protected Properties getSubstituteProperties()
        Returns non-null props to substitute. Param is the base/default set, also non-null.
      • getResourceName

        public String getResourceName()
        Since:
        solr 1.3
      • getName

        public String getName()
      • getDocument

        public Document getDocument()
      • getXPath

        public XPath getXPath()
      • getNode

        public Node getNode​(String path,
                            boolean errifMissing)
      • getUnsubstitutedNode

        public Node getUnsubstitutedNode​(String path,
                                         boolean errIfMissing)
      • getNodeList

        public NodeList getNodeList​(String path,
                                    boolean errIfMissing)
      • getUnknownAttributes

        public Set<String> 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.
      • complainAboutUnknownAttributes

        public void complainAboutUnknownAttributes​(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.
      • getVal

        public String getVal​(String path,
                             boolean errIfMissing)
      • getInt

        public int getInt​(String path)
      • getInt

        public int getInt​(String path,
                          int def)
      • getBool

        public boolean getBool​(String path)
      • getBool

        public boolean getBool​(String path,
                               boolean def)
      • getFloat

        public float getFloat​(String path)
      • getFloat

        public float getFloat​(String path,
                              float def)
      • getDouble

        public double getDouble​(String path)
      • getDouble

        public double getDouble​(String path,
                                double def)
      • getZnodeVersion

        public int getZnodeVersion()
        If this config is loaded from zk the version is relevant other wise -1 is returned