Example usage for java.util Properties get

List of usage examples for java.util Properties get

Introduction

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

Prototype

@Override
    public Object get(Object key) 

Source Link

Usage

From source file:com.roche.iceboar.settings.GlobalSettingsFactory.java

private static String getSplashScreen(String codeBase, Properties properties) {
    return getAbsoluteUrl(codeBase, defaultIfNull((String) properties.get(JNLP_SPLASH_SCREEN), ""));
}

From source file:com.nridge.core.base.std.Platform.java

/**
 * Determines if the current platform that the JVM is executing within is
 * a Windows-based operating system./*from  w  w  w. j a v  a2 s.c om*/
 * @return <i>true</i> if it is or <i>false</i> otherwise.
 */
public static boolean isWindows() {
    String osName;
    Properties osProperties;

    osProperties = System.getProperties();
    osName = (String) osProperties.get("os.name");
    return StringUtils.isNotEmpty(osName) && osName.startsWith(PLATFORM_WINDOWS);
}

From source file:com.nridge.core.base.std.Platform.java

/**
 * Determines if the current platform that the JVM is executing within is
 * a Mac-based operating system./*from  w ww .  j  av  a  2  s  .c o m*/
 * @return <i>true</i> if it is or <i>false</i> otherwise.
 */
public static boolean isMac() {
    String osName;
    Properties osProperties;

    osProperties = System.getProperties();
    osName = (String) osProperties.get("os.name");
    return StringUtils.isNotEmpty(osName) && osName.startsWith(PLATFORM_MACOS);
}

From source file:com.nridge.core.base.std.Platform.java

/**
 * Determines if the current platform that the JVM is executing within is
 * a Linux-based operating system.//from   w  w  w  . j a va2s  .co m
 * @return <i>true</i> if it is or <i>false</i> otherwise.
 */
public static boolean isLinux() {
    String osName;
    Properties osProperties;

    osProperties = System.getProperties();
    osName = (String) osProperties.get("os.name");
    return StringUtils.isNotEmpty(osName) && osName.startsWith(PLATFORM_LINUX);
}

From source file:com.nridge.core.base.std.Platform.java

/**
 * Determines if the current platform that the JVM is executing within is
 * a UNIX-based operating system.// www .  j a v a2 s .  c o  m
 * @return <i>true</i> if it is or <i>false</i> otherwise.
 */
public static boolean isUNIX() {
    String osName;
    Properties osProperties;

    osProperties = System.getProperties();
    osName = (String) osProperties.get("os.name");
    return StringUtils.isNotEmpty(osName) && osName.startsWith(PLATFORM_UNIX);
}

From source file:it.geosolutions.geobatch.jetty.Start.java

private static void setSystemProperties(final Properties prop) {
    Iterator<?> it = prop.keySet().iterator();
    while (it.hasNext()) {
        Object key = it.next();/*from   w  ww .ja v a  2 s .c  o  m*/
        System.setProperty(key.toString(), prop.get(key).toString());
    }
}

From source file:com.hightail.metrics.reporter.NewRelicReporterFactory.java

private static NewRelicReporter buildNewRelicAgentInstance(Properties properties)
        throws CannotCreateInstanceException {

    if (!properties.containsKey(NewRelicConstants.METRIC_REGISTRY)
            || properties.get(NewRelicConstants.METRIC_REGISTRY) == null) {
        throw new CannotCreateInstanceException(NewRelicConstants.METRIC_REGISTRY + " is not provided");
    }/*from ww  w  . j  a  v  a 2  s .  c o m*/

    MetricRegistry registry = (MetricRegistry) properties.get(NewRelicConstants.METRIC_REGISTRY);
    String prefix = (properties.containsKey(NewRelicConstants.PREFIX))
            ? properties.getProperty(NewRelicConstants.PREFIX)
            : NewRelicConstants.DEFAULT_PREFIX;
    TimeUnit rateUnit = (properties.containsKey(NewRelicConstants.RATE_UNIT))
            ? (TimeUnit) properties.get(NewRelicConstants.RATE_UNIT)
            : NewRelicConstants.DEFAULT_RATE_UNIT;
    TimeUnit durationUnit = (properties.containsKey(NewRelicConstants.DURATION_UNIT))
            ? (TimeUnit) properties.get(NewRelicConstants.DURATION_UNIT)
            : NewRelicConstants.DEFAULT_DURATION_UNIT;
    MetricFilter filter = (properties.containsKey(NewRelicConstants.METRIC_FILTER))
            ? (MetricFilter) properties.get(NewRelicConstants.METRIC_FILTER)
            : NewRelicConstants.DEFAULT_METRIC_FILTER;

    return NewRelicAgentReporter.forRegistry(registry).prefixedWith(prefix).convertRatesTo(rateUnit)
            .convertDurationsTo(durationUnit).filter(filter).build();

}

From source file:dpfmanager.shell.core.DPFManagerProperties.java

public static String getPropertiesValue(String key, String def) {
    Properties properties = getPropertiesConfig();
    String value = (String) properties.get(key);
    if (value == null) {
        value = def;// ww w .  j a v a 2  s .co  m
    }
    return value;
}

From source file:edu.berkeley.compbio.ncbitaxonomy.service.NcbiTaxonomyServicesContextFactory.java

public static ApplicationContext makeNcbiTaxonomyServicesContext() throws IOException {

    File propsFile = PropertiesUtils.findPropertiesFile("NCBI_TAXONOMY_SERVICE_PROPERTIES", ".ncbitaxonomy",
            "service.properties");

    logger.debug("Using properties file: " + propsFile);
    Properties p = new Properties();
    FileInputStream is = null;//from   ww w  .  j ava2s  .com
    try {
        is = new FileInputStream(propsFile);
        p.load(is);
    } finally {
        is.close();
    }
    String dbName = (String) p.get("default");

    Map<String, Properties> databases = PropertiesUtils.splitPeriodDelimitedProperties(p);

    GenericApplicationContext ctx = new GenericApplicationContext();
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
    xmlReader.loadBeanDefinitions(new ClassPathResource("ncbitaxonomyclient.xml"));

    PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
    Properties properties = databases.get(dbName);

    if (properties == null) {
        logger.error("Service definition not found: " + dbName);
        logger.error("Valid names: " + StringUtils.join(databases.keySet().iterator(), ", "));
        throw new NcbiTaxonomyRuntimeException("Database definition not found: " + dbName);
    }

    cfg.setProperties(properties);
    ctx.addBeanFactoryPostProcessor(cfg);

    ctx.refresh();

    // add a shutdown hook for the above context...
    ctx.registerShutdownHook();

    return ctx;
}

From source file:com.krawler.portal.util.SystemEnv.java

public static void setProperties(Properties props) {
    Properties envProps = getProperties();

    Enumeration<String> enu = (Enumeration<String>) envProps.propertyNames();

    while (enu.hasMoreElements()) {
        String key = enu.nextElement();

        props.setProperty("env." + key, (String) envProps.get(key));
    }//from  w w  w  .  j  ava  2s  . c  om
}