this.selectedAdapter = request.getParameter("name", null);
}
private void loadAdapter(final boolean refreshDetail) {
ModelNode operation = new ModelNode();
operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION);
operation.get(ADDRESS).set(Baseadress.get());
operation.get(ADDRESS).add("subsystem", "resource-adapters");
operation.get(CHILD_TYPE).set("resource-adapter");
operation.get(RECURSIVE).set(true);
dispatcher.execute(new DMRAction(operation), new SimpleCallback<DMRResponse>() {
@Override
public void onSuccess(DMRResponse response) {
ModelNode result = response.get();
List<Property> children = result.get(RESULT).asPropertyList();
List<ResourceAdapter> resourceAdapters = new ArrayList<ResourceAdapter>(children.size());
for(Property child : children)
{
ModelNode raModel = child.getValue();
ResourceAdapter resourceAdapter = adapter.fromDMR(raModel);
List<PropertyRecord> props = parseConfigProperties(raModel);
resourceAdapter.setProperties(props);
resourceAdapter.setConnectionDefinitions(new ArrayList<ConnectionDefinition>());
// connection definition
if(raModel.hasDefined("connection-definitions"))
{
List<Property> connections = raModel.get("connection-definitions").asPropertyList();
for(Property con : connections )
{
ModelNode connectionModel = con.getValue();
ConnectionDefinition connectionDefinition = connectionAdapter.fromDMR(connectionModel);
// config properties
List<PropertyRecord> connectionProps = parseConfigProperties(connectionModel);
connectionDefinition.setProperties(connectionProps);
// pool
PoolConfig poolConfig = poolAdapter.with(new KeyAssignment() {
@Override
public Object valueForKey(String key) {
//return connectionModel.get("");
return "";
}
}).fromDMR(connectionModel);
connectionDefinition.setPoolConfig(poolConfig);
resourceAdapter.getConnectionDefinitions().add(connectionDefinition);
}
}
// admin objects
if(raModel.hasDefined("admin-objects"))
{
List<Property> admins = raModel.get("admin-objects").asPropertyList();
List<AdminObject> adminEntities = new ArrayList<AdminObject>(admins.size());
for(Property admin : admins)
{
ModelNode adminModel = admin.getValue();
AdminObject adminObject = adminAdapter.fromDMR(adminModel);
adminObject.setName(admin.getName()); // just to make sure
List<PropertyRecord> adminConfig = parseConfigProperties(adminModel);
adminObject.setProperties(adminConfig);