List of usage examples for java.util Properties putAll
@Override public synchronized void putAll(Map<?, ?> t)
From source file:org.apache.zeppelin.rest.InterpreterRestApi.java
/** * Add new interpreter setting/*from ww w. j av a 2 s . co m*/ * @param message * @return * @throws IOException * @throws InterpreterException */ @POST @Path("setting") public Response newSettings(String message) throws InterpreterException, IOException { NewInterpreterSettingRequest request = gson.fromJson(message, NewInterpreterSettingRequest.class); Properties p = new Properties(); p.putAll(request.getProperties()); // Option is deprecated from API, always use remote = true InterpreterGroup interpreterGroup = interpreterFactory.add(request.getName(), request.getGroup(), new InterpreterOption(true), p); InterpreterSetting setting = interpreterFactory.get(interpreterGroup.getId()); logger.info("new setting created with " + setting.id()); return new JsonResponse(Status.CREATED, "", setting).build(); }
From source file:edu.tamu.tcat.db.core.AbstractDataSourceFactory.java
public DataSource getDataSource(Properties parameters) throws DataSourceException { BasicDataSource dataSource = dataSources.get(parameters); if (dataSource == null) { Properties nonMutating = new Properties(); nonMutating.putAll(parameters); dataSource = createDataSource(nonMutating); dataSources.put(nonMutating, dataSource); }//from w w w . ja va 2s.c o m return dataSource; }
From source file:com.flipkart.aesop.runtime.bootstrap.DefaultBootstrapProducerFactory.java
/** * Interface method implementation. Creates and returns a {@link DefaultBootstrapProducer} instance * @see org.springframework.beans.factory.FactoryBean#getObject() *///from w ww . j a v a2 s. c o m public DefaultBootstrapProducer getObject() throws Exception { // using fully qualified class name for Databus BootstrapProducerConfig reference as we have class with same name in Aesop as well com.linkedin.databus.bootstrap.producer.BootstrapProducerConfig producerConfig = new com.linkedin.databus.bootstrap.producer.BootstrapProducerConfig(); ConfigLoader<BootstrapProducerStaticConfig> staticProducerConfigLoader = new ConfigLoader<BootstrapProducerStaticConfig>( BootstrapProducerConfig.BOOTSTRAP_PROPERTIES_PREFIX, producerConfig); // create a merged properties list from Relay Client and Bootstrap specific properties Properties mergedProperties = this.bootstrapProducerConfig.getRelayClientBootstrapProperties(); mergedProperties.putAll(this.clientConfig.getClientProperties()); BootstrapProducerStaticConfig staticProducerConfig = staticProducerConfigLoader .loadConfig(mergedProperties); return new DefaultBootstrapProducer(staticProducerConfig); }
From source file:com.cognifide.qa.bb.config.YamlConfig.java
/** * Loads the default Bobcat configuration from {@code default.yaml} file. * * @return {@inheritDoc}/*from ww w.j av a 2 s .c om*/ */ @Override public Properties loadDefaultConfig() { Properties defaultConfig = new Properties(); defaultConfig.putAll(readDefaultYaml().getDefaultConfig().getProperties()); return defaultConfig; }
From source file:com.amalto.core.save.generator.HazelcastAutoIncrementGenerator.java
@Override public void saveState(XmlServer server) { if (NEED_TO_SAVE.getAndSet(0) == 1) { try {//from w w w . ja v a 2 s . co m Properties properties = new Properties(); properties.putAll(CONFIGURATION); String xmlString = Util.convertAutoIncrement(properties); ItemPOJO pojo = new ItemPOJO(DC, // cluster AUTO_INCREMENT, // concept name IDS, System.currentTimeMillis(), // insertion time xmlString // actual data ); pojo.setDataModelName(XSystemObjects.DM_CONF.getName()); pojo.store(); } catch (Exception e) { LOGGER.error(e.getLocalizedMessage(), e); } } }
From source file:gobblin.azkaban.AzkabanJobLauncher.java
public AzkabanJobLauncher(String jobId, Properties props) throws Exception { super(jobId, LOG); Properties properties = new Properties(); properties.putAll(props); Configuration conf = new Configuration(); String fsUri = conf.get(HADOOP_FS_DEFAULT_NAME); if (!Strings.isNullOrEmpty(fsUri)) { if (!properties.containsKey(ConfigurationKeys.FS_URI_KEY)) { properties.setProperty(ConfigurationKeys.FS_URI_KEY, fsUri); }/* w w w . j av a 2 s. c o m*/ if (!properties.containsKey(ConfigurationKeys.STATE_STORE_FS_URI_KEY)) { properties.setProperty(ConfigurationKeys.STATE_STORE_FS_URI_KEY, fsUri); } } // Set the job tracking URL to point to the Azkaban job execution link URL properties.setProperty(ConfigurationKeys.JOB_TRACKING_URL_KEY, Strings.nullToEmpty(conf.get(AZKABAN_LINK_JOBEXEC_URL))); // Necessary for compatibility with Azkaban's hadoopJava job type // http://azkaban.github.io/azkaban/docs/2.5/#hadoopjava-type if (System.getenv(HADOOP_TOKEN_FILE_LOCATION) != null) { properties.setProperty(MAPREDUCE_JOB_CREDENTIALS_BINARY, System.getenv(HADOOP_TOKEN_FILE_LOCATION)); } JobMetrics.addCustomTagsToProperties(properties, getAzkabanTags()); // If the job launcher type is not specified in the job configuration, // override the default to use the MAPREDUCE launcher. if (!properties.containsKey(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY)) { properties.setProperty(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY, JobLauncherFactory.JobLauncherType.MAPREDUCE.toString()); } // Create a JobLauncher instance depending on the configuration. The same properties object is // used for both system and job configuration properties because Azkaban puts configuration // properties in the .job file and in the .properties file into the same Properties object. this.jobLauncher = this.closer.register(JobLauncherFactory.newJobLauncher(properties, properties)); }
From source file:org.cloudfoundry.reconfiguration.util.StandardPropertyAugmenter.java
private Properties convert(Map<String, String> map) { Properties properties = new Properties(); properties.putAll(map); return properties; }
From source file:com.google.enterprise.connector.otex.LivelinkConnectorFactory.java
/** * Create a connector instance.// www . ja v a 2 s.co m * This conforms to com.google.enterprise.connector.spi.ConnectorFactory * interface for use by validateConfig(). * * @param config Map of configuration properties */ @Override public Connector makeConnector(Map<String, String> config) throws RepositoryException { try { DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader beanReader = new XmlBeanDefinitionReader(factory); Resource prototype = new ClassPathResource("config/connectorInstance.xml"); beanReader.loadBeanDefinitions(prototype); // Seems non-intuitive to load these in this order, but we want newer // versions of the connectors to override any default bean definitions // specified in old-style monolithic connectorInstance.xml files. Resource defaults = new ClassPathResource("config/connectorDefaults.xml"); if (defaults != null) { beanReader.loadBeanDefinitions(defaults); } // This code should be using setLocation rather than setProperties, but // that requires the machinery of InstanceInfo.getPropertiesResource. PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer(); Properties props = new Properties(); props.putAll(config); cfg.setProperties(props); cfg.postProcessBeanFactory(factory); return (Connector) factory.getBean("Livelink_Enterprise_Server"); } catch (Throwable t) { throw new RepositoryException(t); } }
From source file:com.wavemaker.commons.properties.PropertiesWriter.java
protected Properties sort() { if (sortProperties) { Properties sortedProperties = new SortedProperties(); sortedProperties.putAll(properties); properties = sortedProperties;/*from w w w .j a v a 2 s. c o m*/ } return properties; }
From source file:edu.utah.further.core.util.text.PlaceHolderResolverImpl.java
/** * Resolve all place holders in a string. Allows to override the default place holders * for this specific string./*from w ww. ja va 2 s . com*/ * * @param strVal * original string * @param overriddenPlaceholders * map of key-value place holders to use. Is overlaid over the default * place holder map, potentially overriding the default values with * identical keys in both maps * @return string with place holders replaced with their values * @throws ApplicationException * if unresolved or circular place holder references are detected */ @Override public String resolvePlaceholders(final String strVal, final Properties overriddenPlaceholders) { if (strVal == null) { return strVal; } final Properties props = new Properties(defaultPlaceHolders); props.putAll(overriddenPlaceholders); return helper.replacePlaceholders(strVal, props); }