List of usage examples for java.util Properties propertyNames
public Enumeration<?> propertyNames()
From source file:org.metaeffekt.dcc.commons.spring.xml.ProfileValidationBeanFactoryPostProcessor.java
protected boolean checkUnresolvedVariables(String context, Properties p) { Enumeration<?> enumeration = p.propertyNames(); boolean hasUnresolvedVariables = false; while (enumeration.hasMoreElements()) { Object key = enumeration.nextElement(); String value = p.getProperty(key.toString()); value = value.replace("${dcc.", "{"); if (value.contains("${")) { if (!hasUnresolvedVariables) { LOG.warn("The properties derived for {} contains unresolved variables:", context); hasUnresolvedVariables = true; }//from www. j ava2 s.co m LOG.warn(" Value of key [{}]: {}", key, value); } } return hasUnresolvedVariables; }
From source file:org.wso2.carbon.identity.event.IdentityEventConfigBuilder.java
/** * Build and store per module configuration objects *//* w w w.j a va 2 s . co m*/ private void build() { Properties moduleNames = IdentityEventUtils.getSubProperties("module.name", notificationMgtConfigProperties); Enumeration propertyNames = moduleNames.propertyNames(); // Iterate through events and build event objects while (propertyNames.hasMoreElements()) { String key = (String) propertyNames.nextElement(); String moduleName = (String) moduleNames.remove(key); moduleConfiguration.put(moduleName, buildModuleConfigurations(moduleName)); } }
From source file:org.xmatthew.spy2servers.config.IntegrationNamespaceHandler.java
@SuppressWarnings("unchecked") private Map<String, Class<? extends BeanDefinitionParser>> loadAdapterParserMappings() { Map<String, Class<? extends BeanDefinitionParser>> parserMappings = new HashMap<String, Class<? extends BeanDefinitionParser>>(); ClassLoader classLoader = getClass().getClassLoader(); try {/* ww w .j a v a 2 s . c o m*/ Properties mappings = PropertiesLoaderUtils.loadAllProperties(ADAPTER_PARSER_MAPPINGS_LOCATION, classLoader); if (logger.isDebugEnabled()) { logger.debug("Loaded parser mappings [" + mappings + "]"); } Enumeration<?> propertyNames = mappings.propertyNames(); while (propertyNames.hasMoreElements()) { String name = (String) propertyNames.nextElement(); String classname = mappings.getProperty(name); Class<?> parserClass = ClassUtils.forName(classname, classLoader); if (!BeanDefinitionParser.class.isAssignableFrom(parserClass)) { throw new IllegalStateException("Expected class of type BeanDefinitionParser, but '" + name + "' was of type '" + parserClass.getSimpleName() + "'"); } parserMappings.put(name, (Class<? extends BeanDefinitionParser>) parserClass); } return parserMappings; } catch (IOException e) { throw new IllegalStateException("Unable to load BeanDefinitionParser mappings from location [" + ADAPTER_PARSER_MAPPINGS_LOCATION + "]. Root cause: " + e); } catch (ClassNotFoundException e) { throw new IllegalStateException("Failed to load BeanDefinitionParser.", e); } }
From source file:org.eclipse.smila.connectivity.framework.crawler.web.metadata.Metadata.java
/** * Assigns a meta data names/values mapping from the given properties. * /*from ww w . j a v a 2 s .com*/ * @param properties * set of properties representing name/value mapping. */ public void setAll(final Properties properties) { final Enumeration<?> names = properties.propertyNames(); while (names.hasMoreElements()) { final String name = (String) names.nextElement(); set(name, properties.getProperty(name)); } }
From source file:org.springframework.osgi.web.extender.internal.activator.WarListenerConfiguration.java
/** * Constructs a new <code>WarListenerConfiguration</code> instance. * Locates the extender configuration, creates an application context which * will returned the extender items./* ww w.jav a2 s . co m*/ * * @param bundleContext extender OSGi bundle context */ public WarListenerConfiguration(BundleContext bundleContext) { Bundle bundle = bundleContext.getBundle(); Properties properties = new Properties(createDefaultProperties()); Enumeration enm = bundle.findEntries(EXTENDER_CFG_LOCATION, XML_PATTERN, false); if (enm == null) { log.info("No custom extender configuration detected; using defaults..."); warScanner = createDefaultWarScanner(); warDeployer = createDefaultWarDeployer(bundleContext); contextPathStrategy = createDefaultContextPathStrategy(); } else { String[] configs = copyEnumerationToList(enm); log.info("Detected extender custom configurations at " + ObjectUtils.nullSafeToString(configs)); // create OSGi specific XML context ConfigurableOsgiBundleApplicationContext context = new OsgiBundleXmlApplicationContext(configs); context.setBundleContext(bundleContext); context.refresh(); synchronized (lock) { extenderConfiguration = context; } warScanner = context.containsBean(WAR_SCANNER_NAME) ? (WarScanner) context.getBean(WAR_SCANNER_NAME, WarScanner.class) : createDefaultWarScanner(); warDeployer = context.containsBean(WAR_DEPLOYER_NAME) ? (WarDeployer) context.getBean(WAR_DEPLOYER_NAME, WarDeployer.class) : createDefaultWarDeployer(bundleContext); contextPathStrategy = context.containsBean(CONTEXT_PATH_STRATEGY_NAME) ? (ContextPathStrategy) context.getBean(CONTEXT_PATH_STRATEGY_NAME, ContextPathStrategy.class) : createDefaultContextPathStrategy(); // extender properties using the defaults as backup if (context.containsBean(PROPERTIES_NAME)) { Properties customProperties = (Properties) context.getBean(PROPERTIES_NAME, Properties.class); Enumeration propertyKey = customProperties.propertyNames(); while (propertyKey.hasMoreElements()) { String property = (String) propertyKey.nextElement(); properties.setProperty(property, customProperties.getProperty(property)); } } } undeployWarsAtShutdown = getUndeployWarsAtShutdown(properties); }
From source file:com.ifunshow.antelopeframe.core.web.exception.SimpleMappingExceptionResolver.java
/** * Set the HTTP status code that this exception resolver will apply for a given resolved error view. Keys are * view names; values are status codes.//from ww w . j a v a 2 s . c om * <p>Note that this error code will only get applied in case of a top-level request. It will not be set for an include * request, since the HTTP status cannot be modified from within an include. * <p>If not specified, the default status code will be applied. * @see #setDefaultStatusCode(int) */ public void setStatusCodes(Properties statusCodes) { for (Enumeration<?> enumeration = statusCodes.propertyNames(); enumeration.hasMoreElements();) { String viewName = (String) enumeration.nextElement(); Integer statusCode = new Integer(statusCodes.getProperty(viewName)); this.statusCodes.put(viewName, statusCode); } }
From source file:org.fao.geonet.api.site.SiteInformation.java
/** * Compute information about git commit. *///from ww w .ja v a 2 s . com private void loadVersionInfo(ServiceContext context) { Properties prop = new Properties(); try (InputStream input = getClass().getResourceAsStream("/git.properties")) { prop.load(input); Enumeration<?> e = prop.propertyNames(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); String value = prop.getProperty(key); versionProperties.put(key, value); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:org.rdv.ConfigurationManager.java
/** * Save the application configuration to the specified file. * //ww w .j a v a 2 s. co m * @param configFile the file to save the configuration to * @since 1.3 */ public static void saveConfiguration(File configFile) { PrintWriter out; try { out = new PrintWriter(new BufferedWriter(new FileWriter(configFile))); } catch (IOException e) { return; } out.println("<?xml version=\"1.0\"?>"); out.println("<rdv>"); RBNBController rbnb = RBNBController.getInstance(); out.println(" <rbnb>"); out.println(" <host>" + rbnb.getRBNBHostName() + "</host>"); out.println(" <port>" + rbnb.getRBNBPortNumber() + "</port>"); out.println(" <state>" + RBNBController.getStateName(rbnb.getState()) + "</state>"); out.println(" <timeScale>" + rbnb.getTimeScale() + "</timeScale>"); out.println(" <playbackRate>" + rbnb.getPlaybackRate() + "</playbackRate>"); out.println(" </rbnb>"); LocalChannelManager localChannelManager = LocalChannelManager.getInstance(); if (localChannelManager.hasChannels()) { for (LocalChannel localChannel : localChannelManager.getChannels()) { out.print(" <localChannel name=\"" + localChannel.getName() + "\""); if (localChannel.getUnit() != null) { out.print(" unit=\"" + localChannel.getUnit() + "\""); } out.println(" formula=\"" + localChannel.getFormula() + "\">"); for (Entry<String, String> variable : localChannel.getVariables().entrySet()) { out.println(" <variable name=\"" + variable.getKey() + "\" channel=\"" + variable.getValue() + "\"/>"); } out.println(" </localChannel>"); } } List<DataPanel> dataPanels = DataPanelManager.getInstance().getDataPanels(); Iterator<DataPanel> it = dataPanels.iterator(); while (it.hasNext()) { DataPanel dataPanel = it.next(); Properties properties = dataPanel.getProperties(); if (isPanelDetached(dataPanel, properties)) { if (dataPanel.subscribedChannelCount() == 0) // A detached panel with no channels subscribed, or a non-existing detached panel continue; // don't add to configuration } out.println(" <dataPanel id=\"" + dataPanel.getClass().getName() + "\">"); if (dataPanel.subscribedChannelCount() > 0) { out.println(" <channels>"); Iterator<String> channels = dataPanel.subscribedChannels().iterator(); while (channels.hasNext()) { String channel = channels.next(); out.println(" <channel>" + channel + "</channel>"); } out.println(" </channels>"); } if (properties.size() > 0) { out.println(" <properties>"); for (Enumeration<?> keys = properties.propertyNames(); keys.hasMoreElements();) { String key = (String) keys.nextElement(); String value = properties.getProperty(key); out.println(" <entry key=\"" + key + "\">" + value + "</entry>"); } out.println(" </properties>"); } out.println(" </dataPanel>"); } out.print("</rdv>"); out.close(); }
From source file:org.geolatte.maprenderer.sld.graphics.ExternalGraphicsRepository.java
private void readGraphicsFromPackage(String packageName, Properties index) throws IOException { Enumeration<String> enumeration = (Enumeration<String>) index.propertyNames(); while (enumeration.hasMoreElements()) { String url = enumeration.nextElement(); String path = packageName + "/" + index.getProperty(url).trim(); retrieveAndStore(url, path);//from www . j a va2 s . co m } }
From source file:org.ops4j.pax.runner.platform.concierge.internal.ConciergePlatformBuilder.java
/** * Writes properties to configuration file. * * @param writer a property writer//from w w w.j a v a2 s . co m * @param properties properties to be written; can be null */ private void appendProperties(final PropertiesWriter writer, final Properties properties) { if (properties != null) { final Enumeration enumeration = properties.propertyNames(); while (enumeration.hasMoreElements()) { final String key = (String) enumeration.nextElement(); writer.append("-D" + key, properties.getProperty(key)); } } }