Java Code Examples for org.jboss.as.controller.registry.Resource#hasChildren()

The following examples show how to use org.jboss.as.controller.registry.Resource#hasChildren() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RootResourceIterator.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void doIterate(final Resource current, final PathAddress address) {
    boolean handleChildren = false;

    ObjectName resourceObjectName = action.onAddress(address);
    if (resourceObjectName != null &&
            (accessControlUtil == null || accessControlUtil.getResourceAccess(address, false).isAccessibleResource())) {
        handleChildren = action.onResource(resourceObjectName);
    }

    if (handleChildren) {
        for (String type : current.getChildTypes()) {
            if (current.hasChildren(type)) {
                for (ResourceEntry entry : current.getChildren(type)) {
                    final PathElement pathElement = entry.getPathElement();
                    final PathAddress childAddress = address.append(pathElement);
                    doIterate(entry, childAddress);
                }
            }
        }
    }
}
 
Example 2
Source File: AffectedDeploymentOverlay.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private static Set<String> listDeploymentNames(Resource deploymentRootResource, Set<Pattern> patterns) {
    Set<String> deploymentNames = new HashSet<>();
    if (deploymentRootResource.hasChildren(DEPLOYMENT)) {
        for (Resource.ResourceEntry deploymentResource : deploymentRootResource.getChildren(DEPLOYMENT)) {
            if (isAcceptableDeployment(deploymentResource.getModel(), patterns)) {
                deploymentNames.add(deploymentResource.getName());
            } else if (deploymentResource.hasChildren(SUBDEPLOYMENT)) {
                for (Resource.ResourceEntry subdeploymentResource : deploymentResource.getChildren(SUBDEPLOYMENT)) {
                    if (isAcceptableDeployment(subdeploymentResource.getModel(), patterns)) {
                        deploymentNames.add(deploymentResource.getName());
                    }
                }
            }
        }
    }
    return deploymentNames;
}
 
Example 3
Source File: AffectedDeploymentOverlay.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Returns all the deployment runtime names associated with an overlay.
 *
 * @param context the current OperationContext.
 * @param overlayAddress the address for the averlay.
 * @return all the deployment runtime names associated with an overlay.
 */
public static Set<String> listLinks(OperationContext context, PathAddress overlayAddress) {
    Resource overlayResource = context.readResourceFromRoot(overlayAddress);
    if (overlayResource.hasChildren(DEPLOYMENT)) {
        return overlayResource.getChildrenNames(DEPLOYMENT);
    }
    return Collections.emptySet();
}
 
Example 4
Source File: AffectedDeploymentOverlay.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static Set<String> listServerGroupsReferencingOverlay(Resource rootResource, String overlayName) {
    final PathElement overlayPath = PathElement.pathElement(DEPLOYMENT_OVERLAY, overlayName);
    if (rootResource.hasChildren(SERVER_GROUP)) {
        Set<String> set = new HashSet<>();
        for (String serverGroupName : rootResource.getChildrenNames(SERVER_GROUP)) {
            if (rootResource.getChild(PathElement.pathElement(SERVER_GROUP, serverGroupName)).hasChild(overlayPath)) {
                set.add(serverGroupName);
            }
        }
        return set;
    }
    return Collections.emptySet();
}