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:com.evolveum.midpoint.tools.gui.PropertiesGenerator.java

private PropertiesStatistics mergeProperties(Properties baseProperties, Properties targetProperties) {
    PropertiesStatistics stats = new PropertiesStatistics();

    Set<Object> keySet = baseProperties.keySet();
    for (Object key : keySet) {
        if (targetProperties.containsKey(key)) {
            continue;
        }/*www .  ja  va  2 s .c  o m*/

        targetProperties.setProperty((String) key, (String) baseProperties.get(key));
        stats.incrementAdded();
    }

    keySet = new HashSet<Object>();
    keySet.addAll(targetProperties.keySet());
    for (Object key : keySet) {
        if (baseProperties.containsKey(key)) {
            continue;
        }

        targetProperties.remove(key);
        stats.incrementDeleted();
    }

    return stats;
}

From source file:edu.isi.wings.execution.engine.api.impl.local.LocalExecutionEngine.java

public LocalExecutionEngine(Properties props) {
    this.props = props;
    if (props.containsKey("parallel"))
        this.maxParallel = Integer.parseInt(props.getProperty("parallel"));
    this.stepEngine = this;
    this.planEngine = this;
    executor = Executors.newFixedThreadPool(maxParallel);
}

From source file:org.apache.juddi.v3.client.transport.SAPRegistryJAXWSTransport.java

/**
 * Sets the credentials on the RequestContext if the services are protected
 * by Basic Authentication. The username and password are obtained from the 
 * uddi.xml./* www .  j a  v  a2 s .  c  om*/
 * 
 * @param requestContext
 * @throws ConfigurationException
 */
private void setCredentials(Map<String, Object> requestContext) throws ConfigurationException {
    UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(managerName);
    Properties properties = manager.getClientConfig().getUDDINode(nodeName).getProperties();
    String username = null;
    String password = null;
    if (properties.containsKey(Property.BASIC_AUTH_USERNAME)) {
        username = properties.getProperty(Property.BASIC_AUTH_USERNAME);
    }
    if (properties.containsKey(Property.BASIC_AUTH_PASSWORD)) {
        password = properties.getProperty(Property.BASIC_AUTH_PASSWORD);
    }
    if (username != null && password != null) {
        requestContext.put(BindingProvider.USERNAME_PROPERTY, username);
        requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
    }
}

From source file:com.jaspersoft.jasperserver.api.metadata.olap.service.impl.MondrianConnectionSharedCacheEventListener.java

public MondrianConnectionSharedCacheEventListener(ApplicationContext ctx, Properties properties) {

    Properties springBeanNameConfiguration = null;
    try {/*from w w w . j  av a  2  s. c  o m*/
        springBeanNameConfiguration = ((Properties) ctx.getBean("springConfiguration"));
    } catch (NoSuchBeanDefinitionException e) {
        springBeanNameConfiguration = new Properties();
    }

    String repositoryServiceName = "repositoryService";
    if (springBeanNameConfiguration.containsKey("bean.repositoryService")) {
        repositoryServiceName = springBeanNameConfiguration.getProperty("bean.repositoryService");
    }

    RepositoryService repositoryService = (RepositoryService) ctx.getBean(repositoryServiceName);

}

From source file:org.apache.jackrabbit.core.security.principal.DefaultPrincipalProvider.java

/**
 * Sets the {@link #NEGATIVE_ENTRY_KEY} option value to <code>true</code> if
 * it isn't included yet in the passed options, before calling the init
 * method of the base class./*  ww w  .  ja v  a  2 s .co m*/
 * 
 * @param options
 */
@Override
public void init(Properties options) {
    if (!options.containsKey(NEGATIVE_ENTRY_KEY)) {
        options.put(NEGATIVE_ENTRY_KEY, "true");
    }
    super.init(options);
}

From source file:gobblin.runtime.app.ServiceBasedAppLauncher.java

private void addServicesFromProperties(Properties properties) throws IllegalAccessException,
        InstantiationException, ClassNotFoundException, InvocationTargetException {
    if (properties.containsKey(APP_ADDITIONAL_SERVICES)) {
        for (String serviceClassName : new State(properties).getPropAsSet(APP_ADDITIONAL_SERVICES)) {
            Class<?> serviceClass = Class.forName(serviceClassName);
            if (Service.class.isAssignableFrom(serviceClass)) {
                Service service;/*from   ww  w.ja  v a 2  s . c  o  m*/
                Constructor<?> constructor = ConstructorUtils.getMatchingAccessibleConstructor(serviceClass,
                        Properties.class);
                if (constructor != null) {
                    service = (Service) constructor.newInstance(properties);
                } else {
                    service = (Service) serviceClass.newInstance();
                }
                addService(service);
            } else {
                throw new IllegalArgumentException(
                        String.format("Class %s specified by %s does not implement %s", serviceClassName,
                                APP_ADDITIONAL_SERVICES, Service.class.getSimpleName()));
            }
        }
    }
}

From source file:com.jaspersoft.jasperserver.war.xmla.XmlaServletImpl.java

