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

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

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

Environment.<init>介绍

[英]Call to that constructor should be followed by a call to #init(). Depending on the available System properties, you may want to also call #loadProperties(Properties) or #setServerHome(File) methods before #init(); here is the recommended order:

  1. Environment env = new Environment(home);
  2. Environment.setDefault(env);
  3. env.loadProperties(properties);
  4. env.setServerHome(home);
  5. env.init();

[中]对该构造函数的调用之后应该是对#init()的调用。根据可用的系统属性,您可能还希望在#init()之前调用#loadProperties(properties)或#setServerHome(File)方法;以下是推荐的订单:

  1. Environment env = new Environment(home);
  2. Environment.setDefault(env);
  3. env.loadProperties(properties);
  4. env.setServerHome(home);
  5. env.init();

代码示例

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

  1. private static synchronized void tryInitEnvironment() {
  2. String homeDir = System.getProperty(NUXEO_HOME);
  3. if (homeDir != null) {
  4. File home = new File(homeDir);
  5. if (home.isDirectory()) {
  6. DEFAULT = new Environment(home);
  7. DEFAULT.init();
  8. }
  9. }
  10. }

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

  1. public NuxeoApp(File home, ClassLoader loader) {
  2. this.loader = loader;
  3. env = new Environment(home);
  4. Environment.setDefault(env);
  5. }

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

  1. Environment env = new Environment(home);
  2. env.setCommandLineArguments(args);
  3. val = options.getOption("data");
  4. return env;
  5. } else {
  6. return new Environment(new File("").getCanonicalFile());

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

  1. env = new Environment(home);

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

相关文章