org.nuxeo.common.Environment.setPath()方法的使用及代码示例

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

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

Environment.setPath介绍

[英]Add a file path as a property
[中]将文件路径添加为属性

代码示例

代码示例来源:origin: org.nuxeo.common/nuxeo-common

  1. /**
  2. * Add a file path as a property
  3. *
  4. * @param key Property key
  5. * @param value Property value: an absolute or relative file; if relative, it will be resolved against {@link #home}
  6. * @since 8.1
  7. * @see #setProperty(String, String)
  8. * @see #setPath(String, File, File)
  9. */
  10. public void setPath(String key, File value) {
  11. setPath(key, value, home);
  12. }

代码示例来源:origin: org.nuxeo.common/nuxeo-common

  1. /**
  2. * Add a file path as a property
  3. *
  4. * @param key Property key
  5. * @param value Property value: an absolute or relative file path; if relative, it will be resolved against
  6. * {@link #home}
  7. * @since 8.1
  8. * @see #setProperty(String, String)
  9. * @see #setPath(String, String, File)
  10. */
  11. public void setPath(String key, String value) {
  12. setPath(key, value, home);
  13. }

代码示例来源:origin: org.nuxeo.common/nuxeo-common

  1. /**
  2. * Initialization with System properties to avoid issues due to home set with runtime home instead of server home.
  3. * If {@link #NUXEO_HOME} System property is not set, or if you want to set a custom server home, then you should
  4. * call {@link #setServerHome(File)} before.
  5. *
  6. * @since 5.4.1
  7. */
  8. public void init() {
  9. initServerHome();
  10. initRuntimeHome();
  11. String dataDir = System.getProperty(NUXEO_DATA_DIR);
  12. if (StringUtils.isNotEmpty(dataDir)) {
  13. setData(new File(dataDir));
  14. }
  15. String configDir = System.getProperty(NUXEO_CONFIG_DIR);
  16. if (StringUtils.isNotEmpty(configDir)) {
  17. setConfig(new File(configDir));
  18. }
  19. String logDir = System.getProperty(NUXEO_LOG_DIR);
  20. if (StringUtils.isNotEmpty(logDir)) {
  21. setLog(new File(logDir));
  22. }
  23. String tmpDir = System.getProperty(NUXEO_TMP_DIR);
  24. if (StringUtils.isNotEmpty(tmpDir)) {
  25. setTemp(new File(tmpDir));
  26. }
  27. String mpDir = System.getProperty(NUXEO_MP_DIR);
  28. setPath(NUXEO_MP_DIR, StringUtils.isNotEmpty(mpDir) ? mpDir : DEFAULT_MP_DIR, getServerHome());
  29. }

代码示例来源:origin: org.nuxeo.runtime/nuxeo-runtime-osgi

  1. env.setPath(Environment.BUNDLES, new File(val).getCanonicalFile());

代码示例来源:origin: org.nuxeo.runtime/nuxeo-launcher-commons

  1. /**
  2. * @since 5.6
  3. * @return an {@link Environment} initialized with a few basics
  4. */
  5. public Environment getEnv() {
  6. /*
  7. * It could be useful to initialize DEFAULT env in {@link #setBasicConfiguration()}... For now, the generated
  8. * {@link Environment} is not static.
  9. */
  10. if (env == null) {
  11. env = new Environment(getRuntimeHome());
  12. File distribFile = new File(new File(nuxeoHome, TEMPLATES), "common/config/distribution.properties");
  13. if (distribFile.exists()) {
  14. try {
  15. env.loadProperties(loadTrimmedProperties(distribFile));
  16. } catch (IOException e) {
  17. log.error(e);
  18. }
  19. }
  20. env.loadProperties(userConfig);
  21. env.setServerHome(getNuxeoHome());
  22. env.init();
  23. env.setData(userConfig.getProperty(Environment.NUXEO_DATA_DIR, "data"));
  24. env.setLog(userConfig.getProperty(Environment.NUXEO_LOG_DIR, "logs"));
  25. env.setTemp(userConfig.getProperty(Environment.NUXEO_TMP_DIR, "tmp"));
  26. env.setPath(PARAM_MP_DIR, getDistributionMPDir(), env.getServerHome());
  27. env.setPath(Environment.NUXEO_MP_DIR, getPackagesDir(), env.getServerHome());
  28. }
  29. return env;
  30. }

相关文章