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

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

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

Environment.loadProperties介绍

暂无

代码示例

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

  1. /**
  2. * Call to that constructor should be followed by a call to {@link #init()}. Depending on the available System
  3. * properties, you may want to also call {@link #setServerHome(File)} method before {@link #init()}; here is the
  4. * recommended order:
  5. *
  6. * <pre>
  7. * Environment env = new Environment(home, properties);
  8. * Environment.setDefault(env);
  9. * env.setServerHome(home);
  10. * env.init();
  11. * </pre>
  12. *
  13. * @param home Root path used for most defaults. It is recommended to make it match the server home rather than the
  14. * runtime home.
  15. * @param properties Source properties for initialization. It is used as an {@code Hashtable}: ie only the custom
  16. * values are read, the properties default values are ignored if any.
  17. * @see #init()
  18. */
  19. public Environment(File home, Properties properties) {
  20. this.home = home.getAbsoluteFile();
  21. this.properties = new Properties();
  22. if (properties != null) {
  23. loadProperties(properties);
  24. }
  25. }

代码示例来源: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. }

相关文章