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:com.betfair.tornjak.monitor.overlay.AuthFileReader.java

private static MBeanAttributeMatcher createMatcher(String prefix, Properties p) {
    String domainRegEx = p.getProperty(prefix + "domain");
    String keyPropertyRegEx = p.getProperty(prefix + "keyProperty");
    String attrRegEx = p.getProperty(prefix + "attr");
    if (StringUtils.isNotBlank(attrRegEx)) {
        if (StringUtils.isBlank(domainRegEx)) {
            domainRegEx = ".*";
        }//from w w w .  j  av  a2  s  .c  o  m
        if (StringUtils.isBlank(keyPropertyRegEx)) {
            keyPropertyRegEx = ".*";
        }

        return new RegExpMatcher(domainRegEx, keyPropertyRegEx, attrRegEx);
    }

    return null;
}

From source file:org.gytheio.messaging.amqp.AmqpNodeBootstrapUtils.java

public static AmqpDirectEndpoint createEndpoint(MessageConsumer messageConsumer, Properties properties) {
    String brokerUrl = properties.getProperty(PROP_MESSAGING_BROKER_URL);
    String brokerUsername = properties.getProperty(PROP_MESSAGING_BROKER_USERNAME);
    String brokerPassword = properties.getProperty(PROP_MESSAGING_BROKER_PASSWORD);
    String receiveQueueName = properties.getProperty(PROP_MESSAGING_QUEUE_REQUEST);
    String replyQueueName = properties.getProperty(PROP_MESSAGING_QUEUE_REPLY);
    validate(brokerUrl, receiveQueueName, replyQueueName);
    return createEndpoint(messageConsumer, brokerUrl, brokerUsername, brokerPassword, receiveQueueName,
            replyQueueName);//from w  w  w  .  java2 s  .  com
}

From source file:com.netflix.suro.SuroServer.java

private static int getControlPort(Properties properties) {
    String value = properties.getProperty("SuroServer.controlPort");
    if (value == null) {
        return DEFAULT_CONTROL_PORT;
    }//from   ww w. j a va2s . c o m
    return Integer.parseInt(value);
}

From source file:com.google.mr4c.content.S3Credentials.java

public static S3Credentials extractFrom(Properties props) {
    String id = props.getProperty(PROP_NATIVE_ID);
    String secret = props.getProperty(PROP_NATIVE_SECRET);
    S3Credentials cred = new S3Credentials(id, secret);
    if (!cred.isValid()) {
        id = props.getProperty(PROP_BLOCK_ID);
        secret = props.getProperty(PROP_BLOCK_SECRET);
    }/*from   www .j  a  v a2 s .co  m*/
    cred = new S3Credentials(id, secret);
    return cred.isValid() ? cred : null;
}

From source file:net.sourceforge.jabm.spring.BeanFactorySingleton.java

public static void initialiseFactory() {
    Properties systemProperties = SystemProperties.jabsConfiguration();
    String configFile = systemProperties.getProperty(SystemProperties.PROPERTY_CONFIG);
    if (configFile == null) {
        throw new IllegalArgumentException("Must specify a configuration file by setting the system property "
                + SystemProperties.PROPERTY_BASE + "." + SystemProperties.PROPERTY_CONFIG);
    }/* w ww .ja va2 s. c  om*/
    initialiseFactory(new FileSystemResource(configFile));
}

From source file:com.athena.chameleon.common.utils.PropertyUtil.java

/**
 * <pre>//from w  ww . j  a  v  a 2  s  . c  o  m
 *  key?  property ? .
 * ? key     ? .
 * </pre>
 *
 * @param key
 * @return value
 * @throws Exception ? ?? ?? load   ?
 */
public static String getProperty(String key) throws Exception {
    if (exception != null) {
        throw exception;
    }

    String value = null;
    for (Properties p : properties) {
        if ((value = p.getProperty(key)) != null) {
            break;
        }
    }

    return value;
}

From source file:br.com.ingenieux.jenkins.plugins.awsebdeployment.Utils.java

public static String getVersion() {
    if (DEFAULT_VERSION.equals(VERSION)) {
        try (InputStream is = Utils.class.getResourceAsStream("version.properties")) {
            Properties p = new Properties();

            p.load(is);/*from  w w w.j  a  v  a  2 s.co m*/

            VERSION = p.getProperty("awseb-deployer-plugin.version");

        } catch (Exception exc) {
            throw new RuntimeException(exc);
        }
    }

    return VERSION;
}

From source file:com.metratech.metanga.api.impl.ClientHttpRequestFactorySelector.java

public static ClientHttpRequestFactory getRequestFactory() {
    Properties properties = System.getProperties();
    String proxyHost = properties.getProperty("http.proxyHost");
    int proxyPort = properties.containsKey("http.proxyPort")
            ? Integer.valueOf(properties.getProperty("http.proxyPort"))
            : 80;//ww w .j a v  a  2 s.  c  om
    if (HTTP_COMPONENTS_AVAILABLE) {
        return HttpComponentsClientRequestFactoryCreator.createRequestFactory(proxyHost, proxyPort);
    } else {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        if (proxyHost != null) {
            requestFactory.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)));
        }
        return requestFactory;
    }
}

From source file:com.emc.vipr.services.s3.S3ClientFactory.java

private static void checkProxyConfig(AmazonS3Client client, Properties props) {
    String proxyHost = props.getProperty(ViprConfig.PROP_PROXY_HOST);
    if (proxyHost != null && !proxyHost.isEmpty()) {
        int proxyPort = Integer.parseInt(props.getProperty(ViprConfig.PROP_PROXY_PORT));
        ClientConfiguration config = new ClientConfiguration();
        config.setProxyHost(proxyHost);//from   w  w w .j av  a  2  s. com
        config.setProxyPort(proxyPort);
        client.setConfiguration(config);
    }
}

From source file:com.katsu.json.serializer.SerializerFactory.java

private static String getProperty(JsonProperty jprop, Properties properties) {
    if (properties != null) {
        return properties.getProperty(jprop.getValue());
    }/*from ww w  .  ja  va 2s .  c  o  m*/
    return null;
}