List of usage examples for java.util Properties stringPropertyNames
public Set<String> stringPropertyNames()
From source file:com.fujitsu.dc.engine.rs.StatusResource.java
/** * GET???./*from w w w . ja va 2 s . c om*/ * @return JAS-RS Response */ @SuppressWarnings("unchecked") @GET @Produces("application/json") public Response get() { StringBuilder sb = new StringBuilder(); // Properties props = DcEngineConfig.getProperties(); JSONObject responseJson = new JSONObject(); JSONObject propertiesJson = new JSONObject(); for (String key : props.stringPropertyNames()) { String value = props.getProperty(key); propertiesJson.put(key, value); } responseJson.put("properties", propertiesJson); sb.append(responseJson.toJSONString()); return Response.status(HttpStatus.SC_OK).entity(sb.toString()).build(); }
From source file:se.sics.kompics.simulation.TimeInterceptor.java
public void start(ClassPool pool) throws NotFoundException, CannotCompileException { // well known exceptions exceptions.add("se.sics.kompics.p2p.simulator.P2pSimulator"); exceptions.add("org.apache.log4j.PropertyConfigurator"); exceptions.add("org.apache.log4j.helpers.FileWatchdog"); exceptions.add("org.mortbay.thread.QueuedThreadPool"); exceptions.add("org.mortbay.io.nio.SelectorManager"); exceptions.add("org.mortbay.io.nio.SelectorManager$SelectSet"); exceptions.add("org.apache.commons.math.stat.descriptive.SummaryStatistics"); exceptions.add("org.apache.commons.math.stat.descriptive.DescriptiveStatistics"); // try to add user-defined exceptions from properties file InputStream in = ClassLoader.getSystemResourceAsStream("timer.interceptor.properties"); Properties p = new Properties(); if (in != null) { try {/*from w ww . j a v a 2 s . c om*/ p.load(in); for (String classname : p.stringPropertyNames()) { String value = p.getProperty(classname); if (value != null && value.equals("IGNORE")) { exceptions.add(classname); } } } catch (IOException e) { e.printStackTrace(); } } }
From source file:com.mozilla.bagheera.hazelcast.persistence.ElasticSearchIndexMapStore.java
public void init(HazelcastInstance hazelcastInstance, Properties properties, String mapName) { Configuration conf = HBaseConfiguration.create(); for (String name : properties.stringPropertyNames()) { if (name.startsWith("hbase.") || name.startsWith("hadoop.") || name.startsWith("zookeeper.")) { conf.set(name, properties.getProperty(name)); }//from ww w . j a v a 2s.co m } int hbasePoolSize = Integer.parseInt(properties.getProperty("hazelcast.hbase.pool.size", "10")); MAP_NAME = properties.getProperty("hazelcast.map.name", "tasks"); String tableName = properties.getProperty("hazelcast.hbase.table", "default"); String family = properties.getProperty("hazelcast.hbase.column.family", "data"); String columnQualifier = properties.getProperty("hazelcast.hbase.column.qualifier"); String qualifier = columnQualifier == null ? "" : columnQualifier; pool = new HTablePool(conf, hbasePoolSize); table = new HBaseTableDao(pool, tableName, family, qualifier); String indexName = properties.getProperty("hazelcast.elasticsearch.index", "default"); String typeName = properties.getProperty("hazelcast.elasticsearch.type.name", "data"); es = new ElasticSearchDao(NodeClientSingleton.getInstance(properties).getClient(), indexName, typeName); }
From source file:io.personium.engine.rs.StatusResource.java
/** * GET???./* w w w .j a v a 2s .c o m*/ * @return JAS-RS Response */ @SuppressWarnings("unchecked") @GET @Produces("application/json") public Response get() { StringBuilder sb = new StringBuilder(); // Properties props = PersoniumEngineConfig.getProperties(); JSONObject responseJson = new JSONObject(); JSONObject propertiesJson = new JSONObject(); for (String key : props.stringPropertyNames()) { String value = props.getProperty(key); propertiesJson.put(key, value); } responseJson.put("properties", propertiesJson); sb.append(responseJson.toJSONString()); return Response.status(HttpStatus.SC_OK).entity(sb.toString()).build(); }
From source file:eu.eidas.node.utils.CountrySpecificUtil.java
private Map<String, Boolean> getConfiguredPlugins(ApplicationContext ctx) { Properties eidasConfig = (Properties) ctx.getBean("nodeProps"); Map<String, Boolean> confPlugins = new HashMap<String, Boolean>(); if (eidasConfig != null) { for (String key : eidasConfig.stringPropertyNames()) { if (key.startsWith(PLUGIN_ACTIVATION_PREFIX)) { if (Boolean.valueOf(eidasConfig.getProperty(key))) { confPlugins.put(key.substring(PLUGIN_ACTIVATION_PREFIX.length()), Boolean.TRUE); } else { confPlugins.put(key.substring(PLUGIN_ACTIVATION_PREFIX.length()), Boolean.FALSE); }/*from w w w . j a va2 s . com*/ } } } return confPlugins; }
From source file:com.izforge.izpack.compiler.data.PropertyManager.java
/** * Resolve references to IzPack variables in all values of a properties object * * @param props properties to resolve//from www .jav a 2 s. c o m */ private void resolveAllProperties(Properties props) throws IOException { for (String name : props.stringPropertyNames()) { String value = props.getProperty(name); props.put(name, IOUtils.toString(new VariableSubstitutorReader(new StringReader(value), variables, SubstitutionType.TYPE_AT, true))); } }
From source file:gov.nih.nci.ncicb.tcga.dcc.qclive.common.util.VcfHeaderDefinitionStorePropertyFileImpl.java
/** * Initialize the VcfFileHeader Map//from w w w .j ava2 s . co m * * @param logger the logger to use for logging errors */ private void initVcfFileHeaderMap(final Logger logger) { try { final Properties vcfHeaderDefinitionsProperties = getProperties(); final Set<String> propertyNames = vcfHeaderDefinitionsProperties.stringPropertyNames(); for (final String propertyName : propertyNames) { final String[] nameParts = propertyName.split("\\.", -1); if (nameParts.length == 3) { //Property names are expected to be in the form headerType.headerId.headerSubField final String headerType = nameParts[0]; final String headerId = nameParts[1]; final String headerSubField = nameParts[2]; final String mapKey = makeMapKey(headerType, headerId); final String propertyValue = vcfHeaderDefinitionsProperties.getProperty(propertyName); VcfFileHeader vcfFileHeader = getVcfFileHeaderMap().get(mapKey); if (vcfFileHeader == null) { // Create a new VcfFileHeader and add it to the Map final Map<String, String> values = new HashMap<String, String>(); values.put(ID, headerId); values.put(headerSubField, propertyValue); vcfFileHeader = new VcfFileHeader(headerType); vcfFileHeader.setValueMap(values); getVcfFileHeaderMap().put(mapKey, vcfFileHeader); } else { //Update the VcfFileHeader valueMap vcfFileHeader.getValueMap().put(headerSubField, propertyValue); } } } cleanupVcfFileHeaderMap(); } catch (final IOException e) { logger.log(e); } }
From source file:org.openvpms.web.echo.style.StyleSheetCache.java
/** * Returns properties for the specified resource. * * @param name the resource name/*from w ww.j a v a 2 s .co m*/ * @param required determines if the resource is required or not * @return the resource, or {@code null} if it does exist and wasn't required * @throws IOException if an I/O error occurs * @throws StyleSheetException if the resource cannot be found and is required */ private Map<String, String> getProperties(String name, boolean required) throws IOException { Map<String, String> result = null; InputStream stream = getResource(name, required); if (stream != null) { result = new HashMap<String, String>(); Properties properties = new Properties(); properties.load(stream); for (String key : properties.stringPropertyNames()) { result.put(key, (String) properties.get(key)); } } return result; }
From source file:org.apache.hadoop.hive.ql.util.HiveStrictManagedMigration.java
static RunOptions createRunOptions(CommandLine cli) throws Exception { // Process --hiveconf // Get hiveconf param values and set the System property values Properties confProps = cli.getOptionProperties("hiveconf"); for (String propKey : confProps.stringPropertyNames()) { LOG.info("Setting {}={}", propKey, confProps.getProperty(propKey)); if (propKey.equalsIgnoreCase("hive.root.logger")) { // TODO: logging currently goes to hive.log CommonCliOptions.splitAndSetLogger(propKey, confProps); } else {/*from w w w . j av a 2s .co m*/ System.setProperty(propKey, confProps.getProperty(propKey)); } } LogUtils.initHiveLog4j(); String dbRegex = cli.getOptionValue("dbRegex", ".*"); String tableRegex = cli.getOptionValue("tableRegex", ".*"); TableMigrationOption migrationOption = TableMigrationOption .valueOf(cli.getOptionValue("migrationOption", "none").toUpperCase()); boolean shouldModifyManagedTableLocation = cli.hasOption("shouldModifyManagedTableLocation"); boolean shouldModifyManagedTableOwner = cli.hasOption("shouldModifyManagedTableOwner"); boolean shouldModifyManagedTablePermissions = cli.hasOption("shouldModifyManagedTablePermissions"); if (cli.hasOption("modifyManagedTables")) { shouldModifyManagedTableLocation = true; shouldModifyManagedTableOwner = true; shouldModifyManagedTablePermissions = true; } String oldWarehouseRoot = cli.getOptionValue("oldWarehouseRoot"); boolean dryRun = cli.hasOption("dryRun"); RunOptions runOpts = new RunOptions(dbRegex, tableRegex, oldWarehouseRoot, migrationOption, shouldModifyManagedTableLocation, shouldModifyManagedTableOwner, shouldModifyManagedTablePermissions, dryRun); return runOpts; }
From source file:org.springframework.batch.core.jsr.configuration.xml.JsrBeanDefinitionDocumentReader.java
private void resolvePropertyValues(Properties properties) { for (String propertyKey : properties.stringPropertyNames()) { String resolvedPropertyValue = resolvePropertyValue(properties.getProperty(propertyKey)); if (!properties.getProperty(propertyKey).equals(resolvedPropertyValue)) { properties.setProperty(propertyKey, resolvedPropertyValue); }/*from ww w . ja v a 2s . c om*/ } }