private void applyOperationToActiveMQService(ModelNode operation, String attributeName, ModelNode newValue, ServiceController<?> activeMQServiceController) { ActiveMQServerControl serverControl = ActiveMQServer.class.cast(activeMQServiceController.getValue()).getActiveMQServerControl(); if (serverControl == null) { PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address); } try { if (attributeName.equals(ServerDefinition.MESSAGE_COUNTER_SAMPLE_PERIOD.getName())) { serverControl.setMessageCounterSamplePeriod(newValue.asLong()); } else if (attributeName.equals(ServerDefinition.MESSAGE_COUNTER_MAX_DAY_HISTORY.getName())) { serverControl.setMessageCounterMaxDayCount(newValue.asInt()); } else if (attributeName.equals(ServerDefinition.STATISTICS_ENABLED.getName())) { if (newValue.asBoolean()) { serverControl.enableMessageCounters(); } else { serverControl.disableMessageCounters(); } } else { // Bug! Someone added the attribute to the set but did not implement throw MessagingLogger.ROOT_LOGGER.unsupportedRuntimeAttribute(attributeName); } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
private void applyOperationToActiveMQService(ModelNode operation, String attributeName, ModelNode newValue, ServiceController<?> activeMQServiceController) { ActiveMQServerControl serverControl = ActiveMQServer.class.cast(activeMQServiceController.getValue()).getActiveMQServerControl(); if (serverControl == null) { PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address); } try { if (attributeName.equals(ServerDefinition.MESSAGE_COUNTER_SAMPLE_PERIOD.getName())) { serverControl.setMessageCounterSamplePeriod(newValue.asLong()); } else if (attributeName.equals(ServerDefinition.MESSAGE_COUNTER_MAX_DAY_HISTORY.getName())) { serverControl.setMessageCounterMaxDayCount(newValue.asInt()); } else if (attributeName.equals(ServerDefinition.STATISTICS_ENABLED.getName())) { if (newValue.asBoolean()) { serverControl.enableMessageCounters(); } else { serverControl.disableMessageCounters(); } } else { // Bug! Someone added the attribute to the set but did not implement throw MessagingLogger.ROOT_LOGGER.unsupportedRuntimeAttribute(attributeName); } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }