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

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

本文整理了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

  1. /**
  2. * @return extension manage home folder
  3. */
  4. public File getHome()
  5. {
  6. return new File(this.environment.getPermanentDirectory(), "extension/");
  7. }

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

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

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

  1. @Override
  2. public void initialize() throws InitializationException
  3. {
  4. File permanentDirectory = this.environment.getPermanentDirectory();
  5. if (permanentDirectory != null) {
  6. this.folder = new File(permanentDirectory, "cache/extension/core/");
  7. }
  8. }

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

  1. /**
  2. * @return the default home directory located inside the environment's permanent directory.
  3. */
  4. String getDefaultHomeDirectory()
  5. {
  6. String result = new File(this.environment.getPermanentDirectory(), DEFAULT_SOLR_DIRECTORY_NAME).getPath();
  7. return result;
  8. }
  9. }

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

  1. /**
  2. * @return the Lucene work directory where to store Lucene index files
  3. */
  4. private File getLuceneWorkDirectory()
  5. {
  6. File dir = new File(this.environment.getPermanentDirectory().getAbsolutePath(), "lucene");
  7. if (!dir.exists()) {
  8. dir.mkdir();
  9. }
  10. return dir;
  11. }
  12. }

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

  1. protected File getInternalFile(String name, String dir)
  2. {
  3. File parent = new File(this.environment.getPermanentDirectory(), dir);
  4. if (!parent.exists()) {
  5. parent.mkdirs();
  6. }
  7. return new File(parent, name);
  8. }

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

  1. private File getInternalFile(String name, String dir)
  2. {
  3. File parent = new File(this.environment.getPermanentDirectory(), dir);
  4. if (!parent.exists()) {
  5. parent.mkdirs();
  6. }
  7. return new File(parent, name);
  8. }

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

  1. protected File getInternalFile(String name, String dir)
  2. {
  3. File parent = new File(this.environment.getPermanentDirectory(), dir);
  4. if (!parent.exists()) {
  5. parent.mkdirs();
  6. }
  7. return new File(parent, name);
  8. }

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

  1. protected File getInternalFile(String name, String dir)
  2. {
  3. File parent = new File(this.environment.getPermanentDirectory(), dir);
  4. if (!parent.exists()) {
  5. parent.mkdirs();
  6. }
  7. return new File(parent, name);
  8. }

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

  1. @Override
  2. public File getStorage()
  3. {
  4. if (this.storage == null) {
  5. String historyPath = this.configuration.get().getProperty("extension.historyFolder");
  6. if (historyPath == null) {
  7. this.storage = new File(this.environment.getPermanentDirectory(), "extension/history/");
  8. } else {
  9. this.storage = new File(historyPath);
  10. }
  11. }
  12. return this.storage;
  13. }
  14. }

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

  1. @Override
  2. public void initialize()
  3. {
  4. this.storageDir = new File(this.environment.getPermanentDirectory(), STORAGE_DIR_NAME);
  5. if (config.cleanOnStartup()) {
  6. final File dir = this.storageDir;
  7. new Thread(new Runnable() {
  8. public void run()
  9. {
  10. deleteEmptyDirs(dir, 0);
  11. }
  12. }).start();
  13. }
  14. }

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

  1. @Override
  2. public void initialize()
  3. {
  4. File solrHome = new File(this.environment.getPermanentDirectory().getAbsolutePath(), "solr");
  5. this.cores = new CoreContainer(solrHome.getAbsolutePath());
  6. this.cores.load();
  7. }

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

  1. @Override
  2. public void initialize()
  3. {
  4. File solrHome = new File(this.environment.getPermanentDirectory().getAbsolutePath(), "solr");
  5. this.cores = new CoreContainer(solrHome.getAbsolutePath());
  6. this.cores.load();
  7. }

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

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

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

  1. @Override
  2. public void createReplacementCore(Vocabulary vocabulary) throws InitializationException
  3. {
  4. try {
  5. final String replacementCoreId = vocabulary.getIdentifier() + TEMP;
  6. final String absPath = this.environment.getPermanentDirectory().getAbsolutePath();
  7. File tempDirectory = new File(absPath, SOLR + replacementCoreId);
  8. if (!tempDirectory.exists()) {
  9. Files.createDirectories(tempDirectory.toPath());
  10. }
  11. CoreContainer container = this.coreContainer.getContainer();
  12. File configOrigin = new File(absPath, SOLR + vocabulary.getIdentifier() + "/conf");
  13. File configTemp = new File(absPath, SOLR + replacementCoreId + "/conf");
  14. FileUtils.copyDirectory(configOrigin, configTemp);
  15. container.create(replacementCoreId, Collections.<String, String>emptyMap());
  16. SolrClient core = new EmbeddedSolrServer(container, replacementCoreId);
  17. this.cores.put(replacementCoreId, core);
  18. } catch (IOException ex) {
  19. throw new InitializationException("Invalid Solr resource: " + ex.getMessage(), ex);
  20. }
  21. }

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

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

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

  1. @Override
  2. public void replaceCore(Vocabulary vocabulary) throws InitializationException
  3. {
  4. final String absPath = this.environment.getPermanentDirectory().getAbsolutePath();
  5. final File indexOrigin = new File(absPath, SOLR + vocabulary.getIdentifier() + "/data");
  6. final File indexTemp = new File(absPath, SOLR + vocabulary.getIdentifier() + TEMP + "/data");
  7. try {
  8. CoreContainer container = this.coreContainer.getContainer();
  9. SolrCore solrCore = container.getCore(vocabulary.getIdentifier());
  10. if (solrCore != null) {
  11. solrCore.close();
  12. }
  13. container.unload(vocabulary.getIdentifier(), true, false, false);
  14. FileUtils.copyDirectory(indexTemp, indexOrigin);
  15. initialize(vocabulary);
  16. } catch (IOException ex) {
  17. ex.printStackTrace();
  18. }
  19. }

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

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

相关文章