@Override public void unregisterOperationHandler(final String operationName) { checkPermission(); if (operationsUpdater.remove(this, operationName) == null) { throw operationNotRegisteredException(operationName, resourceDefinition.getPathElement()); } }
@Override AttributeAccess getAttributeAccess( final ListIterator<PathElement> iterator, final String attributeName) { if (iterator.hasNext()) { final PathElement next = iterator.next(); final NodeSubregistry subregistry = children.get(next.getKey()); if (subregistry == null) { return null; } return subregistry.getAttributeAccess(iterator, next.getValue(), attributeName); } else { checkPermission(); final Map<String, AttributeAccess> snapshot = attributesUpdater.get(this); AttributeAccess access = snapshot.get(attributeName); if (access == null && hasNoAlternativeWildcardRegistration()) { // If there is metadata for an attribute but no AttributeAccess, assume RO. Can't // be writable without a registered handler. This opens the possibility that out-of-date // metadata // for attribute "foo" can lead to a read of non-existent-in-model "foo" with // an unexpected undefined value returned. But it removes the possibility of a // dev forgetting to call registry.registerReadOnlyAttribute("foo", null) resulting // in the valid attribute "foo" not being readable DescriptionProvider provider = resourceDefinition.getDescriptionProvider(this); if (provider instanceof DefaultResourceDescriptionProvider) { return null; // attribute was not registered so it does not exist. no need to read // resource description as we wont find anything and cause SO } // todo get rid of this fallback loop as with code cleanup we wont need it anymore. final ModelNode desc = resourceDefinition.getDescriptionProvider(this).getModelDescription(null); if (desc.has(ATTRIBUTES) && desc.get(ATTRIBUTES).keys().contains(attributeName)) { access = new AttributeAccess( AccessType.READ_ONLY, Storage.CONFIGURATION, null, null, null, null); } } return access; } }
@Override DescriptionProvider getModelDescription(final ListIterator<PathElement> iterator) { if (iterator.hasNext()) { final PathElement next = iterator.next(); final NodeSubregistry subregistry = children.get(next.getKey()); if (subregistry == null) { return null; } return subregistry.getModelDescription(iterator, next.getValue()); } else { checkPermission(); return resourceDefinition.getDescriptionProvider(this); } }
@Override public ManagementResourceRegistration registerSubModel( final ResourceDefinition resourceDefinition) { if (resourceDefinition == null) { throw ControllerLogger.ROOT_LOGGER.nullVar("resourceDefinition"); } final PathElement address = resourceDefinition.getPathElement(); if (address == null) { throw ControllerLogger.ROOT_LOGGER.cannotRegisterSubmodelWithNullPath(); } if (isRuntimeOnly()) { throw ControllerLogger.ROOT_LOGGER.cannotRegisterSubmodel(); } final AbstractResourceRegistration existing = getSubRegistration(PathAddress.pathAddress(address)); if (existing != null && existing.getValueString().equals(address.getValue())) { throw ControllerLogger.ROOT_LOGGER.nodeAlreadyRegistered(existing.getLocationString()); } final String key = address.getKey(); final NodeSubregistry child = getOrCreateSubregistry(key); final ManagementResourceRegistration resourceRegistration = child.register(address.getValue(), resourceDefinition, false); resourceDefinition.registerAttributes(resourceRegistration); resourceDefinition.registerOperations(resourceRegistration); resourceDefinition.registerChildren(resourceRegistration); if (constraintUtilizationRegistry != null && resourceDefinition instanceof ConstrainedResourceDefinition) { PathAddress childAddress = getPathAddress().append(address); List<AccessConstraintDefinition> constraintDefinitions = ((ConstrainedResourceDefinition) resourceDefinition).getAccessConstraints(); for (AccessConstraintDefinition acd : constraintDefinitions) { constraintUtilizationRegistry.registerAccessConstraintResourceUtilization( acd.getKey(), childAddress); } } return resourceRegistration; }
@Override public DescriptionProvider getDescriptionProvider( ImmutableManagementResourceRegistration resourceRegistration) { return delegate.getDescriptionProvider(resourceRegistration); }
@Override public PathElement getPathElement() { return delegate.getPathElement(); }