List of usage examples for java.util Properties remove
@Override public synchronized Object remove(Object key)
From source file:edu.ku.brc.specify.prefs.FormattingPrefsPanel.java
@SuppressWarnings("unchecked") //$NON-NLS-1$ @Override/*from w w w.j av a 2 s . c o m*/ public void getChangedFields(final Properties changeHash) { super.getChangedFields(changeHash); if (disciplineCBX.isChanged()) { Pair<String, ImageIcon> item = (Pair<String, ImageIcon>) disciplineCBX.getComboBox().getSelectedItem(); if (item != null) { changeHash.put(getDisciplineImageName(), item.first); //$NON-NLS-1$ } } if (UIHelper.isMacOS_10_5_X()) { changeHash.remove("fontSizes"); //$NON-NLS-1$ changeHash.remove("fontNames"); changeHash.remove("controlSizes"); //$NON-NLS-1$ } else { changeHash.remove("controlSizes"); //$NON-NLS-1$ } }
From source file:org.apache.geode.cache.lucene.LuceneSearchWithRollingUpgradeDUnit.java
public Properties getSystemProperties() { Properties props = DistributedTestUtils.getAllDistributedSystemProperties(new Properties()); props.remove("disable-auto-reconnect"); props.remove(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME); props.remove(DistributionConfig.LOCK_MEMORY_NAME); return props; }
From source file:com.streamsets.datacollector.cluster.ClusterProviderImpl.java
private void rewriteProperties(File sdcPropertiesFile, Map<String, String> sourceConfigs, Map<String, String> sourceInfo, String clusterToken, Optional<String> mesosURL) throws IOException { InputStream sdcInStream = null; OutputStream sdcOutStream = null; Properties sdcProperties = new Properties(); try {//from www.j a v a 2s. c o m sdcInStream = new FileInputStream(sdcPropertiesFile); sdcProperties.load(sdcInStream); sdcProperties.remove(Configuration.CONFIG_INCLUDES); sdcProperties.setProperty(WebServerTask.HTTP_PORT_KEY, "0"); sdcProperties.setProperty(WebServerTask.HTTPS_PORT_KEY, "-1"); sdcProperties.setProperty(RuntimeModule.PIPELINE_EXECUTION_MODE_KEY, ExecutionMode.SLAVE.name()); sdcProperties.setProperty(WebServerTask.REALM_FILE_PERMISSION_CHECK, "false"); sdcProperties.remove(RuntimeModule.DATA_COLLECTOR_BASE_HTTP_URL); if (runtimeInfo != null) { String id = String.valueOf(runtimeInfo.getId()); sdcProperties.setProperty(Constants.SDC_ID, id); sdcProperties.setProperty(Constants.PIPELINE_CLUSTER_TOKEN_KEY, clusterToken); sdcProperties.setProperty(Constants.CALLBACK_SERVER_URL_KEY, runtimeInfo.getClusterCallbackURL()); } if (mesosURL.isPresent()) { sdcProperties.setProperty(Constants.MESOS_JAR_URL, mesosURL.get()); } addClusterConfigs(sourceConfigs, sdcProperties); addClusterConfigs(sourceInfo, sdcProperties); sdcOutStream = new FileOutputStream(sdcPropertiesFile); sdcProperties.store(sdcOutStream, null); LOG.debug("sourceConfigs = {}", sourceConfigs); LOG.debug("sourceInfo = {}", sourceInfo); LOG.debug("sdcProperties = {}", sdcProperties); sdcOutStream.flush(); sdcOutStream.close(); } finally { if (sdcInStream != null) { IOUtils.closeQuietly(sdcInStream); } if (sdcOutStream != null) { IOUtils.closeQuietly(sdcOutStream); } } }
From source file:org.kuali.rice.krad.web.service.impl.QueryControllerServiceImpl.java
/** * Inspects the given request and action parameters on the form to build a URL to the requested * lookup view./*from w ww.ja va 2 s . co m*/ * * <p>First the data object class for the lookup view is found from the action parameters. A call * is then made to check if there is a module service that handles that class, and if so the URL from the * module service is used. If not, the base url is and other lookup URL parameters are created from the * action parameters and form.</p> * * {@inheritDoc} * * @see QueryControllerServiceImpl#getLookupDataObjectClass(java.util.Properties) * @see QueryControllerServiceImpl#getLookupUrlFromModuleService(java.lang.Class<?>, java.util.Properties) * @see QueryControllerServiceImpl#buildLookupUrlParameters(org.kuali.rice.krad.web.form.UifFormBase, * javax.servlet.http.HttpServletRequest, java.lang.Class<?>, java.util.Properties) */ @Override public ModelAndView performLookup(UifFormBase form) { Properties urlParameters = form.getActionParametersAsProperties(); Class<?> lookupDataObjectClass = getLookupDataObjectClass(urlParameters); if (lookupDataObjectClass == null) { throw new RuntimeException("Lookup data object class not found for lookup call"); } // Force skip of dirty check urlParameters.put(UifParameters.PERFORM_DIRTY_CHECK, "false"); // first give module service the opportunity to build the lookup URL String baseLookupUrl = getLookupUrlFromModuleService(lookupDataObjectClass, urlParameters); if (StringUtils.isNotBlank(baseLookupUrl)) { // url fully built by module service urlParameters = new Properties(); } else { baseLookupUrl = urlParameters.getProperty(UifParameters.BASE_LOOKUP_URL); urlParameters.remove(UifParameters.BASE_LOOKUP_URL); buildLookupUrlParameters(form, form.getRequest(), lookupDataObjectClass, urlParameters); } return getModelAndViewService().performRedirect(form, baseLookupUrl, urlParameters); }
From source file:fr.fastconnect.factory.tibco.bw.maven.packaging.MergePropertiesMojo.java
/** * <p>//from w w w . java 2s . com * This expands wild cards properties.<br /><br /> * Both wildcard expressions and expressions to expand are present in the * same properties object.<br /><br /> * <i>Example</i> * <ul> * <li><b>property with wildcard</b>: /root/element[*]/key=new_value</li> * <li><b>property matching</b>: /root/element[my_name]/key=old_value</li> * </ul> * will expand to:<br /> * <ul> * <li><b>property after expansion</b>: * /root/element[my_name]/key=new_value</li> * </ul> * </p> * * @param properties, the properties object with wildcard expressions and * expressions to expand * @return properties with expanded expressions, but without wildcard * expressions */ protected Properties expandWildCards(Properties properties) { Properties propertiesWithWildCards = new Properties() { // sorted properties private static final long serialVersionUID = 7793482336210629858L; @Override public synchronized Enumeration<Object> keys() { return Collections.enumeration(new TreeSet<Object>(super.keySet())); } }; String key; // retrieve the keys with WildCards Enumeration<Object> e = properties.keys(); while (e.hasMoreElements()) { key = (String) e.nextElement(); if (isAWildCard(key)) { propertiesWithWildCards.setProperty(key, properties.getProperty(key)); properties.remove(key); } } // try to replace the values of other keys matching the keys with WildCards Enumeration<Object> w = propertiesWithWildCards.keys(); while (w.hasMoreElements()) { String keyWithWildCards = (String) w.nextElement(); String regex = wildcardToRegex(keyWithWildCards); String ignoreWildcardInVariablesPattern = "(.*)variables\\\\\\[(.*)\\\\\\]\\/variable\\\\\\[(.*)\\\\\\](.*)"; Pattern p = Pattern.compile(ignoreWildcardInVariablesPattern); Matcher m = p.matcher(regex); if (m.matches()) { String variables = m.group(2); String variable = m.group(3); variables = variables.replace(".*", "\\*"); variable = variable.replace(".*", "\\*"); regex = m.group(1) + "variables\\[" + variables + "\\]/variable\\[" + variable + "\\]" + m.group(4); } Boolean found = false; e = properties.keys(); while (e.hasMoreElements()) { key = (String) e.nextElement(); if (Pattern.matches(regex, key)) { found = true; String value = (String) propertiesWithWildCards.getProperty(keyWithWildCards); properties.setProperty(key, value); } } // not found, we put back the expression with wild cards in the original list (false positive) // this way the wildcard can still be used in a next pass and will be removed at the end by AbstractPackagingMojo.removeWildCards if (!found) { properties.setProperty(keyWithWildCards, propertiesWithWildCards.getProperty(keyWithWildCards)); } } return properties; }
From source file:org.kuali.rice.krad.web.service.impl.QueryControllerServiceImpl.java
/** * If lookup criteria parameters were configured, pulls the values for those parameters from the form and * passes as values to pre-populate the lookup view criteria. * * @param form form instance containing the model data * @param request http request object being handled * @param lookupDataObjectClass data object class the lookup URL is being built for * @param urlParameters properties instance holding the lookup URL parameters *///from w ww .j av a2 s . c o m protected void buildLookupCriteriaParameters(UifFormBase form, HttpServletRequest request, Class<?> lookupDataObjectClass, Properties urlParameters) { String lookupParameterString = urlParameters.getProperty(UifParameters.LOOKUP_PARAMETERS); if (StringUtils.isBlank(lookupParameterString)) { return; } Map<String, String> lookupParameterFields = KRADUtils.getMapFromParameterString(lookupParameterString); for (Map.Entry<String, String> lookupParameter : lookupParameterFields.entrySet()) { String lookupParameterValue = LookupUtils.retrieveLookupParameterValue(form, request, lookupDataObjectClass, lookupParameter.getValue(), lookupParameter.getKey()); if (StringUtils.isNotBlank(lookupParameterValue)) { urlParameters.setProperty( UifPropertyPaths.LOOKUP_CRITERIA + "['" + lookupParameter.getValue() + "']", lookupParameterValue); } } urlParameters.remove(UifParameters.LOOKUP_PARAMETERS); }
From source file:org.apache.solr.update.InvenioKeepRecidUpdated.java
private Properties loadProperties(SolrParams params) throws FileNotFoundException, IOException { Properties prop = new Properties(); File f = getPropertyFile();/*from w ww .ja va 2s . c om*/ if (f.exists()) { FileInputStream input = new FileInputStream(f); prop.load(input); input.close(); } String prop_recid = null; if (prop.containsKey(LAST_RECID)) { prop_recid = (String) prop.remove(LAST_RECID); } String prop_mod_date = null; if (prop.containsKey(LAST_UPDATE)) { prop_mod_date = (String) prop.remove(LAST_UPDATE); } boolean userParam = false; // parameters in url have always precedence (if both set // it is up to the python to figure out who has precedence if (params.getInt(LAST_RECID) != null) { prop.put(LAST_RECID, params.get(LAST_RECID)); userParam = true; } if (params.get(LAST_UPDATE, null) != null) { prop.put(LAST_UPDATE, params.get(LAST_UPDATE)); userParam = true; } if (!userParam) { // when no user params were supplied, prefer the mod_date over recid if (prop_mod_date != null) { prop.put(LAST_UPDATE, prop_mod_date); } else if (prop_recid != null) { prop.put(LAST_RECID, prop_recid); } } if (params.get(PARAM_BATCHSIZE, null) != null) { int bs = params.getInt(PARAM_BATCHSIZE); if (bs > max_batchsize) { prop.put(PARAM_BATCHSIZE, max_batchsize); } else { prop.put(PARAM_BATCHSIZE, bs); } } if (params.get(PARAM_MAXIMPORT, null) != null) { int mi = params.getInt(PARAM_MAXIMPORT); if (mi > max_maximport) { prop.put(PARAM_MAXIMPORT, max_maximport); } else { prop.put(PARAM_MAXIMPORT, mi); } } prop.put(PARAM_TOKEN, params.get(PARAM_TOKEN, "")); return prop; }
From source file:com.mirth.connect.model.util.ImportConverter3_0_0.java
private static void convertDataPrunerProperties(DonkeyElement propertiesElement) { Properties properties = readPropertiesElement(propertiesElement); properties.remove("allowBatchPruning"); properties.setProperty("archiveEnabled", "false"); writePropertiesElement(propertiesElement, properties); }
From source file:com.googlecode.fascinator.transformer.jsonVelocity.JsonVelocityTransformer.java
private boolean okToProcess(DigitalObject in, JsonSimple itemConfig) throws TransformerException { if (itemConfig.getBoolean(false, "checkForTFMETAProperty")) { String propertyName = itemConfig.getString(null, "TFMETAPropertyName"); String propertyValue = itemConfig.getString(null, "TFMETAPropertyValue"); if (propertyName != null && propertyValue != null) { Properties tfMetadata; try { tfMetadata = in.getMetadata(); } catch (StorageException e) { throw new TransformerException(e); }/* w w w . j a v a2 s. co m*/ if (!propertyValue.equals(tfMetadata.getProperty(propertyName))) { return false; } if (itemConfig.getBoolean(false, "clearPropertyOnTransform")) { ByteArrayInputStream input; try { tfMetadata.remove(propertyName); ByteArrayOutputStream output = new ByteArrayOutputStream(); tfMetadata.store(output, null); input = new ByteArrayInputStream(output.toByteArray()); StorageUtils.createOrUpdatePayload(in, "TF-OBJ-META", input); } catch (Exception e) { throw new TransformerException(e); } } } } return true; }
From source file:com.mirth.connect.model.util.ImportConverter.java
/** Convert http connector and destination settings */ private static void convertHttpConnectorFor2_0(Document document, Element connectorRoot) throws Exception { // convert HTTP Listener and HTTP writer to the new formats Node transportNode = getConnectorTransportNode(connectorRoot); String transportNameText = transportNode.getTextContent(); String attribute = ""; String value = ""; Element propertiesElement = getPropertiesElement(connectorRoot); // Default Properties Map<String, String> propertyDefaults = new HashMap<String, String>(); // Properties to be added if missing, or reset if present Map<String, String> propertyChanges = new HashMap<String, String>(); // logic to deal with HTTP listener settings if (transportNameText.equals("HTTP Listener") || transportNameText.equals("HTTPS Listener")) { NodeList properties = connectorRoot.getElementsByTagName("property"); // set defaults propertyDefaults.put("DataType", "HTTP Listener"); propertyDefaults.put("host", "0.0.0.0"); propertyDefaults.put("port", "80"); propertyDefaults.put("receiverResponse", "None"); propertyDefaults.put("receiverBodyOnly", "1"); propertyDefaults.put("HTTP_RESPONSE_CONTENT_TYPE", "text/plain"); // rename properties for (int i = 0; i < properties.getLength(); i++) { // get the current attribute and current value attribute = properties.item(i).getAttributes().item(0).getTextContent(); value = properties.item(i).getTextContent(); // Now rename attributes if (attribute.equals("responseValue")) { propertyChanges.put("receiverResponse", value); }/*from w ww. j ava 2s. co m*/ if (attribute.equals("appendPayload")) { // The old property value needs to be flipped // If appendPayload was 1, set bodyOnly to 0 // If appendPayload was 0 or null, set bodyOnly to 1 propertyChanges.put("receiverBodyOnly", ("1".equals(value) ? "0" : "1")); } } // set changes propertyChanges.put("host", "0.0.0.0"); propertyChanges.put("DataType", "HTTP Listener"); // set new name of transport node transportNode.setTextContent("HTTP Listener"); // update properties updateProperties(document, propertiesElement, propertyDefaults, propertyChanges); } else if (transportNameText.equals("HTTP Sender") || transportNameText.equals("HTTPS Sender")) { // get properties NodeList properties = connectorRoot.getElementsByTagName("property"); // disable connector // document.getElementsByTagName("enabled").item(0).setTextContent("false"); // set defaults ObjectXMLSerializer serializer = ObjectXMLSerializer.getInstance(); propertyDefaults.put("DataType", "HTTP Sender"); propertyDefaults.put("host", ""); propertyDefaults.put("dispatcherMethod", "POST"); propertyDefaults.put("dispatcherHeaders", serializer.serialize(new Properties())); propertyDefaults.put("dispatcherParameters", serializer.serialize(new Properties())); propertyDefaults.put("dispatcherReplyChannelId", "sink"); propertyDefaults.put("dispatcherIncludeHeadersInResponse", "0"); propertyDefaults.put("dispatcherMultipart", "0"); propertyDefaults.put("dispatcherUseAuthentication", "0"); propertyDefaults.put("dispatcherAuthenticationType", "Basic"); propertyDefaults.put("dispatcherUsername", ""); propertyDefaults.put("dispatcherPassword", ""); propertyDefaults.put("dispatcherContent", ""); propertyDefaults.put("dispatcherContentType", "text/plain"); propertyDefaults.put("dispatcherCharset", "UTF-8"); propertyDefaults.put("dispatcherSocketTimeout", "30000"); // Add new queue property propertyDefaults.put("queuePollInterval", "200"); for (int i = 0; i < properties.getLength(); i++) { // get the current attribute and current value attribute = properties.item(i).getAttributes().item(0).getTextContent(); value = properties.item(i).getTextContent(); // Now rename attributes if (attribute.equals("method")) { propertyChanges.put("dispatcherMethod", value); } if (attribute.equals("requestVariables")) { // get the properties object for the variables Properties tempProps = serializer.deserialize(value, Properties.class); // set the content of 2.0 to be $payload of 1.8.2 propertyChanges.put("dispatcherContent", tempProps.getProperty("$payload", "")); // remove $payload as we dont need it tempProps.remove("$payload"); // set the params propertyChanges.put("dispatcherParameters", serializer.serialize(tempProps)); } if (attribute.equals("replyChannelId")) { propertyChanges.put("dispatcherReplyChannelId", value); } if (attribute.equals("headerVariables")) { propertyChanges.put("dispatcherHeaders", value); } if (attribute.equals("excludeHeaders")) { if (value.equals("0")) { propertyChanges.put("dispatcherIncludeHeadersInResponse", "1"); } else { propertyChanges.put("dispatcherIncludeHeadersInResponse", "0"); } } if (attribute.equals("multipart")) { propertyChanges.put("dispatcherMultipart", value); } } // If we have a post/put message and blank content, then disable String requestMethod = propertyChanges.get("dispatcherMethod") == null ? propertyDefaults.get("dispatcherMethod") : propertyChanges.get("dispatcherMethod"); String requestContent = propertyChanges.get("dispatcherContent") == null ? propertyDefaults.get("dispatcherContent") : propertyChanges.get("dispatcherContent"); if (requestContent.length() == 0 && (requestMethod.equalsIgnoreCase("POST") || requestMethod.equalsIgnoreCase("PUT"))) { document.getElementsByTagName("enabled").item(0).setTextContent("false"); } propertyChanges.put("DataType", "HTTP Sender"); // set new name of transport node transportNode.setTextContent("HTTP Sender"); updateProperties(document, propertiesElement, propertyDefaults, propertyChanges); } }