@Override public PathAddress getPathAddress() { return delegate.getPathAddress(); }
@Override public PathAddress getPathAddress() { return delegate.getPathAddress(); }
/** * Gets the minimum number of times a resource of the type described by this registration * can occur under its parent resource (or, for a root resource, the number of times it can * occur at all.) * * @return the minimum number of occurrences */ default int getMinOccurs() { return getPathAddress().size() == 0 ? 1 : 0; }
/** * Gets the minimum number of times a resource of the type described by this registration * can occur under its parent resource (or, for a root resource, the number of times it can * occur at all.) * * @return the minimum number of occurrences */ default int getMinOccurs() { return getPathAddress().size() == 0 ? 1 : 0; }
default boolean isFeature() { return !PathAddress.EMPTY_ADDRESS.equals(getPathAddress()); }
default boolean isFeature() { return !PathAddress.EMPTY_ADDRESS.equals(getPathAddress()); }
private void addReferences(ModelNode feature, ImmutableManagementResourceRegistration registration) { PathAddress address = registration.getPathAddress(); if (address == null || PathAddress.EMPTY_ADDRESS.equals(address)) { return; } ModelNode refs = feature.get(REFS).setEmptyList(); if (registration.getParent() != null && registration.getParent().isFeature()) { addReference(refs, registration.getParent()); } PathElement element = registration.getPathAddress().getLastElement(); if (SUBSYSTEM.equals(element.getKey())) { ModelNode ref = new ModelNode(); final String rootType = registration.getPathAddress().getElement(0).getKey(); if (HOST.equals(rootType)) { ref.get(FEATURE).set(HOST_EXTENSION); } else if (PROFILE.equals(rootType)) { ref.get(FEATURE).set(DOMAIN_EXTENSION); } else { ref.get(FEATURE).set(EXTENSION); } ref.get(INCLUDE).set(true); refs.add(ref); } if (refs.asList().isEmpty()) { feature.remove(REFS); } }
private ImmutableManagementResourceRegistration getRootRegistration(final ImmutableManagementResourceRegistration registration) { if (!PathAddress.EMPTY_ADDRESS.equals(registration.getPathAddress())) { return getRootRegistration(registration.getParent()); } return registration; }
/** * Gets whether the given {@code resourceRegistration} is for a server, or if not, * is not for a resource in the {@code profile} resource tree. */ static boolean isServerOrHostController(ImmutableManagementResourceRegistration resourceRegistration) { return resourceRegistration.getProcessType().isServer() || !ModelDescriptionConstants.PROFILE.equals(resourceRegistration.getPathAddress().getElement(0).getKey()); }
private void addReference(ModelNode refs, ImmutableManagementResourceRegistration registration) { PathAddress address = registration.getPathAddress(); if (address == null || PathAddress.EMPTY_ADDRESS.equals(address)) { return; } if (registration.isFeature()) { ModelNode ref = new ModelNode(); ref.get(FEATURE).set(registration.getFeature()); refs.add(ref); } if (registration.getParent() != null) { addReference(refs, registration.getParent()); } }
/** * Gets the maximum number of times a resource of the type described by this registration * can occur under its parent resource (or, for a root resource, the minimum number of times it can * occur at all.) * * @return the minimum number of occurrences */ default int getMaxOccurs() { PathAddress pa = getPathAddress(); return pa.size() == 0 || !pa.getLastElement().isWildcard() ? 1 : Integer.MAX_VALUE; }
private void addReferences(ModelNode feature, ImmutableManagementResourceRegistration registration) { PathAddress address = registration.getPathAddress(); if (address == null || PathAddress.EMPTY_ADDRESS.equals(address)) { return; } ModelNode refs = feature.get(REFS).setEmptyList(); if (registration.getParent() != null && registration.getParent().isFeature()) { addReference(refs, registration.getParent()); } PathElement element = registration.getPathAddress().getLastElement(); if (SUBSYSTEM.equals(element.getKey())) { ModelNode ref = new ModelNode(); final String rootType = registration.getPathAddress().getElement(0).getKey(); if (HOST.equals(rootType)) { ref.get(FEATURE).set(HOST_EXTENSION); } else if (PROFILE.equals(rootType)) { ref.get(FEATURE).set(DOMAIN_EXTENSION); } else { ref.get(FEATURE).set(EXTENSION); } ref.get(INCLUDE).set(true); refs.add(ref); } if (refs.asList().isEmpty()) { feature.remove(REFS); } }
@Override protected void describe(OrderedChildTypesAttachment orderedChildTypesAttachment, Resource resource, ModelNode address, ModelNode result, ImmutableManagementResourceRegistration registration) { // Don't describe the configuration=endpoint resource. It's just an alias for // a set of attributes on its parent and the parent description covers those. PathElement pe = registration.getPathAddress().getLastElement(); if (!pe.equals(RemotingEndpointResource.ENDPOINT_PATH)) { super.describe(orderedChildTypesAttachment, resource, address, result, registration); } } }
private ImmutableManagementResourceRegistration getRootRegistration(final ImmutableManagementResourceRegistration registration) { if (!PathAddress.EMPTY_ADDRESS.equals(registration.getPathAddress())) { return getRootRegistration(registration.getParent()); } return registration; }
private void addReference(ModelNode refs, ImmutableManagementResourceRegistration registration) { PathAddress address = registration.getPathAddress(); if (address == null || PathAddress.EMPTY_ADDRESS.equals(address)) { return; } if (registration.isFeature()) { ModelNode ref = new ModelNode(); ref.get(FEATURE).set(registration.getFeature()); refs.add(ref); } if (registration.getParent() != null) { addReference(refs, registration.getParent()); } }
/** * Gets the maximum number of times a resource of the type described by this registration * can occur under its parent resource (or, for a root resource, the minimum number of times it can * occur at all.) * * @return the minimum number of occurrences */ default int getMaxOccurs() { PathAddress pa = getPathAddress(); return pa.size() == 0 || !pa.getLastElement().isWildcard() ? 1 : Integer.MAX_VALUE; }
default String getFeature() { if(PathAddress.EMPTY_ADDRESS.equals(getPathAddress())) { if(getProcessType().isServer()) { return "server-root"; } return ""; } StringJoiner joiner = new StringJoiner("."); final PathAddress pathAddress = getPathAddress(); final String initialKey = pathAddress.getElement(0).getKey(); if (getProcessType().isManagedDomain() && !HOST.equals(initialKey) && !PROFILE.equals(initialKey)) { joiner.add(DOMAIN); } for (int i = 0; i < pathAddress.size(); i++) { PathElement elt = pathAddress.getElement(i); joiner.add(elt.getKey()); if (!elt.isWildcard() && (i > 0 || !HOST.equals(elt.getKey()))) { joiner.add(elt.getValue()); } } return joiner.toString(); }
default String getFeature() { if(PathAddress.EMPTY_ADDRESS.equals(getPathAddress())) { if(getProcessType().isServer()) { return "server-root"; } return ""; } StringJoiner joiner = new StringJoiner("."); final PathAddress pathAddress = getPathAddress(); final String initialKey = pathAddress.getElement(0).getKey(); if (getProcessType().isManagedDomain() && !HOST.equals(initialKey) && !PROFILE.equals(initialKey)) { joiner.add(DOMAIN); } for (int i = 0; i < pathAddress.size(); i++) { PathElement elt = pathAddress.getElement(i); joiner.add(elt.getKey()); if (!elt.isWildcard() && (i > 0 || !HOST.equals(elt.getKey()))) { joiner.add(elt.getValue()); } } return joiner.toString(); }
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); } } }