public boolean setProperty(String name, String value) {
        if (name == null) {
            return false;
        }
        if (!StringEscapeUtils.escapeXml10(name).equals(name)) {
            throw new IllegalArgumentException("Property name cannot contain XML entities.");
        }
        if (value == null) {
            value = "";
        }

        String[] propName = parsePropertyName(name);
        final boolean saved;

        final Lock writeLock = readWriteLock.writeLock();
        writeLock.lock();
        try {
            // Set cache correctly with prop name and value.
            propertyCache.put(name, Optional.of(value));

            // Search for this property by traversing down the XML hierarchy.
            Element element = document.getRootElement();
            for (String aPropName : propName) {
                // If we don't find this part of the property in the XML hierarchy
                // we add it as a new node
                if (element.element(aPropName) == null) {
                    element.addElement(aPropName);
                }
                element = element.element(aPropName);
            }
            // Set the value of the property in this node.
            if (value.startsWith("<![CDATA[")) {
                Iterator<Node> it = element.nodeIterator();
                while (it.hasNext()) {
                    Node node = it.next();
                    if (node instanceof CDATA) {
                        element.remove(node);
                        break;
                    }
                }
                element.addCDATA(value.substring(9, value.length() - 3));
            } else {
                String propValue = value;
                // check to see if the property is marked as encrypted
                if (JiveGlobals.isXMLPropertyEncrypted(name)) {
                    propValue = JiveGlobals.getPropertyEncryptor(true).encrypt(value);
                    element.addAttribute(ENCRYPTED_ATTRIBUTE, "true");
                }
                element.setText(propValue);
            }
            // Write the XML properties to disk
            saved = saveProperties();
        } finally {
            writeLock.unlock();
        }

        // Generate event.
        Map<String, Object> params = new HashMap<>();
        params.put("value", value);
        PropertyEventDispatcher.dispatchEvent(name, PropertyEventDispatcher.EventType.xml_property_set, params);
        return saved;
    }
Sets the value of the specified property. If the property doesn't
currently exist, it will be automatically created.

@param name  the name of the property to set.
@param value the new value for the property.
@return {@code true} if the property was correctly saved to file, otherwise {@code false}
xmppserver/src/main/java/org/jivesoftware/util/XMLProperties.java