String factoryName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
final ServiceName hqServiceName = MessagingServices.getHornetQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
ServiceController<?> hqService = context.getServiceRegistry(false).getService(hqServiceName);
HornetQServer hqServer = HornetQServer.class.cast(hqService.getValue());
ConnectionFactoryControl control = ConnectionFactoryControl.class.cast(hqServer.getManagementService().getResource(ResourceNames.JMS_CONNECTION_FACTORY + factoryName));
if (control == null) {
rollbackOperationWithResourceNotFound(context, operation);
return;
}
if (HA.getName().equals(attributeName)) {
context.getResult().set(control.isHA());
} else if (ConnectionFactoryAttributes.Regular.FACTORY_TYPE.getName().equals(attributeName)) {
context.getResult().set(control.getFactoryType());
} else if (ConnectionFactoryAttributes.Regular.INITIAL_MESSAGE_PACKET_SIZE.getName().equals(attributeName)) {
context.getResult().set(control.getInitialMessagePacketSize());
} else {
// Bug
throw MESSAGES.unsupportedAttribute(attributeName);
}
context.stepCompleted();