// set attributes
for (Map.Entry<String, String> entry : getAttributes().entrySet()) {
String attributeName = entry.getKey();
GAttributeInfo attributeInfo = gbeanInfo.getAttribute(attributeName);
if (attributeInfo == null) {
throw new InvalidConfigException("No attribute: " + attributeName + " for gbean: " + data.getAbstractName());
}
String valueString = entry.getValue();
Object value = getValue(attributeInfo, valueString, configName, gbeanName, classLoader);
data.setAttribute(attributeName, value);
//encrypt any encryptable attributes set to plaintext by users
if (valueString != null) {
if (valueString.equals(attributeInfo.getEncryptedSetting().decrypt(valueString))) {
String encrypted = (String) attributeInfo.getEncryptedSetting().encrypt(valueString);
if (!encrypted.equals(valueString)) {
entry.setValue(encrypted);
}
}
}
}
//Clear attributes
for (String attribute : getClearAttributes()) {
data.clearAttribute(attribute);
}
//Null attributes
for (String attribute : getNullAttributes()) {
data.setAttribute(attribute, null);
}
// set references
for (Map.Entry<String, ReferencePatterns> entry : getReferences().entrySet()) {
String referenceName = entry.getKey();
GReferenceInfo referenceInfo = gbeanInfo.getReference(referenceName);
if (referenceInfo == null) {
throw new InvalidConfigException("No reference: " + referenceName + " for gbean: " + data.getAbstractName());
}
ReferencePatterns referencePatterns = entry.getValue();
data.setReferencePatterns(referenceName, referencePatterns);