Example usage for java.util Properties contains

List of usage examples for java.util Properties contains

Introduction

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

Prototype

@Override
    public boolean contains(Object value) 

Source Link

Usage

From source file:io.fabric8.profiles.ProfilesHelpers.java

public static void merge(Properties target, Properties source) {
    if (source.contains(DELETED)) {
        target.clear();//  w  w  w  .  j a  v a2  s . co  m
    } else {
        for (Map.Entry<Object, Object> entry : source.entrySet()) {
            if (DELETED.equals(entry.getValue())) {
                target.remove(entry.getKey());
            } else {
                target.put(entry.getKey(), entry.getValue());
            }
        }
    }
}

From source file:org.spring.data.gemfire.AbstractGemFireIntegrationTest.java

private static ServerLauncher buildServerLauncher(final String cacheXmlPathname,
        final Properties gemfireProperties, final String serverId, final int serverPort,
        final File serverWorkingDirectory) {
    ServerLauncher.Builder serverLauncherBuilder = new ServerLauncher.Builder()
            //.setCommand(ServerLauncher.Command.START)
            .setDebug(Boolean.FALSE).setForce(Boolean.FALSE).setRedirectOutput(Boolean.TRUE)
            .setServerPort(serverPort).setWorkingDirectory(serverWorkingDirectory.getAbsolutePath())
            .set(DistributionConfig.CACHE_XML_FILE_NAME, cacheXmlPathname);

    if (!gemfireProperties.contains(DistributionConfig.NAME_NAME)) {
        serverLauncherBuilder.setMemberName(serverId);
    }//w  w  w.j a  va 2s  .  c  o  m

    for (String property : gemfireProperties.stringPropertyNames()) {
        serverLauncherBuilder.set(property, gemfireProperties.getProperty(property));
    }

    return serverLauncherBuilder.build();
}

From source file:heigit.ors.routing.traffic.providers.FtpDataSource.java

@Override
public void Initialize(Properties props) {
    server = props.getProperty("server");
    user = props.getProperty("user");
    password = props.getProperty("password");
    file = props.getProperty("file");
    if (props.contains("port"))
        port = Integer.parseInt(props.getProperty("port"));
}

From source file:org.up4j.APITest.java

@Before
public void setUp() throws IOException {
    Properties properties = System.getProperties();
    if (properties.contains("test.email")) {
        email = properties.getProperty("test.email");
    }/*from   w w  w .java2 s  . co  m*/
    if (properties.contains("test.password")) {
        password = properties.getProperty("test.password");
    }

    api = DefaultAPIImpl.newInstance();
    jsonResponseHolder = new JsonResponseHolder();
    ((DefaultAPIImpl) api).addJsonResponseListener(jsonResponseHolder);
    authenticationResponse = api.login(email, password);
}

From source file:com.qubole.quark.sql.QueryContext.java

public QueryContext(Properties info) throws QuarkException {
    try {//from  w w w  .  j a  va  2 s .  c  om
        Class schemaFactoryClazz = Class.forName(info.getProperty("schemaFactory"));
        if (!info.contains(CalciteConnectionProperty.FUN.camelName())) {
            info.put(CalciteConnectionProperty.FUN.camelName(), "standard,hive");
        }
        this.cfg = new CalciteConnectionConfigImpl(info);
        final RelDataTypeSystem typeSystem = cfg.typeSystem(RelDataTypeSystem.class, RelDataTypeSystem.DEFAULT);
        this.typeFactory = new JavaTypeFactoryImpl(typeSystem);
        this.unitTestMode = Boolean.parseBoolean(info.getProperty("unitTestMode", "false"));

        Object obj = schemaFactoryClazz.newInstance();
        if (obj instanceof QuarkFactory) {
            final QuarkFactory schemaFactory = (QuarkFactory) schemaFactoryClazz.newInstance();
            QuarkFactoryResult factoryResult = schemaFactory.create(info);
            for (DataSourceSchema schema : factoryResult.dataSourceSchemas) {
                SchemaPlus schemaPlus = rootSchema.add(schema.getName(), schema);
                schema.setSchemaPlus(schemaPlus);
            }

            SchemaPlus metadataPlus = rootSchema.add(factoryResult.metadataSchema.getName(),
                    factoryResult.metadataSchema);
            factoryResult.metadataSchema.setSchemaPlus(metadataPlus);

            for (DataSourceSchema dataSourceSchema : factoryResult.dataSourceSchemas) {
                dataSourceSchema.initialize(this);
            }
            factoryResult.metadataSchema.initialize(this);

            this.defaultDataSource = factoryResult.defaultSchema;
            defaultSchema = parseDefaultSchema(info);
        } else {
            final TestFactory schemaFactory = (TestFactory) schemaFactoryClazz.newInstance();
            List<QuarkSchema> schemas = schemaFactory.create(info);
            for (QuarkSchema schema : schemas) {
                SchemaPlus schemaPlus = rootSchema.add(schema.getName(), schema);
                schema.setSchemaPlus(schemaPlus);
            }
            for (QuarkSchema schema : schemas) {
                schema.initialize(this);
            }
            if (info.getProperty("defaultSchema") == null) {
                throw new QuarkException(new Throwable("Default schema has to be specified"));
            }
            final ObjectMapper mapper = new ObjectMapper();
            defaultSchema = Arrays.asList(mapper.readValue(info.getProperty("defaultSchema"), String[].class));
        }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IOException e) {
        throw new QuarkException(e);
    }
}

