Example usage for java.util Properties getProperty

List of usage examples for java.util Properties getProperty

Introduction

In this page you can find the example usage for java.util Properties getProperty.

Prototype

public String getProperty(String key) 

Source Link

Document

Searches for the property with the specified key in this property list.

Usage

From source file:Main.java

public static boolean isWindowsOS() {

    Properties prop = System.getProperties();
    String os = prop.getProperty("os.name");
    // log.info("platform is:"+os);
    if (os.contains("Windows")) {
        return true;
    }//from  w  w  w  . j  a  va  2s. c om

    return false;
}

From source file:net.duckling.ddl.web.bean.ClbHelper.java

private static String getClbTokenUrl(Properties properties) {
    return properties.getProperty("duckling.clb.url") + "/wopi/fetch/accessToken";
}

From source file:org.openmrs.ModuleStory.java

/**
 * Utility method that checks if there is a runtime properties file containing database
 * connection credentials/*from   ww w  . j  a  v a2  s . c  om*/
 *
 * @return
 */
private static boolean skipDatabaseSetupPage() {
    Properties props = OpenmrsUtil.getRuntimeProperties(WebConstants.WEBAPP_NAME);
    return (props != null && StringUtils.hasText(props.getProperty("connection.url"))
            && StringUtils.hasText(props.getProperty("connection.username"))
            && StringUtils.hasText(props.getProperty("connection.password")));
}

From source file:com.hazelcast.qasonar.utils.PropertyReaderBuilder.java

private static String getProperty(Properties props, String key) {
    String value = props.getProperty(key);
    return (value == null) ? null : value.trim();
}

From source file:ca.uhn.fhir.util.VersionUtil.java

private static void initialize() {
    InputStream is = null;//from  w ww  .  j  av  a 2  s.  co m
    try {
        is = VersionUtil.class.getResourceAsStream("/ca/uhn/fhir/hapi-version.properties");
        Properties p = new Properties();
        p.load(is);
        ourVersion = p.getProperty("version");
        ourLog.info("HAPI FHIR version is: " + ourVersion);
    } catch (Exception e) {
        ourLog.warn("Unable to determine HAPI version information", e);
    } finally {
        IOUtils.closeQuietly(is);
    }
}

From source file:com.splunk.shuttl.archiver.filesystem.hadoop.HdfsProperties.java

public static HdfsProperties create(File hdfsProperties) {
    Properties properties = loadProperties(hdfsProperties);
    String host = properties.getProperty("hadoop.host");
    String port = properties.getProperty("hadoop.port");
    return new HdfsProperties(host, port);
}

From source file:com.machinelinking.cli.loader.java

private static String getPropertyOrFail(Properties properties, String property, String errMsg) {
    final String value = properties.getProperty(property);
    if (value == null)
        throw new IllegalArgumentException(
                String.format("Invalid properties file: must define property [%s] - %s.", property, errMsg));
    return value;
}

From source file:OperatingSystem.java

/**
 * @return user-displayable operating system version
 *///  w w  w. j a  va 2 s. c om
public static String osVersion() {
    Properties p = System.getProperties();
    String osName = p.getProperty("os.name");
    String osVersion = p.getProperty("os.version");

    if ((osVersion != null) && (osVersion.length() != 0))
        osName += " " + osVersion;

    switch (userOS) {
    case OSX:
        if (osVersion.startsWith("10.0"))
            osName += " Cheetah";
        else if (osVersion.startsWith("10.1"))
            osName += " Puma";
        else if (osVersion.startsWith("10.2"))
            osName += " Jaguar";
        else if (osVersion.startsWith("10.3"))
            osName += " Panther";
        else if (osVersion.startsWith("10.4"))
            osName += " Tiger";
        else if (osVersion.startsWith("10.5"))
            osName += " Leopard";
        else if (osVersion.startsWith("10.6"))
            osName += " Snow Leopard";
        break;
    case WINDOWS:
        osName += " " + p.getProperty("sun.os.patch.level");
        break;
    }

    osName += " (" + p.getProperty("os.arch") + ")";
    return osName;
}

From source file:de.ingrid.interfaces.csw.admin.command.AdminManager.java

/**
 * Read the override configuration and convert the clear text password to a bcrypt-hash,
 * which is used and needed by the base-webapp v3.6.1 
 *///from  ww w  .  jav a 2  s .  co m
private static void migratePassword() {
    try {
        InputStream is = new FileInputStream("conf/config.properties");
        Properties props = new Properties();
        props.load(is);
        String oldPassword = props.getProperty("ingrid.admin.password");
        is.close();

        props.setProperty("ingrid.admin.password", BCrypt.hashpw(oldPassword, BCrypt.gensalt()));

        OutputStream os = new FileOutputStream("conf/config.override.properties");
        props.store(os, "Override configuration written by the application");
        os.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static String getProperty(String filePath, String fileName, String propertyName) {
    try {//from   w  ww  .j  ava 2 s.co  m
        Properties p = loadPropertyInstance(filePath, fileName);
        return p.getProperty(propertyName);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}