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


Java Resource.getChildTypes方法代码示例

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


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

示例1: doIterate

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

示例2: describe

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void describe(final PathAddress base, final Resource resource, List<ModelNode> nodes, boolean isRuntimeChange) {
    if (resource.isProxy() || resource.isRuntime()) {
        return; // ignore runtime and proxies
    } else if (base.size() >= 1 && base.getElement(0).getKey().equals(ModelDescriptionConstants.HOST)) {
        return; // ignore hosts
    }
    if (base.size() == 1) {
        newRootResources.add(base.getLastElement());
    }
    final ModelNode description = new ModelNode();
    description.get(DOMAIN_RESOURCE_ADDRESS).set(base.toModelNode());
    description.get(DOMAIN_RESOURCE_MODEL).set(resource.getModel());
    Set<String> orderedChildren = resource.getOrderedChildTypes();
    if (orderedChildren.size() > 0) {
        ModelNode orderedChildTypes = description.get(DOMAIN_RESOURCE_PROPERTIES, ORDERED_CHILD_TYPES_PROPERTY);
        for (String type : orderedChildren) {
            orderedChildTypes.add(type);
        }
    }
    nodes.add(description);
    for (final String childType : resource.getChildTypes()) {
        for (final Resource.ResourceEntry entry : resource.getChildren(childType)) {
            describe(base.append(entry.getPathElement()), entry, nodes, isRuntimeChange);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:27,代码来源:ReadMasterDomainModelUtil.java

示例3: 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

示例4: copy

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void copy(Resource src, Resource dest) {
    dest.getModel().set(src.getModel());
    for (String type : src.getChildTypes()) {
        for (ResourceEntry entry : src.getChildren(type)) {
            Resource added = Resource.Factory.create();
            dest.registerChild(PathElement.pathElement(type, entry.getName()), added);
            copy(entry, added);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:11,代码来源:ChainedTransformingDescription.java

示例5: describe

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
protected void describe(final OrderedChildTypesAttachment orderedChildTypesAttachment, final Resource resource,
                        final ModelNode address, ModelNode result, final ImmutableManagementResourceRegistration registration) {
    if(resource == null || registration.isRemote() || registration.isRuntimeOnly() || resource.isProxy() || resource.isRuntime() || registration.isAlias()) {
        return;
    }

    final Set<PathElement> children;
    final Set<PathElement> defaultChildren = new LinkedHashSet<>();
    for (String type : resource.getChildTypes()) {
        for (String value : resource.getChildrenNames(type)) {
            defaultChildren.add(PathElement.pathElement(type, value));
        }
    }
    if (comparator == null) {
        children = defaultChildren;
    } else {
        children = new TreeSet<PathElement>(comparator);
        children.addAll(defaultChildren);
    }
    result.add(createAddOperation(orderedChildTypesAttachment, address, resource, children));
    for(final PathElement element : children) {
        final Resource child = resource.getChild(element);
        final ImmutableManagementResourceRegistration childRegistration = registration.getSubModel(PathAddress.pathAddress(element));
        if (childRegistration == null) {
            ControllerLogger.ROOT_LOGGER.debugf("No MRR exists for %s", registration.getPathAddress().append(element));
        } else {
            final ModelNode childAddress = address.clone();
            childAddress.add(element.getKey(), element.getValue());
            describe(orderedChildTypesAttachment, child, childAddress, result, childRegistration);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:33,代码来源:GenericSubsystemDescribeHandler.java

示例6: testFixedRedirect

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Test
public void testFixedRedirect() throws Exception {
    PathElement newChild = PathElement.pathElement("new-style", "lalala");
    final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createInstance(PATH);
    builder.addChildRedirection(CHILD_ONE, newChild);
    TransformationDescription.Tools.register(builder.build(), transformersSubRegistration);

    final Resource resource = transformResource();
    Assert.assertNotNull(resource);
    final Resource toto = resource.getChild(PATH);
    Assert.assertNotNull(toto);

    Set<String> types = toto.getChildTypes();
    Assert.assertEquals(2, types.size());
    Assert.assertTrue(types.contains(CHILD_TWO.getKey()));
    Assert.assertTrue(types.contains(newChild.getKey()));

    Set<ResourceEntry> childEntries = toto.getChildren(CHILD_TWO.getKey());
    Assert.assertEquals(1, childEntries.size());
    Assert.assertEquals(CHILD_TWO, childEntries.iterator().next().getPathElement());

    childEntries = toto.getChildren(newChild.getKey());
    Assert.assertEquals(1, childEntries.size());
    Assert.assertEquals(newChild, childEntries.iterator().next().getPathElement());

    //Test operations get redirected
    final ModelNode addOp = Util.createAddOperation(PathAddress.pathAddress(PATH, CHILD_ONE));
    OperationTransformer.TransformedOperation txOp = transformOperation(ModelVersion.create(1), addOp.clone());
    Assert.assertFalse(txOp.rejectOperation(success()));
    final ModelNode expectedTx = Util.createAddOperation(PathAddress.pathAddress(PATH, newChild));
    Assert.assertEquals(expectedTx, txOp.getTransformedOperation());

    //Test operations in a composite get redirected
    final ModelNode composite = createComposite(addOp, addOp);
    txOp = transformOperation(ModelVersion.create(1), composite);
    Assert.assertFalse(txOp.rejectOperation(success()));
    Assert.assertEquals(createComposite(expectedTx, expectedTx), txOp.getTransformedOperation());

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:40,代码来源:ChildRedirectTestCase.java

示例7: testResourceTransformation

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Test
public void testResourceTransformation() throws Exception {
    //We probably test this elsewhere, but make sure that only real (i.e. non-alias resources get transformed)
    final Resource resource = transformResource();
    Assert.assertNotNull(resource);
    final Resource toto = resource.getChild(PATH);
    Assert.assertNotNull(toto);

    Set<String> types = toto.getChildTypes();
    Assert.assertEquals(1, types.size());
    Assert.assertTrue(types.contains(LEGACY_CHILD.getKey()));
    Set<Resource.ResourceEntry> entries = toto.getChildren(LEGACY_CHILD.getKey());
    Assert.assertEquals(1, entries.size());
    Assert.assertNotNull(toto.getChild(PathElement.pathElement(LEGACY_CHILD.getKey(), "one")));
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:16,代码来源:AliasTransformerTestCase.java

示例8: readModelRecursively

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private ModelNode readModelRecursively(Resource resource) {
    ModelNode model = new ModelNode();
    model.set(resource.getModel().clone());

    for (String type : resource.getChildTypes()) {
        for (ResourceEntry entry : resource.getChildren(type)) {
            model.get(type, entry.getName()).set(readModelRecursively(entry));
        }
    }
    return model;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:OperationTransformationTestCase.java

示例9: testWildcardRedirect

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Test
public void testWildcardRedirect() throws Exception {
    final ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createInstance(PATH);
    builder.addChildRedirection(CHILD, NEW_CHILD);
    TransformationDescription.Tools.register(builder.build(), transformersSubRegistration);

    final Resource resource = transformResource();
    Assert.assertNotNull(resource);
    final Resource toto = resource.getChild(PATH);
    Assert.assertNotNull(toto);

    Set<String> types = toto.getChildTypes();
    Assert.assertEquals(1, types.size());
    Assert.assertTrue(types.contains(NEW_CHILD.getKey()));

    Set<ResourceEntry> entries = toto.getChildren(NEW_CHILD.getKey());
    Assert.assertEquals(2, entries.size());

    PathElement[] expectedChildren = new PathElement[] {PathElement.pathElement(NEW_CHILD.getKey(), CHILD_ONE.getValue()), PathElement.pathElement(NEW_CHILD.getKey(), CHILD_TWO.getValue())};
    for (PathElement expectedChild : expectedChildren) {
        boolean found = false;
        for (ResourceEntry entry : entries) {
            if (entry.getPathElement().equals(expectedChild)) {
                found = true;
                break;
            }
        }
        Assert.assertTrue(found);
    }

    //Test operations get redirected
    final ModelNode addOp = Util.createAddOperation(PathAddress.pathAddress(PATH, CHILD));
    OperationTransformer.TransformedOperation txOp = transformOperation(ModelVersion.create(1), addOp.clone());
    Assert.assertFalse(txOp.rejectOperation(success()));
    final ModelNode expectedTx = Util.createAddOperation(PathAddress.pathAddress(PATH, NEW_CHILD));
    Assert.assertEquals(expectedTx, txOp.getTransformedOperation());

    //Test operations in a composite get redirected
    final ModelNode composite = createComposite(addOp, addOp);
    txOp = transformOperation(ModelVersion.create(1), composite);
    Assert.assertFalse(txOp.rejectOperation(success()));
    Assert.assertEquals(createComposite(expectedTx, expectedTx), txOp.getTransformedOperation());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:44,代码来源:ChildRedirectTestCase.java


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