From source file:herddb.jdbc.BasicHerdDBDataSource.java

protected synchronized void ensureClient() throws SQLException {
    if (client == null) {
        ClientConfiguration clientConfiguration = new ClientConfiguration(properties);
        Properties propsNoPassword = new Properties(properties);
        if (propsNoPassword.contains("password")) {
            propsNoPassword.setProperty("password", "-------");
        }/*from   ww  w  . j a v a 2 s  . co m*/
        LOGGER.log(Level.INFO, "Booting HerdDB Client, url:" + url + ", properties:" + propsNoPassword
                + " clientConfig " + clientConfiguration);
        clientConfiguration.readJdbcUrl(url);
        if (properties.containsKey("discoverTableSpaceFromQuery")) {
            this.discoverTableSpaceFromQuery = clientConfiguration.getBoolean("discoverTableSpaceFromQuery",
                    true);
        }
        client = new HDBClient(clientConfiguration);
    }
    if (pool == null) {
        if (properties.containsKey("maxActive")) {
            this.maxActive = Integer.parseInt(properties.get("maxActive").toString());
        }
        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        config.setBlockWhenExhausted(true);
        config.setMaxTotal(maxActive);
        config.setMaxIdle(maxActive);
        config.setMinIdle(maxActive / 2);
        config.setJmxNamePrefix("HerdDBClient");
        pool = new GenericObjectPool<>(new ConnectionsFactory(), config);
    }
}

From source file:gobblin.data.management.retention.DatasetCleaner.java

public DatasetCleaner(FileSystem fs, Properties props) throws IOException {

    this.closer = Closer.create();
    try {//  www  . j  a v a  2 s .  c om
        FileSystem optionalRateControlledFs = fs;
        if (props.contains(DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT)) {
            optionalRateControlledFs = this.closer.register(new RateControlledFileSystem(fs,
                    Long.parseLong(props.getProperty(DATASET_CLEAN_HDFS_CALLS_PER_SECOND_LIMIT))));
            ((RateControlledFileSystem) optionalRateControlledFs).startRateControl();
        }

        this.datasetFinder = new MultiCleanableDatasetFinder(optionalRateControlledFs, props);
    } catch (NumberFormatException exception) {
        throw new IOException(exception);
    } catch (ExecutionException exception) {
        throw new IOException(exception);
    }
    ExecutorService executor = ScalingThreadPoolExecutor.newScalingThreadPool(0,
            Integer.parseInt(props.getProperty(MAX_CONCURRENT_DATASETS_CLEANED,
                    DEFAULT_MAX_CONCURRENT_DATASETS_CLEANED)),
            100, ExecutorsUtils.newThreadFactory(Optional.of(LOG), Optional.of("Dataset-cleaner-pool-%d")));
    this.service = ExecutorsUtils.loggingDecorator(executor);

    List<Tag<?>> tags = Lists.newArrayList();
    tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));
    // TODO -- Remove the dependency on gobblin-core after new Gobblin Metrics does not depend on gobblin-core.
    this.metricContext = this.closer
            .register(Instrumented.getMetricContext(new State(props), DatasetCleaner.class, tags));
    this.isMetricEnabled = GobblinMetrics.isEnabled(props);
    this.eventSubmitter = new EventSubmitter.Builder(this.metricContext, RetentionEvents.NAMESPACE).build();
    this.throwables = Lists.newArrayList();
}

From source file:org.wso2.carbon.bpmn.analytics.publisher.utils.BPMNDataReceiverConfig.java

/**
 * Populate default data publisher Configuration Properties if not exists for given registry resource.
 *
 * @param resource given registry resources
 *//* w w  w.j av  a2  s . c  o m*/
