List of usage examples for java.lang System getenv
public static String getenv(String name)
From source file:com.boundary.sdk.event.snmp.SnmpSendTrapRouteTest.java
/** * @throws java.lang.Exception/*from w w w . j a va 2 s.com*/ */ @BeforeClass public static void setUpBeforeClass() throws Exception { SmiSupport smi = new SmiSupport(); smi.setLicense(System.getenv("BOUNDARY_MIB_LICENSE")); smi.setRepository(System.getenv("BOUNDARY_MIB_REPOSITORY")); smi.initialize(); smi.loadModules(); smiManager = smi.getSmiManager(); }
From source file:com.github.pires.hazelcast.HazelcastDiscoveryController.java
private static String getEnvOrDefault(String var, String def) { final String val = System.getenv(var); return (val == null || val.isEmpty()) ? def : val; }
From source file:org.drugis.addis.config.controller.IndexController.java
private static String getPataviMcdaWsUri() { try {/*from w w w . ja va2 s . com*/ String uri; String envUri = System.getenv("ADDIS_CORE_PATAVI_MCDA_WS_URI"); if (envUri != null && !envUri.isEmpty()) { uri = envUri; } else { uri = DEFAULT_PATAVI_MCDA_WS_URI; } logger.info("PATAVI_MCDA_WS_URI: " + uri); return uri; } catch (Exception e) { logger.error( "can not find env variable PATAVI_MCDA_WS_URI fallback to using DEFAULT_PATAVI_MCDA_WS_URI: " + DEFAULT_PATAVI_MCDA_WS_URI); return DEFAULT_PATAVI_MCDA_WS_URI; } }
From source file:io.kahu.hawaii.service.io.LocationHelper.java
public String getHawaiiServerHome() { if (hawaiiServerHome == null) { hawaiiServerHome = System.getenv("HAWAII_SERVER_HOME"); if (!hawaiiServerHome.endsWith(File.separator)) { hawaiiServerHome = hawaiiServerHome + File.separator; }// w ww . j a v a 2s . com } return hawaiiServerHome; }
From source file:JOOQTest.java
@BeforeClass public static void setup() throws Exception { File webAppPath = new File("files"); micro = new Micro(webAppPath.getPath(), null, "../../lib"); Assert.assertNotNull(micro);/*from w w w .j a v a2s.c o m*/ SITE = micro.getSite(); Assert.assertNotNull(SITE); SITE.setMicroEnv(Globals.TEST); // we're overwriting the ExtensionManager bootstrap String extensionsFolder = System.getenv("EXTENSIONS_FOLDER"); Assert.assertNotNull("Must specify the extensions folder. Missing.", extensionsFolder); File extensionConfigFile = new File(extensionsFolder + EXTENSION_NAME + ".yml"); SITE.setExtensionsManager(new ExtensionsManager(SITE, new File[] { extensionConfigFile })); SITE.getExtensionsManager().require(EXTENSION_NAME); Assert.assertNotNull("Micro 'SITE' initialization failed", micro.getSite().getWebInfPath()); Assert.assertTrue("Micro is not pointing to the correct test web app", SITE.getWebInfPath().getAbsolutePath().contains("files/WEB-INF")); Assert.assertTrue("The Micro test web app is not properly defined", SITE.getWebInfPath().exists()); log.info("unit test setup, completed."); }
From source file:com.datamoin.tajo.tpcds.TpcDsSingleTest.java
private static String getProperty(String name, boolean throwException) { String value = System.getProperty(name); if (value == null || value.isEmpty()) { value = System.getenv(name); }// w ww . j a v a 2s. com if (throwException && (value == null || value.isEmpty())) { throw new RuntimeException("No property [" + name + "] in conf/tajo-tpcds-env.sh"); } return value; }
From source file:com.seeyon.apps.dee.DEEInitialitionListener.java
public void contextInitialized(ServletContextEvent arg0) { String dee_home = System.getenv(DEE_HOME); if (dee_home == null) { dee_home = SystemEnvironment.getBaseFolder() + File.separator + "dee"; System.setProperty(DEE_HOME, dee_home); }//from w ww.ja v a 2s .c o m File deeLicensePath = new File(dee_home + File.separator + "licence"); if (deeLicensePath.exists() && deeLicensePath.isDirectory()) { File[] keys = deeLicensePath.listFiles(new DeekeyFileFilter(Pattern.compile("(?:.+\\.seeyonkey)"))); boolean checked = keys.length > 0; for (File file : keys) { checked = checked && checkLicense(file); } if (checked) { // DataSourceManager.getInstance(); } else { log.info("?DEE."); } } else { log.info("?DEE License."); return; } }
From source file:Main.java
public static String getTitaniumBaseSdkPath() { final String homeFolder = System.getProperty("user.home"); String sdkPath = null;/*from w ww . j a v a2 s.c o m*/ File sdkFile = null; if (isMac()) { sdkPath = homeFolder + "/Library/Application Support/Titanium/mobilesdk/osx/"; sdkFile = new File(sdkPath); if (!sdkFile.exists()) { sdkPath = "/Library/Application Support/Titanium/mobilesdk/osx/"; sdkFile = new File(sdkPath); if (!sdkFile.exists()) { sdkPath = null; } } } else if (isWindows()) { final String userProfileFolder = System.getenv("ALLUSERSPROFILE"); sdkPath = userProfileFolder + "\\Titanium\\mobilesdk\\win32\\"; sdkFile = new File(sdkPath); if (!sdkFile.exists()) { sdkPath = "C:\\Documents and Settings\\All Users\\Application Data\\Titanium\\mobilesdk\\win32\\"; sdkFile = new File(sdkPath); if (!sdkFile.exists()) { sdkPath = null; } } } else if (isUnix()) { sdkPath = homeFolder + "/.titanium/mobilesdk/linux/"; sdkFile = new File(sdkPath); if (!sdkFile.exists()) { sdkPath = null; } } return sdkPath; }
From source file:com.github.cjm.service.BaseService.java
public BaseService() { apiKey = System.getenv("MOVIEDB_API_KEY"); }
From source file:com.trivago.mail.pigeon.configuration.Settings.java
public static Settings create(String fileName, boolean nocache) { log.trace("Settings instance requested"); if (fileName == null && instance != null && !nocache) { log.trace("Returning cached instance"); return instance; } else if (fileName == null && instance == null) { log.trace("Requesting ENV PIDGEON_CONFIG as path to properties as fileName was null"); String propertyFileName = System.getenv("PIDGEON_CONFIG"); if (propertyFileName == null || propertyFileName.equals("")) { log.warn(/*from w w w . ja va 2 s. co m*/ "ENV is empty and no filename was given -> no config properties found! Using configuration.properties"); } URL resource = Thread.currentThread().getContextClassLoader().getResource("configuration.properties"); propertyFileName = resource.toExternalForm(); instance = new Settings(); try { instance.setConfiguration(new PropertiesConfiguration(propertyFileName)); } catch (ConfigurationException e) { log.error(e); throw new ConfigurationRuntimeException(e); } } else if (fileName != null && instance == null) { log.trace("Requesting file properties from " + fileName); instance = new Settings(); try { instance.setConfiguration(new PropertiesConfiguration(fileName)); } catch (ConfigurationException e) { log.error(e); throw new ConfigurationRuntimeException(e); } } return instance; }