@Override public String toString() { return path.toString(); } }
@Override public String toString() { return path.toString(); } }
protected void validateChildren(OperationContext context, ModelNode operation) throws OperationFailedException { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); if (resource.getChildTypes().isEmpty()) { throw ROOT_LOGGER.emptyResource(pathAddress.getLastElement().toString()); } } }
protected void validateChildren(OperationContext context, ModelNode operation) throws OperationFailedException { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); if (resource.getChildTypes().isEmpty()) { throw ROOT_LOGGER.emptyResource(pathAddress.getLastElement().toString()); } } }
protected void validateRequiredChild(OperationContext context, ModelNode operation) throws OperationFailedException { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); Set<ResourceEntry> children = resource.getChildren(this.childElement.getName()); if (children.isEmpty()) { throw ROOT_LOGGER.requiredChild(pathAddress.getLastElement().toString(), this.childElement.getName()); } } }
protected void validateRequiredChild(OperationContext context, ModelNode operation) throws OperationFailedException { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); Set<ResourceEntry> children = resource.getChildren(this.childElement.getName()); if (children.isEmpty()) { throw ROOT_LOGGER.requiredChild(pathAddress.getLastElement().toString(), this.childElement.getName()); } } }
throw JGroupsMessages.MESSAGES.protocolNotDefined(protocolRelativePath.toString()) ;
static ModelNode createDeploymentSubModel(final String subsystemName, final PathElement address, final DeploymentUnit unit) { final Resource root = unit.getAttachment(DEPLOYMENT_RESOURCE); synchronized (root) { final ImmutableManagementResourceRegistration registration = unit.getAttachment(REGISTRATION_ATTACHMENT); final Resource subsystem = getOrCreate(root, PathElement.pathElement(SUBSYSTEM, subsystemName)); final ImmutableManagementResourceRegistration subModel = registration.getSubModel(getExtensionAddress(subsystemName, address)); if(subModel == null) { throw new IllegalStateException(address.toString()); } return getOrCreate(subsystem, address).getModel(); } }
static ModelNode createDeploymentSubModel(final String subsystemName, final PathElement address, final DeploymentUnit unit) { final Resource root = unit.getAttachment(DEPLOYMENT_RESOURCE); synchronized (root) { final ImmutableManagementResourceRegistration registration = unit.getAttachment(REGISTRATION_ATTACHMENT); final Resource subsystem = getOrCreate(root, PathElement.pathElement(SUBSYSTEM, subsystemName)); final ImmutableManagementResourceRegistration subModel = registration.getSubModel(getExtensionAddress(subsystemName, address)); if(subModel == null) { throw new IllegalStateException(address.toString()); } return getOrCreate(subsystem, address).getModel(); } }
protected void validateOccurrence(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); PathAddress parentAddress = Util.getParentAddressByKey(address, this.parentElement.getName()); Set<String> elements = context.readResourceFromRoot(parentAddress, false).getChildrenNames(this.element.getName()); if (elements.size() > this.maxOccurs) { throw ROOT_LOGGER.invalidChildTypeOccurrence(parentAddress.getLastElement().toString(), this.maxOccurs, this.element .getName()); } } }
protected void validateOccurrence(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); PathAddress parentAddress = Util.getParentAddressByKey(address, this.parentElement.getName()); Set<String> elements = context.readResourceFromRoot(parentAddress, false).getChildrenNames(this.element.getName()); if (elements.size() > this.maxOccurs) { throw ROOT_LOGGER.invalidChildTypeOccurrence(parentAddress.getLastElement().toString(), this.maxOccurs, this.element .getName()); } } }
protected void validateAlternatives(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode elementNode = context.readResource(EMPTY_ADDRESS, false).getModel(); PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); ModelNode definedAttribute = null; for (AttributeDefinition attribute : this.attributes) { if (elementNode.hasDefined(attribute.getName())) { if (definedAttribute != null) { throw ROOT_LOGGER.invalidAlternativeAttributeOccurrence(attribute.getName(), address.getLastElement().toString(), getAttributeNames()); } definedAttribute = attribute.resolveModelAttribute(context, elementNode); } } if (this.required && definedAttribute == null) { throw ROOT_LOGGER.requiredAlternativeAttributes(address.getLastElement().toString(), getAttributeNames()); } }
protected void validateAlternatives(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode elementNode = context.readResource(EMPTY_ADDRESS, false).getModel(); PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); ModelNode definedAttribute = null; for (AttributeDefinition attribute : this.attributes) { if (elementNode.hasDefined(attribute.getName())) { if (definedAttribute != null) { throw ROOT_LOGGER.invalidAlternativeAttributeOccurrence(attribute.getName(), address.getLastElement().toString(), getAttributeNames()); } definedAttribute = attribute.resolveModelAttribute(context, elementNode); } } if (this.required && definedAttribute == null) { throw ROOT_LOGGER.requiredAlternativeAttributes(address.getLastElement().toString(), getAttributeNames()); } }
/** * @see #getDeploymentSubModel(String, org.jboss.as.controller.PathElement, DeploymentUnit) */ static ModelNode getDeploymentSubModel(final String subsystemName, final PathElement address, final DeploymentUnit unit) { final Resource root = unit.getAttachment(DEPLOYMENT_RESOURCE); synchronized (root) { final ImmutableManagementResourceRegistration registration = unit.getAttachment(REGISTRATION_ATTACHMENT); final PathElement subsystemPath = PathElement.pathElement(SUBSYSTEM, subsystemName); if (address == null) { return getOrCreate(root, subsystemPath, null).getModel(); } Resource parent = getOrCreate(root, subsystemPath); final ImmutableManagementResourceRegistration subModel = registration.getSubModel(PathAddress.pathAddress(subsystemPath, address)); if (subModel == null) { throw new IllegalStateException(address.toString()); } return getOrCreate(parent, address, null).getModel(); } }
/** * @see #getDeploymentSubModel(String, org.jboss.as.controller.PathElement, DeploymentUnit) */ static ModelNode getDeploymentSubModel(final String subsystemName, final PathElement address, final DeploymentUnit unit) { final Resource root = unit.getAttachment(DEPLOYMENT_RESOURCE); synchronized (root) { final ImmutableManagementResourceRegistration registration = unit.getAttachment(REGISTRATION_ATTACHMENT); final PathElement subsystemPath = PathElement.pathElement(SUBSYSTEM, subsystemName); if (address == null) { return getOrCreate(root, subsystemPath, null).getModel(); } Resource parent = getOrCreate(root, subsystemPath); final ImmutableManagementResourceRegistration subModel = registration.getSubModel(PathAddress.pathAddress(subsystemPath, address)); if (subModel == null) { throw new IllegalStateException(address.toString()); } return getOrCreate(parent, address, null).getModel(); } }
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathElement transportRelativePath = PathElement.pathElement(ModelKeys.TRANSPORT, ModelKeys.TRANSPORT_NAME); final Resource resource = context.createResource(PathAddress.EMPTY_ADDRESS); final ModelNode subModel = resource.getModel(); // Process attributes for(final AttributeDefinition attribute : attributes) { // don't process properties twice - we do them below if (attribute.getName().equals(ModelKeys.PROPERTIES)) continue ; attribute.validateAndSet(operation, subModel); } // The transport config parameters <property name=>value</property> if(operation.hasDefined(ModelKeys.PROPERTIES)) { for(Property property : operation.get(ModelKeys.PROPERTIES).asPropertyList()) { // create a new property=name resource final Resource param = context.createResource(PathAddress.pathAddress(PathElement.pathElement(ModelKeys.PROPERTY, property.getName()))); final ModelNode value = property.getValue(); if(!value.isDefined()) { throw JGroupsMessages.MESSAGES.propertyNotDefined(property.getName(), transportRelativePath.toString()); } // set the value of the property PropertyResource.VALUE.validateAndSet(value, param.getModel()); } } // This needs a reload reloadRequiredStep(context); context.stepCompleted(); }
private void describeChildren(final Resource resource, final ImmutableManagementResourceRegistration registration, final PathAddress address, OperationContext context, final AtomicReference<ModelNode> failureRef, final ModelNode results, ModelNode operation, Boolean nest) { for(String childType : resource.getChildTypes()) { for(Resource.ResourceEntry entry : resource.getChildren(childType)) { if(addressFilter != null && !addressFilter.accepts(address.append(entry.getPathElement()))) { continue; } final ImmutableManagementResourceRegistration childRegistration = registration.getSubModel(PathAddress.EMPTY_ADDRESS.append(entry.getPathElement())); if(childRegistration == null) { ControllerLogger.ROOT_LOGGER.debugf("Couldn't find a registration for %s at %s for resource %s at %s", entry.getPathElement().toString(), registration.getPathAddress().toCLIStyleString(), resource, address.toCLIStyleString()); continue; } if(childRegistration.isRuntimeOnly() || childRegistration.isRemote() || childRegistration.isAlias()) { continue; } describeChildResource(entry, registration, address, context, failureRef, results, operation, nest); } } }
private void describeChildren(final Resource resource, final ImmutableManagementResourceRegistration registration, final PathAddress address, OperationContext context, final AtomicReference<ModelNode> failureRef, final ModelNode results, ModelNode operation, Boolean nest) { for(String childType : resource.getChildTypes()) { for(Resource.ResourceEntry entry : resource.getChildren(childType)) { if(addressFilter != null && !addressFilter.accepts(address.append(entry.getPathElement()))) { continue; } final ImmutableManagementResourceRegistration childRegistration = registration.getSubModel(PathAddress.EMPTY_ADDRESS.append(entry.getPathElement())); if(childRegistration == null) { ControllerLogger.ROOT_LOGGER.debugf("Couldn't find a registration for %s at %s for resource %s at %s", entry.getPathElement().toString(), registration.getPathAddress().toCLIStyleString(), resource, address.toCLIStyleString()); continue; } if(childRegistration.isRuntimeOnly() || childRegistration.isRemote() || childRegistration.isAlias()) { continue; } describeChildResource(entry, registration, address, context, failureRef, results, operation, nest); } } }