当前位置: 首页>>代码示例>>Java>>正文


Java Resource.ResourceEntry方法代码示例

本文整理汇总了Java中org.jboss.as.controller.registry.Resource.ResourceEntry方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.ResourceEntry方法的具体用法?Java Resource.ResourceEntry怎么用?Java Resource.ResourceEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.as.controller.registry.Resource的用法示例。


在下文中一共展示了Resource.ResourceEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateRuntimeNames

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
static void validateRuntimeNames(String deploymentName, OperationContext context, PathAddress address) throws OperationFailedException {
    ModelNode deployment = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();

    if (ENABLED.resolveModelAttribute(context, deployment).asBoolean()) {
        Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS);
        ModelNode domainDeployment = root.getChild(PathElement.pathElement(DEPLOYMENT, deploymentName)).getModel();
        String runtimeName = getRuntimeName(deploymentName, deployment, domainDeployment);
        PathAddress sgAddress = address.subAddress(0, address.size() - 1);
        Resource serverGroup = root.navigate(sgAddress);
        for (Resource.ResourceEntry re : serverGroup.getChildren(DEPLOYMENT)) {
            String reName = re.getName();
            if (!deploymentName.equals(reName)) {
                ModelNode otherDepl = re.getModel();
                if (ENABLED.resolveModelAttribute(context, otherDepl).asBoolean()) {
                    domainDeployment = root.getChild(PathElement.pathElement(DEPLOYMENT, reName)).getModel();
                    String otherRuntimeName = getRuntimeName(reName, otherDepl, domainDeployment);
                    if (runtimeName.equals(otherRuntimeName)) {
                        throw DomainControllerLogger.ROOT_LOGGER.runtimeNameMustBeUnique(reName, runtimeName, sgAddress.getLastElement().getValue());
                    }
                }
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:25,代码来源:ServerGroupDeploymentAddHandler.java

示例2: checkCanRemove

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
protected void checkCanRemove(OperationContext context, ModelNode operation) throws OperationFailedException {
    final String deploymentName = PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement().getValue();
    final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS);

    if(root.hasChild(PathElement.pathElement(SERVER_GROUP))) {
        final List<String> badGroups = new ArrayList<String>();
        for(final Resource.ResourceEntry entry : root.getChildren(SERVER_GROUP)) {
            if(entry.hasChild(PathElement.pathElement(DEPLOYMENT, deploymentName))) {
                badGroups.add(entry.getName());
            }
        }

        if (badGroups.size() > 0) {
            throw new OperationFailedException(DomainControllerLogger.ROOT_LOGGER.cannotRemoveDeploymentInUse(deploymentName, badGroups));
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:DeploymentRemoveHandler.java

示例3: listDeploymentNames

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
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;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:AffectedDeploymentOverlay.java

示例4: validateRuntimeNames

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void validateRuntimeNames(String deploymentName, OperationContext context) throws OperationFailedException {
    ModelNode deployment = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();

    if (ENABLED.resolveModelAttribute(context, deployment).asBoolean()) {
        String runtimeName = getRuntimeName(deploymentName, deployment);
        Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS);
        for (Resource.ResourceEntry re : root.getChildren(DEPLOYMENT)) {
            String reName = re.getName();
            if (!deploymentName.equals(reName)) {
                ModelNode otherDepl = re.getModel();
                if (ENABLED.resolveModelAttribute(context, otherDepl).asBoolean()) {
                    String otherRuntimeName = getRuntimeName(reName, otherDepl);
                    if (runtimeName.equals(otherRuntimeName)) {
                        throw ServerLogger.ROOT_LOGGER.runtimeNameMustBeUnique(reName, runtimeName);
                    }
                }
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:DeploymentAddHandler.java

示例5: execute

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    final PathAddress address = context.getCurrentAddress();
    final String connectorName = address.getLastElement().getValue();

    PathAddress parentAddress = address.getParent();
    Resource parent = context.readResourceFromRoot(parentAddress, false);
    Resource resource = context.readResourceFromRoot(address, false);
    ModelNode resourceRef = resource.getModel().get(CommonAttributes.CONNECTOR_REF);
    boolean listenerAlreadyExists = false;

    for(Resource.ResourceEntry child: parent.getChildren(CommonAttributes.HTTP_CONNECTOR)) {
        if(!connectorName.equals(child.getName())) {
            Resource childResource = context.readResourceFromRoot(PathAddress.pathAddress(parentAddress, child.getPathElement()), false);
            if(childResource.getModel().get(CommonAttributes.CONNECTOR_REF).equals(resourceRef)) {
                listenerAlreadyExists = true;
                break;
            }
        }
    }

    if(listenerAlreadyExists) {
        throw ControllerLogger.ROOT_LOGGER.alreadyDefinedAttribute(CommonAttributes.HTTP_CONNECTOR, resourceRef.asString(), CommonAttributes.CONNECTOR_REF);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:HttpConnectorAdd.java

示例6: getAuthorizationResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private Resource getAuthorizationResource(PathAddress address) {
    Resource model = this.managementModel.getRootResource();
    for (PathElement element : address) {
        // Allow wildcard navigation for the last element
        if (element.isWildcard()) {
            model = Resource.Factory.create();
            final Set<Resource.ResourceEntry> children = model.getChildren(element.getKey());
            for (final Resource.ResourceEntry entry : children) {
                model.registerChild(entry.getPathElement(), entry);
            }
        } else {
            model = model.getChild(element);
            if (model == null) {
                return Resource.Factory.create();
            }
        }
    }
    return model;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:OperationContextImpl.java

示例7: transformResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public void transformResource(ResourceTransformationContext context, PathAddress address, Resource resource) throws OperationFailedException {
    final ResourceTransformationContext childContext = context.addTransformedResource(PathAddress.EMPTY_ADDRESS, resource);
    for(final Resource.ResourceEntry entry : resource.getChildren("renamed")) {
        childContext.processChild(PathElement.pathElement("element", "renamed"), entry);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:8,代码来源:VersionedExtension2.java

示例8: getChildren

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public Set<Resource.ResourceEntry> getChildren(String childType) {
    if (!hasChildren(childType)) {
        return Collections.emptySet();
    } else {
        Set<Resource.ResourceEntry> result = new HashSet<ResourceEntry>();
        synchronized (content) {
            for (String name : content.keySet()) {
                result.add(getChildEntry(name));
            }
        }
        return result;
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:15,代码来源:ManagedDMRContentTypeResource.java

示例9: testComplexInsertOrderedChildrenModelSync

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Test
public void testComplexInsertOrderedChildrenModelSync() throws Exception {
    //Complex test
    ModelNode originalModel = readResourceRecursive();

    Resource rootResource = createMasterDcResources();
    createAndRegisterSubsystemChildFromRoot(rootResource, ORDERED_CHILD.getKey(), "grape", 1);
    createAndRegisterSubsystemChildFromRoot(rootResource, ORDERED_CHILD.getKey(), "lemon", 1);
    createAndRegisterSubsystemChildFromRoot(rootResource, ORDERED_CHILD.getKey(), "pear", 0);
    createAndRegisterSubsystemChildFromRoot(rootResource, ORDERED_CHILD.getKey(), "cherry");
    ModelNode master = Resource.Tools.readModel(rootResource);

    executeTriggerSyncOperation(rootResource);
    ModelNode currentModel = readResourceRecursive();

    Assert.assertNotEquals(originalModel, currentModel);
    compare(findSubsystemResource(currentModel).get(ORDERED_CHILD.getKey()).keys(), "pear", "apple", "lemon", "grape", "orange", "cherry");
    compareSubsystemModels(master, currentModel);

    Resource subsystemResource = findSubsystemResource(rootResource);
    subsystemResource.removeChild(PathElement.pathElement(ORDERED_CHILD.getKey(), "pear"));
    subsystemResource.removeChild(PathElement.pathElement(ORDERED_CHILD.getKey(), "apple"));
    subsystemResource.removeChild(PathElement.pathElement(ORDERED_CHILD.getKey(), "lemon"));
    createAndRegisterSubsystemChildFromRoot(rootResource, ORDERED_CHILD.getKey(), "kiwi", 1);
    createAndRegisterSubsystemChildFromRoot(rootResource, ORDERED_CHILD.getKey(), "melon", 100);
    for (Resource.ResourceEntry child : subsystemResource.getChildren(ORDERED_CHILD.getKey())) {
        child.getModel().get(ATTR.getName()).set(child.getModel().get(ATTR.getName()).asString() + "$" + child.getName());
    }
    master = Resource.Tools.readModel(rootResource);

    executeTriggerSyncOperation(rootResource);
    currentModel = readResourceRecursive();

    Assert.assertNotEquals(originalModel, currentModel);
    compare(findSubsystemResource(currentModel).get(ORDERED_CHILD.getKey()).keys(), "grape", "kiwi", "orange", "cherry", "melon");
    compareSubsystemModels(master, currentModel);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:38,代码来源:OrderedChildResourceSyncModelTestCase.java

示例10: processChildren

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public void processChildren(final Resource resource) throws OperationFailedException {
    final Set<String> types = resource.getChildTypes();
    for (final String type : types) {
        for (final Resource.ResourceEntry child : resource.getChildren(type)) {
            processChild(child.getPathElement(), child);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:10,代码来源:ResourceTransformationContextImpl.java

示例11: getChildren

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public Set<ResourceEntry> getChildren(String childType) {
    Set<ResourceEntry> children = delegate.getChildren(childType);
    if (children != null) {
        Set<ResourceEntry> protectedChildren = new LinkedHashSet<Resource.ResourceEntry>();
        for (ResourceEntry entry : children) {
            protectedChildren.add(new ProtectedModelResourceEntry(entry));
        }
        return protectedChildren;
    }
    return null;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:TransformationRule.java

示例12: readResourceFromRoot

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
Resource readResourceFromRoot(ManagementModel managementModel, PathAddress address, boolean recursive) {
    //
    // TODO double check authorization checks for this!
    //
    Resource model = managementModel.getRootResource();
    final Iterator<PathElement> iterator = address.iterator();
    while(iterator.hasNext()) {
        final PathElement element = iterator.next();
        // Allow wildcard navigation for the last element
        if(element.isWildcard() && ! iterator.hasNext()) {
            final Set<Resource.ResourceEntry> children = model.getChildren(element.getKey());
            if(children.isEmpty()) {
                final PathAddress parent = address.subAddress(0, address.size() -1);
                final Set<String> childrenTypes = managementModel.getRootResourceRegistration().getChildNames(parent);
                if(! childrenTypes.contains(element.getKey())) {
                    throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address);
                }
                // Return an empty model
                return Resource.Factory.create();
            }
            model = Resource.Factory.create();
            for(final Resource.ResourceEntry entry : children) {
                model.registerChild(entry.getPathElement(), entry);
            }
        } else {
            model = requireChild(model, element, address);
        }
    }
    if(recursive) {
        return model.clone();
    } else {
        return model.shallowCopy();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:36,代码来源:OperationContextImpl.java

示例13: getChildren

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public Set<Resource.ResourceEntry> getChildren(String childType) {
    if (!hasChildren(childType)) {
        return Collections.emptySet();
    } else {
        Set<Resource.ResourceEntry> result = new LinkedHashSet<ResourceEntry>();
        for (String name : getChildrenNames()) {
            result.add(getChildEntry(name));
        }
        return result;
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:AbstractPlatformMBeanResource.java

示例14: createResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
static Resource.ResourceEntry createResource(AccessConstraintUtilization constraintUtilization) {
    return new AccessConstraintAppliesToResource(constraintUtilization);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:4,代码来源:AccessConstraintAppliesToResourceDefinition.java

示例15: getRootResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
public Resource.ResourceEntry getRootResource() {
    IgnoredDomainResourceRoot root = new IgnoredDomainResourceRoot(this);
    this.rootResource = root;
    return root;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:6,代码来源:IgnoredDomainResourceRegistry.java


注:本文中的org.jboss.as.controller.registry.Resource.ResourceEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。