List of usage examples for java.util Properties propertyNames
public Enumeration<?> propertyNames()
From source file:corner.orm.spring.CornerPropertiesPersister.java
/** * ??/*from w w w . j a v a 2 s . c o m*/ * @param props * @throws IOException ?? */ private void importConfig(Properties props) throws IOException { Enumeration propertyNames = props.propertyNames(); List<String> list = new ArrayList<String>(); while (propertyNames.hasMoreElements()) { String propertyName = (String) propertyNames.nextElement(); if (propertyName.startsWith("config.import")) { list.add(propertyName); } } for (String str : list) { this.loadImportConfigFile(props, this.ctx.getResource(props.getProperty(str))); } }
From source file:org.josso.gateway.audit.service.handler.LoggerAuditTrailHandler.java
public int handle(SSOAuditTrail trail) { StringBuffer line = new StringBuffer(); // Append TIME : CATEGORY - SEVERITY - line.append(trail.getTime()).append(" - ").append(trail.getCategory()).append(" - ") .append(trail.getSeverity()); // Append SUBJECT - ACTION=OUTCOME line.append(" - ").append(trail.getSubject() == null ? "" : trail.getSubject()).append(" - ") .append(trail.getAction()).append("=").append(trail.getOutcome()); // Append properties PROPERTIES:p1=v1,p2=v2 Properties properties = trail.getProperties(); Enumeration names = properties.propertyNames(); if (names.hasMoreElements()) { line.append(" - "); }//from ww w .j a v a2 s.c o m while (names.hasMoreElements()) { String key = (String) names.nextElement(); String value = properties.getProperty(key); line.append(key).append("=").append(value); if (names.hasMoreElements()) line.append(","); } // Log error information !? // Append error informatino if any : ERROR:<message><classname> if (trail.getError() != null) { line.append(" - ERROR:").append(trail.getError().getMessage()).append(":") .append(trail.getError().getClass().getName()); // Append error cause informatino if any : ERROR_CAUSE:<message><classname> if (trail.getError().getCause() != null) { line.append(" ERROR_CAUSE:").append(trail.getError().getCause().getMessage()).append(":") .append(trail.getError().getClass().getName()); } } // Logging the proper line : trailsLogger.info(line); return CONTINUE_PROCESS; }
From source file:org.springframework.security.provisioning.InMemoryUserDetailsManager.java
public InMemoryUserDetailsManager(Properties users) { Enumeration<?> names = users.propertyNames(); UserAttributeEditor editor = new UserAttributeEditor(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); editor.setAsText(users.getProperty(name)); UserAttribute attr = (UserAttribute) editor.getValue(); UserDetails user = new User(name, attr.getPassword(), attr.isEnabled(), true, true, true, attr.getAuthorities());// w w w. ja va 2 s . com createUser(user); } }
From source file:org.araneaframework.servlet.support.ReloadingPropertyFileResourceBundle.java
protected void loadData(Properties newProperties) throws Exception { properties = new HashMap(); for (Enumeration i = newProperties.propertyNames(); i.hasMoreElements();) { String key = (String) i.nextElement(); String value = newProperties.getProperty(key); properties.put(key, value);//from w w w .jav a 2 s .c o m } }
From source file:org.apache.nutch.parse.metatags.MetaTagsParser.java
public ParseResult filter(Content content, ParseResult parseResult, HTMLMetaTags metaTags, DocumentFragment doc) {/*from w w w.j a v a2 s . c om*/ Parse parse = parseResult.get(content.getUrl()); Metadata metadata = parse.getData().getParseMeta(); // check in the metadata first : the tika-parser // might have stored the values there already for (String mdName : metadata.names()) { addIndexedMetatags(metadata, mdName, metadata.getValues(mdName)); } Metadata generalMetaTags = metaTags.getGeneralTags(); for (String tagName : generalMetaTags.names()) { addIndexedMetatags(metadata, tagName, generalMetaTags.getValues(tagName)); } Properties httpequiv = metaTags.getHttpEquivTags(); for (Enumeration<?> tagNames = httpequiv.propertyNames(); tagNames.hasMoreElements();) { String name = (String) tagNames.nextElement(); String value = httpequiv.getProperty(name); addIndexedMetatags(metadata, name, value); } return parseResult; }
From source file:org.wso2.carbon.apimgt.impl.indexing.indexer.CustomAPIIndexer.java
public IndexDocument getIndexedDocument(AsyncIndexer.File2Index fileData) throws SolrException, RegistryException { Registry registry = GovernanceUtils .getGovernanceSystemRegistry(IndexingManager.getInstance().getRegistry(fileData.tenantId)); String resourcePath = fileData.path.substring(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH.length()); Resource resource = null;//ww w. j a v a2s .c o m if (registry.resourceExists(resourcePath)) { resource = registry.get(resourcePath); } if (log.isDebugEnabled()) { log.debug("CustomAPIIndexer is currently indexing the api at path " + resourcePath); } // Here we are adding properties as fields, so that we can search the properties as we do for attributes. IndexDocument indexDocument = super.getIndexedDocument(fileData); Map<String, List<String>> fields = indexDocument.getFields(); if (resource != null) { Properties properties = resource.getProperties(); Enumeration propertyNames = properties.propertyNames(); while (propertyNames.hasMoreElements()) { String property = (String) propertyNames.nextElement(); if (log.isDebugEnabled()) { log.debug("API at " + resourcePath + " has " + property + " property"); } if (property.startsWith(APIConstants.API_RELATED_CUSTOM_PROPERTIES_PREFIX)) { fields.put((OVERVIEW_PREFIX + property), getLowerCaseList(resource.getPropertyValues(property))); if (log.isDebugEnabled()) { log.debug( property + " is added as " + (OVERVIEW_PREFIX + property) + " field for indexing"); } } } indexDocument.setFields(fields); } return indexDocument; }
From source file:io.fabric8.profiles.containers.wildfly.YamlTransformer.java
public YamlTransformer(Properties properties) { Enumeration<?> names = properties.propertyNames(); while (names.hasMoreElements()) { String key = (String) names.nextElement(); if (key.toString().startsWith("namespace.")) { String value = properties.getProperty(key); namespaces.put(key.substring(10), Namespace.getNamespace(value)); }//from ww w . j av a2 s. c o m } }
From source file:org.apache.nutch.parse.MetaTagsParser.java
public ParseResult filter(Content content, ParseResult parseResult, HTMLMetaTags metaTags, DocumentFragment doc) {//w w w . j av a 2 s. c o m Parse parse = parseResult.get(content.getUrl()); Metadata metadata = parse.getData().getParseMeta(); // check in the metadata first : the tika-parser // might have stored the values there already for (String mdName : metadata.names()) { String value = metadata.get(mdName); // check whether the name is in the list of what we want or if // specified * if (metatagset.contains("*") || metatagset.contains(mdName.toLowerCase())) { LOG.debug("Found meta tag : " + mdName + "\t" + value); metadata.add("metatag." + mdName.toLowerCase(), value); } } Properties generalMetaTags = metaTags.getGeneralTags(); for (Enumeration tagNames = generalMetaTags.propertyNames(); tagNames.hasMoreElements();) { String name = (String) tagNames.nextElement(); String value = generalMetaTags.getProperty(name); // check whether the name is in the list of what we want or if // specified * if (metatagset.contains("*") || metatagset.contains(name.toLowerCase())) { LOG.debug("Found meta tag : " + name + "\t" + value); metadata.add("metatag." + name.toLowerCase(), value); } } Properties httpequiv = metaTags.getHttpEquivTags(); for (Enumeration tagNames = httpequiv.propertyNames(); tagNames.hasMoreElements();) { String name = (String) tagNames.nextElement(); String value = httpequiv.getProperty(name); // check whether the name is in the list of what we want or if // specified * if (metatagset.contains("*") || metatagset.contains(name.toLowerCase())) { LOG.debug("Found meta tag : " + name + "\t" + value); metadata.add("metatag." + name.toLowerCase(), value); } } return parseResult; }
From source file:com.forthgo.jspwiki.jdbcprovider.DBCPConnectionProvider.java
private String stringifyProps(Properties props, String separator) { String s;//from ww w . j a v a2s . c o m StringBuffer sb = new StringBuffer(); Enumeration e = props.propertyNames(); while (e.hasMoreElements()) { s = (String) e.nextElement(); sb.append(s + "=" + props.getProperty(s)); if (e.hasMoreElements()) sb.append(separator); } return sb.toString(); }
From source file:com.ebizarts.jspwiki.providers.jdbcprovider.DBCPConnectionProvider.java
private String stringifyProps(Properties props, String separator) { String s;//from w w w .j ava2 s . c o m StringBuffer sb = new StringBuffer(); Enumeration<?> e = props.propertyNames(); while (e.hasMoreElements()) { s = (String) e.nextElement(); sb.append(s + "=" + props.getProperty(s)); if (e.hasMoreElements()) sb.append(separator); } return sb.toString(); }