Example usage for java.util Properties containsKey

List of usage examples for java.util Properties containsKey

Introduction

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

Prototype

@Override
    public boolean containsKey(Object key) 

Source Link

Usage

From source file:org.apache.stratos.cloud.controller.iaases.gce.GCEPartitionValidator.java

@Override
public IaasProvider validate(Partition partition, Properties properties) throws InvalidPartitionException {
    try {//from   w w  w  .jav  a2s . co m
        if (properties.containsKey(Scope.REGION.toString())) {
            String region = properties.getProperty(Scope.REGION.toString());
            iaas.isValidRegion(region);
            IaasProvider updatedIaasProvider = new IaasProvider(iaasProvider);
            if (properties.containsKey(Scope.ZONE.toString())) {
                String zone = properties.getProperty(Scope.ZONE.toString());
                iaas.isValidZone(region, zone);
                updatedIaasProvider.setProperty(CloudControllerConstants.AVAILABILITY_ZONE, zone);
            }
            updateOtherProperties(updatedIaasProvider, properties);
            Iaas updatedIaas = updatedIaasProvider.buildIaas();
            updatedIaas.setIaasProvider(updatedIaasProvider);
            return updatedIaasProvider;
        } else {
            return iaasProvider;
        }
    } catch (Exception ex) {
        String message = String.format("Invalid partition detected: [partition-id] %s", partition.getId());
        throw new InvalidPartitionException(message, ex);
    }
}

From source file:com.griddynamics.jagger.JaggerLauncher.java

public static void loadBootProperties(URL directory, String environmentPropertiesLocation,
        Properties environmentProperties) throws IOException {
    URL bootPropertiesFile = new URL(directory, environmentPropertiesLocation);
    System.setProperty(ENVIRONMENT_PROPERTIES, environmentPropertiesLocation);
    environmentProperties.load(bootPropertiesFile.openStream());

    String defaultBootPropertiesLocation = environmentProperties.getProperty(DEFAULT_ENVIRONMENT_PROPERTIES);
    if (defaultBootPropertiesLocation == null) {
        defaultBootPropertiesLocation = DEFAULT_ENVIRONMENT_PROPERTIES_LOCATION;
    }//from w ww. jav a2s  .c  o m
    URL defaultBootPropertiesFile = new URL(directory, defaultBootPropertiesLocation);
    Properties defaultBootProperties = new Properties();
    defaultBootProperties.load(defaultBootPropertiesFile.openStream());
    for (String name : defaultBootProperties.stringPropertyNames()) {
        if (!environmentProperties.containsKey(name)) {
            environmentProperties.setProperty(name, defaultBootProperties.getProperty(name));
        }
    }

    Properties properties = System.getProperties();
    for (Enumeration<String> enumeration = (Enumeration<String>) properties.propertyNames(); enumeration
            .hasMoreElements();) {
        String key = enumeration.nextElement();
        environmentProperties.put(key, properties.get(key));
    }

    System.setProperty(ENVIRONMENT_PROPERTIES, environmentPropertiesLocation);
    System.setProperty(DEFAULT_ENVIRONMENT_PROPERTIES, defaultBootPropertiesLocation);
}

From source file:gobblin.compliance.validation.ComplianceValidationJob.java

public void initDatasetFinder(Properties properties) {
    Preconditions.checkArgument(properties.containsKey(GOBBLIN_COMPLIANCE_DATASET_FINDER_CLASS),
            "Missing required propety " + GOBBLIN_COMPLIANCE_DATASET_FINDER_CLASS);
    String finderClass = properties.getProperty(GOBBLIN_COMPLIANCE_DATASET_FINDER_CLASS);
    this.finder = GobblinConstructorUtils.invokeConstructor(DatasetsFinder.class, finderClass,
            new State(properties));
}

From source file:it.cnr.icar.eric.client.admin.AbstractAdminShell.java

