@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<RollbackInfo> handbackHolder) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final PathElement element = address.getLastElement(); final String bindingName = element.getValue(); final ModelNode bindingModel = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); final ServiceController<?> controller = context.getServiceRegistry(true).getRequiredService(SOCKET_BINDING.append(bindingName)); final SocketBinding binding = controller.getState() == ServiceController.State.UP ? SocketBinding.class.cast(controller.getValue()) : null; final boolean bound = binding != null && binding.isBound(); if (binding == null) { // existing is not started, so can't update it. Instead reinstall the service handleBindingReinstall(context, bindingName, bindingModel); } else if (bound) { // Cannot edit bound sockets return true; } else { handleRuntimeChange(operation, attributeName, resolvedValue, binding); } handbackHolder.setHandback(new RollbackInfo(bindingName, bindingModel, binding)); return requiresRestart(); }
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<RollbackInfo> handbackHolder) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final PathElement element = address.getLastElement(); final String bindingName = element.getValue(); final ModelNode bindingModel = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); final ServiceController<?> controller = context.getServiceRegistry(true).getRequiredService(SOCKET_BINDING.append(bindingName)); final SocketBinding binding = controller.getState() == ServiceController.State.UP ? SocketBinding.class.cast(controller.getValue()) : null; final boolean bound = binding != null && binding.isBound(); if (binding == null) { // existing is not started, so can't update it. Instead reinstall the service handleBindingReinstall(context, bindingName, bindingModel); } else if (bound) { // Cannot edit bound sockets return true; } else { handleRuntimeChange(operation, attributeName, resolvedValue, binding); } handbackHolder.setHandback(new RollbackInfo(bindingName, bindingModel, binding)); return requiresRestart(); }
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<RollbackInfo> handbackHolder) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final PathElement element = address.getLastElement(); final String bindingName = element.getValue(); final ModelNode bindingModel = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); final ServiceName serviceName = SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(bindingName, SocketBinding.class); final ServiceController<?> controller = context.getServiceRegistry(true).getRequiredService(serviceName); final SocketBinding binding = controller.getState() == ServiceController.State.UP ? SocketBinding.class.cast(controller.getValue()) : null; final boolean bound = binding != null && binding.isBound(); if (binding == null) { // existing is not started, so can't update it. Instead reinstall the service handleBindingReinstall(context, bindingName, bindingModel, serviceName); } else if (bound) { // Cannot edit bound sockets return true; } else { handleRuntimeChange(context, operation, attributeName, resolvedValue, binding); } handbackHolder.setHandback(new RollbackInfo(bindingName, bindingModel, binding)); return requiresRestart(); }
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<RollbackInfo> handbackHolder) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final PathElement element = address.getLastElement(); final String bindingName = element.getValue(); final ModelNode bindingModel = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); final ServiceName serviceName = SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(bindingName, SocketBinding.class); final ServiceController<?> controller = context.getServiceRegistry(true).getRequiredService(serviceName); final SocketBinding binding = controller.getState() == ServiceController.State.UP ? SocketBinding.class.cast(controller.getValue()) : null; final boolean bound = binding != null && binding.isBound(); if (binding == null) { // existing is not started, so can't update it. Instead reinstall the service handleBindingReinstall(context, bindingName, bindingModel, serviceName); } else if (bound) { // Cannot edit bound sockets return true; } else { handleRuntimeChange(context, operation, attributeName, resolvedValue, binding); } handbackHolder.setHandback(new RollbackInfo(bindingName, bindingModel, binding)); return requiresRestart(); }