List of usage examples for java.util Properties setProperty
public synchronized Object setProperty(String key, String value)
From source file:com.sky.projects.pool.kafka.KafkaConnectionFactory.java
public KafkaConnectionFactory(final String brokers, final String type, final String acks, final String codec, final String batch) { Properties props = new Properties(); props.setProperty(KafkaConfig.BROKERS_LIST_PROPERTY, brokers); props.setProperty(KafkaConfig.PRODUCER_TYPE_PROPERTY, type); props.setProperty(KafkaConfig.REQUEST_ACKS_PROPERTY, acks); props.setProperty(KafkaConfig.COMPRESSION_CODEC_PROPERTY, codec); props.setProperty(KafkaConfig.BATCH_NUMBER_PROPERTY, batch); this.config = new ProducerConfig(props); }
From source file:ezbake.frack.submitter.SubmitterClient.java
private void run(CmdLineParser parser) throws TException, IOException, CmdLineException, EzConfigurationLoaderException { if (!(submit || shutdown || ping)) { throw new CmdLineException(parser, "Must provide either -u or -d option to client"); }/* w w w. j ava 2 s. co m*/ Properties props = new EzConfiguration().getProperties(); props.setProperty(EzBakePropertyConstants.EZBAKE_SECURITY_ID, securityId); ThriftClientPool pool = new ThriftClientPool(props); Submitter.Client client = pool.getClient(submitterConstants.SERVICE_NAME, Submitter.Client.class); try { if (submit) { if (Strings.isNullOrEmpty(pipelineId)) { throw new CmdLineException(parser, "Pipeline ID required for submission"); } File zipFile = new File(pathToTarGz); byte[] fileBytes = FileUtils.readFileToByteArray(zipFile); SubmitResult result = client.submit(ByteBuffer.wrap(fileBytes), pipelineId); System.out.println(result.getMessage()); } else if (shutdown) { if (Strings.isNullOrEmpty(pipelineId)) { throw new CmdLineException(parser, "Pipeline ID required for shutdown"); } client.shutdown(pipelineId); } else { boolean healthy = client.ping(); System.out.println(healthy ? "The service is healthy!" : "The service is unhealthy!"); } } finally { if (client != null) { pool.returnToPool(client); pool.close(); } } }
From source file:com.alejandroszlv.mock.repository.config.RepositoryConfig.java
Properties additionalProperties() { Properties properties = new Properties(); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.DerbyDialect"); return properties; }
From source file:de.escidoc.core.admin.common.util.spring.RemoteJndiLocator.java
/** * Set the JNDI properties./*from w ww. ja v a2 s . c o m*/ * * @throws WebserverSystemException * Thrown in case of an internal error. */ private void setInitialContextJndiProperties() throws WebserverSystemException { Properties properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.setProperty(Context.URL_PKG_PREFIXES, "org.jnp.interfaces:org.jboss.naming"); properties.setProperty(Context.PROVIDER_URL, jndiUrl); this.setJndiEnvironment(properties); }
From source file:io.pivotal.example.app.bootstrap.config.ExampleApplicationGemFireConfiguration.java
@Bean public Properties gemfireProperties(@Value("${gemfire.log.level:config}") String logLevel, @Value("${gemfire.locator.host-port:localhost[10334}") String locatorHostPort) { Properties gemfireProperties = new Properties(); gemfireProperties.setProperty("name", "ExampleGemFireSpringJavaApplication"); gemfireProperties.setProperty("mcast-port", "0"); gemfireProperties.setProperty("log-level", "config"); gemfireProperties.setProperty("locators", locatorHostPort); return gemfireProperties; }
From source file:com.github.jarscanner.XmlGenerator.java
public void generate() { Properties p = new Properties(); p.setProperty("resource.loader", "string"); p.setProperty("resource.loader.class", "org.apache.velocity.runtime.resource.loader.StringResourceLoader"); Velocity.init(p);//from ww w . ja va 2 s. c o m Template template = getTemplate("com/github/jarscanner/jar-data.vm"); VelocityContext context = new VelocityContext(); context.put("duplicatesImpl", duplicatesImpl); context.put("duplicatesBridges", duplicatesBridges); try { Writer writer = new OutputStreamWriter(new FileOutputStream(outXml), "utf-8"); template.merge(context, writer); writer.flush(); writer.close(); } catch (IOException e) { LOG.error(e, e.getMessage()); } }
From source file:nl.tranquilizedquality.itest.configuration.CommonHibernateDBConfiguration.java
@Lazy @Bean(name = "sessionFactory") public SessionFactory sessionFactory(final DataSource datasource) throws IOException { final LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean(); localSessionFactoryBean.setDataSource(datasource); localSessionFactoryBean.setAnnotatedClasses(annotatedClasses); final Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.dialect", hibernateDialect); hibernateProperties.setProperty("hibernate.show_sql", hibernateShowSQL); hibernateProperties.setProperty("hibernate.generate_statistics", hibernateGenerateStatistics); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", hibernateHbm2ddl); localSessionFactoryBean.setHibernateProperties(hibernateProperties); localSessionFactoryBean.afterPropertiesSet(); return localSessionFactoryBean.getObject(); }
From source file:com.haulmont.cuba.portal.config.SiteSettings.java
public Properties getFreeMarkerSettings() { Configuration configuration = AppBeans.get(Configuration.NAME); GlobalConfig globalConfig = configuration.getConfig(GlobalConfig.class); Map<String, Locale> availableLocales = globalConfig.getAvailableLocales(); if (availableLocales.isEmpty()) throw new IllegalStateException("Property cuba.availableLocales is not configured"); Locale locale = availableLocales.values().iterator().next(); FormatStrings formatStrings = Datatypes.getFormatStrings(locale); final Properties freemarkerSettings = new Properties(); freemarkerSettings.setProperty("number_format", "#"); freemarkerSettings.setProperty("datetime_format", formatStrings.getDateTimeFormat()); freemarkerSettings.setProperty("date_format", formatStrings.getDateFormat()); freemarkerSettings.setProperty("template_exception_handler", "rethrow"); return freemarkerSettings; }
From source file:eu.crydee.stanfordcorenlp.Tokenizer.java
/** * Constructor./*from w ww. j ava 2 s . c o m*/ */ public Tokenizer() { Properties props1 = new Properties(); props1.setProperty("annotators", "tokenize, ssplit"); pipelineWithSS = new StanfordCoreNLP(props1); Properties props2 = new Properties(); props2.setProperty("annotators", "tokenize"); pipelineWithoutSS = new StanfordCoreNLP(props2); }