private void populateDefaultConfigurationProperties(Resource resource) {
    if (log.isDebugEnabled()) {
        log.debug("Populating Data publisher configuration. Tenant ID : " + tenantID + ", Registry :"
                + resource.getPath());
    }

    Properties properties = resource.getProperties();
    if (!properties.contains(AnalyticsPublisherConstants.PUBLISHER_ENABLED_PROPERTY))
        resource.addProperty(AnalyticsPublisherConstants.PUBLISHER_ENABLED_PROPERTY, String.valueOf(false));

    if (!properties.contains(AnalyticsPublisherConstants.PUBLISHER_TYPE_PROPERTY))
        resource.addProperty(AnalyticsPublisherConstants.PUBLISHER_TYPE_PROPERTY, "");

    if (!properties.contains(AnalyticsPublisherConstants.PUBLISHER_RECEIVER_URL_SET_PROPERTY))
        resource.addProperty(AnalyticsPublisherConstants.PUBLISHER_RECEIVER_URL_SET_PROPERTY,
                "tcp://localhost:7611");

    if (!properties.contains(AnalyticsPublisherConstants.PUBLISHER_AUTH_URL_SET_PROPERTY))
        resource.addProperty(AnalyticsPublisherConstants.PUBLISHER_AUTH_URL_SET_PROPERTY, "");

    if (!properties.contains(AnalyticsPublisherConstants.PUBLISHER_USER_NAME_PROPERTY))
        resource.addProperty(AnalyticsPublisherConstants.PUBLISHER_USER_NAME_PROPERTY, "admin");

    if (!properties.contains(AnalyticsPublisherConstants.PUBLISHER_PASSWORD_PROPERTY))
        resource.addProperty(AnalyticsPublisherConstants.PUBLISHER_PASSWORD_PROPERTY, "configure me");

    String documentation = "Configure following registry properties in this registry resource to enable BPMN analytics publisher\n\n"
            + AnalyticsPublisherConstants.PUBLISHER_ENABLED_PROPERTY
            + "\t: set this value to true/false to enable/disable data publisher.\n"
            + AnalyticsPublisherConstants.PUBLISHER_TYPE_PROPERTY
            + "\t: The Agent name from which the DataPublisher that needs to be created."
            + " By default Thrift, and Binary is supported. Leave empty for default.\n "
            + AnalyticsPublisherConstants.PUBLISHER_RECEIVER_URL_SET_PROPERTY
            + "\t : The receiving endpoint URL Set. This can be either load balancing URL set or Failover URL set."
            + " Eg : tcp://localhost:7611|tcp://localhost:7612|tcp://localhost:7613\n"
            + AnalyticsPublisherConstants.PUBLISHER_AUTH_URL_SET_PROPERTY
            + "\t: The authenticating URL Set for the endpoints given in receiverURLSet parameter. This should be in the same format"
            + " as receiverURL set parameter. Leave it empty fro default value."
            + AnalyticsPublisherConstants.PUBLISHER_USER_NAME_PROPERTY
            + "\t: Authorized username at receiver. (For Tenant include tenant domain)"
            + AnalyticsPublisherConstants.PUBLISHER_PASSWORD_PROPERTY
            + "\t: The encrypted Password of the username provided.";

    try {
        resource.setContent(documentation);
    } catch (RegistryException e) {
        log.error("Error while adding content to registry resource : " + resource.getPath(), e);
    }
}

From source file:io.fabric8.maven.plugin.mojo.build.BuildMojo.java

/**
 * Customization hook called by the base plugin.
 *
 * @param configs configuration to customize
 * @return the configuration customized by our generators.
 *//*from ww  w  .  j  a v  a 2 s .c  o m*/
@Override
public List<ImageConfiguration> customizeConfig(List<ImageConfiguration> configs) {
    platformMode = clusterAccess.resolvePlatformMode(mode, log);
    if (platformMode == PlatformMode.openshift) {
        log.info("Using [[B]]OpenShift[[B]] build with strategy [[B]]%s[[B]]", buildStrategy.getLabel());
    } else {
        log.info("Building Docker image in [[B]]Kubernetes[[B]] mode");
    }

    if (platformMode.equals(PlatformMode.openshift)) {
        Properties properties = project.getProperties();
        if (!properties.contains(PlatformMode.FABRIC8_EFFECTIVE_PLATFORM_MODE)) {
            properties.setProperty(PlatformMode.FABRIC8_EFFECTIVE_PLATFORM_MODE, platformMode.toString());
        }
    }

    try {
        return GeneratorManager.generate(configs, getGeneratorContext(), false);
    } catch (MojoExecutionException e) {
        throw new IllegalArgumentException("Cannot extract generator config: " + e, e);
    }
}

From source file:org.fusesource.cloudmix.controller.properties.PropertiesEvaluator.java

public void evaluateProperties(Properties answer, FeatureDetails feature) {
    List<PropertyDefinition> list = feature.getProperties();
    if (list != null) {
        for (PropertyDefinition property : list) {
            Expression evaluator = cache.getExpression(property);
            if (evaluator != null) {
                String id = property.getId();
                if (answer.contains(id)) {
                    LOG.warn("Duplicate property definition id " + id + " from feature " + feature);
                }/*w  ww.j  av  a  2 s . co  m*/
                Map<String, Object> variables = createVariables(feature);
                Object value = evaluator.evaluate(variables);
                if (value != null) {
                    answer.put(id, value);
                }
            }
        }
    }
}