List of usage examples for org.apache.commons.configuration HierarchicalConfiguration getInt
public int getInt(String key, int defaultValue)
From source file:com.vangent.hieos.hl7v2util.acceptor.config.ListenerConfig.java
/** * /*from ww w .java 2s . c om*/ * @param hc * @param acceptorConfig * @throws HL7v2UtilException */ public void load(HierarchicalConfiguration hc, AcceptorConfig acceptorConfig) throws HL7v2UtilException { enabled = hc.getBoolean(ENABLED, false); tlsEnabled = hc.getBoolean(TLS_ENABLED, false); port = hc.getInt(PORT, -1); threadPoolSize = hc.getInt(THREAD_POOL_SIZE, -1); if (tlsEnabled) { this.loadCipherSuites(hc); } if (port == -1) { throw new HL7v2UtilException("Must specify " + PORT + " in configuration."); } if (threadPoolSize == -1) { throw new HL7v2UtilException("Must specify " + THREAD_POOL_SIZE + " in configuration."); } }
From source file:com.servioticy.queueclient.KestrelMemcachedClient.java
@Override protected void init(HierarchicalConfiguration config) throws QueueClientException { checkBaseAddress();/*from www .j a va 2s .c o m*/ checkRelativeAddress(); // If config is null, just load the defaults. if (config == null) { config = new HierarchicalConfiguration(); } this.expire = config.getInt("expire", 0); }
From source file:com.sm.store.BuildRemoteConfig.java
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) { StringBuilder sb = new StringBuilder(); String name = configuration.getString("name"); if (name == null) sb.append("store name is not defined "); String path = configuration.getString("path", "data"); String filename = configuration.getString("filename", name); boolean delay = configuration.getBoolean("delay", true); int mode = configuration.getInt("mode", 0); int freq = configuration.getInt("freq", this.freq == 0 ? 1 : this.freq); int batchSize = configuration.getInt("batchSize", 10); String logPath = configuration.getString("logPath", "log"); List<String> replicaUrl = configuration.getList("replicaUrl"); long replciaTimeout = configuration.getLong("replicaTimeout", 60000); if (replicaUrl == null) sb.append("no replicaUrl is defined"); boolean sorted = configuration.getBoolean("sorted", false); if (sb.length() > 0) { throw new RuntimeException("error on buildStoreConfig " + sb.toString()); } else {//from w ww . ja v a 2 s .co m StoreConfig storeConfig = new StoreConfig(name, path, freq, replicaUrl, batchSize, delay, mode, sorted); storeConfig.setGetTriggerName(configuration.getString("getTrigger")); storeConfig.setPutTriggerName(configuration.getString("putTrigger")); storeConfig.setDeleteTriggerName(configuration.getString("deleteTrigger")); storeConfig.setUseMaxCache(configuration.getBoolean("useMaxCache", false)); storeConfig.setMaxCacheMemory(configuration.getInt("maxCacheMemory", 20000)); storeConfig.setUseLRU(configuration.getBoolean("useLRU", false)); storeConfig.setLogPath(logPath); storeConfig.setReplicaTimeout(replciaTimeout); //add pstReplicaURl storeConfig.setPstReplicaUrl(configuration.getList("pstReplicaUrl")); storeConfig.setSerializeClass(configuration.getString("serializeClass")); return storeConfig; } }
From source file:com.sm.store.cluster.BuildStoreConfig.java
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) { StringBuilder sb = new StringBuilder(); String name = configuration.getString("name"); if (name == null) sb.append("store name is not defined "); String path = configuration.getString("path", "data"); String filename = configuration.getString("filename", name); boolean delay = configuration.getBoolean("delayWrite", true); int mode = configuration.getInt("mode", 0); int delayThread = configuration.getInt("delayThread", 2); String serializeClass = configuration.getString("serializer", "com.sm.localstore.impl.HessianSerializer"); String blockSizeClass = configuration.getString("blockSize"); BlockSize blockSize = null;//from w w w. ja v a 2 s .co m if (blockSizeClass != null) { try { blockSize = (BlockSize) Class.forName(blockSizeClass).newInstance(); } catch (Exception ex) { sb.append(("unable to load " + blockSizeClass + " " + ex.getMessage())); } } boolean useCache = configuration.getBoolean("useCache", false); long maxCache = configuration.getLong("maxCache", 1000 * 1000 * 1000L); String logPath = configuration.getString("logPath", "log"); String replicaUrl = configuration.getString("replicaUrl"); String purgeClass = configuration.getString("purgeClass"); if (sb.length() > 0) { throw new RuntimeException("error on buildStoreConfig " + sb.toString()); } else { StoreConfig storeConfig = new StoreConfig(name, path, 10, null); storeConfig.setDelay(delay); storeConfig.setDelayThread(delayThread); storeConfig.setLogPath(logPath); storeConfig.setBlockSize(blockSize); storeConfig.setPurgeClass(purgeClass); // return new StoreConfig(name, path, filename, delay, mode, writeThread, useCache, maxCache, maxCache, // logPath, serializeClass, blockSize, replicaUrl); return storeConfig; } }
From source file:banner.tagging.dictionary.DictionaryTagger.java
public void load(HierarchicalConfiguration config) throws IOException { HierarchicalConfiguration localConfig = config.configurationAt(this.getClass().getName()); String dictionaryFilename = localConfig.getString("dictionaryFile"); if (dictionaryFilename == null) throw new IllegalArgumentException("Must specify dictionary filename"); String dictionaryTypeName = localConfig.getString("dictionaryType"); if (dictionaryTypeName == null) throw new IllegalArgumentException("Must specify dictionary type"); String delimiter = localConfig.getString("delimiter"); int column = localConfig.getInt("column", -1); if (delimiter != null && column == -1) throw new IllegalArgumentException("Must specify column if delimiter specified"); EntityType dictionaryType = EntityType.getType(dictionaryTypeName); // Load data//w ww. j a v a 2s . co m BufferedReader reader = new BufferedReader(new FileReader(dictionaryFilename)); String line = reader.readLine(); while (line != null) { line = line.trim(); if (line.length() > 0) { if (delimiter == null) { add(line, dictionaryType); } else { // TODO Performance - don't use split String[] split = line.split(delimiter); add(split[column], dictionaryType); } } line = reader.readLine(); } reader.close(); }
From source file:com.intuit.tank.vm.settings.VmManagerConfig.java
/** * //from w w w .ja va 2 s .c o m * @param config */ @SuppressWarnings("unchecked") public VmManagerConfig(@Nonnull HierarchicalConfiguration config) { this.config = config; if (this.config != null) { List<HierarchicalConfiguration> creds = config.configurationsAt("credentials"); if (creds != null) { for (HierarchicalConfiguration credentialsConfig : creds) { CloudCredentials cloudCredentials = new CloudCredentials(credentialsConfig); credentialsMap.put(cloudCredentials.getType(), cloudCredentials); } } List<HierarchicalConfiguration> tags = config.configurationsAt("tags/tag"); if (tags != null) { for (HierarchicalConfiguration tagsConfig : tags) { InstanceTag tag = new InstanceTag(tagsConfig.getString("@name"), tagsConfig.getString("")); if (tag.isValid()) { tagList.add(tag); } } } HierarchicalConfiguration defaultInstance = config.configurationAt("default-instance-description"); List<HierarchicalConfiguration> regionConfigs = config.configurationsAt("instance-descriptions"); if (regionConfigs != null) { for (HierarchicalConfiguration regionConfig : regionConfigs) { VMRegion region = VMRegion.valueOf(regionConfig.getString("@region")); Map<VMImageType, InstanceDescription> instanceMap = new HashMap<VMImageType, InstanceDescription>(); regionMap.put(region, instanceMap); List<HierarchicalConfiguration> instanceConfigs = regionConfig .configurationsAt("instance-descripion"); for (HierarchicalConfiguration instanceConfig : instanceConfigs) { InstanceDescription description = new InstanceDescription(instanceConfig, defaultInstance); instanceMap.put(description.getType(), description); } } } // get reserved elastic ips List<HierarchicalConfiguration> eipConfig = config.configurationsAt("reserved-elastic-ips/eip"); if (eipConfig != null) { for (HierarchicalConfiguration eip : eipConfig) { reservedElasticIps.add(eip.getString("")); } } // get instance type definitions List<HierarchicalConfiguration> instanceTypesConfig = config.configurationsAt("instance-types/type"); instanceTypes = new ArrayList<VmInstanceType>(); if (instanceTypesConfig != null) { for (HierarchicalConfiguration instanceTypeConfig : instanceTypesConfig) { // example: <type name="c3.large" cost=".105" users="500" cpus="2" ecus="7" mem="3.75" /> VmInstanceType type = VmInstanceType.builder().withName(instanceTypeConfig.getString("@name")) .withCost(instanceTypeConfig.getDouble("@cost", 0D)) .withMemory(instanceTypeConfig.getDouble("@mem", 0D)) .withJvmArgs(instanceTypeConfig.getString("@jvmArgs")) .withEcus(instanceTypeConfig.getInt("@ecus", 0)) .withCpus(instanceTypeConfig.getInt("@cpus", 0)) .withDefault(instanceTypeConfig.getBoolean("@default", false)) .withUsers(instanceTypeConfig.getInt("@users", 0)).build(); instanceTypes.add(type); } } } }
From source file:com.servioticy.dispatcher.DispatcherContext.java
public void loadConf(String path) { HierarchicalConfiguration config; try {//from w w w . j ava 2s.com if (path == null) { config = new XMLConfiguration(DispatcherContext.DEFAULT_CONFIG_PATH); } else { config = new XMLConfiguration(path); } config.setExpressionEngine(new XPathExpressionEngine()); this.restBaseURL = config.getString("servioticyAPI", this.restBaseURL); ArrayList<String> updates = new ArrayList<String>(); if (config.containsKey("spouts/updates/addresses/address[1]")) { for (int i = 1; config.containsKey("spouts/updates/addresses/address[" + i + "]"); i++) { updates.add(config.getString("spouts/updates/addresses/address[" + i + "]")); } } else { for (String address : this.updatesAddresses) { updates.add(address); } } this.updatesAddresses = (String[]) updates.toArray(new String[] {}); this.updatesPort = config.getInt("spouts/updates/port", this.updatesPort); this.updatesQueue = config.getString("spouts/updates/name", this.updatesQueue); ArrayList<String> actions = new ArrayList<String>(); if (config.containsKey("spouts/actions/addresses/address[1]")) { for (int i = 1; config.containsKey("spouts/actions/addresses/address[" + i + "]"); i++) { actions.add(config.getString("spouts/actions/addresses/address[" + i + "]")); } } else { for (String address : this.actionsAddresses) { actions.add(address); } } this.actionsAddresses = (String[]) actions.toArray(new String[] {}); this.actionsPort = config.getInt("spouts/actions/port", this.actionsPort); this.actionsQueue = config.getString("spouts/actions/name", this.actionsQueue); this.benchmark = config.getBoolean("benchmark", this.benchmark); this.externalPubAddress = config.getString("publishers/external/address", this.externalPubAddress); this.externalPubPort = config.getInt("publishers/external/port", this.externalPubPort); this.externalPubUser = config.getString("publishers/external/username", this.externalPubUser); this.externalPubPassword = config.getString("publishers/external/password", this.externalPubPassword); this.externalPubClassName = config.getString("publishers/external/class", this.externalPubClassName); this.internalPubAddress = config.getString("publishers/internal/address", this.internalPubAddress); this.internalPubPort = config.getInt("publishers/internal/port", this.internalPubPort); this.internalPubUser = config.getString("publishers/internal/username", this.internalPubUser); this.internalPubPassword = config.getString("publishers/internal/password", this.internalPubPassword); this.internalPubClassName = config.getString("publishers/internal/class", this.internalPubClassName); this.actionsPubAddress = config.getString("publishers/actions/address", this.actionsPubAddress); this.actionsPubPort = config.getInt("publishers/actions/port", this.actionsPubPort); this.actionsPubUser = config.getString("publishers/actions/username", this.actionsPubUser); this.actionsPubPassword = config.getString("publishers/actions/password", this.actionsPubPassword); this.actionsPubClassName = config.getString("publishers/actions/class", this.actionsPubClassName); this.benchResultsDir = config.getString("benchResultsDir", this.benchResultsDir); } catch (Exception e) { e.printStackTrace(); return; } }
From source file:com.gs.obevo.db.api.factory.DbEnvironmentXmlEnricher.java
@Override public DeploySystem<DbEnvironment> readSystem(FileObject sourcePath) { HierarchicalConfiguration sysCfg = getConfig(sourcePath); DbPlatform systemDbPlatform = dbPlatformConfiguration.valueOf(sysCfg.getString("[@type]")); MutableList<String> sourceDirs = ListAdapter.adapt(sysCfg.getList("[@sourceDirs]")); ImmutableSet<String> acceptedExtensions = ListAdapter.adapt(sysCfg.getList("[@acceptedExtensions]")).toSet() .toImmutable();//from w w w.j a v a2 s. c o m MutableList<DbEnvironment> envList = Lists.mutable.empty(); for (HierarchicalConfiguration envCfg : iterConfig(sysCfg, "environments.dbEnvironment")) { DbEnvironment dbEnv = new DbEnvironment(); FileObject rootDir = sourcePath.getType() == FileType.FILE ? sourcePath.getParent() : sourcePath; // Use coreSourcePath and additionalSourceDirs here (instead of setSourceDirs) to facilitate any external integrations dbEnv.setCoreSourcePath(rootDir); dbEnv.setAdditionalSourceDirs(sourceDirs); dbEnv.setAcceptedExtensions(acceptedExtensions); dbEnv.setCleanBuildAllowed(envCfg.getBoolean("[@cleanBuildAllowed]", false)); dbEnv.setDbHost(envCfg.getString("[@dbHost]")); dbEnv.setDbPort(envCfg.getInt("[@dbPort]", 0)); dbEnv.setDbServer(envCfg.getString("[@dbServer]")); dbEnv.setDbSchemaPrefix(envCfg.getString("[@dbSchemaPrefix]")); dbEnv.setDbSchemaSuffix(envCfg.getString("[@dbSchemaSuffix]")); dbEnv.setDbDataSourceName(envCfg.getString("[@dbDataSourceName]")); dbEnv.setJdbcUrl(envCfg.getString("[@jdbcUrl]")); MutableMap<String, String> tokens = Maps.mutable.empty(); for (HierarchicalConfiguration tok : iterConfig(envCfg, "tokens.token")) { tokens.put(tok.getString("[@key]"), tok.getString("[@value]")); } dbEnv.setTokens(tokens.toImmutable()); // Allow the groups + users to be tokenized upfront for compatibility w/ the EnvironmentInfraSetup classes Tokenizer tokenizer = new Tokenizer(dbEnv.getTokens(), dbEnv.getTokenPrefix(), dbEnv.getTokenSuffix()); dbEnv.setGroups(iterConfig(sysCfg, "groups.group").collect(convertCfgToGroup(tokenizer))); dbEnv.setUsers(iterConfig(sysCfg, "users.user").collect(convertCfgToUser(tokenizer))); if (envCfg.getString("[@driverClass]") != null) { dbEnv.setDriverClassName(envCfg.getString("[@driverClass]")); } dbEnv.setName(envCfg.getString("[@name]")); dbEnv.setDefaultUserId(envCfg.getString("[@defaultUserId]")); dbEnv.setDefaultPassword(envCfg.getString("[@defaultPassword]")); dbEnv.setDefaultTablespace(envCfg.getString("[@defaultTablespace]")); // TODO add include/exclude schemas functionality MutableList<Schema> schemaObjs = Lists.mutable.withAll(iterConfig(sysCfg, "schemas.schema")) .collect(convertCfgToSchema(systemDbPlatform)); MutableSet<String> schemasToInclude = iterString(envCfg, "includeSchemas").toSet(); MutableSet<String> schemasToExclude = iterString(envCfg, "excludeSchemas").toSet(); if (!schemasToInclude.isEmpty() && !schemasToExclude.isEmpty()) { throw new IllegalArgumentException("Environment " + dbEnv.getName() + " has includeSchemas [" + schemasToInclude + "] and excludeSchemas [" + schemasToExclude + "] defined; please only specify one of them"); } else if (!schemasToInclude.isEmpty()) { schemaObjs = schemaObjs.select(Predicates.attributeIn(Schema.TO_NAME, schemasToInclude)); } else if (!schemasToExclude.isEmpty()) { schemaObjs = schemaObjs.reject(Predicates.attributeIn(Schema.TO_NAME, schemasToExclude)); } MutableMap<String, String> schemaNameOverrides = Maps.mutable.empty(); MutableSet<String> schemaNames = schemaObjs.collect(Schema.TO_NAME).toSet(); for (HierarchicalConfiguration schemaOverride : iterConfig(envCfg, "schemaOverrides.schemaOverride")) { String schema = schemaOverride.getString("[@schema]"); if (schemaObjs.collect(Schema.TO_NAME).contains(schema)) { schemaNameOverrides.put(schema, schemaOverride.getString("[@overrideValue]")); } else { throw new IllegalArgumentException( "Schema override definition value " + schema + " is not defined in the schema list " + schemaNames + " for environment " + dbEnv.getName()); } } dbEnv.setSchemaNameOverrides(schemaNameOverrides.toImmutable()); // ensure that we only store the unique schema names here dbEnv.setSchemas(UnifiedSetWithHashingStrategy .newSet(HashingStrategies.fromFunction(Schema.TO_NAME), schemaObjs).toImmutable()); dbEnv.setPersistToFile(envCfg.getBoolean("[@persistToFile]", false)); dbEnv.setDisableAuditTracking(envCfg.getBoolean("[@disableAuditTracking]", false)); dbEnv.setRollbackDetectionEnabled(envCfg.getBoolean("[@rollbackDetectionEnabled]", sysCfg.getBoolean("[@rollbackDetectionEnabled]", true))); dbEnv.setAutoReorgEnabled( envCfg.getBoolean("[@autoReorgEnabled]", sysCfg.getBoolean("[@autoReorgEnabled]", true))); dbEnv.setInvalidObjectCheckEnabled(envCfg.getBoolean("[@invalidObjectCheckEnabled]", sysCfg.getBoolean("[@invalidObjectCheckEnabled]", true))); dbEnv.setReorgCheckEnabled( envCfg.getBoolean("[@reorgCheckEnabled]", sysCfg.getBoolean("[@reorgCheckEnabled]", true))); dbEnv.setChecksumDetectionEnabled(envCfg.getBoolean("[@checksumDetectionEnabled]", sysCfg.getBoolean("[@checksumDetectionEnabled]", false))); dbEnv.setMetadataLineReaderVersion( envCfg.getInt("[@metadataLineReaderVersion]", sysCfg.getInt("[@metadataLineReaderVersion]", dbPlatformConfiguration.getFeatureToggleVersion("metadataLineReaderVersion")))); dbEnv.setCsvVersion(envCfg.getInt("[@csvVersion]", sysCfg.getInt("[@csvVersion]", dbPlatformConfiguration.getFeatureToggleVersion("csvVersion")))); int legacyDirectoryStructureEnabledValue = envCfg.getInt("[@legacyDirectoryStructureEnabled]", sysCfg.getInt("[@legacyDirectoryStructureEnabled]", dbPlatformConfiguration.getFeatureToggleVersion("legacyDirectoryStructureEnabled"))); dbEnv.setLegacyDirectoryStructureEnabled(legacyDirectoryStructureEnabledValue == 1); // 1 == legacy, 2 == new MutableMap<String, String> extraEnvAttrs = Maps.mutable.empty(); for (String extraEnvAttr : dbPlatformConfiguration.getExtraEnvAttrs()) { String attrStr = "[@" + extraEnvAttr + "]"; extraEnvAttrs.put(extraEnvAttr, envCfg.getString(attrStr, sysCfg.getString(attrStr))); } dbEnv.setExtraEnvAttrs(extraEnvAttrs.toImmutable()); ImmutableList<HierarchicalConfiguration> envPermissions = iterConfig(envCfg, "permissions.permission"); ImmutableList<HierarchicalConfiguration> sysPermissions = iterConfig(sysCfg, "permissions.permission"); if (!envPermissions.isEmpty()) { dbEnv.setPermissions(envPermissions.collect(convertCfgToPermission(tokenizer))); } else if (!sysPermissions.isEmpty()) { dbEnv.setPermissions(sysPermissions.collect(convertCfgToPermission(tokenizer))); } DbPlatform platform; if (envCfg.getString("[@inMemoryDbType]") != null) { platform = dbPlatformConfiguration.valueOf(envCfg.getString("[@inMemoryDbType]")); } else { platform = systemDbPlatform; } dbEnv.setSystemDbPlatform(systemDbPlatform); dbEnv.setPlatform(platform); String delim = sysCfg.getString("[@dataDelimiter]"); if (delim != null) { if (delim.length() == 1) { dbEnv.setDataDelimiter(delim.charAt(0)); } else { throw new IllegalArgumentException( "dataDelimiter must be 1 character long. instead, got [" + delim + "]"); } } String nullToken = sysCfg.getString("[@nullToken]"); if (nullToken != null) { dbEnv.setNullToken(nullToken); } dbEnv.setAuditTableSql(getProperty(sysCfg, envCfg, "auditTableSql")); envList.add(dbEnv); } CollectionUtil.verifyNoDuplicates(envList, DbEnvironment.TO_NAME, "Invalid configuration from " + sourcePath + "; not expecting duplicate env names"); return new DeploySystem<DbEnvironment>(envList); }
From source file:com.houghtonassociates.bamboo.plugins.GerritRepositoryAdapter.java
@Override public void populateFromConfig(HierarchicalConfiguration config) { super.populateFromConfig(config); hostname = StringUtils.trimToEmpty(config.getString(REPOSITORY_GERRIT_REPOSITORY_HOSTNAME)); username = config.getString(REPOSITORY_GERRIT_USERNAME); userEmail = config.getString(REPOSITORY_GERRIT_EMAIL); sshKey = config.getString(REPOSITORY_GERRIT_SSH_KEY, ""); sshPassphrase = encryptionService.decrypt(config.getString(REPOSITORY_GERRIT_SSH_PASSPHRASE)); port = config.getInt(REPOSITORY_GERRIT_REPOSITORY_PORT, 29418); project = config.getString(REPOSITORY_GERRIT_PROJECT); String strDefBranch = config.getString(REPOSITORY_GERRIT_DEFAULT_BRANCH, ""); String strCustBranch = config.getString(REPOSITORY_GERRIT_CUSTOM_BRANCH, ""); if (strDefBranch.equals(MASTER_BRANCH.getName()) || strDefBranch.equals(ALL_BRANCH.getName())) { vcsBranch = new VcsBranchImpl(strDefBranch); } else {// w ww . j a va 2 s .com vcsBranch = new VcsBranchImpl(strCustBranch); } useShallowClones = config.getBoolean(REPOSITORY_GERRIT_USE_SHALLOW_CLONES); useSubmodules = config.getBoolean(REPOSITORY_GERRIT_USE_SUBMODULES); commandTimeout = config.getInt(REPOSITORY_GERRIT_COMMAND_TIMEOUT, DEFAULT_COMMAND_TIMEOUT_IN_MINUTES); verboseLogs = config.getBoolean(REPOSITORY_GERRIT_VERBOSE_LOGS, false); String gitRepoUrl = "ssh://" + username + "@" + hostname + ":" + port + "/" + project; String tmpCP = config.getString(REPOSITORY_GERRIT_CONFIG_DIR); if (tmpCP == null || tmpCP.isEmpty()) { tmpCP = GerritService.SYSTEM_DIRECTORY + File.separator + GerritService.CONFIG_DIRECTORY; } relativeConfigPath = tmpCP.replace("\\", "/"); absConfigPath = prepareConfigDir(relativeConfigPath).getAbsolutePath(); String tmpSSHKFP = config.getString(REPOSITORY_GERRIT_SSH_KEY_FILE); if (tmpSSHKFP == null || tmpSSHKFP.isEmpty()) { tmpSSHKFP = GerritService.SYSTEM_DIRECTORY + File.separator + GerritService.CONFIG_DIRECTORY; } relativeSSHKeyFilePath = tmpSSHKFP.replace("\\", "/"); String decryptedKey = encryptionService.decrypt(sshKey); sshKeyFile = prepareSSHKeyFile(relativeSSHKeyFilePath, decryptedKey); gc.setHost(hostname); gc.setPort(port); gc.setRepositoryUrl(gitRepoUrl); gc.setWorkingDirectory(absConfigPath); gc.setSshKeyFile(sshKeyFile); gc.setSshKey(decryptedKey); gc.setSshPassphrase(sshPassphrase); gc.setUsername(username); gc.setUserEmail(userEmail); gc.setUseShallowClones(useShallowClones); gc.setUseSubmodules(useSubmodules); gc.setVerboseLogs(verboseLogs); gc.setCommandTimeout(commandTimeout); try { initializeGerritService(); if (this.isOnLocalAgent()) { if (isRemoteTriggeringReop()) { getGerritDAO().addListener(this); } else { getGerritDAO().removeListener(this); } } } catch (RepositoryException e) { log.error(e.getMessage()); } }
From source file:com.eyeq.pivot4j.impl.PivotModelImpl.java
/** * @see com.eyeq.pivot4j.state.Configurable#restoreSettings(org.apache.commons.configuration.HierarchicalConfiguration) *///from w w w .ja va 2 s . c o m @Override public synchronized void restoreSettings(HierarchicalConfiguration configuration) { if (configuration == null) { throw new NullArgumentException("configuration"); } String mdx = configuration.getString("mdx"); setMdx(mdx); if (mdx == null) { if (logger.isWarnEnabled()) { logger.warn("The configuration does not contain valid MDX query."); } return; } if (!isInitialized()) { initialize(); } this.sorting = configuration.getBoolean("sort[@enabled]", false); this.sortPosMembers = null; this.sortCriteria = SortCriteria.ASC; this.topBottomCount = 10; Quax quaxToSort = null; if (sorting) { List<Object> sortPosUniqueNames = configuration.getList("sort.member"); if (sortPosUniqueNames != null && !sortPosUniqueNames.isEmpty()) { try { Cube cube = getCube(); this.sortPosMembers = new ArrayList<Member>(sortPosUniqueNames.size()); for (Object uniqueName : sortPosUniqueNames) { Member member = cube.lookupMember( IdentifierNode.parseIdentifier(uniqueName.toString()).getSegmentList()); if (member == null) { if (logger.isWarnEnabled()) { logger.warn("Sort position member not found " + uniqueName); } break; } sortPosMembers.add(member); } } catch (OlapException e) { throw new PivotException(e); } } this.topBottomCount = configuration.getInt("sort[@topBottomCount]", 10); String sortName = configuration.getString("sort[@criteria]"); if (sortName != null) { this.sortCriteria = SortCriteria.valueOf(sortName); } int ordinal = configuration.getInt("sort[@ordinal]", -1); if (ordinal > 0) { for (Axis axis : queryAdapter.getAxes()) { Quax quax = queryAdapter.getQuax(axis); if (quax.getOrdinal() == ordinal) { quaxToSort = quax; break; } } } } queryAdapter.setQuaxToSort(quaxToSort); this.cellSet = null; }