private static List<String> get_weights(String plugin, SubnodeConfiguration work) { List<String> weight_strings = new LinkedList<String>(); @SuppressWarnings("unchecked") List<SubnodeConfiguration> weights = work.configurationsAt("weights"); boolean weights_started = false; for (SubnodeConfiguration weight : weights) { // stop if second attributed node encountered if (weights_started && weight.getRootNode().getAttributeCount() > 0) { break; } //start adding node values, if node with attribute equal to current plugin encountered if (weight.getRootNode().getAttributeCount() > 0 && weight.getRootNode().getAttribute(0).getValue().equals(plugin)) { weights_started = true; } if (weights_started) { weight_strings.add(weight.getString("")); } } return weight_strings; }
private void writeWp43Configs(List<Contingency> contingencies, Path workingDir) throws IOException, ConfigurationException { Path baseWp43ConfigFile = PlatformConfig.defaultConfig().getConfigDir().resolve(WP43_CONFIGS_FILE_NAME); // generate one variant of the base config for all the contingency // this allow to add extra variables for some indexes HierarchicalINIConfiguration configuration = new HierarchicalINIConfiguration(baseWp43ConfigFile.toFile()); SubnodeConfiguration node = configuration.getSection("smallsignal"); node.setProperty("f_instant", parameters.getFaultEventInstant()); for (int i = 0; i < contingencies.size(); i++) { Contingency contingency = contingencies.get(i); if (contingency.getElements().isEmpty()) { throw new AssertionError("Empty contingency " + contingency.getId()); } Iterator<ContingencyElement> it = contingency.getElements().iterator(); // compute the maximum fault duration double maxDuration = getFaultDuration(contingency, it.next()); while (it.hasNext()) { maxDuration = Math.max(maxDuration, getFaultDuration(contingency, it.next())); } node.setProperty("f_duration", maxDuration); Path wp43Config = workingDir.resolve(WP43_CONFIGS_PER_FAULT_FILE_NAME.replace(Command.EXECUTION_NUMBER_PATTERN, Integer.toString(i))); try (Writer writer = Files.newBufferedWriter(wp43Config, StandardCharsets.UTF_8)) { configuration.save(writer); } } }
@Override protected void notify(Parameters parameters) throws NotificationException { SubnodeConfiguration config = retrieveTeamInformation(); if (config == null) { throw new NotificationException("Invalid configuration"); } SlackWebApiClient slackClient = SlackClientFactory.createWebApiClient(config.getString("accessToken")); ChatPostMessageMethod chatPostMessageMethod = new ChatPostMessageMethod(channel, message); chatPostMessageMethod.setAs_user(true); slackClient.postMessage(chatPostMessageMethod); log.info("https://" + config.getString("teamName") + ".slack.com/messages/" + channel + "/"); }
@Override protected void storeAccessTokenData(AccessTokenData accessTokenData, HierarchicalINIConfiguration configuration) throws NotificationException { String teamId = accessTokenData.get("teamId"); configuration.setProperty(KEY_DEFAULT_TEAM_ID, teamId); SubnodeConfiguration section = configuration.getSection(teamId); section.setProperty(KEY_ACCESS_TOKEN, accessTokenData.getAccessToken()); for (Map.Entry<String, String> entry : accessTokenData.getData()) { section.setProperty(entry.getKey(), entry.getValue()); } try { configuration.save(); } catch (ConfigurationException e) { throw new NotificationException(e); } }
@Test public void getConfiguration() throws Exception { // given LPlatformClient lplatformClient = prepareLPlatformClient(); HashMap<String, String> request = prepareRequest("GetLServerConfiguration"); XMLConfiguration xMLConfiguration = mock(XMLConfiguration.class); SubnodeConfiguration config = mock(SubnodeConfiguration.class); when(config.getString(eq(VMTYPE))).thenReturn(VMTYPE); when(xMLConfiguration.configurationAt(eq("lserver"))) .thenReturn(config); when(vdcClient.execute(eq(request))).thenReturn(xMLConfiguration); // when prepareLServerClient(lplatformClient); LServerConfiguration result = lServerClient.getConfiguration(); // then assertEquals(result.getVmType(), VMTYPE); }
/** * @return the products */ public String getReporterClass() { String ret = DEFAULT_REPORTER; if (config != null) { try { SubnodeConfiguration configurationAt = config.configurationAt(KEY_REPORTER); String string = configurationAt.getString(""); if (StringUtils.isNotBlank(string)) { ret = string; } else { LOG.warn("Reporter not configured. Using default of " + ret); } } catch (Exception e) { LOG.warn("Reporter specified more than once. Using default of " + ret); } } return ret; }
/** * @return the products */ public String getReaderClass() { String ret = DEFAULT_READER; if (config != null) { try { SubnodeConfiguration configurationAt = config.configurationAt(KEY_READER); String string = configurationAt.getString(""); if (StringUtils.isNotBlank(string)) { ret = string; } else { LOG.warn("Reader not configured. Using default of " + ret); } } catch (Exception e) { LOG.warn("Reader specified more than once. Using default of " + ret); } } return ret; }
void configure(HierarchicalConfiguration conf) throws Exception { this.stormConfig = new Config(); this.builder = new TopologyBuilder(); SubnodeConfiguration topologyConf = conf.configurationAt(TOPOLOGY); this.topologyName = getTopologyName(topologyConf); SubnodeConfiguration stormConf = topologyConf.configurationAt(STORM_CONF); configureStorm(stormConf, stormConfig); SubnodeConfiguration spoutConf = conf.configurationAt(SPOUT); String spout = configureSpout(builder, spoutConf); SubnodeConfiguration boltConfs = conf.configurationAt(BOLTS); configureBolts(builder, boltConfs, spout); }
@Test public void testLoadConfiguration() throws ConfigurationException { Mockito.doReturn(Sets.newLinkedHashSet(SECTION)).when(hierarchicalINIConfiguration).getSections(); final SubnodeConfiguration subnodeConfiguration = new SubnodeConfiguration(new HierarchicalConfiguration(), new HierarchicalConfiguration.Node()); subnodeConfiguration.setProperty(INSTANCE_ID, OrderType.START.toString()); Mockito.doReturn(subnodeConfiguration).when(hierarchicalINIConfiguration).getSection(SECTION); configurationService.loadConfiguration(); final InOrder inOrder = Mockito.inOrder(hierarchicalINIConfiguration); inOrder.verify(hierarchicalINIConfiguration).clear(); inOrder.verify(hierarchicalINIConfiguration).load(ConfigurationService.CONFIGURATION_FILE_NAME); inOrder.verify(hierarchicalINIConfiguration).getSections(); inOrder.verify(hierarchicalINIConfiguration).getSection(SECTION); Assertions.assertThat(configurationService.getConfiguredSections()).containsOnly(MapEntry.entry(SECTION, Lists.newArrayList(new InstanceOrder(INSTANCE_ID, OrderType.START.toString())))); Assertions.assertThat(configurationService.getConfiguredSections(SECTION)).containsOnly(new InstanceOrder(INSTANCE_ID, OrderType.START.toString())); final String expectedConfiguration = "Section section" + System.lineSeparator() + " instance id:START" + System.lineSeparator(); Assertions.assertThat(configurationService.toString()).isEqualTo(expectedConfiguration); Assertions.assertThat(configurationService.toString(Lists.newArrayList(SECTION))).isEqualTo(expectedConfiguration); Assertions.assertThat(configurationService.toString(Lists.newArrayList(""))).isEmpty(); }
@Test public void testLoadEmptyConfiguration() throws ConfigurationException { Mockito.doReturn(Sets.newLinkedHashSet(SECTION)).when(hierarchicalINIConfiguration).getSections(); final SubnodeConfiguration subnodeConfiguration = new SubnodeConfiguration(new HierarchicalConfiguration(), new HierarchicalConfiguration.Node()); Mockito.doReturn(subnodeConfiguration).when(hierarchicalINIConfiguration).getSection(SECTION); configurationService.loadConfiguration(); final InOrder inOrder = Mockito.inOrder(hierarchicalINIConfiguration); inOrder.verify(hierarchicalINIConfiguration).clear(); inOrder.verify(hierarchicalINIConfiguration).load(ConfigurationService.CONFIGURATION_FILE_NAME); inOrder.verify(hierarchicalINIConfiguration).getSections(); inOrder.verify(hierarchicalINIConfiguration).getSection(SECTION); Assertions.assertThat(configurationService.getConfiguredSections()).containsOnly(MapEntry.entry(SECTION, new ArrayList<InstanceOrder>())); Assertions.assertThat(configurationService.getConfiguredSections(SECTION)).isEmpty(); final String expectedConfiguration = "Section section" + System.lineSeparator() + " EMPTY" + System.lineSeparator(); Assertions.assertThat(configurationService.toString()).isEqualTo(expectedConfiguration); Assertions.assertThat(configurationService.toString(Lists.newArrayList(SECTION))).isEqualTo(expectedConfiguration); Assertions.assertThat(configurationService.toString(Lists.newArrayList(""))).isEmpty(); }
private void copyLibraryFiles(SubnodeConfiguration languageConf, File jobTransformDir) throws IOException { // Get the library directory, returning if not specified File libDir = getLibraryDirectory(languageConf); if (libDir == null) return; // Get the file extension appropriate for the language String scriptExtension = languageConf.getString("extension", ""); if (!scriptExtension.isEmpty()) scriptExtension = "." + scriptExtension; // Create a file filter to exclude prefix/suffix files String pattern = "^(mapper|reducer)-(prefix|suffix)" + Pattern.quote(scriptExtension) + "$"; FileFilter libFilter = new NotFileFilter(new RegexFileFilter(pattern)); // Copy filtered contents of library directory FileUtils.copyDirectory(libDir, jobTransformDir, libFilter); }
@Override public void afterPropertiesSet() throws Exception { log.info("set Up Proxy Configuration"); jmxAccess = new HashMap<String, JmxLoginPass>(); String fileName = System.getProperty("configFilePath"); if(System.getProperty("configFilePath") != null){ try{ XMLConfiguration xmlConfiguration = new XMLConfiguration(fileName); SubnodeConfiguration accessList = xmlConfiguration.configurationAt("accessList"); List<HierarchicalConfiguration> loginPassConfs = accessList.configurationsAt("accessConf"); for(HierarchicalConfiguration loginPassConf : loginPassConfs){ JmxLoginPass jmxLoginPass = new JmxLoginPass(); jmxLoginPass.setLogin(loginPassConf.getString("login")); jmxLoginPass.setPassword(loginPassConf.getString("password")); jmxAccess.put(loginPassConf.getString("key"), jmxLoginPass); } } catch(Exception e){ log.error("Error while reading conf file : "+fileName, e); } }else{ log.info("no configuration given to the jvm by param -DconfigFilePath"); } }
private void loadZanataUserConfig() { File userConfig = new File(System.getProperty("user.home"), DEFAULT_CONFIG_LOCATION); System.out.println("Config file: " + userConfig.getAbsolutePath()); try { HierarchicalINIConfiguration config = new HierarchicalINIConfiguration(userConfig); SubnodeConfiguration serverConfig = config.getSection("servers"); DataConfiguration dataConfig = new DataConfiguration(serverConfig); servers = getServerList(dataConfig); } catch (ConfigurationException e) { System.out.println("Failed to load configuration from " + userConfig.getAbsolutePath()); e.printStackTrace(); } }
/** * Extracts the weights from the xmlConfig file whenever we want to use a different transaction mixed from the standard TPC-C specification. * @return */ private double get_NewOrder_WeightFromXMLConf(){ SubnodeConfiguration work = xmlConfig.configurationAt("works/work[" + 1 + "]"); List<String> weight_strings; String weightKey = work.getString("weights").toLowerCase(); return Double.parseDouble("0."+weightKey); }
public DymolaAdaptersMatParamsWriter(HierarchicalINIConfiguration configuration) { if (configuration == null) { throw new RuntimeException("null config"); } this.configuration = configuration; //this below will simply log parameters .. for (String section : configuration.getSections()) { SubnodeConfiguration node = configuration.getSection(section); List<String> paramsSummary = StreamSupport.stream( Spliterators.spliteratorUnknownSize(node.getKeys(), Spliterator.ORDERED), false).map(p -> p + "=" + node.getString(p)).collect(Collectors.<String>toList()); LOGGER.info("index {}: {}", section, paramsSummary); } }
@SuppressWarnings("unchecked") private void prepareLServerConfiguration(LPlatformClient platformClient) throws Exception { RORClient vdcClient = platformClient.getVdcClient(); HashMap<String, String> request = new HashMap<>(); doReturn(request).when(vdcClient).getBasicParameters(); XMLConfiguration xmlConfiguration = mock(XMLConfiguration.class); doReturn(xmlConfiguration).when(vdcClient).execute(any(HashMap.class)); SubnodeConfiguration config = mock(SubnodeConfiguration.class); doReturn(PRIVATE_IP).when(config).getString(NIC_PRIVATE_IP); doReturn(config).when(xmlConfiguration).configurationAt("lserver"); }
private void PrepareSubnodeConfiguration(HashMap<String, String> request) throws Exception { XMLConfiguration xMLConfiguration = mock(XMLConfiguration.class); SubnodeConfiguration config = mock(SubnodeConfiguration.class); when(config.getString(eq(LPLATFORMID))).thenReturn(LPLATFORMID); when(xMLConfiguration.configurationAt(eq(LPLATFORM))) .thenReturn(config); when(rorClient.execute(eq(request))).thenReturn(xMLConfiguration); }
/** * @param string * @return */ private Set<ConfigInclusionExclusionRule> parseInclusionExclusions(String key) { Set<ConfigInclusionExclusionRule> ret = new HashSet<ConfigInclusionExclusionRule>(); SubnodeConfiguration groupConfig = config.configurationAt(key); if (groupConfig != null) { @SuppressWarnings("unchecked") List<HierarchicalConfiguration> list = groupConfig.configurationsAt("rule"); for (HierarchicalConfiguration c : list) { ret.add(new ConfigInclusionExclusionRule(getTransactionPart(c), c.getString("@header", "all"), getMatchType(c), c.getString(""))); } } return ret; }
@SuppressWarnings("unchecked") public void cfg2Mdl(XMLConfiguration config) { // TODO Auto-generated method stub if (null == config) { return; } List<SubnodeConfiguration> items = config.configurationsAt("module.rest"); RestUrl resturl = null; for (SubnodeConfiguration subnode : items) { if (null != subnode && !NFVOUtils.isEmpty(subnode.getString("[@id]"))) { REST_URLS.put( subnode.getString("[@id]"), resturl = new RestUrl(subnode.getString("[@id]"), subnode.getString("url"), subnode .getString("[@type]"), subnode.getString("[@desc]"))); resturl.setReqjson(subnode.getString("reqjson")); List<SubnodeConfiguration> items2 = subnode.configurationsAt("properties.property"); for (SubnodeConfiguration subnode2 : items2) { resturl.getPairs().add(subnode2.getString("[@key]"), subnode2.getString("[@value]")); } } } LOGGER.info("REST_URLS = {}", REST_URLS); }
@SuppressWarnings("unchecked") public void cfg2Mdl(XMLConfiguration config) { // TODO Auto-generated method stub if (null == config) { return; } List<SubnodeConfiguration> items = config.configurationsAt("module.block"); ConfigBlock block = null; for (SubnodeConfiguration subnode : items) { if (null != subnode && !NFVOUtils.isEmpty(subnode.getString("[@id]"))) { block = new ConfigBlock(); block.setId(subnode.getString("[@id]")); List<SubnodeConfiguration> items2 = subnode.configurationsAt("property"); for (SubnodeConfiguration subnode2 : items2) { block.getPairs().add(subnode2.getString("[@key]"), subnode2.getString("[@value]")); } CONFIG_BLOCKS.put(block.getId(), block); } } LOGGER.info("CONFIG_BLOCKS = {}", CONFIG_BLOCKS); }
/** Get the replacement string for a key in a section. * @param section The section to look for. * @param key The key to be replaced. * @return The replacement value, or the original value * if there is no match. */ public String getMatchedContent(final String section, final String key) { SubnodeConfiguration sObj = metadataRewriteConf.getSection(section); String replacement = sObj.getString(key); if (replacement != null) { return replacement; } return key; }
private void extractMQSCAttributeAndValueForReplacement( XMLConfiguration config, String environment, List<String> mqscVars, List<String> mqscVarValues) { SubnodeConfiguration localSubnodeConfig = config.configurationAt(environment); for(Iterator<String> iter = localSubnodeConfig.getKeys();iter.hasNext();){ String key = iter.next(); mqscVars.add(MQSC_VAR_PREFIX + key + MQSC_VAR_SUFFIX); mqscVarValues.add(config.getString(environment + "." + key)); } }
/** * Gets a topology builder and set of storm bolt configurations. Initializes the bolts and sets them with the * topology builder. * * @param builder storm topology builder * @param boltsConf component configurations * @param spout type of storm component being added (spout/bolt) * @throws ConfigurationException */ void configureBolts(TopologyBuilder builder, SubnodeConfiguration boltsConf, String spout) throws ConfigurationException { String prevComponent = spout; // bolts subscribe to other bolts by number HashMap<Integer, String> boltNumberToId = new HashMap<>(); List<HierarchicalConfiguration> bolts = boltsConf.configurationsAt(BOLT); for (HierarchicalConfiguration bolt : bolts) { String boltType = bolt.getString(TYPE); Configuration boltConf = bolt.configurationAt(CONF); int boltNum = bolt.getInt(NUMBER_ATTRIBUTE); String boltId = String.format("%02d_%s", boltNum, boltType); boltNumberToId.put(boltNum, boltId); String subscribingToComponent = getSubscribingToComponent(prevComponent, boltNumberToId, boltConf); logger.info("{} subscribing to {}", boltId, subscribingToComponent); IComponent baseComponent = buildComponent(boltType, boltConf); StormParallelismConfig stormParallelismConfig = getStormParallelismConfig(boltConf); BoltDeclarer declarer = buildBoltDeclarer(builder, stormParallelismConfig, boltId, baseComponent); configureTickFrequency(boltConf, declarer); configureStreamGrouping(subscribingToComponent, boltConf, declarer); prevComponent = boltId; boltNum++; } }
@Test public void testConfigure( @Injectable HierarchicalConfiguration conf, @Injectable SubnodeConfiguration topologyConf, @Injectable SubnodeConfiguration stormConf, @Injectable SubnodeConfiguration spoutConf, @Injectable SubnodeConfiguration boltConfs, @Injectable String topologyName, @Injectable String spout) throws Exception { new Expectations(topology) {{ conf.configurationAt(TOPOLOGY); result = topologyConf; topology.getTopologyName(topologyConf); result = topologyName; topologyConf.configurationAt(STORM_CONF); result = stormConf; topology.configureStorm(stormConf, (Config) any); conf.configurationAt(SPOUT); result = spoutConf; topology.configureSpout((TopologyBuilder) any, spoutConf); result = spout; conf.configurationAt(BOLTS); result = boltConfs; topology.configureBolts((TopologyBuilder) any, boltConfs, spout); }}; topology.configure(conf); }
public static SubnodeConfiguration configurationAt(String key, boolean supportUpdates) { // return configuration.configurationAt(key, supportUpdates); // return configurationAtAndCache(key); try { return ((CombinedConfiguration) factory.getConfiguration()).configurationAt(key, supportUpdates); } catch (Exception ex) { ex.printStackTrace(); } return null; }
@Test // no cache // 1000000 times: 2340 mills. // 1000000 times: 2357 mills. // 1000000 times: 2342 mills. // // cache // 1000000 times: 283 mills. // 1000000 times: 280 mills. // 1000000 times: 274 mills. // // cache when null 會變慢 // 1000000 times: 4020 mills. // 1000000 times: 4035 mills. // 1000000 times: 4092 mills. // // #fix: cache when null 會變慢, ok // 1000000 times: 268 mills. // 1000000 times: 282 mills. // 1000000 times: 278 mills. public void configurationAt() { // classHelper.poMapping.entry SubnodeConfiguration result = null; int count = 1000000;// 100w long beg = System.currentTimeMillis(); for (int i = 0; i < count; i++) { // sub = // ConfigHelper.configurationAt("classHelper.poMapping.entry(0)"); try { result = ConfigHelper.configurationAt("xxxclassHelper.poMapping.entry(0)"); } catch (Exception ex) { } } long end = System.currentTimeMillis(); System.out.println(count + " times: " + (end - beg) + " mills. "); // System.out.println(result); assertNull(result); }
/** * Load the configuration from the configuration file. * * @throws ConfigurationException configuration loading exception */ public void loadConfiguration() throws ConfigurationException { LOG.entry(); configuredSections.clear(); hierarchicalINIConfiguration.clear(); hierarchicalINIConfiguration.load(CONFIGURATION_FILE_NAME); // Sections loading for (final String section : hierarchicalINIConfiguration.getSections()) { LOG.info("Loading section: {}", section); final List<InstanceOrder> sectionList = new ArrayList<InstanceOrder>(); final SubnodeConfiguration subnodeConfiguration = hierarchicalINIConfiguration.getSection(section); final Iterator<String> iterator = subnodeConfiguration.getKeys(); while (iterator.hasNext()) { final String instanceId = iterator.next(); LOG.trace("Loading configuration for instanceId: {} -> order: {}", instanceId, subnodeConfiguration.getString(instanceId)); sectionList.add(new InstanceOrder(instanceId, subnodeConfiguration.getString(instanceId))); } configuredSections.put(section, ImmutableList.copyOf(sectionList)); LOG.info("section {} loaded with {} orders", section, sectionList.size()); } LOG.exit(); }
/** * Load configuration from ddf.ini, or the file name specified by the environment variable DDF_INI. * * @return the {@link Configuration} object loaded * @throws Exception * @throws ConfigurationException , {@link IOException} */ @Override public Configuration loadConfig() throws ConfigurationException, IOException { Configuration resultConfig = new Configuration(); if (!Utils.localFileExists(this.getConfigFileName())) { // String configFileName = System.getenv(ConfigConstant.DDF_INI_ENV_VAR.getValue()); File file = new File(this.locateConfigFileName(this.getConfigDir(), this.getConfigFileName())); mConfigDir = file.getParentFile().getName(); mConfigFileName = file.getCanonicalPath(); } if (!Utils.localFileExists(this.getConfigFileName())) return null; HierarchicalINIConfiguration config = new HierarchicalINIConfiguration(this.getConfigFileName()); @SuppressWarnings("unchecked") Set<String> sectionNames = config.getSections(); for (String sectionName : sectionNames) { SubnodeConfiguration section = config.getSection(sectionName); if (section != null) { Configuration.Section resultSection = resultConfig.getSection(sectionName); @SuppressWarnings("unchecked") Iterator<String> keys = section.getKeys(); while (keys.hasNext()) { String key = keys.next(); String value = section.getString(key); if (value != null) { resultSection.set(key, value); } } } } mConfig = resultConfig; return mConfig; }
@Override public Config getSubconfig(String key) { try { SubnodeConfiguration subnodeConfiguration = mConfiguration.configurationAt(key); return new XmlConfig(this, subnodeConfiguration); } catch (Exception e) { return null; } }
private void initializePortalConfig(HttpServletRequest request) { this.contextRootPath = request.getContextPath(); this.scriptPath = this.contextRootPath + request.getServletPath(); PropertyListConfiguration serverConfig = getPortalConfiguration(request); this.storageDirectory = serverConfig.getString("storage.local"); this.tdbDirectory = serverConfig.getString("storage.tdb"); this.serverUrl = serverConfig.getString("server"); this.softwareOntologyUrl = serverConfig.getString("ontology.software"); this.dataOntologyUrl = serverConfig.getString("ontology.data"); this.communityOntologyUrl = serverConfig.getString("ontology.community"); this.resourceOntologyUrl = serverConfig.getString("ontology.resource"); if(this.communityOntologyUrl == null) this.communityOntologyUrl = ontdirurl + "/community.owl"; this.standardNamesOntologies = new HashMap<String, String>(); SubnodeConfiguration snconfig = serverConfig.configurationAt("ontology.standard_names"); for(@SuppressWarnings("unchecked") Iterator<String> it = snconfig.getKeys(); it.hasNext(); ) { String snrepo = it.next(); String snurl = snconfig.getString(snrepo); this.standardNamesOntologies.put(snrepo, snurl); } this.miscProperties = new HashMap<String, String>(); try { SubnodeConfiguration misc = serverConfig.configurationAt("misc"); for(@SuppressWarnings("unchecked") Iterator<String> it = misc.getKeys(); it.hasNext(); ) { String key = it.next(); String value = misc.getString(key); this.miscProperties.put(key, value); } } catch (Exception e) { } }
private File getLibraryDirectory(SubnodeConfiguration languageConf) { String libDirString = languageConf.getString("library", ""); if (libDirString.isEmpty()) return null; File libDir = new File(libDirString); if (!libDir.isAbsolute()) libDir = new File(m_languageConfDir, libDirString); return libDir; }
private List<ServerInfo> getServerList() throws ConfigurationException { HierarchicalINIConfiguration config = new HierarchicalINIConfiguration(userConfig); SubnodeConfiguration serverConfig = config.getSection("servers"); DataConfiguration dataConfig = new DataConfiguration(serverConfig); List<String> prefixes = findPrefixes(dataConfig); return findServerInfoByPrefixes(dataConfig, prefixes); }
/** * Creates a ArangoDBGraph by a Rexster configuration context * * @param context * Rexster configuration context * @return Graph a ArangoDBGraph */ @Override public Graph configureGraphInstance(GraphConfigurationContext context) throws GraphConfigurationException { final HierarchicalConfiguration graphSectionConfig = (HierarchicalConfiguration) context.getProperties(); SubnodeConfiguration conf; try { conf = graphSectionConfig.configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES); } catch (IllegalArgumentException iae) { throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_PROPERTIES, iae); } try { final String host = conf.getString("host"); final int port = conf.getInt("port", 5000); final String graphName = conf.getString("graph-name"); final String vertexCollectionName = conf.getString("vertex-name"); final String edgeCollectionName = conf.getString("edge-name"); return new ArangoDBGraph(host, port, graphName, vertexCollectionName, edgeCollectionName); } catch (Exception ex) { throw new GraphConfigurationException(ex); } }
private SubnodeConfiguration retrieveTeamInformation() throws NotificationException { return getConfiguration().getSection(getTeamId()); }
/** * @return the read capacity for dynamoDB tables. */ public HierarchicalConfiguration getResultsProviderConfig() { SubnodeConfiguration ret = config.configurationAt("results/config"); return ret; }
/** * * @return */ InstanceDescriptionDefaults getInstanceDefaults() { SubnodeConfiguration c = config.configurationAt("default-instance-description"); return new InstanceDescriptionDefaults(c, c); }