/** * Initializes the interface, socket binding group and socket binding part of the model * * @param rootResource the root model resource * @param rootRegistration the root model registry */ protected void initializeSocketBindingsModel(Resource rootResource, ManagementResourceRegistration rootRegistration) { if (socketBindings.size() == 0 && outboundSocketBindings.isEmpty()) { return; } rootResource.getModel().get(INTERFACE); rootResource.getModel().get(SOCKET_BINDING_GROUP); ManagementResourceRegistration interfaces = rootRegistration.registerSubModel(new InterfaceDefinition( SpecifiedInterfaceAddHandler.INSTANCE, SpecifiedInterfaceRemoveHandler.INSTANCE, true )); /*interfaces.registerOperationHandler(SpecifiedInterfaceAddHandler.OPERATION_NAME, SpecifiedInterfaceAddHandler.INSTANCE, new DefaultResourceAddDescriptionProvider(interfaces, CommonDescriptions.getResourceDescriptionResolver()), false); interfaces.registerOperationHandler(SpecifiedInterfaceRemoveHandler.OPERATION_NAME, SpecifiedInterfaceRemoveHandler.INSTANCE, new DefaultResourceRemoveDescriptionProvider(CommonDescriptions.getResourceDescriptionResolver()), false);*/ //TODO socket-binding-group currently lives in controller and the child RDs live in server so they currently need passing in from here rootRegistration.registerSubModel(new SocketBindingGroupResourceDefinition(BindingGroupAddHandler.INSTANCE, SocketBindingGroupRemoveHandler.INSTANCE, false, SocketBindingResourceDefinition.INSTANCE, RemoteDestinationOutboundSocketBindingResourceDefinition.INSTANCE, LocalDestinationOutboundSocketBindingResourceDefinition.INSTANCE)); }
protected void validateUpdatedModel(final OperationContext context, final Resource model) throws OperationFailedException { validateDefaultInterfaceReference(context, model.getModel()); } });
protected void validateUpdatedModel(final OperationContext context, final Resource model) throws OperationFailedException { validateDefaultInterfaceReference(context, model.getModel()); } });
resourceRegistration.registerSubModel(new SocketBindingGroupResourceDefinition( SocketBindingGroupAddHandler.INSTANCE, DomainSocketBindingGroupRemoveHandler.INSTANCE,
/** * {@inheritDoc} */ @Override protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException { final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); ModelNode model = resource.getModel(); populateModel(operation, model); SocketBindingGroupResourceDefinition.PORT_OFFSET.validateAndSet(operation, model); // Validate only a single socket binding group final PathAddress mine = PathAddress.pathAddress(operation.require(OP_ADDR)); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Set<ResourceEntry> children = root.getChildren(SOCKET_BINDING_GROUP); if (children.size() > 1) { for (ResourceEntry entry : children) { if (!entry.getName().equals(mine.getLastElement().getValue())) { throw ServerMessages.MESSAGES.cannotAddMoreThanOneSocketBindingGroupForServer( mine, PathAddress.pathAddress(PathElement.pathElement(SOCKET_BINDING_GROUP, entry.getName()))); } } } context.stepCompleted(); } }, OperationContext.Stage.MODEL); SocketBindingGroupResourceDefinition.validateDefaultInterfaceReference(context, model); }
resourceRegistration.registerSubModel(new SocketBindingGroupResourceDefinition(BindingGroupAddHandler.INSTANCE, SocketBindingGroupRemoveHandler.INSTANCE, false,
/** * {@inheritDoc} */ @Override protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException { final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); ModelNode model = resource.getModel(); populateModel(operation, model); SocketBindingGroupResourceDefinition.PORT_OFFSET.validateAndSet(operation, model); // Validate only a single socket binding group final PathAddress mine = PathAddress.pathAddress(operation.require(OP_ADDR)); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Set<ResourceEntry> children = root.getChildren(SOCKET_BINDING_GROUP); if (children.size() > 1) { for (ResourceEntry entry : children) { if (!entry.getName().equals(mine.getLastElement().getValue())) { throw ServerMessages.MESSAGES.cannotAddMoreThanOneSocketBindingGroupForServer( mine, PathAddress.pathAddress(PathElement.pathElement(SOCKET_BINDING_GROUP, entry.getName()))); } } } context.stepCompleted(); } }, OperationContext.Stage.MODEL); SocketBindingGroupResourceDefinition.validateDefaultInterfaceReference(context, model); }
resourceRegistration.registerSubModel(new SocketBindingGroupResourceDefinition(BindingGroupAddHandler.INSTANCE, SocketBindingGroupRemoveHandler.INSTANCE, false,