@Override
public Node connect(String connectionIdentifier, Map<ConnectionConstants, String> params) {
if (connectionService == null) return null;
- return connectionService.connect(connectionIdentifier, params);
+ Node node = connectionService.connect(connectionIdentifier, params);
+ AbstractScheme scheme = schemes.get(activeScheme);
+ if (scheme != null && node != null) scheme.addNode(node);
+ return node;
}
@Override
public Node connect(String type, String connectionIdentifier, Map<ConnectionConstants, String> params) {
if (connectionService == null) return null;
- return connectionService.connect(type, connectionIdentifier, params);
+ Node node = connectionService.connect(connectionIdentifier, params);
+ AbstractScheme scheme = schemes.get(activeScheme);
+ if (scheme != null && node != null) scheme.addNode(node);
+ return node;
}
@Override
public Status disconnect (Node node) {
+ if (node == null) return new Status(StatusCode.BADREQUEST);
if (connectionService == null) return new Status(StatusCode.NOSERVICE);
- return connectionService.disconnect(node);
+ Status status = connectionService.disconnect(node);
+ if (status.isSuccess()) {
+ AbstractScheme scheme = schemes.get(activeScheme);
+ if (scheme != null) scheme.removeNode(node);
+ }
+ return status;
}
@Override