List of usage examples for org.apache.commons.configuration Configuration getString
String getString(String key, String defaultValue);
From source file:com.caricah.iotracah.core.security.DefaultSecurityHandler.java
public void configure(Configuration configuration) { String securityFileDirectory = System.getProperty("iotracah.default.path.conf", SYSTEM_CONFIG_SECURITY_CONFIG_DIRECTORY_DEFAULT_VALUE); securityFileDirectory = configuration.getString(SYSTEM_CONFIG_SECURITY_CONFIG_DIRECTORY, securityFileDirectory);/* w ww . j a va 2s.c o m*/ setSecurityFileDirectory(securityFileDirectory); String defaultPartitionName = configuration.getString(CONFIG_SYSTEM_SECURITY_DEFAULT_PARTITION_NAME, CONFIG_SYSTEM_SECURITY_DEFAULT_PARTITION_NAME_VALUE_DEFAULT); setDefaultPartitionName(defaultPartitionName); }
From source file:com.parallax.server.blocklyprop.monitoring.Monitor.java
@Inject public Monitor(Configuration configuration) { consoleEnabled = configuration.getBoolean("monitor.console.enabled", false); consoleReportingInterval = configuration.getInt("monitor.console.interval", 300); graphiteEnabled = configuration.getBoolean("monitor.graphite.enabled", false); graphitePrefix = configuration.getString("monitor.graphite.prefix", "blocklyprop"); graphiteServerAddress = configuration.getString("monitor.graphite.address", "localhost"); graphiteServerPort = configuration.getInt("monitor.graphite.port", 2003); graphiteReportingInterval = configuration.getInt("monitor.graphite.interval", 30); init();/*from w w w. j a v a 2s . c o m*/ }
From source file:com.caricah.iotracah.datastore.ignitecache.internal.impl.SubscriptionFilterHandler.java
@Override public void configure(Configuration configuration) { String cacheName = configuration.getString(CONFIG_IGNITECACHE_SUBSCRIPTION_FILTER_CACHE_NAME, CONFIG_IGNITECACHE_SUBSCRIPTION_FILTER_CACHE_NAME_VALUE_DEFAULT); setCacheName(cacheName);//from w w w . j ava 2s .c om }
From source file:com.w20e.socrates.process.ModelResource.java
/** * Get the model definition. Create if necessary. * /*from w w w .j a v a 2 s. c om*/ * @param id * Model id * @param cfg * Congfiguration * @return the model definition. * @throws Exception * in case the definition can't be created. */ private synchronized Questionnaire getModelDefinition(final URI id, final Configuration cfg) throws Exception { if (!this.models.containsKey(id)) { this.models.put(id, getFactory( cfg.getString("model.factory", "com.w20e.socrates.factories.XMLQuestionnaireFactory")) .createQuestionnaire(id, cfg)); } return this.models.get(id); }
From source file:com.caricah.iotracah.bootstrap.system.handler.impl.DefaultLogHandler.java
@Override public void configure(Configuration configuration) throws UnRetriableException { String logsConfigFile = SYSTEM_CONFIG_LOGGING_LOG_CONFIG_FILE_DEFAULT_VALUE; String logsConfigDirectory = System.getProperty("iotracah.default.path.conf", DEFAULT_CONFIG_DIRECTORY); if (null != configuration) { logsConfigFile = configuration.getString(SYSTEM_CONFIG_LOGGING_LOG_CONFIG_FILE, SYSTEM_CONFIG_LOGGING_LOG_CONFIG_FILE_DEFAULT_VALUE); logsConfigDirectory = configuration.getString(SYSTEM_CONFIG_LOGGING_LOG_CONFIG_DIRECTORY, logsConfigDirectory);/*from www . j ava 2 s. c o m*/ } String logsConfigFilePath = logsConfigDirectory + File.separator + logsConfigFile; log.debug(" configure : path to logging configs is {} .", logsConfigFilePath); File logConfigurationFile = new File(logsConfigFilePath); if (!logConfigurationFile.exists()) { logConfigurationFile = ResourceFileUtil.getFileFromResource(getClass(), logsConfigFile); } log.debug(" configure : File with logging configs is {} .", logConfigurationFile); Configurator.initialize(null, logConfigurationFile.getAbsolutePath()); }
From source file:com.w20e.socrates.process.RunnerFactoryImpl.java
/** * Create a statemanager for this model. * /* w w w . j av a2 s . c o m*/ * @param m * Model * @param i * Instance * @param rCfg * Rendering info * @param cfg * Configuration resource * @return Statemanager created * @throws Exception * when the statemanager can't be created. */ private StateManager createStateManager(final Configuration cfg, final RenderConfig rCfg, final Model model, final Instance instance) throws Exception { StateManager mgr = (StateManager) Class .forName(cfg.getString("statemanager.class", "com.w20e.socrates.process.DefaultStateManager")) .newInstance(); mgr.init(cfg, rCfg, model, instance); return mgr; }
From source file:de.hybris.platform.servicelayer.config.ConfigServiceTest.java
public void testOldVsNewPerformance() { final Map<String, String> all = Registry.getCurrentTenant().getConfig().getAllParameters(); long count1 = 0; final long start1 = System.currentTimeMillis(); for (final Map.Entry<String, String> entry : all.entrySet()) { final String key = entry.getKey(); //log.info(key + "=" + Registry.getCurrentTenant().getConfig().getString(key, null)); Registry.getCurrentTenant().getConfig().getString(key, null); count1++;/*from w ww. jav a 2 s .c om*/ } final long end1 = System.currentTimeMillis(); log.info("1)Processed " + count1 + " requests; took " + (end1 - start1) + "ms"); long count2 = 0; final long start2 = System.currentTimeMillis(); final Configuration config2 = this.configurationService.getConfiguration(); for (final Iterator<String> iter = config2.getKeys(); iter.hasNext();) { final String key = iter.next(); //log.info(key + "=" + Registry.getCurrentTenant().getConfig().getString(key, null)); config2.getString(key, null); count2++; } final long end2 = System.currentTimeMillis(); log.info("2)Processed " + count2 + " requests; took " + (end2 - start2) + "ms"); log.info("1)Processed " + count1 + " requests; took " + (end1 - start1) + "ms"); }
From source file:net.sf.jclal.util.mail.SenderEmail.java
/** * * @param configuration The configuration of SenderEmail. * *The XML labels supported are:/*from w w w.ja v a 2 s . com*/ * * <ul> * <li>smtp-host= ip</li> * <li>smtp-port= int</li> * <li>to= email</li> * <li>from= email</li> * <li>attach-report-file=boolean</li> * <li>user=String</li> * <li>pass=String</li> * </ul> */ @Override public void configure(Configuration configuration) { String hostT = configuration.getString("smtp-host", ""); if (hostT.isEmpty()) { throw new ConfigurationRuntimeException("\nThe tag <smtp-host></smtp-host> is empty."); } setHost(hostT); int portT = configuration.getInt("smtp-port", 21); setPort(portT); String fromT = configuration.getString("from", ""); if (fromT.isEmpty()) { throw new ConfigurationRuntimeException("\nThe tag <from></from> is empty. "); } setFrom(fromT); // Number of defined recipients int numberRecipients = configuration.getList("to").size(); if (numberRecipients == 0) { throw new ConfigurationRuntimeException("\nAt least one <to></to> tag must be defined. "); } // For each recipients in list for (int i = 0; i < numberRecipients; i++) { String header = "to(" + i + ")"; // recipient String recipientName = configuration.getString(header, ""); // Add this recipient toRecipients.append(recipientName).append(";"); } toRecipients.deleteCharAt(toRecipients.length() - 1); boolean attach = configuration.getBoolean("attach-report-file", false); setAttachReporFile(attach); String userT = configuration.getString("user", ""); if (userT.isEmpty()) { throw new ConfigurationRuntimeException("\nThe tag <user></user> is empty. "); } setUser(userT); String passT = configuration.getString("pass", ""); if (passT.isEmpty()) { throw new ConfigurationRuntimeException("\nThe tag <pass></pass> is empty. "); } setPass(passT); }
From source file:com.dcsquare.hivemq.plugin.fileauthentication.authentication.FileAuthenticator.java
/** * The configuration and {@link PasswordComparator} is injected, using Guice. * * @param configurations object, which holds all properties read from the specified configuration files in {@link com.dcsquare.hivemq.plugin.fileauthentication.FileAuthenticationModule} * @param passwordComparator instance of the class {@link PasswordComparator} *//*from ww w .j a v a2 s. c o m*/ @Inject public FileAuthenticator(Configuration configurations, PasswordComparator passwordComparator) { this.configurations = configurations; this.passwordComparator = passwordComparator; isHashed = configurations.getBoolean("passwordHashing.enabled", true); iterations = configurations.getInt("passwordHashing.iterations", 1000000); algorithm = configurations.getString("passwordHashing.algorithm", "SHA-512"); separationChar = configurations.getString("passwordHashingSalt.separationChar", "$"); isSalted = configurations.getBoolean("passwordHashingSalt.enabled", true); isFirst = configurations.getBoolean("passwordHashingSalt.isFirst", true); }
From source file:net.sf.jclal.activelearning.scenario.AbstractScenario.java
/** * Configuration of Batch Mode//from w ww . j a v a2 s . c o m * * @param configuration The configuration object to use */ public void setBatchModeConfiguration(Configuration configuration) { String batchError = "batch-mode type= "; try { // Set batch String batchModeClassName = configuration.getString("batch-mode[@type]", ""); batchError += batchModeClassName; // batch-mode class Class<? extends IBatchMode> batchModeClass = (Class<? extends IBatchMode>) Class .forName(batchModeClassName); IBatchMode batchModeT = batchModeClass.newInstance(); // Configure query strategy (if necessary) if (batchModeT instanceof IConfigure) { ((IConfigure) batchModeT).configure(configuration.subset("batch-mode")); } setBatchMode(batchModeT); } catch (ClassNotFoundException e) { throw new ConfigurationRuntimeException("\nIllegal batch-mode classname: " + batchError, e); } catch (InstantiationException e) { throw new ConfigurationRuntimeException("\nIllegal batch-mode classname: " + batchError, e); } catch (IllegalAccessException e) { throw new ConfigurationRuntimeException("\nIllegal batch-mode classname: " + batchError, e); } }