org.apache.solr.core
Class Config

java.lang.Object
  extended by org.apache.solr.core.Config
Direct Known Subclasses:
SolrConfig

public class Config
extends Object

Version:
$Id: Config.java 820652 2009-10-01 13:32:22Z gsingers $

Field Summary
static org.slf4j.Logger log
           
 
Constructor Summary
Config(SolrResourceLoader loader, String name)
          Builds a config from a resource name with no xpath prefix.
Config(SolrResourceLoader loader, String name, InputStream is, String prefix)
          Builds a config:
Config(String name, InputStream is, String prefix)
          Deprecated. Use Config(SolrResourceLoader, String, InputStream, String) instead.
 
Method Summary
 Object evaluate(String path, QName type)
           
 Class findClass(String cname, String... subpackages)
          Deprecated. Use SolrResourceLoader.findClass(String, String[]) instead.
 String get(String path)
           
 String get(String path, String def)
           
 boolean getBool(String path)
           
 boolean getBool(String path, boolean def)
           
 String getConfigDir()
          Deprecated. Use SolrResourceLoader.getConfigDir() instead.
 Document getDocument()
           
 double getDouble(String path)
           
 double getDouble(String path, double def)
           
 float getFloat(String path)
           
 float getFloat(String path, float def)
           
 String getInstanceDir()
          Deprecated. Use SolrResourceLoader.getInstanceDir() instead.
 int getInt(String path)
           
 int getInt(String path, int def)
           
 List<String> getLines(String resource)
          Deprecated. Use SolrResourceLoader.getLines(String) instead.
 String getName()
           
 Node getNode(String path, boolean errIfMissing)
           
 SolrResourceLoader getResourceLoader()
           
 String getResourceName()
           
 String getVal(String path, boolean errIfMissing)
           
 XPath getXPath()
           
 Object newInstance(String cname, String... subpackages)
          Deprecated. Use SolrResourceLoader.newInstance(String, String[]) instead.
 InputStream openResource(String resource)
          Deprecated. Use SolrResourceLoader.openResource(String) instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.slf4j.Logger log
Constructor Detail

Config

@Deprecated
public Config(String name,
                         InputStream is,
                         String prefix)
       throws ParserConfigurationException,
              IOException,
              SAXException
Deprecated. Use Config(SolrResourceLoader, String, InputStream, String) instead.

Throws:
ParserConfigurationException
IOException
SAXException

Config

public Config(SolrResourceLoader loader,
              String name)
       throws ParserConfigurationException,
              IOException,
              SAXException
Builds a config from a resource name with no xpath prefix.

Parameters:
loader -
name -
Throws:
ParserConfigurationException
IOException
SAXException

Config

public Config(SolrResourceLoader loader,
              String name,
              InputStream is,
              String prefix)
       throws ParserConfigurationException,
              IOException,
              SAXException
Builds 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 null
name - the resource name used if the input stream 'is' is null
is - the resource as a stream
prefix - an optional prefix that will be preprended to all non-absolute xpath expressions
Throws:
ParserConfigurationException
IOException
SAXException
Method Detail

getResourceLoader

public SolrResourceLoader getResourceLoader()
Since:
solr 1.3

getResourceName

public String getResourceName()
Since:
solr 1.3

getName

public String getName()

getDocument

public Document getDocument()

getXPath

public XPath getXPath()

evaluate

public Object evaluate(String path,
                       QName type)

getNode

public Node getNode(String path,
                    boolean errIfMissing)

getVal

public String getVal(String path,
                     boolean errIfMissing)

get

public String get(String path)

get

public String get(String path,
                  String def)

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)

getConfigDir

@Deprecated
public String getConfigDir()
Deprecated. Use SolrResourceLoader.getConfigDir() instead.


openResource

@Deprecated
public InputStream openResource(String resource)
Deprecated. Use SolrResourceLoader.openResource(String) instead.


getLines

@Deprecated
public List<String> getLines(String resource)
                      throws IOException
Deprecated. Use SolrResourceLoader.getLines(String) instead.

Throws:
IOException

findClass

@Deprecated
public Class findClass(String cname,
                                  String... subpackages)
Deprecated. Use SolrResourceLoader.findClass(String, String[]) instead.


newInstance

@Deprecated
public Object newInstance(String cname,
                                     String... subpackages)
Deprecated. Use SolrResourceLoader.newInstance(String, String[]) instead.


getInstanceDir

@Deprecated
public String getInstanceDir()
Deprecated. Use SolrResourceLoader.getInstanceDir() instead.



Copyright © 2010 Apache Software Foundation. All Rights Reserved.