@Override protected void describe(OrderedChildTypesAttachment orderedChildTypesAttachment, Resource resource, ModelNode addressModel, ModelNode result, ImmutableManagementResourceRegistration registration) { if (resource == null || registration.isRemote() || registration.isRuntimeOnly() || resource.isProxy() || resource.isRuntime() || registration.isAlias()) return; result.add(createAddOperation(orderedChildTypesAttachment, addressModel, resource, registration.getChildAddresses(PathAddress.EMPTY_ADDRESS))); PathAddress address = PathAddress.pathAddress(addressModel); for (String type : resource.getChildTypes()) { for (Resource.ResourceEntry entry : resource.getChildren(type)) { PathElement path = entry.getPathElement(); ImmutableManagementResourceRegistration childRegistration = Optional.ofNullable(registration.getSubModel(PathAddress.pathAddress(path))).orElse(registration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(path.getKey())))); PathAddress childAddress = address.append(path); this.describe(orderedChildTypesAttachment, entry, childAddress.toModelNode(), result, childRegistration); } } }
@Override public boolean isRemote() { return delegate.isRemote(); }
@Override public boolean isRemote() { return delegate.isRemote(); }
@Override public boolean isRemote() { return delegate.isRemote(); }
@Override public boolean isRemote() { return delegate.isRemote(); }
private static Set<String> getNonIgnoredChildTypes(ImmutableManagementResourceRegistration mrr) { Set<String> result = new HashSet<>(); for (PathElement pe : mrr.getChildAddresses(PathAddress.EMPTY_ADDRESS)) { ImmutableManagementResourceRegistration childMrr = mrr.getSubModel(PathAddress.pathAddress(pe)); if (childMrr != null && !childMrr.isRemote() && !childMrr.isRuntimeOnly()) { result.add(pe.getKey()); } } return result; }
private static Set<String> getNonIgnoredChildTypes(ImmutableManagementResourceRegistration mrr) { Set<String> result = new HashSet<>(); for (PathElement pe : mrr.getChildAddresses(PathAddress.EMPTY_ADDRESS)) { ImmutableManagementResourceRegistration childMrr = mrr.getSubModel(PathAddress.pathAddress(pe)); if (childMrr != null && !childMrr.isRemote() && !childMrr.isRuntimeOnly()) { result.add(pe.getKey()); } } return result; }
protected ResourceTransformer resolveTransformer(TransformerEntry entry, PathAddress address) { final ResourceTransformer transformer = entry.getResourceTransformer(); if (transformer == null) { final ImmutableManagementResourceRegistration childReg = originalModel.getRegistration(address); if (childReg == null) { return ResourceTransformer.DISCARD; } if (childReg.isRemote() || childReg.isRuntimeOnly()) { return ResourceTransformer.DISCARD; } return ResourceTransformer.DEFAULT; } return transformer; }
protected ResourceTransformer resolveTransformer(TransformerEntry entry, PathAddress address) { final ResourceTransformer transformer = entry.getResourceTransformer(); if (transformer == null) { final ImmutableManagementResourceRegistration childReg = originalModel.getRegistration(address); if (childReg == null) { return ResourceTransformer.DISCARD; } if (childReg.isRemote() || childReg.isRuntimeOnly()) { return ResourceTransformer.DISCARD; } return ResourceTransformer.DEFAULT; } return transformer; }
@Override public ResourceTransformer resolveTransformer(PathAddress address) { final ResourceTransformer transformer = originalModel.target.resolveTransformer(this, address); if (transformer == null) { final ImmutableManagementResourceRegistration childReg = originalModel.getRegistration(address); if (childReg == null) { return ResourceTransformer.DISCARD; } if (childReg.isRemote() || childReg.isRuntimeOnly()) { return ResourceTransformer.DISCARD; } return ResourceTransformer.DEFAULT; } return transformer; }
@Override public ResourceTransformer resolveTransformer(PathAddress address) { final ResourceTransformer transformer = originalModel.target.resolveTransformer(address); if (transformer == null) { final ImmutableManagementResourceRegistration childReg = originalModel.getRegistration(address); if (childReg == null) { return ResourceTransformer.DISCARD; } if (childReg.isRemote() || childReg.isRuntimeOnly()) { return ResourceTransformer.DISCARD; } return ResourceTransformer.DEFAULT; } return transformer; }
/** * Creates a set of child types that are not {@linkplain ImmutableManagementResourceRegistration#isRemote() remote} * or {@linkplain ImmutableManagementResourceRegistration#isRuntimeOnly() runtime} child types. * * @param mrr the resource registration to process the child types for * * @return a collection of non-remote and non-runtime only child types */ private static Set<String> getNonIgnoredChildTypes(ImmutableManagementResourceRegistration mrr) { final Set<String> result = new LinkedHashSet<>(); for (PathElement pe : mrr.getChildAddresses(PathAddress.EMPTY_ADDRESS)) { ImmutableManagementResourceRegistration childMrr = mrr.getSubModel(PathAddress.pathAddress(pe)); if (childMrr != null && !childMrr.isRemote() && !childMrr.isRuntimeOnly()) { result.add(pe.getKey()); } } return result; }
/** * Creates a set of child types that are not {@linkplain ImmutableManagementResourceRegistration#isRemote() remote} * or {@linkplain ImmutableManagementResourceRegistration#isRuntimeOnly() runtime} child types. * * @param mrr the resource registration to process the child types for * * @return a collection of non-remote and non-runtime only child types */ private static Set<String> getNonIgnoredChildTypes(ImmutableManagementResourceRegistration mrr) { final Set<String> result = new LinkedHashSet<>(); for (PathElement pe : mrr.getChildAddresses(PathAddress.EMPTY_ADDRESS)) { ImmutableManagementResourceRegistration childMrr = mrr.getSubModel(PathAddress.pathAddress(pe)); if (childMrr != null && !childMrr.isRemote() && !childMrr.isRuntimeOnly()) { result.add(pe.getKey()); } } return result; }
protected ResourceTransformer resolveTransformer(TransformerEntry entry, PathAddress address) { final ResourceTransformer transformer; try { transformer = entry.getResourceTransformer(); } catch (NullPointerException e) { //Temp for WFCORE-1270 to get some more information NullPointerException npe = new NullPointerException("NPE for " + address); npe.setStackTrace(e.getStackTrace()); throw npe; } if (transformer == null) { final ImmutableManagementResourceRegistration childReg = originalModel.getRegistration(address); if (childReg == null) { return ResourceTransformer.DISCARD; } if (childReg.isRemote() || childReg.isRuntimeOnly()) { return ResourceTransformer.DISCARD; } return ResourceTransformer.DEFAULT; } return transformer; }
protected ResourceTransformer resolveTransformer(TransformerEntry entry, PathAddress address) { final ResourceTransformer transformer; try { transformer = entry.getResourceTransformer(); } catch (NullPointerException e) { //Temp for WFCORE-1270 to get some more information NullPointerException npe = new NullPointerException("NPE for " + address); npe.setStackTrace(e.getStackTrace()); throw npe; } if (transformer == null) { final ImmutableManagementResourceRegistration childReg = originalModel.getRegistration(address); if (childReg == null) { return ResourceTransformer.DISCARD; } if (childReg.isRemote() || childReg.isRuntimeOnly()) { return ResourceTransformer.DISCARD; } return ResourceTransformer.DEFAULT; } return transformer; }
@Override protected void executeSingleTargetChild(PathAddress base, PathElement currentElement, PathAddress newRemaining, OperationContext context, boolean ignoreMissing) { final PathAddress next = base.append(currentElement); // Either require the child or a remote target final Resource resource = context.readResource(base, false); final ImmutableManagementResourceRegistration nr = context.getResourceRegistration().getSubModel(next); if (resource.hasChild(currentElement) || (nr != null && nr.isRemote())) { safeExecute(next, newRemaining, context, nr, ignoreMissing); } //if we are on the wrong host no need to do anything else if(!resource.hasChild(currentElement)) { throw new Resource.NoSuchResourceException(currentElement); } }
@Override protected void describe(OrderedChildTypesAttachment orderedChildTypesAttachment, Resource resource, ModelNode addressModel, ModelNode result, ImmutableManagementResourceRegistration registration) { if (resource == null || registration.isRemote() || registration.isRuntimeOnly() || resource.isProxy() || resource.isRuntime() || registration.isAlias()) return; result.add(createAddOperation(orderedChildTypesAttachment, addressModel, resource, registration.getChildAddresses(PathAddress.EMPTY_ADDRESS))); PathAddress address = PathAddress.pathAddress(addressModel); for (String type : resource.getChildTypes()) { for (Resource.ResourceEntry entry : resource.getChildren(type)) { PathElement path = entry.getPathElement(); ImmutableManagementResourceRegistration childRegistration = Optional.ofNullable(registration.getSubModel(PathAddress.pathAddress(path))).orElse(registration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(path.getKey())))); PathAddress childAddress = address.append(path); this.describe(orderedChildTypesAttachment, entry, childAddress.toModelNode(), result, childRegistration); } } }
@Override protected void executeSingleTargetChild(PathAddress base, PathElement currentElement, PathAddress newRemaining, OperationContext context, boolean ignoreMissing) { final PathAddress next = base.append(currentElement); // Either require the child or a remote target final Resource resource = context.readResource(base, false); final ImmutableManagementResourceRegistration nr = context.getResourceRegistration().getSubModel(next); if (resource.hasChild(currentElement) || (nr != null && nr.isRemote())) { safeExecute(next, newRemaining, context, nr, ignoreMissing); } //if we are on the wrong host no need to do anything else if(!resource.hasChild(currentElement)) { throw new Resource.NoSuchResourceException(currentElement); } }
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); } } }