for(ModelNode item : payload)
{
// returned as type property (key=ds name)
Property property = item.asProperty();
ModelNode ds = property.getValue().asObject();
String name = property.getName();
//System.out.println(ds.toJSONString(false));
try {
XADataSource model = factory.xaDataSource().as();
model.setName(name);
model.setJndiName(ds.get("jndi-name").asString());
model.setDriverName(ds.get("driver-name").asString());
model.setEnabled(ds.get("enabled").asBoolean());
model.setUsername(ds.get("user-name").asString());
model.setPassword(ds.get("password").asString());
model.setPoolName(ds.get("pool-name").asString());
List<PropertyRecord> xaProperties = Collections.EMPTY_LIST;
// System properties
if(ds.hasDefined("xa-data-source-properties"))
{
List<ModelNode> properties = ds.get("xa-data-source-properties").asList();
xaProperties = new ArrayList<PropertyRecord>(properties.size());
for(ModelNode xaProp : properties)
{
Property p = xaProp.asProperty();
PropertyRecord propRecord = factory.property().as();
propRecord.setKey(p.getName());
ModelNode value = p.getValue();
propRecord.setValue(value.asString());
xaProperties.add(propRecord);
}
}