}
public void onCreateConnection(ConnectionDefinition connectionDefinition) {
closeDialoge();
ModelNode operation = new ModelNode();
operation.get(ADDRESS).setEmptyList();
operation.get(OP).set(COMPOSITE);
List<ModelNode> steps = new ArrayList<ModelNode>();
ModelNode createConnectionOp = connectionAdapter.fromEntity(connectionDefinition);
createConnectionOp.get(OP).set(ADD);
ModelNode addressModel = connectionMetaData.getAddress().asResource(
Baseadress.get(),
selectedAdapter,
connectionDefinition.getJndiName());
createConnectionOp.get(ADDRESS).set(addressModel.get(ADDRESS));
steps.add(createConnectionOp);
// --
if(connectionDefinition.getProperties()!=null && !connectionDefinition.getProperties().isEmpty())
{
ModelNode createPropOp = new ModelNode();
createPropOp.get(OP).set(ADD);
createPropOp.get(ADDRESS).set(addressModel.get(ADDRESS));
for(PropertyRecord prop : connectionDefinition.getProperties())
{
createPropOp.get(ADDRESS).add("config-properties", prop.getKey());
createPropOp.get(VALUE).set(prop.getValue());
}
steps.add(createPropOp);
}
operation.get(STEPS).set(steps);
dispatcher.execute(new DMRAction(operation), new SimpleCallback<DMRResponse>() {
@Override
public void onSuccess(DMRResponse result) {
ModelNode response = result.get();
if(response.isFailure())
Console.error(Console.MESSAGES.addingFailed("Connection Definition"), response.getFailureDescription());
else
Console.info(Console.MESSAGES.added("Connection Definition"));
loadAdapter(true);
}