List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:org.apache.falcon.oozie.process.ProcessExecutionWorkflowBuilder.java
protected void addOutputFeedsAsParams(List<String> paramList, Cluster cluster) throws FalconException { if (entity.getOutputs() == null) { return;//w ww . j a v a 2s.c o m } for (Output output : entity.getOutputs().getOutputs()) { Feed feed = EntityUtil.getEntity(EntityType.FEED, output.getFeed()); Storage storage = FeedHelper.createStorage(cluster, feed); if (storage.getType() == Storage.TYPE.FILESYSTEM) { final String outputName = output.getName(); // no prefix for backwards compatibility paramList.add(outputName + "=${" + outputName + "}"); } else if (storage.getType() == Storage.TYPE.TABLE) { Properties props = new Properties(); propagateCatalogTableProperties(output, (CatalogStorage) storage, props); // prefix is auto added for (Object key : props.keySet()) { paramList.add(key + "=${wf:conf('" + key + "')}"); } final String paramName = "falcon_" + output.getName(); // prefix 'falcon' for new params paramList.add(paramName + "_partitions=${wf:conf('" + paramName + "_partitions_" + entity.getWorkflow().getEngine().name().toLowerCase() + "')}"); } } }
From source file:fr.fastconnect.factory.tibco.bw.maven.source.MassMavenizerMojo.java
/** * //from w w w . j a v a2 s . c o m * @param configuration, a list of "-D" properties * @return the configuration as a List<Element> used by MojoExecutor */ private List<Element> generateConfiguration(Properties configuration) { List<Element> configurations = new ArrayList<Element>(); if (configuration != null) { for (Object key : configuration.keySet()) { String value = configuration.get(key).toString(); getLog().debug(value); configurations.add(element(key.toString(), value)); } } return configurations; }
From source file:edu.duke.cabig.c3pr.web.DashboardController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { SecurityContext context = SecurityContextHolder.getContext(); Authentication auth = context.getAuthentication(); GrantedAuthority[] groups = auth.getAuthorities(); Set<Lov> links = new HashSet<Lov>(); for (GrantedAuthority ga : groups) { if (DashboardController.class.getClassLoader() .getResource(ga.getAuthority() + ".links.properties") != null) { String filename = ga.getAuthority() + ".links.properties"; log.debug("Found rolebased links file: " + filename); Properties p = new Properties(); try { p.load(DashboardController.class.getClassLoader().getResourceAsStream(filename)); log.debug("The links file has " + p.keySet().size() + " elements."); } catch (IOException e) { log.error("Error while trying to read the property file: [" + filename + "]"); }/*from w w w . j a v a 2 s . c o m*/ addLinks(links, p); } } request.setAttribute("links", links); if (SecurityUtils.hasPrivilege(UserPrivilegeType.STUDY_READ)) { getMostEnrolledStudies(request); getRecentPendingStudies(request); } if (SecurityUtils.hasPrivilege(UserPrivilegeType.STUDYSUBJECT_READ)) { getRecentPendingRegistrations(request); } getNotifications(request); request.setAttribute("cctsEnv", isCCTSEnv()); if (isCCTSEnv()) { try { testSmokeTestGridService(); request.setAttribute("authentication", "Passed"); } catch (Exception e) { request.setAttribute("authentication", "Failed"); request.setAttribute("smokeTestError", e.getMessage()); log.error(e); } } return super.handleRequestInternal(request, response); }
From source file:info.magnolia.jcr.util.PropertiesImportExport.java
/** * Each property or node in the stream has to be separated by the \n. *///www. jav a 2s .c o m public void createNodes(Node root, InputStream propertiesStream) throws IOException, RepositoryException { Properties properties = new OrderedProperties(); properties.load(propertiesStream); properties = keysToInnerFormat(properties); for (Object o : properties.keySet()) { String key = (String) o; String valueStr = properties.getProperty(key); String propertyName = StringUtils.substringAfterLast(key, "."); String path = StringUtils.substringBeforeLast(key, "."); String type = null; if (propertyName.equals("@type")) { type = valueStr; } else if (properties.containsKey(path + ".@type")) { type = properties.getProperty(path + ".@type"); } type = StringUtils.defaultIfEmpty(type, NodeTypes.ContentNode.NAME); Node c = NodeUtil.createPath(root, path, type); populateNode(c, propertyName, valueStr); } }
From source file:es.emergya.ui.base.plugins.PluginType.java
PluginTypeContainer() { super();/*from ww w .j a v a 2s . co m*/ // default put("UNKNOWN", new PluginType("UNKNOWN")); PluginType pluginType = new PluginType("ADMIN"); pluginType.detachable = true; put("ADMIN", pluginType); put("MAP", new PluginType("MAP")); final Properties p = new Properties(); try { InputStream resourceAsStream = GoClassLoader.getGoClassLoader().getResourceAsStream("moduletypes"); if (resourceAsStream == null) throw new NullPointerException("No se encontr el fichero de moduletypes"); p.load(resourceAsStream); for (Object k : p.keySet()) { put(k.toString(), new PluginType(k.toString())); } } catch (Exception e) { LogFactory.getLog(PluginType.class).error("moduletypes file not found. Using default."); put("MESSAGES", new PluginType("MESSAGES")); put("FORMS", new PluginType("FORMS")); put("BUTTON", new PluginType("BUTTON")); put("LIST", new PluginType("LIST")); } }
From source file:com.qualogy.qafe.web.css.util.CssProvider.java
public String replaceWithRendererTypeCss(String rendererType, String cssData) { Properties styleProperties = new Properties(); try {// w ww . ja v a 2 s . c o m styleProperties.load( this.getClass().getResourceAsStream("qafe-style-rendering-" + rendererType + ".properties")); Iterator itr = styleProperties.keySet().iterator(); while (itr.hasNext()) { String qafeStyleClass = itr.next().toString(); if (cssData.contains(qafeStyleClass)) { String replacementStyleClass = styleProperties.getProperty(qafeStyleClass); cssData = cssData.replaceAll(qafeStyleClass, replacementStyleClass); } } } catch (IOException e) { logger.fine(ExceptionHelper.printStackTrace(e)); throw new RuntimeException(e); } return cssData; }
From source file:jp.terasoluna.fw.web.struts.action.GlobalMessageResources.java
/** * ?[g?bZ?[Wt@CL?q?bZ?[W}bv/*ww w. j a v a 2 s. c o m*/ * p?B???}bvp?B * * @param prop ?[gv?peBt@C * @return ?[gv?peBt@CL?q?bZ?[W */ private Map<String, String> getRootApplicationMap(Properties prop) { Map<String, String> rootApplicationMap = new HashMap<String, String>(); // L?[ Iterator it = prop.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); // L?[?Aadd.message.file.n?O?B if (key.startsWith(ADD_MESSAGES_FILE)) { continue; } String value = prop.getProperty(key); if (log.isDebugEnabled()) { log.debug("Saving root-application message key [" + key + "]" + "value [" + value + "]"); } rootApplicationMap.put(key, value); } return rootApplicationMap; }
From source file:org.taverna.server.master.identity.UserStore.java
public void setBaselineUserProperties(Properties props) { UserAttributeEditor parser = new UserAttributeEditor(); for (Object name : props.keySet()) { String username = (String) name; String value = props.getProperty(username); // Convert value to a password, enabled setting, and list of granted // authorities parser.setAsText(value);/*from w ww .j ava 2 s . co m*/ UserAttribute attr = (UserAttribute) parser.getValue(); if (attr != null && attr.isEnabled()) base.put(username, new BootstrapUserInfo(username, attr)); } }
From source file:com.hp.security.jauth.core.filter.SystemInit.java
public void initMessageProperties(ResourcePatternResolver resolver) throws IOException { //finding system messages. Resource jauthCoreMessages = resolver.getResource("jauth-core-message.properties"); Properties jauthCoreProp = new Properties(); jauthCoreProp.load(jauthCoreMessages.getInputStream()); Set<Object> jauthCoreKeys = jauthCoreProp.keySet(); for (Object k : jauthCoreKeys) { String key = k.toString(); String value = jauthCoreProp.get(key).toString(); MessageContext.messages.put(key, value); }/*from ww w.j a v a 2 s .c o m*/ log.info("loaded jauth core messages."); try { Resource jauthAdminMessages = resolver.getResource("jauth-admin-message.properties"); Properties jauthAdminProp = new Properties(); jauthAdminProp.load(jauthAdminMessages.getInputStream()); Set<Object> jauthAdminKeys = jauthAdminProp.keySet(); for (Object k : jauthAdminKeys) { String key = k.toString(); String value = jauthAdminProp.get(key).toString(); MessageContext.messages.put(key, value); } log.info("loaded jauth admin messages."); } catch (FileNotFoundException e) { log.info("didn't find any jauth admin messages."); } try { Resource jauthSoapMessages = resolver.getResource("jauth-soap-message.properties"); Properties jauthSoapProp = new Properties(); jauthSoapProp.load(jauthSoapMessages.getInputStream()); Set<Object> jauthSoapKeys = jauthSoapProp.keySet(); for (Object k : jauthSoapKeys) { String key = k.toString(); String value = jauthSoapProp.get(key).toString(); MessageContext.messages.put(key, value); } log.info("loaded jauth soap messages."); } catch (FileNotFoundException e) { log.info("didn't find any jauth soap messages."); } //finding custom messages. try { Resource customMessages = resolver.getResource("message.properties"); Properties customProp = new Properties(); customProp.load(customMessages.getInputStream()); Set<Object> customKeys = customProp.keySet(); for (Object k : customKeys) { String key = k.toString(); String value = customProp.get(key).toString(); MessageContext.messages.put(key, value); } log.info("loaded jauth custom messages."); } catch (FileNotFoundException e) { log.info("didn't find any jauth custom messages."); } //finding jauth properties try { Resource jauth = resolver.getResource("jauth.properties"); Properties jauthProp = new Properties(); jauthProp.load(jauth.getInputStream()); authActive = jauthProp.get(Constants.CONFIG_KEY_ACTIVE) == null ? configService.findByKey(Constants.CONFIG_KEY_ACTIVE).getValue() : jauthProp.get(Constants.CONFIG_KEY_ACTIVE).toString(); authorizationCheck = jauthProp.get(Constants.CONFIG_AUTHORIZATION_CHECK) == null ? configService.findByKey(Constants.CONFIG_AUTHORIZATION_CHECK).getValue() : jauthProp.get(Constants.CONFIG_AUTHORIZATION_CHECK).toString(); arithmeticIndex = jauthProp.get(Constants.CONFIG_KEY_ARITHMETIC) == null ? configService.findByKey(Constants.CONFIG_KEY_ARITHMETIC).getValue() : jauthProp.get(Constants.CONFIG_KEY_ARITHMETIC).toString(); sessionID = jauthProp.get(Constants.CONFIG_KEY_SESSION_ID) == null ? configService.findByKey(Constants.CONFIG_KEY_SESSION_ID).getValue() : jauthProp.get(Constants.CONFIG_KEY_SESSION_ID).toString(); sessionACL = jauthProp.get(Constants.CONFIG_KEY_SESSION_ACL) == null ? configService.findByKey(Constants.CONFIG_KEY_SESSION_ACL).getValue() : jauthProp.get(Constants.CONFIG_KEY_SESSION_ACL).toString(); rules = jauthProp.get(Constants.CONFIG_KEY_RULES) == null ? configService.findByKey(Constants.CONFIG_KEY_RULES).getValue() : jauthProp.get(Constants.CONFIG_KEY_RULES).toString(); accessiblePage = jauthProp.get(Constants.CONFIG_KEY_ACCESSIBLE_PAGE) == null ? configService.findByKey(Constants.CONFIG_KEY_ACCESSIBLE_PAGE).getValue() : jauthProp.get(Constants.CONFIG_KEY_ACCESSIBLE_PAGE).toString(); accessibleHost = jauthProp.get(Constants.CONFIG_KEY_ACCESSIBLE_HOST) == null ? configService.findByKey(Constants.CONFIG_KEY_ACCESSIBLE_HOST).getValue() : jauthProp.get(Constants.CONFIG_KEY_ACCESSIBLE_HOST).toString(); exceptionPage = jauthProp.get(Constants.CONFIG_KEY_EXCEPTION) == null ? configService.findByKey(Constants.CONFIG_KEY_EXCEPTION).getValue() : jauthProp.get(Constants.CONFIG_KEY_EXCEPTION).toString(); loginPage = jauthProp.get(Constants.CONFIG_KEY_LOGIN_PAGE) == null ? configService.findByKey(Constants.CONFIG_KEY_LOGIN_PAGE).getValue() : jauthProp.get(Constants.CONFIG_KEY_LOGIN_PAGE).toString(); soapEnabled = jauthProp.get(Constants.CONFIG_KEY_SOAP_ENABLED) == null ? configService.findByKey(Constants.CONFIG_KEY_SOAP_ENABLED).getValue() : jauthProp.get(Constants.CONFIG_KEY_SOAP_ENABLED).toString(); protectWSDL = jauthProp.get(Constants.CONFIG_KEY_PROTECT_WSDL) == null ? configService.findByKey(Constants.CONFIG_KEY_PROTECT_WSDL).getValue() : jauthProp.get(Constants.CONFIG_KEY_PROTECT_WSDL).toString(); dbLogEnabled = jauthProp.get(Constants.CONFIG_KEY_DB_LOG_ENABLED) == null ? configService.findByKey(Constants.CONFIG_KEY_DB_LOG_ENABLED).getValue() : jauthProp.get(Constants.CONFIG_KEY_DB_LOG_ENABLED).toString(); logPath = jauthProp.get(Constants.CONFIG_KEY_LOG_PATH) == null ? configService.findByKey(Constants.CONFIG_KEY_LOG_PATH).getValue() : jauthProp.get(Constants.CONFIG_KEY_LOG_PATH).toString(); if (logPath.length() > 0) { File logDir = new File(logPath); if (!logDir.exists()) { logDir.mkdirs(); } } log.info("loaded jauth.properties."); } catch (FileNotFoundException e) { log.info("didn't find jauth.properties."); } }
From source file:org.alfresco.config.SystemPropertiesFactoryBean.java
@SuppressWarnings("unchecked") @Override//w ww.j a va2s.co m protected Properties mergeProperties() throws IOException { // First do the default merge Properties props = super.mergeProperties(); // Now resolve all the merged properties if (this.systemPropertiesMode == PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_NEVER) { // If we are in never mode, we don't refer to system properties at all for (String systemProperty : (Set<String>) (Set) props.keySet()) { resolveMergedProperty(systemProperty, props); } } else { // Otherwise, we allow unset properties to drift through from the systemProperties set and potentially set // ones to be overriden by system properties Set<String> propNames = new HashSet<String>((Set<String>) (Set) props.keySet()); propNames.addAll(this.systemProperties); for (String systemProperty : propNames) { resolveMergedProperty(systemProperty, props); if (this.systemPropertiesMode == PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_FALLBACK && props.containsKey(systemProperty)) { // It's already there continue; } // Get the system value and assign if present String systemPropertyValue = System.getProperty(systemProperty); if (systemPropertyValue != null) { props.put(systemProperty, systemPropertyValue); } } } return props; }