use of org.apache.activemq.artemis.api.core.management.ClusterConnectionControl in project wildfly by wildfly.
the class ClusterConnectionControlHandler method handleReadAttribute.
@Override
protected void handleReadAttribute(String attributeName, OperationContext context, ModelNode operation) throws OperationFailedException {
if (ClusterConnectionDefinition.NODE_ID.getName().equals(attributeName)) {
ClusterConnectionControl control = getActiveMQComponentControl(context, operation, false);
context.getResult().set(control.getNodeID());
} else if (ClusterConnectionDefinition.TOPOLOGY.getName().equals(attributeName)) {
ClusterConnectionControl control = getActiveMQComponentControl(context, operation, false);
context.getResult().set(control.getTopology());
} else {
unsupportedAttribute(attributeName);
}
}
use of org.apache.activemq.artemis.api.core.management.ClusterConnectionControl in project wildfly by wildfly.
the class ClusterConnectionControlHandler method handleOperation.
@Override
protected Object handleOperation(String operationName, OperationContext context, ModelNode operation) throws OperationFailedException {
if (ClusterConnectionDefinition.GET_NODES.equals(operationName)) {
ClusterConnectionControl control = getActiveMQComponentControl(context, operation, false);
try {
Map<String, String> nodes = control.getNodes();
final ModelNode result = context.getResult();
result.setEmptyObject();
for (Map.Entry<String, String> entry : nodes.entrySet()) {
result.get(entry.getKey()).set(entry.getValue());
}
} catch (Exception e) {
context.getFailureDescription().set(e.getLocalizedMessage());
}
} else {
unsupportedOperation(operationName);
}
return null;
}
Aggregations