List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:hydrograph.ui.expression.editor.jar.util.BuildExpressionEditorDataSturcture.java
private void loadClassesFromSettingsFolder() { Properties properties = new Properties(); IFolder folder = getCurrentProject().getFolder(PathConstant.PROJECT_RESOURCES_FOLDER); IFile file = folder.getFile(PathConstant.EXPRESSION_EDITOR_EXTERNAL_JARS_PROPERTIES_FILES); try {/*w w w. j av a 2 s . co m*/ LOGGER.debug("Loading property file"); if (file.getLocation().toFile().exists()) { FileInputStream inStream = new FileInputStream(file.getLocation().toString()); properties.load(inStream); for (Object key : properties.keySet()) { String packageName = StringUtils.remove((String) key, Constants.DOT + Constants.ASTERISK); if (StringUtils.isNotBlank(properties.getProperty((String) key)) && StringUtils.isNotBlank(packageName)) { loadUserDefinedClassesInClassRepo(properties.getProperty((String) key), packageName); } } } } catch (IOException | RuntimeException exception) { LOGGER.error("Exception occurred while loading jar files from projects setting folder", exception); } }
From source file:org.apache.wiki.auth.AuthenticationManager.java
/** * Initializes the options Map supplied to the configured LoginModule every time it is invoked. * The properties and values extracted from * <code>jspwiki.properties</code> are of the form * <code>jspwiki.loginModule.options.<var>param</var> = <var>value</var>, where * <var>param</var> is the key name, and <var>value</var> is the value. * @param props the properties used to initialize JSPWiki * @throws IllegalArgumentException if any of the keys are duplicated *//*from w w w . j a v a 2s . c om*/ private void initLoginModuleOptions(Properties props) { for (Object key : props.keySet()) { String propName = key.toString(); if (propName.startsWith(PREFIX_LOGIN_MODULE_OPTIONS)) { // Extract the option name and value String optionKey = propName.substring(PREFIX_LOGIN_MODULE_OPTIONS.length()).trim(); if (optionKey.length() > 0) { String optionValue = props.getProperty(propName); // Make sure the key is unique before stashing the key/value pair if (m_loginModuleOptions.containsKey(optionKey)) { throw new IllegalArgumentException( "JAAS LoginModule key " + propName + " cannot be specified twice!"); } m_loginModuleOptions.put(optionKey, optionValue); } } } }
From source file:org.aliuge.crawler.jobconf.FetchConfig.java
/** * ???/* w ww . j ava2 s . c om*/ * * @param confFile * @return */ @SuppressWarnings("unchecked") public FetchConfig loadConfig(Document confDoc) throws ConfigurationException { try { Document doc = confDoc; super.setJobName(doc.select("job").attr("name")); super.setIndexName(doc.select("job").attr("indexName")); Elements e = doc.select("fetch"); this.type = e.select("type").text(); this.agent = e.select("agent").text(); String temp = e.select("threadNum").text(); if (StringUtils.isNotBlank(temp)) { this.threadNum = Integer.parseInt(temp); } temp = e.select("delayBetweenRequests").text(); if (StringUtils.isNotBlank(temp)) { this.delayBetweenRequests = Integer.parseInt(temp); } temp = e.select("maxDepthOfCrawling").text(); if (StringUtils.isNotBlank(temp)) { this.maxDepthOfCrawling = Integer.parseInt(temp); } temp = e.select("fetchBinaryContent").text(); if (StringUtils.isNotBlank(temp)) { this.fetchBinaryContent = Boolean.parseBoolean(temp); } if (StringUtils.isNotBlank(e.select("maxOutgoingLinksToFollow").text())) { this.maxOutgoingLinksToFollow = Integer.parseInt(e.select("maxOutgoingLinksToFollow").text()); } temp = e.select("fileSuffix").text(); if (StringUtils.isNotBlank(temp)) { this.fileSuffix = temp; } temp = e.select("maxDownloadSizePerPage").text(); if (StringUtils.isNotBlank(temp)) { this.maxDownloadSizePerPage = Integer.parseInt(temp); } temp = e.select("https").text(); if (StringUtils.isNotBlank(temp)) { this.https = Boolean.parseBoolean(temp); } temp = e.select("onlyDomain").text(); if (StringUtils.isNotBlank(temp)) { this.onlyDomain = Boolean.parseBoolean(temp); } temp = e.select("socketTimeoutMilliseconds").text(); if (StringUtils.isNotBlank(temp)) { this.socketTimeoutMilliseconds = Integer.parseInt(temp); } temp = e.select("connectionTimeout").text(); if (StringUtils.isNotBlank(temp)) { this.connectionTimeout = Integer.parseInt(temp); } temp = e.select("maxTotalConnections").text(); if (StringUtils.isNotBlank(temp)) { this.maxTotalConnections = Integer.parseInt(temp); } temp = e.select("maxConnectionsPerHost").text(); if (StringUtils.isNotBlank(temp)) { this.maxConnectionsPerHost = Integer.parseInt(e.select("maxConnectionsPerHost").text()); } temp = e.select("maxConnectionsPerHost").text(); if (StringUtils.isNotBlank(temp)) { this.maxConnectionsPerHost = Integer.parseInt(temp); } temp = e.select("proxy").text(); if (StringUtils.isNotBlank(temp)) { Properties p = PropertyConfigurationHelper.getProperties(temp); this.proxyIps = Lists.newLinkedList(); for (Object o : p.keySet()) { proxyIps.add((String) p.get(o)); } } // seed Elements seeds = doc.select("fetch seeds seed"); for (Element element : seeds) { // WebURL url = new WebURL(); String url = element.text(); if (StringUtils.isBlank(url)) { continue; } url = url.trim(); String area = element.attr("area"); this.seeds.add(url); WebURL areaUrl = new WebURL(area, url); try { PendingManager.getPendingArea(super.getJobName()).addElement(areaUrl); } catch (QueueException e1) { log.error("", e1); e1.printStackTrace(); } // BloomfilterHelper.getInstance().add(url.getURL()); } /* * ??Url */ Elements fetchUrlFilters = doc.select("fetchUrlFilters filter"); for (Element element : fetchUrlFilters) { String tmp = element.text(); if (StringUtils.isNoneBlank(tmp)) this.fetchUrlFilters.add(element.text()); } /* * ?????Url */ Elements extractUrlfilters = doc.select("extractUrlfilters filter"); for (Element element : extractUrlfilters) { String tmp = element.text(); String tmp_rep = element.attr("replace"); if (StringUtils.isNoneBlank(tmp)) this.extractUrlfilters.add(new KeyValue(tmp, tmp_rep)); } } catch (NumberFormatException e) { throw new ConfigurationException("?" + e.getMessage()); } // super.setFetchConfig(this); return this; }
From source file:com.urbancode.ud.client.ResourceClient.java
public void applyTemplate(String resourceParam, String resourceTemplateId, Properties properties) throws JSONException, IOException { JSONObject json = new JSONObject(); json.put("resourceTemplateId", resourceTemplateId); json.put("targetResourceId", resourceParam); for (Object key : properties.keySet()) { String propertyKey = "p_" + (String) key; json.put(propertyKey, properties.get(key)); }/*from w w w .j av a 2s . co m*/ HttpPut method = new HttpPut(url + "/rest/resource/resource/applyTemplate"); method.setEntity(getStringEntity(json)); invokeMethod(method); }
From source file:org.apache.ode.daohib.bpel.BpelDAOConnectionFactoryImpl.java
/** * @see org.apache.ode.bpel.dao.BpelDAOConnectionFactory#init(java.util.Properties) *//*from w w w . j a va 2s .co m*/ public void init(Properties initialProps) { if (_ds == null) { String errmsg = "setDataSource() not called!"; __log.fatal(errmsg); throw new IllegalStateException(errmsg); } if (_tm == null) { String errmsg = "setTransactionManager() not called!"; __log.fatal(errmsg); throw new IllegalStateException(errmsg); } if (initialProps == null) initialProps = new Properties(); // Don't want to pollute original properties Properties properties = new Properties(); for (Object prop : initialProps.keySet()) { properties.put(prop, initialProps.get(prop)); } // Note that we don't allow the following properties to be overriden by // the client. if (properties.containsKey(Environment.CONNECTION_PROVIDER)) __log.warn("Ignoring user-specified Hibernate property: " + Environment.CONNECTION_PROVIDER); if (properties.containsKey(Environment.TRANSACTION_MANAGER_STRATEGY)) __log.warn("Ignoring user-specified Hibernate property: " + Environment.TRANSACTION_MANAGER_STRATEGY); if (properties.containsKey(Environment.SESSION_FACTORY_NAME)) __log.warn("Ignoring user-specified Hibernate property: " + Environment.SESSION_FACTORY_NAME); properties.put(Environment.CONNECTION_PROVIDER, DataSourceConnectionProvider.class.getName()); properties.put(Environment.TRANSACTION_MANAGER_STRATEGY, HibernateTransactionManagerLookup.class.getName()); properties.put(Environment.TRANSACTION_STRATEGY, "org.hibernate.transaction.JTATransactionFactory"); properties.put(Environment.CURRENT_SESSION_CONTEXT_CLASS, "jta"); // Isolation levels override; when you use a ConnectionProvider, this has no effect String level = System.getProperty("ode.connection.isolation", "2"); properties.put(Environment.ISOLATION, level); if (__log.isDebugEnabled()) { Enumeration<?> names = properties.propertyNames(); __log.debug("Properties passed to Hibernate:"); while (names.hasMoreElements()) { String name = (String) names.nextElement(); __log.debug(name + "=" + properties.getProperty(name)); } } _sessionManager = createSessionManager(properties, _ds, _tm); }
From source file:org.xmlactions.action.config.ExecContext.java
private Map<String, Object> convertPropertiesToMap(Properties props) { Map<String, Object> map = new HashMap<String, Object>(); for (Object key : props.keySet()) { map.put((String) key, props.get(key)); }/*www . jav a2s. c om*/ return map; }
From source file:it.greenvulcano.gvesb.api.controller.GvConfigurationControllerRest.java
@GET @Path("/systemproperty") @Produces(MediaType.APPLICATION_JSON)/*w w w . j a va2s.co m*/ @RolesAllowed({ Authority.ADMINISTRATOR, Authority.MANAGER }) public Response getSystemProperties() { Response response = null; Properties systemProperties = System.getProperties(); JSONObject configJson = new JSONObject(); systemProperties.keySet().stream().map(Object::toString) .forEach(k -> configJson.put(k, systemProperties.getProperty(k))); response = Response.ok(configJson.toString()).build(); return response; }
From source file:net.ymate.platform.configuration.provider.impl.JConfigProvider.java
public Map<String, String> getMap(String keyHead) { Map<String, String> map = new HashMap<String, String>(); if (StringUtils.isBlank(keyHead)) { return map; }/*w w w . ja va 2s .c om*/ String[] keys = StringUtils.split(keyHead, IConfiguration.CFG_KEY_SEPERATE); int keysSize = keys.length; Properties properties = null; // "|"0?? if (keysSize == 1) { properties = config.getProperties(); } else if (keysSize == 2) { properties = config.getProperties(keys[0]); } int headLength = keysSize == 1 ? keys[0].length() : keys[1].length(); if (properties != null && !properties.isEmpty()) { for (Object name : properties.keySet()) { if (name != null && name.toString().startsWith(keysSize == 1 ? keys[0] : keys[1])) { String key = name.toString(); Object value = properties.get(name); map.put(key.substring(headLength), value.toString()); } } } return map; }
From source file:org.apache.openjpa.jdbc.schema.DBCPDriverDataSource.java
/** * Merge the passed in properties with a copy of the existing _connectionProperties * @param props/*w w w . j ava2s.c o m*/ * @return Merged properties */ private Properties mergeConnectionProperties(final Properties props) { Properties mergedProps = new Properties(); mergedProps.putAll(getConnectionProperties()); // need to map "user" to "username" for Commons DBCP String uid = removeProperty(mergedProps, "user"); if (uid != null) { mergedProps.setProperty("username", uid); } // now, merge in any passed in properties if (props != null && !props.isEmpty()) { for (Iterator<Object> itr = props.keySet().iterator(); itr.hasNext();) { String key = (String) itr.next(); String value = props.getProperty(key); // need to map "user" to "username" for Commons DBCP if ("user".equalsIgnoreCase(key)) { key = "username"; } // case-insensitive search for existing key String existingKey = hasKey(mergedProps, key); if (existingKey != null) { // update existing entry mergedProps.setProperty(existingKey, value); } else { // add property to the merged set mergedProps.setProperty(key, value); } } } return mergedProps; }