List of usage examples for org.apache.commons.configuration Configuration getBoolean
Boolean getBoolean(String key, Boolean defaultValue);
From source file:de.tor.tribes.ui.views.DSWorkbenchReTimerFrame.java
public void restoreCustomProperties(Configuration pConfig) { centerPanel.setMenuVisible(pConfig.getBoolean(getPropertyPrefix() + ".menu.visible", true)); try {//from w ww . j a v a2s . co m jAlwaysOnTopBox.setSelected(pConfig.getBoolean(getPropertyPrefix() + ".alwaysOnTop")); } catch (Exception e) { } setAlwaysOnTop(jAlwaysOnTopBox.isSelected()); PropertyHelper.restoreTableProperties(jResultTable, pConfig, getPropertyPrefix()); }
From source file:co.turnus.analysis.profiler.orcc.ui.OrccStaticProfilerLaunchDelegate.java
@Override public void launch(ILaunchConfiguration launchConfiguration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { // parse the launch configuration options final Configuration configuration = OrccStaticProfilerOptions.getConfiguration(launchConfiguration, mode); // build the profiling job Job job = new Job("TURNUS Orcc Code Profiler") { private OrccStaticProfiler profiler; @Override/*w w w. j a v a 2s. c o m*/ protected void canceling() { OrccLogger.traceln("Code profiling stop request sent by user"); profiler.stop(); } @Override protected IStatus run(IProgressMonitor monitor) { // launch the profiler profiler = new OrccStaticProfiler(); profiler.setConfiguration(configuration); profiler.start(); // refresh the workspace try { EclipseHelper.refreshWorkspace(monitor); } catch (Exception e) { OrccLogger.warnln("Worspace has not been refreshed: you should do it manually"); } return Status.OK_STATUS; } }; // configure process and logger OrccProfilerProcess process = new OrccProfilerProcess(job, launch); launch.addProcess(process); OrccLogger.configureLoggerWithHandler(new OrccUiConsoleHandler(DebugUITools.getConsole(process)), new OrccConsoleFormatter()); // set the log level boolean verbose = configuration.getBoolean(VERBOSE, false); OrccLogger.setLevel(verbose ? OrccLogger.ALL : OrccLogger.TRACE); // Houston we are go job.setUser(false); job.schedule(); }
From source file:net.sf.jclal.util.mail.SenderEmail.java
/** * * @param configuration The configuration of SenderEmail. * *The XML labels supported are:/*from ww w .ja v a 2s . c o m*/ * * <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.wizecommerce.hecuba.hector.HectorBasedHecubaClientManager.java
private void configureHectorSpecificProperties() { hectorClientConfiguration = new HectorClientConfiguration(); final Configuration configuration = ConfigUtils.getInstance().getConfiguration(); hectorClientConfiguration// w w w .ja va 2s .co m .setLoadBalancingPolicy(configuration.getString(HecubaConstants.HECTOR_LOAD_BALANCING_POLICY, HecubaConstants.HECTOR_LOAD_BALANCY_POLICIES.DynamicLoadBalancingPolicy.name())); hectorClientConfiguration .setMaxActive(configuration.getInteger(HecubaConstants.HECTOR_MAX_ACTIVE_POOLS, 50)); hectorClientConfiguration.setMaxIdle(configuration.getInteger(HecubaConstants.HECTOR_MAX_IDLE, -1)); hectorClientConfiguration .setRetryDownedHosts(configuration.getBoolean(HecubaConstants.HECTOR_RETRY_DOWN_HOST, true)); hectorClientConfiguration.setRetryDownedHostsDelayInSeconds( configuration.getInteger(HecubaConstants.HECTOR_RETRY_DOWN_HOST_DELAY, 30)); hectorClientConfiguration.setThriftSocketTimeout( configuration.getInteger(HecubaConstants.HECTOR_THRIFT_SOCKET_TIMEOUT, 100)); hectorClientConfiguration.setUseThriftFramedTransport( configuration.getBoolean(HecubaConstants.HECTOR_USE_THRIFT_FRAME_TRANSPORT, true)); }
From source file:ch.epfl.eagle.daemon.scheduler.Scheduler.java
public void initialize(Configuration conf, InetSocketAddress socket) throws IOException { address = Network.socketAddressToThrift(socket); String mode = conf.getString(EagleConf.DEPLOYMENT_MODE, "unspecified"); this.conf = conf; if (mode.equals("standalone")) { state = new StandaloneSchedulerState(); } else if (mode.equals("configbased")) { state = new ConfigSchedulerState(); } else {/*from w w w . j av a2s.com*/ throw new RuntimeException("Unsupported deployment mode: " + mode); } state.initialize(conf); defaultProbeRatioUnconstrained = conf.getDouble(EagleConf.SAMPLE_RATIO, EagleConf.DEFAULT_SAMPLE_RATIO); defaultProbeRatioConstrained = conf.getDouble(EagleConf.SAMPLE_RATIO_CONSTRAINED, EagleConf.DEFAULT_SAMPLE_RATIO_CONSTRAINED); requestTaskPlacers = Maps.newConcurrentMap(); useCancellation = conf.getBoolean(EagleConf.CANCELLATION, EagleConf.DEFAULT_CANCELLATION); // [[FLORIN this.hostnameCentralizedScheduler = conf.getString("scheduler.centralized", "none"); this.smallPartition = conf.getInt(EagleConf.SMALL_PARTITION, EagleConf.DEFAULT_SMALL_PARTITION); this.bigPartition = conf.getInt(EagleConf.BIG_PARTITION, EagleConf.DEFAULT_BIG_PARTITION); // if(address.getHost().contains(this.hostnameCentralizedScheduler)){ if (address.getHost().matches(this.hostnameCentralizedScheduler)) { amIMaster = true; LOG.info("I am master: " + this.hostnameCentralizedScheduler + "--" + address.getHost() + "--"); } // LOG.info("I am NOT master: "+this.hostnameCentralizedScheduler+"--"+address.getHost()+"--"); // EAGLE this.piggybacking = conf.getBoolean(EagleConf.PIGGYBACKING, EagleConf.DEFAULT_PIGGYBACKING); LOG.info("Piggybacking: " + this.piggybacking); distributedLongStatusTimestamp = -1; distributedNotExecutingLong = new ArrayList<String>(); this.retry_rounds = conf.getInt(EagleConf.RETRY_ROUNDS, EagleConf.DEFAULT_RETRY_ROUNDS); LOG.info("retry_rounds: " + this.retry_rounds); this.last_round_short_partition = conf.getBoolean(EagleConf.LAST_ROUND_SHORT_PARTITION, EagleConf.DEFAULT_LAST_ROUND_SHORT_PARTITION); if (useCancellation) { LOG.debug("Initializing cancellation service"); cancellationService = new CancellationService(nodeMonitorClientPool); new Thread(cancellationService).start(); } else { LOG.debug("Not using cancellation"); } spreadEvenlyTaskSetSize = conf.getInt(EagleConf.SPREAD_EVENLY_TASK_SET_SIZE, EagleConf.DEFAULT_SPREAD_EVENLY_TASK_SET_SIZE); }
From source file:dk.itst.oiosaml.sp.service.LoginHandler.java
public void handleGet(RequestContext context) throws ServletException, IOException { if (log.isDebugEnabled()) log.debug("Go to login..."); IdpMetadata idpMetadata = context.getIdpMetadata(); Configuration conf = context.getConfiguration(); HttpServletRequest request = context.getRequest(); HttpServletResponse response = context.getResponse(); Metadata metadata;//from www .ja va2 s . c o m if (idpMetadata.enableDiscovery()) { log.debug("Discovery profile is active"); String samlIdp = request.getParameter(Constants.DISCOVERY_ATTRIBUTE); if (samlIdp == null) { String discoveryLocation = conf.getString(Constants.DISCOVERY_LOCATION); log.debug("No _saml_idp discovery value found, redirecting to discovery service at " + discoveryLocation); String url = request.getRequestURL().toString(); if (request.getQueryString() != null) { url += "?" + request.getQueryString(); } Audit.log(Operation.DISCOVER, true, "", discoveryLocation); HTTPUtils.sendMetaRedirect(response, discoveryLocation, "r=" + URLEncoder.encode(url, "UTF-8"), true); return; } else if ("".equals(samlIdp)) { String defaultIdP = conf.getString(Constants.PROP_DISCOVERY_DEFAULT_IDP, null); if (defaultIdP != null) { log.debug("No IdP discovered, using default IdP from configuration: " + defaultIdP); metadata = idpMetadata.getMetadata(defaultIdP); } else { if (conf.getBoolean(Constants.PROP_DISCOVERY_PROMPT, false)) { String url = request.getRequestURL().toString(); url += "?RelayState=" + request.getParameter(Constants.SAML_RELAYSTATE); promptIdp(context, url); return; } else { log.debug("No IdP discovered, using first from metadata"); metadata = idpMetadata.getFirstMetadata(); } } } else { String[] entityIds = SAMLUtil.decodeDiscoveryValue(samlIdp); Audit.log(Operation.DISCOVER, false, "", Arrays.asList(entityIds).toString()); metadata = idpMetadata.findSupportedEntity(entityIds); log.debug("Discovered idp " + metadata.getEntityID()); } } else { metadata = idpMetadata.getFirstMetadata(); } Audit.log(Operation.DISCOVER, metadata.getEntityID()); Endpoint signonLocation = metadata .findLoginEndpoint(conf.getStringArray(Constants.PROP_SUPPORTED_BINDINGS)); if (signonLocation == null) { String msg = "Could not find a valid IdP signon location. Supported bindings: " + conf.getString(Constants.PROP_SUPPORTED_BINDINGS) + ", available: " + metadata.getSingleSignonServices(); log.error(msg); throw new RuntimeException(msg); } log.debug("Signing on at " + signonLocation); BindingHandler bindingHandler = context.getBindingHandlerFactory() .getBindingHandler(signonLocation.getBinding()); log.info("Using idp " + metadata.getEntityID() + " at " + signonLocation.getLocation() + " with binding " + signonLocation.getBinding()); HttpSession session = context.getSession(); UserAssertion ua = (UserAssertion) session.getAttribute(Constants.SESSION_USER_ASSERTION); session.removeAttribute(Constants.SESSION_USER_ASSERTION); UserAssertionHolder.set(null); String relayState = context.getRequest().getParameter(Constants.SAML_RELAYSTATE); OIOAuthnRequest authnRequest = OIOAuthnRequest.buildAuthnRequest(signonLocation.getLocation(), context.getSpMetadata().getEntityID(), context.getSpMetadata().getDefaultAssertionConsumerService().getBinding(), context.getSessionHandler(), relayState, context.getSpMetadata().getDefaultAssertionConsumerService().getLocation()); authnRequest.setNameIDPolicy(conf.getString(Constants.PROP_NAMEID_POLICY, null), conf.getBoolean(Constants.PROP_NAMEID_POLICY_ALLOW_CREATE, false)); authnRequest.setForceAuthn(isForceAuthnEnabled(request, conf)); if (ua == null) { authnRequest.setPasive(conf.getBoolean(Constants.PROP_PASSIVE, false)); } Audit.log(Operation.AUTHNREQUEST_SEND, true, authnRequest.getID(), authnRequest.toXML()); context.getSessionHandler().registerRequest(authnRequest.getID(), metadata.getEntityID()); bindingHandler.handle(request, response, context.getCredential(), authnRequest); }
From source file:keel.Algorithms.Neural_Networks.NNEP_Common.mutators.structural.StructuralMutator.java
/** * <p>/*from www.j a v a 2 s . co m*/ * Configuration parameters for StructuralMutator are: * </p> * @params settings Settings to configure * <ul> * <li> * <code>temperature-exponent[@value] double (default=1)</code></p> * Temperature exponent to be used for obtaining temperature * of each indivual mutated. * </li> * <li> * <code>significative-weigth[@value] double (default=0.0000001)</code></p> * Minimum value of new weigths. * </li> * <li> * <code>neurons-ranges: complex</code></p> * Ranges of neurons added or deleted. * <ul> * <li> * <code>neurons-ranges.added: complex</code> * Ranges of neurons added. * <ul> * <li> * <code>neurons-ranges.added[@min] int (default=1)</code> * Minimum number of added neurons. * </li> * <li> * <code>neurons-ranges.added[@max] int (default=2)</code> * Maximum number of added neurons. * </li> * </ul> * </li> * <li> * <code>neurons-ranges.deleted: complex</code> * Ranges of neurons deleted. * <ul> * <li> * <code>neurons-ranges.deleted[@min] int (default=1)</code> * Minimum number of deleted neurons. * </li> * <li> * <code>neurons-ranges.deleted[@max] int (default=2)</code> * Maximum number of deleted neurons. * </li> * </ul> * </li> * </ul> * </li> * <li> * <code>links-ranges: complex</code></p> * Ranges of links added or deleted. * <ul> * <li> * <code>links-ranges[@relative] boolean (default=false)</code> * If we use a relative number of links, then we have to specify * a percentage of links added or deleted, dependind of the layer * operated * </li> * <li> * <code>links-ranges.added: complex</code> * Ranges of absolute number of links added * (when <code>links-ranges.relative = false </code>). * <ul> * <li> * <code>links-ranges.added[@min] int (default=1)</code> * Minimum number of added links. * </li> * <li> * <code>links-ranges.added[@max] int (default=6)</code> * Maximum number of added links. * </li> * </ul> * </li> * <li> * <code>links-ranges.deleted: complex</code> * Ranges of absolute number of links deleted * (when <code>links-ranges.relative = false </code>). * <ul> * <li> * <code>links-ranges.deleted[@min] int (default=1)</code> * Minimum number of deleted links. * </li> * <li> * <code>links-ranges.deleted[@max] int (default=6)</code> * Maximum number of deleted links. * </li> * </ul> * </li> * <li> * <code>links-ranges.percentages: complex</code> * Percentages of links added and deleted * (when <code>links-ranges.relative = true </code>). * <ul> * <li> * <code>links-ranges.percentages[@hidden] int (default=30)</code> * Percentage of links added/deleted of each neuron of a hidden layer. * </li> * <li> * <code>links-ranges.percentages[@output] int (default=5)</code> * Percentage of links added/deleted of each neuron of an output layer. * </li> * </ul> * </li> * </ul> * </li> * </ul> */ public void configure(Configuration settings) { // Setup pr temperExponent = settings.getDouble("temperature-exponent[@value]", 1); // Setup significativeWeigth significativeWeigth = settings.getDouble("significative-weigth[@value]", 0.0000001); // Setup neurons mutation parameters minNeuronsAdd = settings.getInt("neurons-ranges.added[@min]", 1); maxNeuronsAdd = settings.getInt("neurons-ranges.added[@max]", 2); minNeuronsDel = settings.getInt("neurons-ranges.deleted[@min]", 1); maxNeuronsDel = settings.getInt("neurons-ranges.deleted[@max]", 2); // Setup links mutation parameters nOfLinksRelative = settings.getBoolean("links-ranges[@relative]", false); if (!nOfLinksRelative) { minLinksAdd = settings.getInt("links-ranges.added[@min]", 1); maxLinksAdd = settings.getInt("links-ranges.added[@max]", 6); minLinksDel = settings.getInt("links-ranges.deleted[@min]", 1); maxLinksDel = settings.getInt("links-ranges.deleted[@max]", 6); } else { hiddenLinksPercentage = settings.getInt("links-ranges.percentages[@hidden]", 30); outputLinksPercentage = settings.getInt("links-ranges.percentages[@output]", 5); } }
From source file:com.cisco.oss.foundation.http.netlifx.netty.NettyNetflixHttpClient.java
private InternalServerProxyMetadata loadServersMetadataConfiguration() { Configuration subset = ConfigurationFactory.getConfiguration().subset(getApiName()); final Iterator<String> keysIterator = subset.getKeys(); // read default values int readTimeout = subset.getInt("http." + LoadBalancerConstants.READ_TIME_OUT, LoadBalancerConstants.DEFAULT_READ_TIMEOUT); int connectTimeout = subset.getInt("http." + LoadBalancerConstants.CONNECT_TIME_OUT, LoadBalancerConstants.DEFAULT_CONNECT_TIMEOUT); long waitingTime = subset.getLong("http." + LoadBalancerConstants.WAITING_TIME, LoadBalancerConstants.DEFAULT_WAITING_TIME); int numberOfAttempts = subset.getInt("http." + LoadBalancerConstants.NUMBER_OF_ATTEMPTS, LoadBalancerConstants.DEFAULT_NUMBER_OF_ATTEMPTS); long retryDelay = subset.getLong("http." + LoadBalancerConstants.RETRY_DELAY, LoadBalancerConstants.DEFAULT_RETRY_DELAY); long idleTimeout = subset.getLong("http." + LoadBalancerConstants.IDLE_TIME_OUT, LoadBalancerConstants.DEFAULT_IDLE_TIMEOUT); int maxConnectionsPerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_PER_ADDRESS, LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_PER_ADDRESS); int maxConnectionsTotal = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_TOTAL, LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_TOTAL); int maxQueueSizePerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_QUEUE_PER_ADDRESS, LoadBalancerConstants.DEFAULT_MAX_QUEUE_PER_ADDRESS); boolean followRedirects = subset.getBoolean("http." + LoadBalancerConstants.FOLLOW_REDIRECTS, false); boolean disableCookies = subset.getBoolean("http." + LoadBalancerConstants.DISABLE_COOKIES, false); boolean autoCloseable = subset.getBoolean("http." + LoadBalancerConstants.AUTO_CLOSEABLE, true); boolean autoEncodeUri = subset.getBoolean("http." + LoadBalancerConstants.AUTO_ENCODE_URI, true); boolean staleConnectionCheckEnabled = subset .getBoolean("http." + LoadBalancerConstants.IS_STALE_CONN_CHECK_ENABLED, false); boolean serviceDirectoryEnabled = subset .getBoolean("http." + LoadBalancerConstants.SERVICE_DIRECTORY_IS_ENABLED, false); String serviceName = subset.getString("http." + LoadBalancerConstants.SERVICE_DIRECTORY_SERVICE_NAME, "UNKNOWN"); String keyStorePath = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PATH, ""); String keyStorePassword = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PASSWORD, ""); String trustStorePath = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PATH, ""); String trustStorePassword = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PASSWORD, ""); startEurekaClient = subset.getBoolean("http.startEurekaClient", true); final List<String> keys = new ArrayList<String>(); while (keysIterator.hasNext()) { String key = keysIterator.next(); keys.add(key);/* w w w .j a v a 2s .c om*/ } Collections.sort(keys); List<Pair<String, Integer>> hostAndPortPairs = new CopyOnWriteArrayList<Pair<String, Integer>>(); for (String key : keys) { if (key.contains(LoadBalancerConstants.HOST)) { String host = subset.getString(key); // trim the host name if (org.apache.commons.lang.StringUtils.isNotEmpty(host)) { host = host.trim(); } final String portKey = key.replace(LoadBalancerConstants.HOST, LoadBalancerConstants.PORT); if (subset.containsKey(portKey)) { int port = subset.getInt(portKey); // save host and port for future creation of server list hostAndPortPairs.add(Pair.of(host, port)); } } } InternalServerProxyMetadata metadata = new InternalServerProxyMetadata(readTimeout, connectTimeout, idleTimeout, maxConnectionsPerAddress, maxConnectionsTotal, maxQueueSizePerAddress, waitingTime, numberOfAttempts, retryDelay, hostAndPortPairs, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword, followRedirects, autoCloseable, staleConnectionCheckEnabled, disableCookies, serviceDirectoryEnabled, serviceName, autoEncodeUri); return metadata; }
From source file:com.cisco.oss.foundation.http.AbstractHttpClient.java
private InternalServerProxyMetadata loadServersMetadataConfiguration() { Configuration subset = configuration.subset(apiName); final Iterator<String> keysIterator = subset.getKeys(); // read default values int readTimeout = subset.getInt("http." + LoadBalancerConstants.READ_TIME_OUT, LoadBalancerConstants.DEFAULT_READ_TIMEOUT); int connectTimeout = subset.getInt("http." + LoadBalancerConstants.CONNECT_TIME_OUT, LoadBalancerConstants.DEFAULT_CONNECT_TIMEOUT); long waitingTime = subset.getLong("http." + LoadBalancerConstants.WAITING_TIME, LoadBalancerConstants.DEFAULT_WAITING_TIME); int numberOfAttempts = subset.getInt("http." + LoadBalancerConstants.NUMBER_OF_ATTEMPTS, LoadBalancerConstants.DEFAULT_NUMBER_OF_ATTEMPTS); long retryDelay = subset.getLong("http." + LoadBalancerConstants.RETRY_DELAY, LoadBalancerConstants.DEFAULT_RETRY_DELAY); long idleTimeout = subset.getLong("http." + LoadBalancerConstants.IDLE_TIME_OUT, LoadBalancerConstants.DEFAULT_IDLE_TIMEOUT); int maxConnectionsPerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_PER_ADDRESS, LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_PER_ADDRESS); int maxConnectionsTotal = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_TOTAL, LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_TOTAL); int maxQueueSizePerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_QUEUE_PER_ADDRESS, LoadBalancerConstants.DEFAULT_MAX_QUEUE_PER_ADDRESS); boolean followRedirects = subset.getBoolean("http." + LoadBalancerConstants.FOLLOW_REDIRECTS, false); boolean disableCookies = subset.getBoolean("http." + LoadBalancerConstants.DISABLE_COOKIES, false); boolean autoCloseable = subset.getBoolean("http." + LoadBalancerConstants.AUTO_CLOSEABLE, true); boolean autoEncodeUri = subset.getBoolean("http." + LoadBalancerConstants.AUTO_ENCODE_URI, true); boolean staleConnectionCheckEnabled = subset .getBoolean("http." + LoadBalancerConstants.IS_STALE_CONN_CHECK_ENABLED, false); boolean serviceDirectoryEnabled = subset .getBoolean("http." + LoadBalancerConstants.SERVICE_DIRECTORY_IS_ENABLED, false); String serviceName = subset.getString("http." + LoadBalancerConstants.SERVICE_DIRECTORY_SERVICE_NAME, "UNKNOWN"); String keyStorePath = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PATH, ""); String keyStorePassword = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PASSWORD, ""); String trustStorePath = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PATH, ""); String trustStorePassword = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PASSWORD, ""); final List<String> keys = new ArrayList<String>(); while (keysIterator.hasNext()) { String key = keysIterator.next(); keys.add(key);/*from w w w . ja v a2 s. co m*/ } Collections.sort(keys); List<Pair<String, Integer>> hostAndPortPairs = new CopyOnWriteArrayList<Pair<String, Integer>>(); for (String key : keys) { if (key.contains(LoadBalancerConstants.HOST)) { String host = subset.getString(key); // trim the host name if (StringUtils.isNotEmpty(host)) { host = host.trim(); } final String portKey = key.replace(LoadBalancerConstants.HOST, LoadBalancerConstants.PORT); if (subset.containsKey(portKey)) { int port = subset.getInt(portKey); // save host and port for future creation of server list hostAndPortPairs.add(Pair.of(host, port)); } } } InternalServerProxyMetadata metadata = new InternalServerProxyMetadata(readTimeout, connectTimeout, idleTimeout, maxConnectionsPerAddress, maxConnectionsTotal, maxQueueSizePerAddress, waitingTime, numberOfAttempts, retryDelay, hostAndPortPairs, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword, followRedirects, autoCloseable, staleConnectionCheckEnabled, disableCookies, serviceDirectoryEnabled, serviceName, autoEncodeUri); // metadata.getHostAndPortPairs().addAll(hostAndPortPairs); // metadata.setReadTimeout(readTimeout); // metadata.setConnectTimeout(connectTimeout); // metadata.setNumberOfRetries(numberOfAttempts); // metadata.setRetryDelay(retryDelay); // metadata.setWaitingTime(waitingTime); return metadata; }
From source file:com.evolveum.midpoint.task.quartzimpl.TaskManagerConfiguration.java
void setJdbcJobStoreInformation(MidpointConfiguration masterConfig, SqlRepositoryConfiguration sqlConfig, String defaultJdbcUrlPrefix) { Configuration c = masterConfig.getConfiguration(TASK_MANAGER_CONFIG_SECTION); jdbcDriver = c.getString(JDBC_DRIVER_CONFIG_ENTRY, sqlConfig != null ? sqlConfig.getDriverClassName() : null); String explicitJdbcUrl = c.getString(JDBC_URL_CONFIG_ENTRY, null); if (explicitJdbcUrl == null) { if (sqlConfig.isEmbedded()) { jdbcUrl = defaultJdbcUrlPrefix + "-quartz;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE"; } else {/*from w w w . j a v a 2 s . com*/ jdbcUrl = sqlConfig.getJdbcUrl(); } } else { jdbcUrl = explicitJdbcUrl; } dataSource = c.getString(DATA_SOURCE_CONFIG_ENTRY, null); if (dataSource == null && explicitJdbcUrl == null && sqlConfig != null) { dataSource = sqlConfig.getDataSource(); // we want to use quartz-specific JDBC if there is one (i.e. we do not want to inherit data source from repo in such a case) } if (dataSource != null) { LOGGER.info("Quartz database is at {} (a data source)", dataSource); } else { LOGGER.info("Quartz database is at {} (a JDBC URL)", jdbcUrl); } jdbcUser = c.getString(JDBC_USER_CONFIG_ENTRY, sqlConfig != null ? sqlConfig.getJdbcUsername() : null); jdbcPassword = c.getString(JDBC_PASSWORD_CONFIG_ENTRY, sqlConfig != null ? sqlConfig.getJdbcPassword() : null); hibernateDialect = sqlConfig != null ? sqlConfig.getHibernateDialect() : ""; String defaultSqlSchemaFile = schemas.get(hibernateDialect); String defaultDriverDelegate = delegates.get(hibernateDialect); sqlSchemaFile = c.getString(SQL_SCHEMA_FILE_CONFIG_ENTRY, defaultSqlSchemaFile); jdbcDriverDelegateClass = c.getString(JDBC_DRIVER_DELEGATE_CLASS_CONFIG_ENTRY, defaultDriverDelegate); createQuartzTables = c.getBoolean(CREATE_QUARTZ_TABLES_CONFIG_ENTRY, CREATE_QUARTZ_TABLES_DEFAULT); }