Example usage for java.lang System getenv

List of usage examples for java.lang System getenv

Introduction

In this page you can find the example usage for java.lang System getenv.

Prototype

public static String getenv(String name) 

Source Link

Document

Gets the value of the specified environment variable.

Usage

From source file:com.kylinolap.query.test.KylinQueryTest.java

private static void setUpEnv() {

    if (System.getProperty(KylinConfig.KYLIN_CONF) == null && System.getenv(KylinConfig.KYLIN_CONF) == null)
        System.setProperty(KylinConfig.KYLIN_CONF, "../examples/test_case_data");

    config = KylinConfig.getInstanceFromEnv();
}

From source file:de.akquinet.innovation.play.maven.Helper.java

public static boolean detectPlay2() {
    String home = System.getProperty(AbstractPlay2Mojo.ENV_PLAY2_HOME);
    if (home != null && home.length() != 0) {
        return true;
    }//from   w w w  . j  a  va2 s .  c o  m

    // Second check, environment variable
    home = System.getenv(AbstractPlay2Mojo.ENV_PLAY2_HOME);
    if (home != null && home.length() != 0) {
        return true;
    }

    return false;
}

From source file:com.qwazr.mavenplugin.QwazrStopMojo.java

static String getProperty(String currentValue, String env, String defaultValue) {
    if (currentValue != null)
        return currentValue;
    String value = env == null ? null : System.getenv(env);
    return value != null ? null : defaultValue;
}

From source file:eu.optimis.serviceproviderriskassessmenttool.core.configration.ConfigManager.java

public static String getConfigFilePath(String configFile) {
    String optimisHome = System.getenv("OPTIMIS_HOME");
    if (optimisHome == null) {
        optimisHome = "/opt/optimis";
        log.debug("SPRA: OPTIMIS_HOME: " + optimisHome + " (DEFAULT)");
    } else {/*from   w w w .j  a va 2s. c o  m*/
        log.debug("SPRA: OPTIMIS_HOME: " + optimisHome);
    }

    File fileObject = new File(optimisHome.concat(configFile));
    if (!fileObject.exists()) {
        try {
            createDefaultConfigFile(fileObject);
        } catch (Exception ex) {
            log.error("IPRA: Error reading " + optimisHome.concat(configFile) + " configuration file: "
                    + ex.getMessage());
            ex.printStackTrace();
        }
    }

    return optimisHome.concat(configFile);
}

From source file:eu.optimis.infrastructureproviderriskassessmenttool.core.configration.ConfigManager.java

public static String getConfigFilePath(String configFile) {
    String optimisHome = System.getenv("OPTIMIS_HOME");
    if (optimisHome == null) {
        optimisHome = "/opt/optimis";
        log.debug("IPRA: OPTIMIS_HOME: " + optimisHome + " (DEFAULT)");
    } else {//from   w  w  w  .jav  a 2  s  .  c o  m
        log.debug("IPRA: OPTIMIS_HOME: " + optimisHome);
    }

    File fileObject = new File(optimisHome.concat(configFile));
    if (!fileObject.exists()) {
        try {
            createDefaultConfigFile(fileObject);
        } catch (Exception ex) {
            log.error("IPRA: Error reading " + optimisHome.concat(configFile) + " configuration file: "
                    + ex.getMessage());
            ex.printStackTrace();
        }
    }

    return optimisHome.concat(configFile);
}

From source file:io.apiman.gateway.engine.util.ApimanStrLookup.java

/**
 * @see org.apache.commons.lang.text.StrLookup#lookup(java.lang.String)
 *//*from  w  w  w.java 2 s  .co m*/
@Override
public String lookup(String key) {
    String replacement = System.getProperty(key);
    if (replacement == null) {
        System.getenv(key);
    }
    return replacement;
}

From source file:com.exalttech.trex.ui.UIBaseTest.java

@BeforeTest
public void setUpClass() throws Exception {

    // remove appData folder
    File trexDirectory = new File(System.getenv("LOCALAPPDATA") + APP_DATA_PATH);
    if (trexDirectory.exists()) {
        FileUtils.deleteQuietly(trexDirectory);
    }//from  w ww .  j  a  v a  2s. c om
    ApplicationTest.launch(TrexApp.class);

}

From source file:io.apiman.common.util.ApimanStrLookup.java

/**
 * @see org.apache.commons.lang.text.StrLookup#lookup(java.lang.String)
 *///from   w ww . j  a  v  a  2  s.  co m
@Override
public String lookup(String key) {
    String replacement = System.getProperty(key);
    if (replacement == null) {
        replacement = System.getenv(key);
    }
    return replacement;
}

From source file:eu.optimis.mi.aggregator.util.ConfigManager.java

public static String getConfigFilePath(String configFile) throws IOException {
    String optimisHome = System.getenv("OPTIMIS_HOME");
    if (optimisHome == null) {
        optimisHome = "/opt/optimis";
        log.warn("No environment variable OPTIMIS_HOME. Using default /opt/optimis.");
    }/*from w w w  . java  2s .co m*/

    File fileObject = new File(optimisHome.concat(configFile));
    //If not exists, copy property files from the source code to %OPTIMIS_HOME%
    if (!fileObject.exists()) {
        createDefaultConfigFile(fileObject);
    }
    return optimisHome.concat(configFile);
}

From source file:io.fabric8.maven.sample.enricher.app.HelloController.java

@RequestMapping("/")
public String index() throws IOException {
    return FileCopyUtils.copyToString(new FileReader("/data/mySecretFileData")) + "<br>\n"
            + System.getenv("SECRET_PROPERTY");
}