org.nuxeo.common.Environment类的使用及代码示例

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

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

Environment介绍

暂无

代码示例

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

  1. /**
  2. * @since 8.4
  3. */
  4. public String getHomePath() {
  5. if (homePath == null) {
  6. // Since ES 2.X we need to set a home path for embedded node, but it is not used by the bundle
  7. File dir = new File(Environment.getDefault().getTemp(), "elasticsearch");
  8. homePath = dir.getPath();
  9. }
  10. return homePath;
  11. }

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

  1. protected static File getAppDir() {
  2. return Environment.getDefault().getConfig().getParentFile();
  3. }

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

  1. protected boolean isTargetDirectoryForbidden() {
  2. File nuxeoHome = Environment.getDefault().getServerHome().getAbsoluteFile();
  3. return Paths.get(directory)
  4. .toAbsolutePath()
  5. .normalize()
  6. .startsWith(nuxeoHome.toPath().toAbsolutePath().normalize());
  7. }

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

  1. } else {
  2. File home = Environment.getDefault().getData();
  3. base = new File(home, path);

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

  1. private StandaloneApplication(SharedClassLoader cl, Environment env) {
  2. super(env.getHome(), env.getData(), env.getProperties());
  3. classLoader = cl;
  4. this.env = env;
  5. }

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

  1. Environment env = Environment.getDefault();
  2. if (env == null) {
  3. env = new Environment(home);
  4. if (!home.equals(env.getRuntimeHome())) {
  5. env.setRuntimeHome(home);
  6. env.setHostApplicationName(v == null ? Environment.NXSERVER_HOST : v);
  7. v = (String) hostEnv.get(HOST_VERSION);
  8. if (v != null) {
  9. env.setHostApplicationVersion((String) hostEnv.get(HOST_VERSION));
  10. env.setData(new File(v));
  11. } else {
  12. sysprops.setProperty(Environment.NUXEO_DATA_DIR, env.getData().getAbsolutePath());
  13. env.setLog(new File(v));
  14. } else {
  15. sysprops.setProperty(Environment.NUXEO_LOG_DIR, env.getLog().getAbsolutePath());
  16. env.setTemp(new File(v));
  17. } else {
  18. sysprops.setProperty(Environment.NUXEO_TMP_DIR, env.getTemp().getAbsolutePath());
  19. env.setConfig(new File(v));
  20. } else {
  21. sysprops.setProperty(Environment.NUXEO_CONFIG_DIR, env.getConfig().getAbsolutePath());
  22. env.setWeb(new File(v));

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

  1. /**
  2. * @since 5.5
  3. * @return Environment summary
  4. */
  5. protected static StringBuilder getStartMessage() {
  6. String newline = System.getProperty("line.separator");
  7. Environment env = Environment.getDefault();
  8. String hr = "======================================================================";
  9. StringBuilder msg = new StringBuilder(newline);
  10. msg.append(hr).append(newline);
  11. msg.append("= Starting Nuxeo Framework").append(newline);
  12. msg.append(hr).append(newline);
  13. msg.append(" * Server home = ").append(env.getServerHome()).append(newline);
  14. msg.append(" * Runtime home = ").append(env.getRuntimeHome()).append(newline);
  15. msg.append(" * Data Directory = ").append(env.getData()).append(newline);
  16. msg.append(" * Log Directory = ").append(env.getLog()).append(newline);
  17. msg.append(" * Configuration Directory = ").append(env.getConfig()).append(newline);
  18. msg.append(" * Temp Directory = ").append(env.getTemp()).append(newline);
  19. msg.append(hr);
  20. return msg;
  21. }
  22. }

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

  1. public AbstractTask(PackageUpdateService pus) {
  2. service = pus;
  3. env = new HashMap<>();
  4. Environment nxenv = Environment.getDefault();
  5. File serverHome = nxenv.getServerHome();
  6. File nxHome = nxenv.getRuntimeHome();
  7. File config = nxenv.getConfig();
  8. serverPathPrefix = serverHome.getAbsolutePath();
  9. if (!serverPathPrefix.endsWith(File.separator)) {
  10. serverPathPrefix = serverPathPrefix.concat(File.separator);
  11. }
  12. env.put(ENV_SERVER_HOME, serverHome.getAbsolutePath());
  13. env.put(ENV_HOME, nxHome.getAbsolutePath());
  14. env.put(ENV_CONFIG, config.getAbsolutePath());
  15. env.put(ENV_HOSTAPP_NAME, nxenv.getHostApplicationName());
  16. env.put(ENV_HOSTAPP_VERSION, nxenv.getHostApplicationVersion());
  17. env.put(ENV_SYSLIB, new File(serverHome, "lib").getAbsolutePath());
  18. if (nxenv.isJBoss()) {
  19. File ear = config.getParentFile();
  20. env.put(ENV_EAR, ear.getAbsolutePath());
  21. env.put(ENV_LIB, new File(ear, "lib").getAbsolutePath());
  22. env.put(ENV_BUNDLES, new File(ear, "bundles").getAbsolutePath());
  23. } else {
  24. env.put(ENV_LIB, new File(nxHome, "lib").getAbsolutePath());
  25. env.put(ENV_BUNDLES, new File(nxHome, "bundles").getAbsolutePath());
  26. }
  27. env.put(ENV_TEMPLATES, new File(serverHome, "templates").getAbsolutePath());
  28. env.put(ENV_TIMESTAMP, new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
  29. updateMgr = new UpdateManager(serverHome, service.getRegistry());
  30. }

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

  1. Environment env = new Environment(home);
  2. env.setCommandLineArguments(args);
  3. val = options.getOption("data");
  4. if (val != null) {
  5. env.setData(new File(val).getCanonicalFile());
  6. env.setLog(new File(val).getCanonicalFile());
  7. env.setConfig(new File(val).getCanonicalFile());
  8. env.setWeb(new File(val).getCanonicalFile());
  9. env.setTemp(new File(val).getCanonicalFile());
  10. env.setPath(Environment.BUNDLES, new File(val).getCanonicalFile());
  11. env.setHostApplicationName(Environment.NXSERVER_HOST);
  12. env.setHostApplicationVersion("1.0.0");
  13. env.getData().mkdirs();
  14. env.getLog().mkdirs();
  15. env.getTemp().mkdirs();
  16. return env;
  17. } else {
  18. return new Environment(new File("").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. }

代码示例来源:origin: org.nuxeo.ecm.webengine/nuxeo-webengine-gwt

  1. private static File locateRoot() {
  2. File dir = new File(Environment.getDefault().getWeb(), "root.war/gwt");
  3. dir.mkdirs();
  4. return dir;
  5. }

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

  1. cmd.add(bundle.getAbsolutePath());
  2. cmd.add(NuxeoRestart.class.getName());
  3. Environment env = Environment.getDefault();
  4. if (env.isJBoss()) {
  5. String home = System.getProperty("jboss.home.dir");
  6. File bin = new File(home, "bin");
  7. } else if (env.isTomcat()) {
  8. String home = System.getProperty("catalina.base");
  9. File bin = new File(home, "bin");
  10. File file = new File(env.getHome(), "bin/nuxeoctl").getCanonicalFile();
  11. if (file.isFile()) {
  12. cmd.add(file.getAbsolutePath());
  13. cmd.add("start");
  14. } else {
  15. file = new File(env.getHome(), "nxserverctl.sh").getCanonicalFile();
  16. if (file.isFile()) {
  17. cmd.add(file.getAbsolutePath());

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

  1. @Override
  2. public void runDeploymentPreprocessor() throws IOException {
  3. log.info("Start running deployment preprocessor");
  4. String rootPath = Environment.getDefault().getRuntimeHome().getAbsolutePath();
  5. File root = new File(rootPath);
  6. DeploymentPreprocessor processor = new DeploymentPreprocessor(root);
  7. // initialize
  8. processor.init();
  9. // and predeploy
  10. processor.predeploy();
  11. log.info("Deployment preprocessing done");
  12. }

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

  1. public PackagePersistence(PackageUpdateService pus) throws IOException {
  2. Environment env = Environment.getDefault();
  3. root = env.getPath(Environment.NUXEO_MP_DIR, Environment.DEFAULT_MP_DIR);
  4. if (!root.isAbsolute()) {
  5. throw new RuntimeException();
  6. }
  7. root.mkdirs();
  8. store = new File(root, "store");
  9. store.mkdirs();
  10. temp = new File(root, "tmp");
  11. temp.mkdirs();
  12. service = pus;
  13. states = loadStates();
  14. }

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

  1. @Override
  2. public void addWepApp(WebApplication descriptor) {
  3. String contextPath = normalizeContextPath(descriptor.getContextPath());
  4. File home = Environment.getDefault().getHome();
  5. File docBase = new File(home, descriptor.getWebRoot());
  6. docBase.mkdirs(); // make sure the WAR root exists
  7. Context context = tomcat.addWebapp(contextPath, docBase.getAbsolutePath());
  8. StandardJarScanner jarScanner = (StandardJarScanner) context.getJarScanner();
  9. // avoid costly scanning, we register everything explicitly
  10. jarScanner.setScanManifest(false); // many MANIFEST.MF files have incorrect Class-Path
  11. jarScanner.setScanAllDirectories(false);
  12. jarScanner.setScanAllFiles(false);
  13. jarScanner.setScanBootstrapClassPath(false);
  14. jarScanner.setScanClassPath(false);
  15. }

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-storage-sql

  1. File dumpFile = new File(Environment.getDefault().getLog(), "ddl-vcs-" + repository.getName() + ".sql");
  2. try (OutputStream out = new FileOutputStream(dumpFile); PrintStream ps = new PrintStream(out)) {
  3. for (String sql : dialect.getDumpStart()) {

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

  1. Environment env = Environment.getDefault();
  2. env.setProperty(LAUNCHER_CHANGED_PROPERTY, "true");

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

  1. /**
  2. * Resolve the path against {@link Environment#serverHome} if not absolute.
  3. *
  4. * @since 8.1
  5. */
  6. public void setTemp(String temp) {
  7. setTemp(getServerHome().toPath().resolve(temp).toFile());
  8. }

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

  1. /**
  2. * Resolve the path against {@link Environment#serverHome} if not absolute.
  3. *
  4. * @since 8.1
  5. */
  6. public void setLog(String log) {
  7. setLog(getServerHome().toPath().resolve(log).toFile());
  8. }

相关文章