@Override
protected XmlaHandler.ConnectionFactory createConnectionFactory(ServletConfig servletConfig)
        throws ServletException {
    if (server == null) {
        // A derived class can alter how the calalog locator object is
        // created.
        CatalogLocator catalogLocator = makeCatalogLocator(servletConfig);

        Properties springConfiguration = null;
        ApplicationContext ctx = StaticApplicationContext.getApplicationContext();

        springConfiguration = ((Properties) ctx.getBean("springConfiguration"));

        String xmlaRepository = "xmlaRepository";
        if (springConfiguration.containsKey("bean.xmlaRepository")) {
            xmlaRepository = springConfiguration.getProperty("bean.xmlaRepository");
        }//from  w w w .ja  va 2  s. c  o  m

        final Repository repository = StaticApplicationContext.getApplicationContext().getBean(xmlaRepository,
                Repository.class);

        if (catalogLocator == null) {
            catalogLocator = new IdentityCatalogLocator();
        }

        if (repository instanceof XmlaRepositoryImpl) {
            ((XmlaRepositoryImpl) repository).setLocator(catalogLocator);
        }

        server = JsMondrianServerRegistry.INSTANCE.createWithRepository(repository, catalogLocator);
    }
    return (XmlaHandler.ConnectionFactory) server;
}

From source file:clipboardplugin.ClipboardPlugin.java

public void loadSettings(Properties settings) {
    if (settings != null && settings.containsKey("ParamToUse")) {
        mConfigs = new AbstractPluginProgramFormating[1];
        mConfigs[0] = new LocalPluginProgramFormating(
                mLocalizer.msg("defaultName", "ClipboardPlugin - Default"), "{title}",
                settings.getProperty("ParamToUse"), "UTF-8");
        mLocalFormatings = new LocalPluginProgramFormating[1];
        mLocalFormatings[0] = (LocalPluginProgramFormating) mConfigs[0];
        DEFAULT_CONFIG = mLocalFormatings[0];
    }/*from w w w.ja  v  a2  s.  com*/
}

From source file:gobblin.service.FlowConfigsResource.java

/**
 * Retrieve the flow configuration with the given key
 * @param key flow config id key containing group name and flow name
 * @return {@link FlowConfig} with flow configuration
 */// w ww.  j av  a2  s .co m
@Override
public FlowConfig get(ComplexResourceKey<FlowId, EmptyRecord> key) {
    String flowGroup = key.getKey().getFlowGroup();
    String flowName = key.getKey().getFlowName();

    LOG.info("Get called with flowGroup " + flowGroup + " flowName " + flowName);

    try {
        URI flowCatalogURI = new URI("gobblin-flow", null, "/", null, null);
        URI flowUri = new URI(flowCatalogURI.getScheme(), flowCatalogURI.getAuthority(),
                "/" + flowGroup + "/" + flowName, null, null);
        FlowSpec spec = (FlowSpec) getFlowCatalog().getSpec(flowUri);
        FlowConfig flowConfig = new FlowConfig();
        Properties flowProps = spec.getConfigAsProperties();
        Schedule schedule = null;

        if (flowProps.containsKey(ConfigurationKeys.JOB_SCHEDULE_KEY)) {
            schedule = new Schedule();
            schedule.setCronSchedule(flowProps.getProperty(ConfigurationKeys.JOB_SCHEDULE_KEY));
        }
        if (flowProps.containsKey(ConfigurationKeys.JOB_TEMPLATE_PATH)) {
            flowConfig.setTemplateUris(flowProps.getProperty(ConfigurationKeys.JOB_TEMPLATE_PATH));
        } else if (spec.getTemplateURIs().isPresent()) {
            flowConfig.setTemplateUris(StringUtils.join(spec.getTemplateURIs().get(), ","));
        } else {
            flowConfig.setTemplateUris("NA");
        }
        if (schedule != null) {
            if (flowProps.containsKey(ConfigurationKeys.FLOW_RUN_IMMEDIATELY)) {
                schedule.setRunImmediately(
                        Boolean.valueOf(flowProps.getProperty(ConfigurationKeys.FLOW_RUN_IMMEDIATELY)));
            }

            flowConfig.setSchedule(schedule);
        }

        // remove keys that were injected as part of flowSpec creation
        flowProps.remove(ConfigurationKeys.JOB_SCHEDULE_KEY);
        flowProps.remove(ConfigurationKeys.JOB_TEMPLATE_PATH);

        StringMap flowPropsAsStringMap = new StringMap();
        flowPropsAsStringMap.putAll(Maps.fromProperties(flowProps));

        return flowConfig.setId(new FlowId().setFlowGroup(flowGroup).setFlowName(flowName))
                .setProperties(flowPropsAsStringMap);
    } catch (URISyntaxException e) {
        logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "bad URI " + flowName, e);
    } catch (SpecNotFoundException e) {
        logAndThrowRestLiServiceException(HttpStatus.S_404_NOT_FOUND,
                "Flow requested does not exist: " + flowName, null);
    }

    return null;
}

From source file:com.dtolabs.rundeck.core.common.impl.URLFileUpdater.java

private void contentTypeFromCache(final Properties cacheProperties) {
    if (cacheProperties.containsKey(CONTENT_TYPE)) {
        contentType = cacheProperties.getProperty(CONTENT_TYPE);
        cleanContentType();/*w w w.j  a  va  2 s  .c  o m*/
    }
}