public void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {
validator.validate(operation);
final String attributeName = operation.require(ModelDescriptionConstants.NAME).asString();
JMSQueueControl control = getControl(context, operation);
if (control == null) {
ManagementUtil.rollbackOperationWithNoHandler(context, operation);
return;
}
if (MESSAGE_COUNT.equals(attributeName)) {
try {
context.getResult().set(control.getMessageCount());
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} else if (SCHEDULED_COUNT.equals(attributeName)) {
context.getResult().set(control.getScheduledCount());
} else if (CONSUMER_COUNT.equals(attributeName)) {
context.getResult().set(control.getConsumerCount());
} else if (DELIVERING_COUNT.equals(attributeName)) {
context.getResult().set(control.getDeliveringCount());
} else if (MESSAGES_ADDED.equals(attributeName)) {
context.getResult().set(control.getMessagesAdded());
} else if (QUEUE_ADDRESS.getName().equals(attributeName)) {
context.getResult().set(control.getAddress());
} else if (EXPIRY_ADDRESS.getName().equals(attributeName)) {
context.getResult().set(control.getExpiryAddress());
} else if (DEAD_LETTER_ADDRESS.getName().equals(attributeName)) {
context.getResult().set(control.getDeadLetterAddress());
} else if (PAUSED.equals(attributeName)) {
try {
context.getResult().set(control.isPaused());
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} else if (TEMPORARY.equals(attributeName)) {
context.getResult().set(control.isTemporary());
} else if (METRICS.contains(attributeName) || READ_ATTRIBUTES.contains(attributeName)) {
// Bug
throw MESSAGES.unsupportedAttribute(attributeName);
}
context.completeStep();