Updates string properties.
@param propertiesContent the properties file as a string
@param keyToNewValue the keys to update with their new values
@return a non-null string
484047
public static String updateProperties( String propertiesContent, Map<String,String> keyToNewValue ) {

		for( Map.Entry<String,String> entry : keyToNewValue.entrySet()) {
			propertiesContent = propertiesContent.replaceFirst(
					"(?mi)^\\s*" + entry.getKey() + "\\s*[:=][^\n]*$",
					entry.getKey() + " = " + entry.getValue());
		}

		return propertiesContent;
	}
559879
private void processKeyValue(Map<ConfigurationKey, Object> properties, String stringKey, Object value) {
        processKeyValue(properties, stringKey, value, false);
    }
673877
@Override
  protected void copyToNew(int position, int newPosition) {
    newAdvancedValueSumList[newPosition] = advancedValueSumList[position];
    newAdvancedValueSumOfLogsList[newPosition] = advancedValueSumOfLogsList[position];
    newAdvancedValueSumOfSquaresList[newPosition] = advancedValueSumOfSquaresList[position];
    newAdvancedValueMinList[newPosition] = advancedValueMinList[position];
    newAdvancedValueMaxList[newPosition] = advancedValueMaxList[position];
    newAdvancedValueNList[newPosition] = advancedValueNList[position];
  }
1108773
public Map<String,Object> addPropertiesFile(Map<String,Object> properties)
    {
        String propertiesPath = (String)properties.get("webStartPropertiesFile");
        if (propertiesPath == null)
            return properties;
        if (propertiesPath.startsWith("/"))
            propertiesPath = propertiesPath.substring(1);
        URL url = null;
        try {
            url = ClassServiceUtility.getClassService().getResourceURL(propertiesPath, null, null, this.getClass().getClassLoader());
        } catch (RuntimeException e) {
            e.printStackTrace();    // ???
        }           
        Reader inStream = null;
        if (url != null)
        {
            try {
                inStream = new InputStreamReader(url.openStream());
            } catch (Exception e) {
                // Not found
            }
        }
        if (inStream != null)
        {
            try {
                // Todo may want to add cache info (using bundle lastModified).
                Properties cachedProperties = new Properties();
                cachedProperties.load(inStream);
                inStream.close();
                for (Object key : cachedProperties.keySet())
                {
                    properties.put(key.toString(), cachedProperties.get(key));
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return properties;
    }
701048
public KeyValueStoreUpdate update(String key, String value) {
		actions.add(new Update(key, value));
		return this;
	}
675908
public String encryptPropertyValue(String propertyValue) {
        byte[] bytes = cryptex.encryptString(key, propertyValue);
        String encryptedValue = Base64Utils.encode(bytes);
        return ENCRYPTED_NOTATION + encryptedValue;
    }
415836
@NonNull
  public static UpdateStart update(@Nullable String keyspace, @NonNull String table) {
    return update(
        keyspace == null ? null : CqlIdentifier.fromCql(keyspace), CqlIdentifier.fromCql(table));
  }
105346
public JavascriptVarBuilder appendProperty(final String propertyName, final String propertyValue, final boolean quoted) {
        next();
        sb.append(propertyName);
        sb.append(":");
        appendText(propertyValue, quoted);
        return this;
    }
824706
public static String getStringProperty(Properties properties, String key) {
        String property = properties.getProperty(key);
        return property != null && property.trim().isEmpty() ? null : property;
    }
835180
@Override
    public synchronized ChannelData updateChannelProperty(String channelName, Object propertyKey, Object propertyValue) throws ChannelException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "updateChannelProperty");
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "channelName=" + channelName + "propertyKey=" + propertyKey + ", propertyValue=" + propertyValue);
        }
        if (null == channelName) {
            throw new InvalidChannelNameException("Input channel name is null");
        }
        if (null == propertyKey || null == propertyValue) {
            throw new ChannelException("Null property key or value found.");
        }

        // Find the existing channel config
        ChannelDataImpl channelData = (ChannelDataImpl) channelDataMap.get(channelName);
        if (null == channelData) {
            throw new InvalidChannelNameException("Unable to find input channel, " + channelName);
        }

        // Update the property bag. Note this may throw an exception.
        channelData.setProperty(propertyKey, propertyValue);
        // Update each running channel that is using this parent channel data
        // object.
        updateRunningChannels(channelData);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "updateChannelProperty");
        }
        return channelData;
    }
