mirror of https://github.com/apache/lucene.git
SOLR-1930: remove Config and ResourceLoader deprecations
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1054165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cf43718bca
commit
8fb5053a84
|
@ -51,15 +51,6 @@ public class Config {
|
|||
private final String name;
|
||||
private final SolrResourceLoader loader;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #Config(SolrResourceLoader, String, InputStream, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Config(String name, InputStream is, String prefix) throws ParserConfigurationException, IOException, SAXException
|
||||
{
|
||||
this( null, name, is, prefix );
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a config from a resource name with no xpath prefix.
|
||||
* @param loader
|
||||
|
@ -310,55 +301,4 @@ public class Config {
|
|||
|
||||
return version;
|
||||
}
|
||||
|
||||
// The following functions were moved to ResourceLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SolrResourceLoader#getConfigDir()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getConfigDir() {
|
||||
return loader.getConfigDir();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SolrResourceLoader#openResource(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public InputStream openResource(String resource) {
|
||||
return loader.openResource(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SolrResourceLoader#getLines(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public List<String> getLines(String resource) throws IOException {
|
||||
return loader.getLines(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SolrResourceLoader#findClass(String, String[])} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Class findClass(String cname, String... subpackages) {
|
||||
return loader.findClass(cname, subpackages);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SolrResourceLoader#newInstance(String, String[])} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Object newInstance(String cname, String ... subpackages) {
|
||||
return loader.newInstance(cname, subpackages);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SolrResourceLoader#getInstanceDir()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getInstanceDir() {
|
||||
return loader.getInstanceDir();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -636,10 +636,7 @@ public class SolrResourceLoader implements ResourceLoader
|
|||
}
|
||||
return normalizeDir( home );
|
||||
}
|
||||
@Deprecated
|
||||
public static String locateInstanceDir() {
|
||||
return locateSolrHome();
|
||||
}
|
||||
|
||||
|
||||
public String getInstanceDir() {
|
||||
return instanceDir;
|
||||
|
|
|
@ -65,54 +65,6 @@ public class DirectSolrConnection
|
|||
parser = new SolrRequestParsers( c.getSolrConfig() );
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is designed to make it easy for JNI embedded applications
|
||||
* to setup the entire solr environment with a simple interface. It takes three parameters:
|
||||
*
|
||||
* <code>instanceDir:</code> The solr instance directory. If null, it will check the standard
|
||||
* places first (JNDI,properties,"solr" directory)
|
||||
*
|
||||
* <code>dataDir:</code> where the index is stored.
|
||||
*
|
||||
* <code>loggingPath:</code> Path to a java.util.logging.config.file. If the path represents
|
||||
* an absolute path or is relative to the CWD, it will use that. Next it will try a path
|
||||
* relative to the instanceDir. If none of these files exist, it will error.
|
||||
*/
|
||||
public DirectSolrConnection( String instanceDir, String dataDir, String loggingPath )
|
||||
{
|
||||
// If a loggingPath is specified, try using that (this needs to happen first)
|
||||
if( loggingPath != null ) {
|
||||
File loggingConfig = new File( loggingPath );
|
||||
if( !loggingConfig.exists() && instanceDir != null ) {
|
||||
loggingConfig = new File( new File(instanceDir), loggingPath );
|
||||
}
|
||||
if( loggingConfig.exists() ) {
|
||||
System.setProperty("java.util.logging.config.file", loggingConfig.getAbsolutePath() );
|
||||
}
|
||||
else {
|
||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "can not find logging file: "+loggingConfig );
|
||||
}
|
||||
}
|
||||
|
||||
if( instanceDir == null ) {
|
||||
instanceDir = SolrResourceLoader.locateInstanceDir();
|
||||
}
|
||||
|
||||
// Initialize
|
||||
try {
|
||||
CoreContainer cores = new CoreContainer(new SolrResourceLoader(instanceDir));
|
||||
SolrConfig solrConfig = new SolrConfig(instanceDir, SolrConfig.DEFAULT_CONF_FILE, null);
|
||||
CoreDescriptor dcore = new CoreDescriptor(cores, "", solrConfig.getResourceLoader().getInstanceDir());
|
||||
IndexSchema indexSchema = new IndexSchema(solrConfig, instanceDir+"/conf/schema.xml", null);
|
||||
core = new SolrCore( null, dataDir, solrConfig, indexSchema, dcore);
|
||||
cores.register("", core, false);
|
||||
parser = new SolrRequestParsers( solrConfig );
|
||||
}
|
||||
catch (Exception ee) {
|
||||
throw new RuntimeException(ee);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For example:
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
}
|
||||
|
||||
String cwd=System.getProperty("user.dir");
|
||||
String solrHome= solrConfig.getInstanceDir();
|
||||
String solrHome= solrConfig.getResourceLoader().getInstanceDir();
|
||||
|
||||
boolean cachingEnabled = !solrConfig.getHttpCachingConfig().isNever304();
|
||||
%>
|
||||
|
|
Loading…
Reference in New Issue