public void setProperties(Properties properties) {
    if (properties.containsKey("debug")) {
        setDebug(Boolean.valueOf(properties.getProperty("debug")).booleanValue());
    }/*from w  ww  .  j  a v a 2  s. com*/

    if (properties.containsKey("verbose")) {
        setVerbose(Boolean.valueOf(properties.getProperty("verbose")).booleanValue());
    }

    context.setProperties(properties);
}

From source file:org.obrienlabs.gps.integration.SwaggerConfig.java

private boolean hasDocDev() {
    Properties systemProperties = System.getProperties();
    return systemProperties.containsKey(ENV_DOC_DEV)
            && systemProperties.getProperty(ENV_DOC_DEV).equals("true");
}

From source file:com.galenframework.tests.runner.GalenConfigTest.java

private void deleteSystemProperty(String key) {
    Properties properties = System.getProperties();
    if (properties.containsKey(key)) {
        properties.remove(key);//from   w w  w.java2  s .  c o m
    }
}

From source file:org.commonjava.maven.ext.core.state.SuffixState.java

public SuffixState(final Properties userProps) {
    suffixStrip = userProps.getProperty(SUFFIX_STRIP_PROPERTY);

    if (StringUtils.isEmpty(suffixStrip) && userProps.containsKey(SUFFIX_STRIP_PROPERTY)) {
        suffixStrip = DEFAULT_SUFFIX_STRIP;
    }/*  w w  w  .java  2s  .  c o m*/
}

From source file:com.magnet.tools.tests.ScenarioUtils.java

@And("^the property file \"([^\"]*)\" should be:$")
public static void the_property_file_should_be(String path, List<PropertyEntry> entries) throws Throwable {
    File propertyFile = new File(expandVariables(path));
    Assert.assertTrue(propertyFile.exists());

    Properties props = new Properties();

    InputStream fis = null;/*w w w. j ava 2 s .c o m*/
    try {
        fis = new FileInputStream(propertyFile);
        props.load(fis);
    } finally {
        if (null != fis) {
            try {
                fis.close();
            } catch (Exception e) {
                /* do nothing */
            }

        }
    }

    for (PropertyEntry entry : entries) {
        if (props.containsKey(expandVariables(entry.key))) {
            Assert.assertEquals(expandVariables(entry.value), props.get(expandVariables(entry.key)));
        } else {
            Assert.fail(entry.key + " key not found in file " + propertyFile);
        }
    }

}

From source file:gobblin.compliance.restore.ComplianceRestoreJob.java

public void initDatasetFinder(Properties properties) {
    Preconditions.checkArgument(// w ww . j  ava2s  .  co m
            properties.containsKey(ComplianceConfigurationKeys.GOBBLIN_COMPLIANCE_DATASET_FINDER_CLASS),
            "Missing required propety " + ComplianceConfigurationKeys.GOBBLIN_COMPLIANCE_DATASET_FINDER_CLASS);
    String finderClass = properties
            .getProperty(ComplianceConfigurationKeys.GOBBLIN_COMPLIANCE_DATASET_FINDER_CLASS);
    this.finder = GobblinConstructorUtils.invokeConstructor(DatasetsFinder.class, finderClass,
            new State(properties));
}

From source file:org.sead.repositories.reference.RefRepoLocalPubRequestFacade.java

public RefRepoLocalPubRequestFacade(String RO_ID, String requestPath, Properties props) {
    super(RO_ID, props);
    requestFilePath = requestPath;//w w w .  j a v  a 2 s. co  m

    if (props.containsKey("proxyserver")) {
        // Proxy Mode
        proxyServer = props.getProperty("proxyserver");
        log.debug("Using Proxy: " + proxyServer);
        setLocalContext(SEADAuthenticator.authenticate(proxyServer));
        if (super.getLocalContext() == null) {
            log.error("Unable to authenticate - exiting");
            System.exit(0);
        }
    }
    starttime = System.currentTimeMillis();
}