List of usage examples for org.apache.commons.configuration Configuration getBoolean
Boolean getBoolean(String key, Boolean defaultValue);
From source file:com.boozallen.cognition.ingest.storm.bolt.enrich.SetDateBolt.java
@Override public void configure(Configuration conf) { dateFormat = conf.getString(DATE_FORMAT); dateFields = new ArrayList<>(); conf.getList(DATE_FIELD).forEach(x -> dateFields.add(x.toString())); _updateIndexField = conf.getBoolean(UPDATE_INDEX_FIELD, false); Validate.notEmpty(dateFields);/*from w ww. j a v a 2s. c o m*/ Validate.notBlank(dateFormat); }
From source file:de.iai.ilcd.webgui.controller.admin.ActivationHandler.java
/** * Create the handler/*from w w w .j av a 2 s . co m*/ */ public ActivationHandler() { // check if the page was called with a request parameter specifying the current user and the activation key this.userName = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("user"); this.activationKey = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap() .get("activationKey"); if (this.userName == null) { this.addI18NFacesMessage("facesMsg.activation.invalidUser", FacesMessage.SEVERITY_ERROR); return; } if (this.activationKey == null) { this.addI18NFacesMessage("facesMsg.activation.invalidKey1", FacesMessage.SEVERITY_ERROR); return; } this.user = this.userDao.getUser(this.userName); if (this.user == null) { this.addI18NFacesMessage("facesMsg.activation.noSuchUser", FacesMessage.SEVERITY_ERROR, this.userName); return; } if (this.user.getRegistrationKey() == null) { this.addI18NFacesMessage("facesMsg.activation.alreadyActivated", FacesMessage.SEVERITY_ERROR, this.userName); return; } if (!this.user.getRegistrationKey().equals(this.activationKey)) { this.addI18NFacesMessage("facesMsg.activation.invalidKey2", FacesMessage.SEVERITY_ERROR); return; } // clear registration key to activate user this.user.setRegistrationKey(null); try { this.user = this.userDao.merge(this.user); } catch (MergeException ex) { this.addI18NFacesMessage("facesMsg.activation.stateError", FacesMessage.SEVERITY_ERROR); return; } Configuration properties = ConfigurationService.INSTANCE.getProperties(); boolean selfActivation = properties.getBoolean("user.registration.selfActivation", Boolean.FALSE); if (selfActivation) { UserLoginActions loginActions = new UserLoginActions(); try { loginActions.login(this.user.getUserName(), this.user.getPasswordHash()); } catch (UnknownAccountException uae) { this.addI18NFacesMessage("facesMsg.activation.accountUnknown", FacesMessage.SEVERITY_ERROR); return; } catch (IncorrectCredentialsException ice) { this.addI18NFacesMessage("facesMsg.activation.incorrectCredentials.pw", FacesMessage.SEVERITY_ERROR); return; } catch (LockedAccountException lae) { this.addI18NFacesMessage("facesMsg.accountLocked", FacesMessage.SEVERITY_ERROR); return; } catch (Exception e) { this.addI18NFacesMessage("facesMsg.error", e); return; } this.addI18NFacesMessage("facesMsg.activation.accountActivatedLoggedIn", FacesMessage.SEVERITY_INFO); } else { this.addI18NFacesMessage("facesMsg.activation.accountActivated", FacesMessage.SEVERITY_INFO); } }
From source file:com.caricah.iotracah.core.init.DatastoresInitializer.java
/** * <code>configure</code> allows the initializer to configure its self * Depending on the implementation conditional operation can be allowed * So as to make the system instance more specialized. * <p>//from w w w. java2s . com * For example: via the configurations the implementation may decide to * shutdown backend services and it just works as a server application to receive * and route requests to the workers which are in turn connected to the backend/datastore servers... * * @param configuration * @throws UnRetriableException */ @Override public void configure(Configuration configuration) throws UnRetriableException { boolean configDatastoreEnabled = configuration.getBoolean(CORE_CONFIG_ENGINE_DATASTORE_IS_ENABLED, CORE_CONFIG_ENGINE_DATASTORE_IS_ENABLED_DEFAULT_VALUE); log.debug(" configure : The datastore function is configured to be enabled [{}]", configDatastoreEnabled); setDatastoreEngineEnabled(configDatastoreEnabled); String configDatastoreClassName = configuration.getString(CORE_CONFIG_ENGINE_DATASTORE_CLASS_NAME, CORE_CONFIG_ENGINE_DATASTORE_CLASS_NAME_DEFAULT_VALUE); log.debug(" configure : The datastore class to be loaded by the system is {}", configDatastoreClassName); setDatastoreClassName(configDatastoreClassName); super.configure(configuration); securityHandler.configure(configuration); }
From source file:net.sf.jclal.activelearning.stopcriterion.PassiveLearningMeasureStopCriterion.java
/** * The measures that are actually recognize for single label data are * the following:// w w w . j ava 2 s . c o m * <ul> * <li>Correctly Classified Instances</li> * <li>Incorrectly Classified Instances</li> * <li>Kappa statistic</li> * <li>Mean absolute error</li> * <li>Root mean squared error</li> * <li>Relative absolute error</li> * <li>Root relative squared error</li> * <li>Coverage of cases</li> * <li>Mean region size</li> * <li>Weighted Precision</li> * <li>Weighted Recall</li> * <li>Weighted FMeasure</li> * <li>Weighted TruePositiveRate</li> * <li>Weighted FalsePositiveRate</li> * <li>Weighted MatthewsCorrelation</li> * <li>Weighted AreaUnderROC</li> * <li>Weighted AreaUnderPRC</li> * </ul> * <br> * The measures that are actually recognize for multi label data are the * following: * <ul> * <li>Hamming Loss</li> * <li>Subset Accuracy</li> * <li>Example-Based Precision</li> * <li>Example-Based Recall</li> * <li>Example-Based F Measure</li> * <li>Example-Based Accuracy</li> * <li>Example-Based Specificity</li> * <li>Micro-averaged Precision</li> * <li>Micro-averaged Recall</li> * <li>Micro-averaged F-Measure</li> * <li>Micro-averaged Specificity</li> * <li>Macro-averaged Precision</li> * <li>Macro-averaged Recall</li> * <li>Macro-averaged F-Measure</li> * <li>Macro-averaged Specificity</li> * <li>Average Precision</li> * <li>Coverage</li> * <li>OneError</li> * <li>IsError</li> * <li>ErrorSetSize</li> * <li>Ranking Loss</li> * <li>Mean Average Precision</li> * <li>Geometric Mean Average Precision</li> * <li>Mean Average Interpolated Precision</li> * <li>Geometric Mean Average Interpolated Precision</li> * <li>Micro-averaged AUC</li> * <li>Macro-averaged AUC</li> * </ul> * * If more than one measure is settled then by default the set of * expressions are evaluated in disjunctive form. * *The XML labels supported are: * * <ul> * <li><b>disjunctive-form= boolean</b></li> * <li><b>measure= String</b>, attribute: maximal= boolean</li> * </ul> * * @param settings the object that stores the configuration */ @Override public void configure(Configuration settings) { boolean disjunctiveForm = settings.getBoolean("disjunctive-form", disjunctive); setDisjunctive(disjunctiveForm); // Number of defined measures int numberMeasures = settings.getList("measure").size(); // For each listener in list for (int i = 0; i < numberMeasures; i++) { String header = "measure(" + i + ")"; // measure classname String measureNameT = settings.getString(header, ""); boolean maximalT = settings.getBoolean(header + "[@maximal]"); // Add this measure addMeasure(measureNameT, maximalT); } }
From source file:com.github.anba.test262.BaseTest262.java
protected BaseTest262(Configuration configuration, String testsuite, String sourceName, String path) { Configuration c = configuration.subset(testsuite); this.testsuite = testsuite; this.sourceName = sourceName; this.path = path; this.strictSupported = c.getBoolean("strict", false); this.encoding = c.getString("encoding", "UTF-8"); }
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 w w w . j av a 2 s . c om @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:com.evolveum.midpoint.web.security.WebApplicationConfiguration.java
public WebApplicationConfiguration(Configuration config) { importFolder = config.getString("importFolder"); exportFolder = config.getString("exportFolder"); progressRefreshInterval = config.getInt("progressRefreshInterval", 400); abortEnabled = config.getBoolean("abortEnabled", true); if (abortEnabled && !isProgressReportingEnabled()) { LOGGER.warn(//w ww . j av a 2s. c om "Abort functionality requires progress reporting to be enabled - set progressRefreshInterval in '" + MidPointApplication.WEB_APP_CONFIGURATION + "' section to a non-zero value"); abortEnabled = false; } String midpointHome = System.getProperty(MIDPOINT_HOME); if (importFolder == null) { if (StringUtils.isNotEmpty(midpointHome)) { importFolder = midpointHome + "/tmp"; } else { importFolder = "."; } } if (exportFolder == null) { if (StringUtils.isNotEmpty(midpointHome)) { exportFolder = midpointHome + "/tmp"; } else { exportFolder = "."; } } }
From source file:edu.kit.dama.staging.adalapi.protocol.SimpleHttp.java
@Override public final void configure(Configuration pConfiguration) { //allow to set socket timeout for connection (default: 30s) useCompression = pConfiguration.getBoolean("compression", Boolean.FALSE); bufferSize = pConfiguration.getInt("bufferSize", READ_BUFFER_SIZE); if (useCompression) { LOGGER.debug("Using compression"); }//from ww w . j a v a 2 s .c o m LOGGER.debug("Special WebDav protocol features:: Compression enabled: {}, Buffer size: {}", new Object[] { useCompression, bufferSize }); }
From source file:com.caricah.iotracah.core.worker.DefaultWorker.java
/** * <code>configure</code> allows the base system to configure itself by getting * all the settings it requires and storing them internally. The plugin is only expected to * pick the settings it has registered on the configuration file for its particular use. * * @param configuration/*ww w. ja v a 2 s .c o m*/ * @throws UnRetriableException */ @Override public void configure(Configuration configuration) throws UnRetriableException { boolean configAnnoymousLoginEnabled = configuration.getBoolean(CORE_CONFIG_WORKER_ANNONYMOUS_LOGIN_ENABLED, CORE_CONFIG_WORKER_ANNONYMOUS_LOGIN_ENABLED_DEFAULT_VALUE); log.debug(" configure : Anonnymous login is configured to be enabled [{}]", configAnnoymousLoginEnabled); setAnnonymousLoginEnabled(configAnnoymousLoginEnabled); String configAnnoymousLoginUsername = configuration.getString(CORE_CONFIG_WORKER_ANNONYMOUS_LOGIN_USERNAME, CORE_CONFIG_ENGINE_WORKER_ANNONYMOUS_LOGIN_USERNAME_DEFAULT_VALUE); log.debug(" configure : Anonnymous login username is configured to be [{}]", configAnnoymousLoginUsername); setAnnonymousLoginUsername(configAnnoymousLoginUsername); String configAnnoymousLoginPassword = configuration.getString(CORE_CONFIG_WORKER_ANNONYMOUS_LOGIN_PASSWORD, CORE_CONFIG_ENGINE_WORKER_ANNONYMOUS_LOGIN_PASSWORD_DEFAULT_VALUE); log.debug(" configure : Anonnymous login password is configured to be [{}]", configAnnoymousLoginPassword); setAnnonymousLoginPassword(configAnnoymousLoginPassword); int keepaliveInSeconds = configuration.getInt(CORE_CONFIG_WORKER_CLIENT_KEEP_ALIVE_IN_SECONDS, CORE_CONFIG_WORKER_CLIENT_KEEP_ALIVE_IN_SECONDS_DEFAULT_VALUE); log.debug(" configure : Keep alive maximum is configured to be [{}]", keepaliveInSeconds); setKeepAliveInSeconds(keepaliveInSeconds); String defaultPartitionName = configuration.getString( DefaultSecurityHandler.CONFIG_SYSTEM_SECURITY_DEFAULT_PARTITION_NAME, DefaultSecurityHandler.CONFIG_SYSTEM_SECURITY_DEFAULT_PARTITION_NAME_VALUE_DEFAULT); setDefaultPartitionName(defaultPartitionName); }
From source file:net.sf.jclal.listener.GraphicalReporterListener.java
/** * * @param configuration The configuration object for the Graphical Reporter * Listener.// w ww .jav a 2s .c o m * *The XML labels supported are: * * <ul> * <li><b>show-window= boolean</b></li> * <li><b>show-passive-learning= boolean</b></li> * </ul> */ @Override public void configure(Configuration configuration) { super.configure(configuration); // By default is false boolean showSeparateWindowTemp = configuration.getBoolean("show-window", showSeparateWindow); setShowSeparateWindow(showSeparateWindowTemp); // By default is false boolean showPassiveLearningTemp = configuration.getBoolean("show-passive-learning", showPassiveLearning); setShowPassiveLearning(showPassiveLearningTemp); }