List of usage examples for java.lang System getenv
public static String getenv(String name)
From source file:mesosphere.dcos.hazelcast.discovery.DcosDiscoveryStrategy.java
@Override public Iterable<DiscoveryNode> discoverNodes() { List<DiscoveryNode> servers = new LinkedList<>(); for (String node : StringUtils.split(System.getenv("HAZELCAST_INITIAL_MEMBERS"), System.lineSeparator())) { try {/* w w w .j av a2 s . com*/ servers.add(new SimpleDiscoveryNode(new Address(node, 5701))); } catch (UnknownHostException e) { LOG.warn(String.format("DNS name '%s' not resolvable", node), e); } } return servers; }
From source file:com.comcast.cats.domain.configuration.CatsHome.java
/** * Check if the cats home is specified in the env properties. * If yes specify those value as cats.home in the system property * If found empty or null, create a default location at user.home/cats. * /*from w ww . j ava2 s . c om*/ */ public static void initializeCatsHome() { String catsHome = System.getProperty(CATS_HOME_SYSTEM_PROPERTY); //logger.info( "catsHome from system "+catsHome ); if (null == catsHome || "".equals(catsHome)) { String catsHomeEnv = System.getenv(CATS_HOME_ENV_PROPERTY); //logger.info( "catsHome from Env "+catsHomeEnv ); if (null != catsHomeEnv && !"".equals(catsHomeEnv)) { //logger.info( "Setting catsHome as "+catsHomeEnv ); System.setProperty(CATS_HOME_SYSTEM_PROPERTY, catsHomeEnv); } else { //logger.info( "Creating a temp catsHome " ); String defaultHome = ""; String userHome = System.getProperty("user.home"); if (null != userHome) { //logger.info( "user.home is "+userHome ); defaultHome = userHome; } else { //logger.info( "user.home not found!" ); } defaultHome += FILE_SEPERATOR + CATS_HOME_RELATIVE_DIR; System.setProperty(CATS_HOME_SYSTEM_PROPERTY, defaultHome); } } }
From source file:gov.nih.nci.cabig.caaers.utils.CaaersSerializerUtil.java
/** * This method writes given content to a xml file. Location of the file is $CATALINA_HOME/logs/serializedfiles/ * @param serializedContent/*w ww . j a v a2 s .co m*/ */ public static void dumpContentToFile(String content) { BufferedWriter out = null; StringBuilder sb = null; try { if (StringUtils.isEmpty(CATALINA_HOME)) { sb = new StringBuilder(USER_HOME); } else { sb = new StringBuilder(System.getenv("CATALINA_HOME")); sb.append("/logs"); } sb.append("/serializedfiles"); File file = new File(sb.toString()); if (!file.isDirectory()) { file.mkdir(); } sb.append("/session_").append(System.currentTimeMillis()).append(".xml"); out = new BufferedWriter(new FileWriter(sb.toString())); out.write(content); } catch (Exception e) { logger.error("Exception while writing contect to file -- ", e); } finally { try { out.close(); } catch (Exception e) { } } }
From source file:eu.planets_project.pp.plato.services.characterisation.fits.FitsIntegration.java
public FitsIntegration() throws PlatoServiceException { FITS_HOME = System.getenv("FITS_HOME"); if (FITS_HOME == null) { FITS_HOME = "/home/kraxner/dev/fits-0.2.6/"; if (!new File(FITS_HOME).exists()) { FITS_HOME = null;//from w ww . j a v a 2s. c o m } } if (FITS_HOME == null) { throw new PlatoServiceException("FITS is not propertly configured - FITS_HOME is not defined."); } }
From source file:com.orange.clara.cloud.servicedbdumper.integrations.DumpAndRestoreDatabaseFromUriWithS3FilerIT.java
@Override public void doBeforeTest(DatabaseType databaseType) throws DatabaseExtractionException, CannotFindDatabaseDumperException, InterruptedException, IOException { boolean isS3urlExists = System.getenv("S3_URL") != null && System.getenv("DYNO") != null; if (!isS3urlExists) { this.skipCleaning = true; String skipMessage = "No s3 server found, please set env var S3_URL and DYNO=true"; this.reportIntegration.setSkipped(true); this.reportIntegration.setSkippedReason(skipMessage); assumeTrue(skipMessage, false);//from w ww .ja v a 2 s. c om } super.doBeforeTest(databaseType); }
From source file:com.predic8.membrane.core.RouterCLI.java
private static String getConfigFile(MembraneCommandLine line) { if (line.hasMonitorBeans()) { return "file:" + line.getMonitorBeans(); }//from w w w . j a v a2 s . c om return System.getenv("MEMBRANE_HOME") + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator") + "monitor-beans.xml"; }
From source file:com.kylinolap.common.util.LocalFileMetadataTestCase.java
@Override public void createTestMetadata() { KylinConfig.destoryInstance();//from w w w .j a v a2s . c om this.tempTestMetadataUrl = "../examples/test_metadata"; try { FileUtils.deleteDirectory(new File(tempTestMetadataUrl)); FileUtils.copyDirectory(new File(testDataFolder), new File(tempTestMetadataUrl)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (System.getProperty(KylinConfig.KYLIN_CONF) == null && System.getenv(KylinConfig.KYLIN_CONF) == null) System.setProperty(KylinConfig.KYLIN_CONF, tempTestMetadataUrl); KylinConfig.getInstanceFromEnv().setMetadataUrl(tempTestMetadataUrl); }
From source file:uk.ac.jorum.integration.RestApiBaseTest.java
protected static String resourceBase() { return System.getenv("resource.base"); }
From source file:com.igormaznitsa.zxpoly.utils.AppOptions.java
public synchronized File getAppConfigFolder() { String folder = System.getenv("APPDATA"); if (folder == null) { folder = System.getProperty("user.home", FileUtils.getTempDirectoryPath()); }/*from w w w.j a v a2s . co m*/ final File cfgfolder = new File(folder, APP_FOLDER_NAME); if (!cfgfolder.exists()) cfgfolder.mkdirs(); return cfgfolder; }
From source file:mSearch.tool.Functions.java
/** * Detect and return the currently used operating system. * * @return The enum for supported Operating Systems. *//* w ww . j a va2 s . c o m*/ public static OperatingSystemType getOs() { OperatingSystemType os = OperatingSystemType.UNKNOWN; if (System.getProperty("os.name").toLowerCase().contains("windows")) { if (System.getenv("ProgramFiles(x86)") != null) { // win 64Bit os = OperatingSystemType.WIN64; } else if (System.getenv("ProgramFiles") != null) { // win 32Bit os = OperatingSystemType.WIN32; } } else if (SystemInfo.isLinux()) { os = OperatingSystemType.LINUX; } else if (System.getProperty("os.name").toLowerCase().contains("freebsd")) { os = OperatingSystemType.LINUX; } else if (SystemInfo.isMacOSX()) { os = OperatingSystemType.MAC; } return os; }