791526
@PublicEvolving
	public void setString(ConfigOption<String> key, String value) {
		setValueInternal(key.key(), value);
	}
1173090
protected void replaceValue(Map<String, Object> content, String key, Object value) {
		if (content.containsKey(key) && value != null) {
			content.put(key, value);
		}
	}
163636
private void addToStringMethod(boolean keyOnly) {
        TypeDesc stringBuilder = TypeDesc.forClass(StringBuilder.class);

        Modifiers modifiers = Modifiers.PUBLIC.toSynchronized(true);
        MethodInfo mi = addMethodIfNotFinal(modifiers,
                                            keyOnly ?
                                            TO_STRING_KEY_ONLY_METHOD_NAME :
                                            TO_STRING_METHOD_NAME,
                                            TypeDesc.STRING, null);

        if (mi == null) {
            return;
        }

        CodeBuilder b = new CodeBuilder(mi);
        b.newObject(stringBuilder);
        b.dup();
        b.invokeConstructor(stringBuilder, null);
        b.loadConstant(mStorableType.getName());
        invokeAppend(b, TypeDesc.STRING);

        String detail;
        if (keyOnly) {
            detail = " (key only) {";
        } else {
            detail = " {";
        }

        b.loadConstant(detail);
        invokeAppend(b, TypeDesc.STRING);

        // First pass, just print primary keys.

        LocalVariable commaCountVar = b.createLocalVariable(null, TypeDesc.INT);
        b.loadConstant(-1);
        b.storeLocal(commaCountVar);

        for (StorableProperty property : mInfo.getPrimaryKeyProperties().values()) {
            addPropertyAppendCall(b, property, commaCountVar);
        }

        // Second pass, print non-primary keys.

        if (!keyOnly) {
            for (StorableProperty property : mAllProperties.values()) {
                // Don't print any derived or join properties since they may throw an exception.
                if (!property.isPrimaryKeyMember() &&
                    (!property.isDerived()) && (!property.isJoin()))
                {
                    addPropertyAppendCall(b, property, commaCountVar);
                }
            }
        }

        b.loadConstant('}');
        invokeAppend(b, TypeDesc.CHAR);

        // For key string, also show all the alternate keys. This makes the
        // FetchNoneException message more helpful.
        if (keyOnly) {
            int altKeyCount = mInfo.getAlternateKeyCount();
            for (int i=0; i<altKeyCount; i++) {
                b.loadConstant(-1);
                b.storeLocal(commaCountVar);

                b.loadConstant(", {");
                invokeAppend(b, TypeDesc.STRING);

                StorableKey<S> key = mInfo.getAlternateKey(i);

                for (OrderedProperty<S> op : key.getProperties()) {
                    StorableProperty<S> property = op.getChainedProperty().getPrimeProperty();
                    addPropertyAppendCall(b, property, commaCountVar);
                }

                b.loadConstant('}');
                invokeAppend(b, TypeDesc.CHAR);
            }
        }

        b.invokeVirtual(stringBuilder, TO_STRING_METHOD_NAME, TypeDesc.STRING, null);
        b.returnValue(TypeDesc.STRING);
    }
387104
@Override
	public void updateProperties( Dictionary<?,?> properties ) {

		// Ignore iPojo properties
		final List<String> propertiesToSkip = Arrays.asList(
				"component",
				"felix.fileinstall.filename" );

		Map<String,String> map = new HashMap<> ();
		for( Enumeration<?> en = properties.keys(); en.hasMoreElements(); ) {

			Object key = en.nextElement();
			String keyAsString = String.valueOf( key );
			if( propertiesToSkip.contains( keyAsString ))
				continue;

			// "null" are not acceptable values in dictionaries
			// (OSGi often use Hash tables)
			Object value = properties.get( key );
			map.put( keyAsString, String.valueOf( value ));
		}

		this.cache.clear();
		this.cache.putAll( map );
		this.logger.fine( "Preferences were updated in bulk mode." );
	}
1167230
public Object[][] createNameValueTree(Object mxString[][], Map<String, Object> properties)
    {
        mxString = super.createNameValueTree(mxString, properties);
        if (properties != null)
            mxString = this.addNameValue(mxString, BOOKMARK, properties.get(BOOKMARK));
        return mxString;
    }
1122551
public MemberConfig setProperty(String key, String value) {
    this.properties.put(key, value);
    return this;
  }
844738
public static Update update(String key, Object value) {
    return new Update().set(key, value);
  }