org.xwiki.environment.Environment.getPermanentDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.xwiki.environment.Environment.getPermanentDirectory()方法的一些代码示例,展示了Environment.getPermanentDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getPermanentDirectory()方法的具体详情如下:
包路径:org.xwiki.environment.Environment
类名称:Environment
方法名:getPermanentDirectory

Environment.getPermanentDirectory介绍

[英]Gets the root directory of a location for storing persisting data. Contrary to the Temporary Directory the content of this directory is guaranteed to persist across time.
[中]获取用于存储持久化数据的位置的根目录。与临时目录相反,此目录的内容保证在一段时间内保持不变。

代码示例

代码示例来源:origin: org.xwiki.commons/xwiki-commons-extension-api

/**
 * @return extension manage home folder
 */
public File getHome()
{
  return new File(this.environment.getPermanentDirectory(), "extension/");
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-store-filesystem-oldcore

@Override
public void initialize() throws InitializationException
{
  this.pre11StoreRootDirectory = new File(this.environment.getPermanentDirectory(), "storage");
  this.storeRootDirectory = this.pre11StoreRootDirectory;
}

代码示例来源:origin: org.xwiki.commons/xwiki-commons-extension-api

@Override
public void initialize() throws InitializationException
{
  File permanentDirectory = this.environment.getPermanentDirectory();
  if (permanentDirectory != null) {
    this.folder = new File(permanentDirectory, "cache/extension/core/");
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-search-solr-api

/**
   * @return the default home directory located inside the environment's permanent directory.
   */
  String getDefaultHomeDirectory()
  {
    String result = new File(this.environment.getPermanentDirectory(), DEFAULT_SOLR_DIRECTORY_NAME).getPath();

    return result;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-search-lucene-api

/**
   * @return the Lucene work directory where to store Lucene index files
   */
  private File getLuceneWorkDirectory()
  {
    File dir = new File(this.environment.getPermanentDirectory().getAbsolutePath(), "lucene");
    if (!dir.exists()) {
      dir.mkdir();
    }
    return dir;
  }
}

代码示例来源:origin: edu.toronto.cs.phenotips/phenotype-mapping-service

protected File getInternalFile(String name, String dir)
{
  File parent = new File(this.environment.getPermanentDirectory(), dir);
  if (!parent.exists()) {
    parent.mkdirs();
  }
  return new File(parent, name);
}

代码示例来源:origin: org.phenotips/phenotype-mapping-service

private File getInternalFile(String name, String dir)
{
  File parent = new File(this.environment.getPermanentDirectory(), dir);
  if (!parent.exists()) {
    parent.mkdirs();
  }
  return new File(parent, name);
}

代码示例来源:origin: org.phenotips/phenotype-mapping-service

protected File getInternalFile(String name, String dir)
{
  File parent = new File(this.environment.getPermanentDirectory(), dir);
  if (!parent.exists()) {
    parent.mkdirs();
  }
  return new File(parent, name);
}

代码示例来源:origin: edu.toronto.cs.phenotips/phenotype-mapping-service

protected File getInternalFile(String name, String dir)
{
  File parent = new File(this.environment.getPermanentDirectory(), dir);
  if (!parent.exists()) {
    parent.mkdirs();
  }
  return new File(parent, name);
}

代码示例来源:origin: org.xwiki.commons/xwiki-commons-extension-api

@Override
  public File getStorage()
  {
    if (this.storage == null) {
      String historyPath = this.configuration.get().getProperty("extension.historyFolder");

      if (historyPath == null) {
        this.storage = new File(this.environment.getPermanentDirectory(), "extension/history/");
      } else {
        this.storage = new File(historyPath);
      }
    }

    return this.storage;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-store-filesystem-attachments

@Override
public void initialize()
{
  this.storageDir = new File(this.environment.getPermanentDirectory(), STORAGE_DIR_NAME);
  if (config.cleanOnStartup()) {
    final File dir = this.storageDir;
    new Thread(new Runnable() {
      public void run()
      {
        deleteEmptyDirs(dir, 0);
      }
    }).start();
  }
}

代码示例来源:origin: org.phenotips/ontology-access-api

@Override
public void initialize()
{
  File solrHome = new File(this.environment.getPermanentDirectory().getAbsolutePath(), "solr");
  this.cores = new CoreContainer(solrHome.getAbsolutePath());
  this.cores.load();
}

代码示例来源:origin: phenotips/phenotips

@Override
public void initialize()
{
  File solrHome = new File(this.environment.getPermanentDirectory().getAbsolutePath(), "solr");
  this.cores = new CoreContainer(solrHome.getAbsolutePath());
  this.cores.load();
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-store-filesystem-oldcore

@Override
public void initialize() throws InitializationException
{
  // General location when filesystem based stored put data
  File storeDirectory = new File(this.environment.getPermanentDirectory(), "store");
  // Specific location for file component
  File fileStorageDirectory = new File(storeDirectory, FileSystemStoreUtils.HINT);
  try {
    this.storeRootDirectory = fileStorageDirectory.getCanonicalFile();
  } catch (IOException e) {
    throw new InitializationException("Invalid permanent directory", e);
  }
  // TODO: make this useless (by cleaning empty directories as soon as they appear)
  if (this.config.cleanOnStartup()) {
    final File dir = this.storeRootDirectory;
    new Thread(() -> deleteEmptyDirs(dir, 0)).start();
  }
}

代码示例来源:origin: phenotips/phenotips

@Override
public void createReplacementCore(Vocabulary vocabulary) throws InitializationException
{
  try {
    final String replacementCoreId = vocabulary.getIdentifier() + TEMP;
    final String absPath = this.environment.getPermanentDirectory().getAbsolutePath();
    File tempDirectory = new File(absPath, SOLR + replacementCoreId);
    if (!tempDirectory.exists()) {
      Files.createDirectories(tempDirectory.toPath());
    }
    CoreContainer container = this.coreContainer.getContainer();
    File configOrigin = new File(absPath, SOLR + vocabulary.getIdentifier() + "/conf");
    File configTemp = new File(absPath, SOLR + replacementCoreId + "/conf");
    FileUtils.copyDirectory(configOrigin, configTemp);
    container.create(replacementCoreId, Collections.<String, String>emptyMap());
    SolrClient core = new EmbeddedSolrServer(container, replacementCoreId);
    this.cores.put(replacementCoreId, core);
  } catch (IOException ex) {
    throw new InitializationException("Invalid Solr resource: " + ex.getMessage(), ex);
  }
}

代码示例来源:origin: org.phenotips/clinical-text-analysis-extension-biolark

final File biolarkRoot = new File(this.environment.getPermanentDirectory(), BiolarkWrapperImpl.ROOT_DIRECTORY);
final File biolarkProperties = new File(biolarkRoot, BiolarkWrapperImpl.PROPERTIES_FILENAME);
final File emptyDir = new File(biolarkRoot, BiolarkWrapperImpl.IO_FILENAME);

代码示例来源:origin: phenotips/phenotips

@Override
public void replaceCore(Vocabulary vocabulary) throws InitializationException
{
  final String absPath = this.environment.getPermanentDirectory().getAbsolutePath();
  final File indexOrigin = new File(absPath, SOLR + vocabulary.getIdentifier() + "/data");
  final File indexTemp = new File(absPath, SOLR + vocabulary.getIdentifier() + TEMP + "/data");
  try {
    CoreContainer container = this.coreContainer.getContainer();
    SolrCore solrCore = container.getCore(vocabulary.getIdentifier());
    if (solrCore != null) {
      solrCore.close();
    }
    container.unload(vocabulary.getIdentifier(), true, false, false);
    FileUtils.copyDirectory(indexTemp, indexOrigin);
    initialize(vocabulary);
  } catch (IOException ex) {
    ex.printStackTrace();
  }
}

代码示例来源:origin: phenotips/phenotips

File solrHome = new File(this.environment.getPermanentDirectory().getAbsolutePath(), "solr");
File dest = solrHome;
Files.createDirectories(dest.toPath().resolve(coreIdentifier + "/conf"));

相关文章