List of usage examples for org.apache.commons.configuration Configuration getInt
int getInt(String key, int defaultValue);
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/* w ww . ja v a2s.com*/ * @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:com.evolveum.midpoint.repo.sql.SqlRepositoryConfiguration.java
public SqlRepositoryConfiguration(Configuration configuration) { setDatabase(configuration.getString(PROPERTY_DATABASE, database)); computeDefaultDatabaseParameters();//from www . j a va2 s. c om setAsServer(configuration.getBoolean(PROPERTY_AS_SERVER, embedded)); setBaseDir(configuration.getString(PROPERTY_BASE_DIR, baseDir)); setDriverClassName(configuration.getString(PROPERTY_DRIVER_CLASS_NAME, driverClassName)); setEmbedded(configuration.getBoolean(PROPERTY_EMBEDDED, embedded)); setHibernateDialect(configuration.getString(PROPERTY_HIBERNATE_DIALECT, hibernateDialect)); setHibernateHbm2ddl(configuration.getString(PROPERTY_HIBERNATE_HBM2DDL, hibernateHbm2ddl)); setJdbcPassword(configuration.getString(PROPERTY_JDBC_PASSWORD, jdbcPassword)); setJdbcUrl(configuration.getString(PROPERTY_JDBC_URL, jdbcUrl)); setJdbcUsername(configuration.getString(PROPERTY_JDBC_USERNAME, jdbcUsername)); setPort(configuration.getInt(PROPERTY_PORT, port)); setTcpSSL(configuration.getBoolean(PROPERTY_TCP_SSL, tcpSSL)); setFileName(configuration.getString(PROPERTY_FILE_NAME, fileName)); setDropIfExists(configuration.getBoolean(PROPERTY_DROP_IF_EXISTS, dropIfExists)); setDataSource(configuration.getString(PROPERTY_DATASOURCE, null)); setMinPoolSize(configuration.getInt(PROPERTY_MIN_POOL_SIZE, minPoolSize)); setMaxPoolSize(configuration.getInt(PROPERTY_MAX_POOL_SIZE, maxPoolSize)); setUseZip(configuration.getBoolean(PROPERTY_USE_ZIP, useZip)); computeDefaultConcurrencyParameters(); setTransactionIsolation( configuration.getString(PROPERTY_TRANSACTION_ISOLATION, transactionIsolation.value())); setLockForUpdateViaHibernate( configuration.getBoolean(PROPERTY_LOCK_FOR_UPDATE_VIA_HIBERNATE, lockForUpdateViaHibernate)); setLockForUpdateViaSql(configuration.getBoolean(PROPERTY_LOCK_FOR_UPDATE_VIA_SQL, lockForUpdateViaSql)); setUseReadOnlyTransactions( configuration.getBoolean(PROPERTY_USE_READ_ONLY_TRANSACTIONS, useReadOnlyTransactions)); setPerformanceStatisticsFile( configuration.getString(PROPERTY_PERFORMANCE_STATISTICS_FILE, performanceStatisticsFile)); setPerformanceStatisticsLevel( configuration.getInt(PROPERTY_PERFORMANCE_STATISTICS_LEVEL, performanceStatisticsLevel)); computeDefaultIterativeSearchParameters(); setIterativeSearchByPaging( configuration.getBoolean(PROPERTY_ITERATIVE_SEARCH_BY_PAGING, iterativeSearchByPaging)); setIterativeSearchByPagingBatchSize(configuration.getInt(PROPERTY_ITERATIVE_SEARCH_BY_PAGING_BATCH_SIZE, iterativeSearchByPagingBatchSize)); setIgnoreOrgClosure(configuration.getBoolean(PROPERTY_IGNORE_ORG_CLOSURE, false)); setOrgClosureStartupAction(configuration.getString(PROPERTY_ORG_CLOSURE_STARTUP_ACTION, OrgClosureManager.StartupAction.REBUILD_IF_NEEDED.toString())); setSkipOrgClosureStructureCheck(configuration.getBoolean(PROPERTY_SKIP_ORG_CLOSURE_STRUCTURE_CHECK, false)); setStopOnOrgClosureStartupFailure( configuration.getBoolean(PROPERTY_STOP_ON_ORG_CLOSURE_STARTUP_FAILURE, true)); }
From source file:com.caricah.iotracah.core.worker.DumbWorker.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// www .j a va 2 s. c om * @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); }
From source file:edu.berkeley.sparrow.daemon.scheduler.Scheduler.java
public void initialize(Configuration conf, InetSocketAddress socket) throws IOException { address = Network.socketAddressToThrift(socket); String mode = conf.getString(SparrowConf.DEPLYOMENT_MODE, "unspecified"); this.conf = conf; if (mode.equals("standalone")) { state = new StandaloneSchedulerState(); } else if (mode.equals("configbased")) { state = new ConfigSchedulerState(); } else {/*from ww w . j a v a2 s .c o m*/ throw new RuntimeException("Unsupported deployment mode: " + mode); } state.initialize(conf); defaultProbeRatioUnconstrained = conf.getDouble(SparrowConf.SAMPLE_RATIO, SparrowConf.DEFAULT_SAMPLE_RATIO); defaultProbeRatioConstrained = conf.getDouble(SparrowConf.SAMPLE_RATIO_CONSTRAINED, SparrowConf.DEFAULT_SAMPLE_RATIO_CONSTRAINED); requestTaskPlacers = Maps.newConcurrentMap(); useCancellation = conf.getBoolean(SparrowConf.CANCELLATION, SparrowConf.DEFAULT_CANCELLATION); if (useCancellation) { LOG.debug("Initializing cancellation service"); cancellationService = new CancellationService(nodeMonitorClientPool); new Thread(cancellationService).start(); } else { LOG.debug("Not using cancellation"); } spreadEvenlyTaskSetSize = conf.getInt(SparrowConf.SPREAD_EVENLY_TASK_SET_SIZE, SparrowConf.DEFAULT_SPREAD_EVENLY_TASK_SET_SIZE); }
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 ww . j a v a 2 s. c om 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:com.blazegraph.gremlin.structure.BlazeGraph.java
/** * Construct an instance using the supplied configuration. *///from w ww . j a va2 s .c om protected BlazeGraph(final Configuration config) { this.config = config; this.vf = Optional.ofNullable((BlazeValueFactory) config.getProperty(Options.VALUE_FACTORY)) .orElse(BlazeValueFactory.INSTANCE); final long listIndexFloor = config.getLong(Options.LIST_INDEX_FLOOR, System.currentTimeMillis()); this.vpIdFactory = new AtomicLong(listIndexFloor); this.maxQueryTime = config.getInt(Options.MAX_QUERY_TIME, 0); this.sparqlLogMax = config.getInt(Options.SPARQL_LOG_MAX, Options.DEFAULT_SPARQL_LOG_MAX); this.TYPE = vf.type(); this.VALUE = vf.value(); this.LI_DATATYPE = vf.liDatatype(); this.sparql = new SparqlGenerator(vf); this.transforms = new Transforms(); }
From source file:net.sf.jclal.evaluation.method.RealScenario.java
@Override protected void setDataConfiguration(Configuration configuration) { // Set multiLabel flag boolean multi = configuration.getBoolean("multi-label", false); setMultiLabel(multi);/*from w w w . jav a2 s . co m*/ // Set multiInstance flag boolean multiInstance = configuration.getBoolean("multi-instance", false); setMultiInstance(multiInstance); // Set the xml file, it is used in the case of a multi-label // dataset String xml = configuration.getString("file-xml", ""); setXmlPath(xml); // the multi-label elements are verified if (multi && xml.isEmpty()) { throw new ConfigurationRuntimeException( "\nThe multi-label flag is " + "enabled and the xml path is empty. " + "<multi-label>true</multi-label>" + " <file-xml></file-xml>"); } // Set file labeled String fileLabeled = configuration.getString("file-labeled", ""); setFileLabeledDataset(fileLabeled); // Set file unlabeled String fileUnlabeled = configuration.getString("file-unlabeled", ""); setFileUnlabeledDataset(fileUnlabeled); if (fileLabeled.isEmpty() || fileUnlabeled.isEmpty()) { throw new ConfigurationRuntimeException("\n <file-labeled> and <file-unlabeled> tags must be defined."); } // Set file test String fileTest = configuration.getString("file-test", ""); if (fileTest.isEmpty()) { /* * Logger.getLogger(RealScenario.class.getName()).log(Level.INFO, * "The param <file-test> is empty, the active learning algorithm require this property " * + * "for evaluating the constructed model, but in real scenario is not really necessary. In this case, " * + "we assign the <file-unlabeled> as <file-test>."); */ fileTest = fileUnlabeled; } setFileTestDataset(fileTest); // Set class attribute int classAttributeT = configuration.getInt("class-attribute", -1); setClassAttribute(classAttributeT); }
From source file:net.sf.jclal.evaluation.method.AbstractEvaluationMethod.java
/** * * @param configuration The configuration object for Abstract Evaluation * Method.//from w w w. j a va2s .c o m * *The XML labels supported are: * * <ul> * <li> * <b>rand-gen-factory type= class</b> * <p> * Package: net.sf.jclal.util.random * </p> * <p> * Class: All * </p> * </li> * <li> * <b>sampling-method type= class</b> * <p> * Package: net.sf.jclal.sampling * </p> * <p> * Class: All * </p> * </li> * <li><b>multi-label= boolean</b></li> * <li><b>multi-instance= boolean</b></li> * <li><b>file-dataset= String</b></li> * <li><b>file-train= String</b></li> * <li><b>file-test= String</b></li> * <li><b>file-labeled= String</b></li> * <li><b>file-unlabeled= String</b></li> * <li><b>class-attribute= int</b></li> * <li> * <b>algorithm type= class</b> * <p> * Package: net.sf.jclal.activelearning * </p> * <p> * Class: All * </p> * </li> * <li><b>file-xml= String</b>: If the dataset is multi label</li> * </ul> */ @Override public void configure(Configuration configuration) { setRandGenSettings(configuration); // Set multiLabel flag boolean multi = configuration.getBoolean("multi-label", false); setMultiLabel(multi); // Set multiInstance flag boolean multiInstance = configuration.getBoolean("multi-instance", false); setMultiInstance(multiInstance); // Set the xml file, it is used in the case of a multi-label // dataset String xml = configuration.getString("file-xml", ""); setXmlPath(xml); //the multi-label elements are verified if (multi && xml.isEmpty()) { throw new ConfigurationRuntimeException( "\nThe multi-label flag is " + "enabled and the xml path is empty. " + "<multi-label>true</multi-label>" + " <file-xml></file-xml>"); } // Set file dataset (default "") String fileDatasetT = configuration.getString("file-dataset", ""); setFileDataset(fileDatasetT); if (fileDataset.isEmpty()) { // Set file train String fileTrain = configuration.getString("file-train", ""); setFileTrainDataset(fileTrain); // Set file test String fileTest = configuration.getString("file-test", ""); setFileTestDataset(fileTest); if (fileTest.isEmpty()) { throw new ConfigurationRuntimeException("\n If <file-dataset> tag is not specified," + " then the <file-test> tags must be defined."); } if (fileTrain.isEmpty()) { // Set file labeled String fileLabeled = configuration.getString("file-labeled", ""); setFileLabeledDataset(fileLabeled); // Set file labeled String fileUnlabeled = configuration.getString("file-unlabeled", ""); setFileUnlabeledDataset(fileUnlabeled); if (fileLabeled.isEmpty() || fileUnlabeled.isEmpty()) { throw new ConfigurationRuntimeException( "\n If <file-dataset> and " + " <file-train> tags are not specified," + " then the <file-labeled> and <file-unlabeled> tags must be defined."); } } } // Set class attribute int classAttributeT = configuration.getInt("class-attribute", -1); setClassAttribute(classAttributeT); //Set the configuration of the sampling method setSamplingStrategyConfiguration(configuration); setAlgorithmSettings(configuration); }
From source file:com.cisco.oss.foundation.http.server.jetty.JettyHttpServerFactory.java
/** * @param serviceName - the http logical service name * @param servlets - a mapping between servlet path and servlet instance. This mapping uses the google collections {@link com.google.common.collect.ListMultimap}. * <br>Example of usage: * {@code ArrayListMultimap<String,Servlet> servletMap = ArrayListMultimap.create()} * @param filters - a mapping between filter path and filter instance. This mapping uses the google collections {@link com.google.common.collect.ListMultimap}. * <br>Example of usage: * {@code ArrayListMultimap<String,Filter> filterMap = ArrayListMultimap.create()} * @param eventListeners event listeners to be applied on this server * @param keyStorePath - a path to the keystore file * @param keyStorePassword - the keystore password * @param trustStorePath - the trust store file path * @param trustStorePassword - the trust store password */// w w w . j av a 2 s . c o m @Override public void startHttpServer(String serviceName, ListMultimap<String, Servlet> servlets, ListMultimap<String, Filter> filters, List<EventListener> eventListeners, Map<String, String> initParams, String keyStorePath, String keyStorePassword, String trustStorePath, String trustStorePassword) { if (servers.get(serviceName) != null) { throw new UnsupportedOperationException( "you must first stop stop server: " + serviceName + " before you want to start it again!"); } Configuration configuration = ConfigurationFactory.getConfiguration(); boolean sessionManagerEnabled = configuration.getBoolean(serviceName + ".http.sessionManagerEnabled", false); ContextHandlerCollection handler = new ContextHandlerCollection(); JettyHttpThreadPool jettyHttpThreadPool = new JettyHttpThreadPool(serviceName); Map<String, Map<String, String>> servletMapping = ConfigUtil .parseComplexArrayStructure(serviceName + ".http.servletsMapping"); Map<String, ServletContextHandler> contextMap = new HashMap<>(); int servletNum = -1; for (Map.Entry<String, Servlet> entry : servlets.entries()) { servletNum++; ServletContextHandler context = new ServletContextHandler(); if (sessionManagerEnabled) { context = new ServletContextHandler(ServletContextHandler.SESSIONS); } String uri = entry.getKey(); if (servletMapping != null && !servletMapping.isEmpty()) { contextMap.put(uri, context); } context.setContextPath(configuration.getString(serviceName + ".http.servletContextPath", "/")); if (eventListeners != null && !eventListeners.isEmpty()) { if (servletMapping != null && !servletMapping.isEmpty() && eventListeners.size() == servlets.size()) { context.setEventListeners(new EventListener[] { eventListeners.get(servletNum) }); } else { context.setEventListeners(eventListeners.toArray(new EventListener[0])); } for (EventListener eventListener : JettyHttpServerFactory.eventListeners) { context.addEventListener(eventListener); } } context.addServlet(new ServletHolder(entry.getValue()), uri); for (Map.Entry<String, String> initParam : initParams.entrySet()) { context.setInitParameter(initParam.getKey(), initParam.getValue()); } HttpServerUtil.addFiltersToServletContextHandler(serviceName, jettyHttpThreadPool, context); for (Map.Entry<String, Filter> filterEntry : filters.entries()) { context.addFilter(new FilterHolder(filterEntry.getValue()), filterEntry.getKey(), EnumSet.allOf(DispatcherType.class)); } handler.addHandler(context); } Server server = new Server(); server.setSendServerVersion(false); try { List<Connector> connectors = new ArrayList<>(3); List<String> startupLogs = new ArrayList<>(3); // set connectors String host = configuration.getString(serviceName + ".http.host", "0.0.0.0"); int port = configuration.getInt(serviceName + ".http.port", 8080); int connectionIdleTime = configuration.getInt(serviceName + ".http.connectionIdleTime", 180000); boolean isBlockingChannelConnector = configuration .getBoolean(serviceName + ".http.isBlockingChannelConnector", false); int numberOfAcceptors = configuration.getInt(serviceName + ".http.numberOfAcceptors", Runtime.getRuntime().availableProcessors()); int acceptQueueSize = configuration.getInt(serviceName + ".http.acceptQueueSize", 0); boolean serviceDirectoryEnabled = configuration .getBoolean(serviceName + ".http.serviceDirectory.isEnabled", false); if (servletMapping != null && !servletMapping.isEmpty()) { for (Map<String, String> servletToConnctor : servletMapping.values()) { String logicalName = servletToConnctor.get("logicalName"); String uriMapping = servletToConnctor.get("uriMapping"); String hostForConnector = servletToConnctor.get("host"); int portForConnector = Integer.parseInt(servletToConnctor.get("port")); ServletContextHandler servletContextHandler = contextMap.get(uriMapping); servletContextHandler.setVirtualHosts(new String[] { "@" + logicalName }); boolean isSSL = Boolean.valueOf(servletToConnctor.get("isSSL")); getConnectors(startupLogs, connectors, isSSL, logicalName, serviceName, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword, configuration, hostForConnector, portForConnector, connectionIdleTime, isBlockingChannelConnector, numberOfAcceptors, acceptQueueSize); servletContextHandler.setConnectorNames(new String[] { logicalName }); } } else { boolean useHttpsOnly = configuration.getBoolean(serviceName + ".https.useHttpsOnly", false); getConnectors(startupLogs, connectors, useHttpsOnly, null, serviceName, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword, configuration, host, port, connectionIdleTime, isBlockingChannelConnector, numberOfAcceptors, acceptQueueSize); } server.setConnectors(connectors.toArray(new Connector[0])); // set thread pool server.setThreadPool(jettyHttpThreadPool.threadPool); // set servlets/context handlers server.setHandler(handler); server.start(); ProvidedServiceInstance instance = null; if (serviceDirectoryEnabled) { instance = registerWithSDServer(serviceName, host, port); } servers.put(serviceName, Pair.of(server, instance)); for (String startupLog : startupLogs) { LOGGER.info(startupLog); } // server.join(); } catch (Exception e) { LOGGER.error("Problem starting the http {} server. Error is {}.", new Object[] { serviceName, e, e }); throw new ServerFailedToStartException(e); } }
From source file:com.evolveum.midpoint.wf.impl.WfConfiguration.java
@PostConstruct void initialize() { Configuration c = midpointConfiguration.getConfiguration(WF_CONFIG_SECTION); checkAllowedKeys(c, KNOWN_KEYS, DEPRECATED_KEYS); enabled = c.getBoolean(KEY_ENABLED, true); if (!enabled) { LOGGER.info("Workflows are disabled."); return;/*from w w w . j a v a 2 s . c o m*/ } // activiti properties related to database connection will be taken from SQL repository SqlRepositoryConfiguration sqlConfig = null; String defaultJdbcUrlPrefix = null; try { RepositoryFactory repositoryFactory = (RepositoryFactory) beanFactory.getBean("repositoryFactory"); if (!(repositoryFactory.getFactory() instanceof SqlRepositoryFactory)) { // it may be null as well LOGGER.debug( "SQL configuration cannot be found; Activiti database configuration (if any) will be taken from 'workflow' configuration section only"); if (LOGGER.isTraceEnabled()) { LOGGER.trace("repositoryFactory.getFactory() = " + repositoryFactory); } } else { SqlRepositoryFactory sqlRepositoryFactory = (SqlRepositoryFactory) repositoryFactory.getFactory(); sqlConfig = sqlRepositoryFactory.getSqlConfiguration(); if (sqlConfig.isEmbedded()) { defaultJdbcUrlPrefix = sqlRepositoryFactory.prepareJdbcUrlPrefix(sqlConfig); } } } catch (NoSuchBeanDefinitionException e) { LOGGER.debug( "SqlRepositoryFactory is not available, Activiti database configuration (if any) will be taken from 'workflow' configuration section only."); LOGGER.trace("Reason is", e); } catch (RepositoryServiceFactoryException e) { LoggingUtils.logException(LOGGER, "Cannot determine default JDBC URL for embedded database", e); } String explicitJdbcUrl = c.getString(KEY_JDBC_URL, null); if (explicitJdbcUrl == null) { if (sqlConfig.isEmbedded()) { jdbcUrl = defaultJdbcUrlPrefix + "-activiti;DB_CLOSE_ON_EXIT=FALSE"; } else { jdbcUrl = sqlConfig.getJdbcUrl(); } } else { jdbcUrl = explicitJdbcUrl; } dataSource = c.getString(KEY_DATA_SOURCE, null); if (dataSource == null && explicitJdbcUrl == null) { dataSource = sqlConfig.getDataSource(); // we want to use wf-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("Activiti database is at " + dataSource + " (a data source)"); } else { LOGGER.info("Activiti database is at " + jdbcUrl + " (a JDBC URL)"); } activitiSchemaUpdate = c.getBoolean(KEY_ACTIVITI_SCHEMA_UPDATE, true); jdbcDriver = c.getString(KEY_JDBC_DRIVER, sqlConfig != null ? sqlConfig.getDriverClassName() : null); jdbcUser = c.getString(KEY_JDBC_USERNAME, sqlConfig != null ? sqlConfig.getJdbcUsername() : null); jdbcPassword = c.getString(KEY_JDBC_PASSWORD, sqlConfig != null ? sqlConfig.getJdbcPassword() : null); processCheckInterval = c.getInt(KEY_PROCESS_CHECK_INTERVAL, 10); // todo set to bigger default for production use autoDeploymentFrom = c.getStringArray(KEY_AUTO_DEPLOYMENT_FROM); if (autoDeploymentFrom.length == 0) { autoDeploymentFrom = new String[] { AUTO_DEPLOYMENT_FROM_DEFAULT }; } allowApproveOthersItems = c.getBoolean(KEY_ALLOW_APPROVE_OTHERS_ITEMS, false); if (allowApproveOthersItems) { LOGGER.info( "allowApproveOthersItems parameter is set to true, therefore authorized users CAN approve/reject work items assigned to other users."); } // hibernateDialect = sqlConfig != null ? sqlConfig.getHibernateDialect() : ""; validate(); }