/** * @deprecated Use {@link SolrResourceLoader#getConfigDir()} instead. */ @Deprecated public String getConfigDir() { return loader.getConfigDir(); }
@Override public String toString() { String configDir = ""; try { configDir = "configDir=" + new File(resourceLoader.getConfigDir()).getAbsolutePath() + ", "; } catch (Exception ignored) { // If we get the exception, the resource loader implementation // probably does not support getConfigDir(). Not a big problem. } return "SolrResourceLocator, " + configDir + "Carrot2 relative lexicalResourcesDir=" + carrot2ResourcesDir; } }
protected void findDirectory(DataImporter dataImporter, Map<String, String> params) { if(params.get(DIRECTORY) != null) { configDir = params.get(DIRECTORY); } else { SolrCore core = dataImporter.getCore(); if (core == null) { configDir = SolrResourceLoader.locateSolrHome().toString(); } else { configDir = core.getResourceLoader().getConfigDir(); } } }
if (!f.isAbsolute()) { f = new File(getConfigDir() + resource); throw new RuntimeException("Can't find resource '" + resource + "' in classpath or '" + getConfigDir() + "', cwd="+System.getProperty("user.dir"));
/** * The conf files are copied to the tmp dir to the conf dir. A backup of the old file is maintained */ private void copyTmpConfFiles2Conf(File tmpconfDir) throws IOException { File confDir = new File(solrCore.getResourceLoader().getConfigDir()); for (File file : tmpconfDir.listFiles()) { File oldFile = new File(confDir, file.getName()); if (oldFile.exists()) { File backupFile = new File(confDir, oldFile.getName() + "." + getDateAsStr(new Date(oldFile.lastModified()))); boolean status = oldFile.renameTo(backupFile); if (!status) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unable to rename: " + oldFile + " to: " + backupFile); } } boolean status = file.renameTo(oldFile); if (status) { } else { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unable to rename: " + file + " to: " + oldFile); } } }
File d = d0; if (!d.isAbsolute()) d = new File(solrLoader.getConfigDir() + dirVal); if (d.isDirectory() && d.canRead()) {
File d = d0; if (!d.isAbsolute()) d = new File(solrLoader.getConfigDir() + File.separator + dirVal); if (d.isDirectory() && d.canRead()) {
"Constructed instance information solr.home %s (%s), instance dir %s, conf dir %s, writing index to solr.data.dir %s, with permdir %s", solrHomeDir, solrHomeDir.toUri(), loader.getInstancePath(), loader.getConfigDir(), dataDirStr, outputShardDir));
"Constructed instance information solr.home %s (%s), instance dir %s, conf dir %s, writing index to solr.data.dir %s, with permdir %s", solrHomeDir, solrHomeDir.toUri(), loader.getInstancePath(), loader.getConfigDir(), dataDirStr, outputShardDir));
"Constructed instance information solr.home %s (%s), instance dir %s, conf dir %s, writing index to solr.data.dir %s, with permdir %s", solrHomeDir, solrHomeDir.toUri(), loader.getInstancePath(), loader.getConfigDir(), dataDirStr, outputShardDir));
private void downloadConfFiles(List<Map<String, Object>> confFilesToDownload, long latestVersion) throws Exception { LOG.info("Starting download of configuration files from master: " + confFilesToDownload); confFilesDownloaded = Collections.synchronizedList(new ArrayList<Map<String, Object>>()); File tmpconfDir = new File(solrCore.getResourceLoader().getConfigDir(), "conf." + getDateAsStr(new Date())); try { boolean status = tmpconfDir.mkdirs(); if (!status) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Failed to create temporary config folder: " + tmpconfDir.getName()); } for (Map<String, Object> file : confFilesToDownload) { String saveAs = (String) (file.get(ALIAS) == null ? file.get(NAME) : file.get(ALIAS)); fileFetcher = new FileFetcher(tmpconfDir, file, saveAs, true, latestVersion); currentFile = file; fileFetcher.fetchFile(); confFilesDownloaded.add(new HashMap<String, Object>(file)); } // this is called before copying the files to the original conf dir // so that if there is an exception avoid corrupting the original files. terminateAndWaitFsyncService(); copyTmpConfFiles2Conf(tmpconfDir); } finally { delTree(tmpconfDir); } }
/** * For configuration files, checksum of the file is included because, unlike index files, they may have same content * but different timestamps. * <p/> * The local conf files information is cached so that everytime it does not have to compute the checksum. The cache is * refreshed only if the lastModified of the file changes */ List<Map<String, Object>> getConfFileInfoFromCache(NamedList<String> nameAndAlias, final Map<String, FileInfo> confFileInfoCache) { List<Map<String, Object>> confFiles = new ArrayList<Map<String, Object>>(); synchronized (confFileInfoCache) { File confDir = new File(core.getResourceLoader().getConfigDir()); Checksum checksum = null; for (int i = 0; i < nameAndAlias.size(); i++) { String cf = nameAndAlias.getName(i); File f = new File(confDir, cf); if (!f.exists() || f.isDirectory()) continue; //must not happen FileInfo info = confFileInfoCache.get(cf); if (info == null || info.lastmodified != f.lastModified() || info.size != f.length()) { if (checksum == null) checksum = new Adler32(); info = new FileInfo(f.lastModified(), cf, f.length(), getCheckSum(checksum, f)); confFileInfoCache.put(cf, info); } Map<String, Object> m = info.getAsMap(); if (nameAndAlias.getVal(i) != null) m.put(ALIAS, nameAndAlias.getVal(i)); confFiles.add(m); } } return confFiles; }
"Constructed instance information solr.home %s (%s), instance dir %s, conf dir %s, writing index to solr.data.dir %s, with permdir %s", solrHomeDir, solrHomeDir.toUri(), loader.getInstanceDir(), loader.getConfigDir(), dataDirStr, outputShardDir));
/** * Gets the checksum of a file */ private void getFileChecksum(SolrParams solrParams, SolrQueryResponse rsp) { Checksum checksum = new Adler32(); File dir = new File(core.getIndexDir()); rsp.add(CHECKSUM, getCheckSums(solrParams.getParams(FILE), dir, checksum)); dir = new File(core.getResourceLoader().getConfigDir()); rsp.add(CONF_CHECKSUM, getCheckSums(solrParams.getParams(CONF_FILE_SHORT), dir, checksum)); }
File configdir = new File( solrConfig.getResourceLoader().getConfigDir() ); if( configdir.exists() && configdir.isDirectory() ) { for( String file : configdir.list() ) {
File schemaFile = new File(resourceNameToBeUsed); if (!schemaFile.isAbsolute()) { schemaFile = new File(loader.getConfigDir(), schemaFile.getPath());
File schemaFile = new File(resourceNameToBeUsed); if (!schemaFile.isAbsolute()) { schemaFile = new File(loader.getConfigDir(), schemaFile.getPath());
File configFile = new File(tikaConfigLoc); if (configFile.isAbsolute() == false) { configFile = new File(core.getResourceLoader().getConfigDir(), configFile.getPath());
private VelocityEngine getEngine(SolrQueryRequest request) { VelocityEngine engine = new VelocityEngine(); String template_root = request.getParams().get("v.base_dir"); File baseDir = new File(request.getCore().getResourceLoader().getConfigDir(), "velocity"); if (template_root != null) { baseDir = new File(template_root);
File configFile = new File(tikaConfigLoc); if (configFile.isAbsolute() == false) { configFile = new File(core.getResourceLoader().getConfigDir(), configFile.getPath());