}
//ManagedConnectionFactories are extremely restricted as to the attribute types.
private void setDynamicAttributes(GBeanMBean gBean, ConfigPropertyType[] configProperties, GerConfigPropertySettingType[] configPropertySettings) throws DeploymentException, ReflectionException, MBeanException, InvalidAttributeValueException, AttributeNotFoundException {
for (int i = 0; i < configProperties.length; i++) {
ConfigPropertyType configProperty = configProperties[i];
if (configProperty.getConfigPropertyType() == null) {
continue;
}
Object value;
try {
PropertyEditor editor = PropertyEditors.findEditor(configProperty.getConfigPropertyType().getStringValue());
String valueString = null;
if (editor != null) {
//look for explicit value setting
for (int j = 0; j < configPropertySettings.length; j++) {
GerConfigPropertySettingType configPropertySetting = configPropertySettings[j];
if (configPropertySetting.getName().equals(configProperty.getConfigPropertyName().getStringValue())) {
valueString = configPropertySetting.getStringValue();
break;
}
}
//look for default value
if (valueString == null) {
if (configProperty.getConfigPropertyValue() != null) {
valueString = configProperty.getConfigPropertyValue().getStringValue();
}
}
if (valueString != null) {
editor.setAsText(valueString);
value = editor.getValue();
gBean.setAttribute(configProperty.getConfigPropertyName().getStringValue(), value);
}
} else {
throw new DeploymentException("No property editor for type: " + configProperty.getConfigPropertyType().getStringValue());
}
} catch (ClassNotFoundException e) {
throw new DeploymentException("Could not load attribute class: attribute: " + configProperty.getConfigPropertyName().getStringValue() + ", type: " + configProperty.getConfigPropertyType().getStringValue(), e);
}
}
}