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


Java ContainerSchemaNode类代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode的典型用法代码示例。如果您正苦于以下问题:Java ContainerSchemaNode类的具体用法?Java ContainerSchemaNode怎么用?Java ContainerSchemaNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createInnerAttribute

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
private static AttributeIfc createInnerAttribute(
        final DataSchemaNode dataSchemaNode,
        final TypeProviderWrapper typeProviderWrapper, final String packageName) {
    final Class<? extends DataSchemaNode> type = isAllowedType(dataSchemaNode);

    if (type.equals(LeafSchemaNode.class)) {
        return new JavaAttribute((LeafSchemaNode) dataSchemaNode,
                typeProviderWrapper);
    } else if (type.equals(ListSchemaNode.class)) {
        return ListAttribute.create((ListSchemaNode) dataSchemaNode,
                typeProviderWrapper, packageName);
    } else if (type.equals(LeafListSchemaNode.class)) {
        return ListAttribute.create((LeafListSchemaNode) dataSchemaNode,
                typeProviderWrapper);
    } else if (type.equals(ContainerSchemaNode.class)) {
        return TOAttribute.create((ContainerSchemaNode) dataSchemaNode,
                typeProviderWrapper, packageName);
    }

    throw new IllegalStateException("This should never happen");
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:22,代码来源:TOAttribute.java

示例2: getReturnTypeAttribute

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
private static AttributeIfc getReturnTypeAttribute(final DataSchemaNode child, final TypeProviderWrapper typeProviderWrapper,
        final String packageName) {
    if (child instanceof LeafSchemaNode) {
        LeafSchemaNode leaf = (LeafSchemaNode) child;
        return new JavaAttribute(leaf, typeProviderWrapper);
    } else if (child instanceof ContainerSchemaNode) {
        ContainerSchemaNode container = (ContainerSchemaNode) child;
        TOAttribute toAttribute = TOAttribute.create(container, typeProviderWrapper, packageName);
        return toAttribute;
    } else if (child instanceof ListSchemaNode) {
        return ListAttribute.create((ListSchemaNode) child, typeProviderWrapper, packageName);
    } else if (child instanceof LeafListSchemaNode) {
        return ListAttribute.create((LeafListSchemaNode) child, typeProviderWrapper);
    } else {
        throw new IllegalStateException("Unknown output data node " + child + " for rpc");
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:RuntimeBeanEntry.java

示例3: fromDataSchemaNode

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
public static DataNormalizationOperation<?> fromDataSchemaNode(final DataSchemaNode potential) {
    if (potential instanceof ContainerSchemaNode) {
        return new ContainerNormalization((ContainerSchemaNode) potential);
    } else if (potential instanceof ListSchemaNode) {

        return fromListSchemaNode((ListSchemaNode) potential);
    } else if (potential instanceof LeafSchemaNode) {
        return new LeafNormalization((LeafSchemaNode) potential);
    } else if (potential instanceof ChoiceSchemaNode) {
        return new ChoiceNodeNormalization((ChoiceSchemaNode) potential);
    } else if (potential instanceof LeafListSchemaNode) {
        return fromLeafListSchemaNode((LeafListSchemaNode) potential);
    } else if (potential instanceof AnyXmlSchemaNode) {
        return new AnyXmlNormalization( (AnyXmlSchemaNode) potential);
    }
    return null;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DataNormalizationOperation.java

示例4: testAugmentInUsesResolving

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
@Test
public void testAugmentInUsesResolving() throws Exception {
    final SchemaContext context = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-uses")
        .toURI());
    assertEquals(1, context.getModules().size());

    final Module test = context.getModules().iterator().next();
    final DataNodeContainer links = (DataNodeContainer) test.getDataChildByName(QName.create(test.getQNameModule(),
            "links"));
    final DataNodeContainer link = (DataNodeContainer) links.getDataChildByName(QName.create(test.getQNameModule(),
            "link"));
    final DataNodeContainer nodes = (DataNodeContainer) link.getDataChildByName(QName.create(test.getQNameModule(),
            "nodes"));
    final ContainerSchemaNode node = (ContainerSchemaNode) nodes.getDataChildByName(QName.create(
            test.getQNameModule(), "node"));
    final Set<AugmentationSchemaNode> augments = node.getAvailableAugmentations();
    assertEquals(1, augments.size());
    assertEquals(1, node.getChildNodes().size());
    final LeafSchemaNode id = (LeafSchemaNode) node.getDataChildByName(QName.create(test.getQNameModule(), "id"));
    assertTrue(id.isAugmenting());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:22,代码来源:AugmentTest.java

示例5: init

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
@BeforeClass
public static void init() throws XMLStreamException, URISyntaxException, IOException, ParserConfigurationException,
        SAXException {
    schemaContext = YangParserTestUtils.parseYangResourceDirectory("/yang-modeled-anyxml/yang");
    final Module bazModule = schemaContext.findModules("baz").iterator().next();
    final ContainerSchemaNode bazCont = (ContainerSchemaNode) bazModule.getDataChildByName(
            QName.create(bazModule.getQNameModule(), "baz"));
    assertNotNull(bazCont);

    final InputStream resourceAsStream = YangModeledAnyXmlSupportTest.class.getResourceAsStream(
            "/yang-modeled-anyxml/xml/baz.xml");

    final XMLInputFactory factory = XMLInputFactory.newInstance();
    final XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);

    final NormalizedNodeResult result = new NormalizedNodeResult();

    final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);

    final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, schemaContext, bazCont);
    xmlParser.parse(reader);

    assertNotNull(result.getResult());
    assertTrue(result.getResult() instanceof ContainerNode);
    data = (ContainerNode) result.getResult();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:27,代码来源:YangModeledAnyXmlSupportTest.java

示例6: emitContainer

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
private void emitContainer(final ContainerSchemaNode child) {
    super.writer.startContainerNode(child.getQName());
    child.getMustConstraints().forEach(this::emitMust);
    child.getWhenCondition().ifPresent(this::emitWhen);
    // FIXME: BUG-2444: whenNode //:Optional
    // FIXME: BUG-2444: *(ifFeatureNode )
    emitPresenceNode(child.isPresenceContainer());
    emitConfigNode(child.isConfiguration());
    emitDocumentedNode(child);
    emitDataNodeContainer(child);
    emitUnknownStatementNodes(child.getUnknownSchemaNodes());
    emitNotifications(child.getNotifications());
    emitActions(child.getActions());
    super.writer.endNode();

}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:17,代码来源:SchemaContextEmitter.java

示例7: fromDataSchemaNode

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
static InstanceIdToNodes<?> fromDataSchemaNode(final DataSchemaNode potential) {
    if (potential instanceof ContainerSchemaNode) {
        return new InstanceIdToCompositeNodes.ContainerTransformation((ContainerSchemaNode) potential);
    } else if (potential instanceof ListSchemaNode) {
        return fromListSchemaNode((ListSchemaNode) potential);
    } else if (potential instanceof LeafSchemaNode) {
        return new InstanceIdToSimpleNodes.LeafNormalization((LeafSchemaNode) potential);
    } else if (potential instanceof ChoiceSchemaNode) {
        return new InstanceIdToCompositeNodes.ChoiceNodeNormalization((ChoiceSchemaNode) potential);
    } else if (potential instanceof LeafListSchemaNode) {
        return fromLeafListSchemaNode((LeafListSchemaNode) potential);
    } else if (potential instanceof AnyXmlSchemaNode) {
        return new AnyXmlNormalization((AnyXmlSchemaNode) potential);
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:17,代码来源:InstanceIdToNodes.java

示例8: fromDataSchemaNode

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
@Nullable public static DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
    if (potential instanceof ContainerSchemaNode) {
        return new ContainerContextNode((ContainerSchemaNode) potential);
    } else if (potential instanceof ListSchemaNode) {
        return fromListSchemaNode((ListSchemaNode) potential);
    } else if (potential instanceof LeafSchemaNode) {
        return new LeafContextNode((LeafSchemaNode) potential);
    } else if (potential instanceof ChoiceSchemaNode) {
        return new ChoiceNodeContextNode((ChoiceSchemaNode) potential);
    } else if (potential instanceof LeafListSchemaNode) {
        return fromLeafListSchemaNode((LeafListSchemaNode) potential);
    } else if (potential instanceof AnyXmlSchemaNode) {
        return new AnyXmlContextNode((AnyXmlSchemaNode) potential);
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:17,代码来源:DataSchemaContextNode.java

示例9: testAddedByUsesLeafTypeQName

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
@Test
public void testAddedByUsesLeafTypeQName() throws Exception {
    final SchemaContext loadModules = TestUtils.loadModules(getClass().getResource("/added-by-uses-leaf-test")
            .toURI());
    assertEquals(2, loadModules.getModules().size());
    foo = TestUtils.findModule(loadModules, "foo").get();
    final Module imp = TestUtils.findModule(loadModules, "import-module").get();

    final LeafSchemaNode leaf = (LeafSchemaNode) ((ContainerSchemaNode) foo.getDataChildByName(QName.create(
            foo.getQNameModule(), "my-container")))
            .getDataChildByName(QName.create(foo.getQNameModule(), "my-leaf"));

    TypeDefinition<?> impType = null;
    final Set<TypeDefinition<?>> typeDefinitions = imp.getTypeDefinitions();
    for (final TypeDefinition<?> typeDefinition : typeDefinitions) {
        if (typeDefinition.getQName().getLocalName().equals("imp-type")) {
            impType = typeDefinition;
            break;
        }
    }

    assertNotNull(impType);
    assertEquals(leaf.getType().getQName(), impType.getQName());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:GroupingTest.java

示例10: initDataTree

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
private static void initDataTree() {
    inMemoryDataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL, context);

    final DataTreeModification initialDataTreeModification = inMemoryDataTree
            .takeSnapshot().newModification();

    final ContainerSchemaNode odlProjContSchemaNode = (ContainerSchemaNode) valModule
            .getDataChildByName(odl);

    final ContainerNode odlProjectContainer = createOdlContainer(odlProjContSchemaNode);

    final YangInstanceIdentifier path = YangInstanceIdentifier.of(odl);
    initialDataTreeModification.write(path, odlProjectContainer);
    initialDataTreeModification.ready();

    final DataTreeCandidate writeContributorsCandidate = inMemoryDataTree
            .prepare(initialDataTreeModification);
    inMemoryDataTree.commit(writeContributorsCandidate);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:20,代码来源:DataTreeCandidateValidatorTest.java

示例11: verifySingleQuotesExpression

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
private static void verifySingleQuotesExpression(final SchemaContext schemaContext) {
    final DataSchemaNode dataNodeBar = schemaContext.getDataChildByName(QName.create("foo", "2016-07-11", "bar"));
    assertTrue(dataNodeBar instanceof ContainerSchemaNode);
    final ContainerSchemaNode bar = (ContainerSchemaNode) dataNodeBar;
    final RevisionAwareXPath whenCondition = bar.getWhenCondition().get();
    assertEquals("/foo != 'bar'", whenCondition.toString());

    final Set<TypeDefinition<?>> typeDefinitions = schemaContext.getTypeDefinitions();
    assertEquals(1, typeDefinitions.size());
    final TypeDefinition<?> type = typeDefinitions.iterator().next();
    assertTrue(type instanceof StringTypeDefinition);
    final List<PatternConstraint> patternConstraints = ((StringTypeDefinition) type).getPatternConstraints();
    assertEquals(1, patternConstraints.size());
    final PatternConstraint pattern = patternConstraints.iterator().next();
    assertEquals("^'.*'$", pattern.getJavaPatternString());
    assertTrue(Pattern.compile(pattern.getJavaPatternString()).matcher("'enclosed string in quotes'").matches());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:Bug6180Test.java

示例12: createOdlContainer

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
private static ContainerNode createOdlContainer(
        final ContainerSchemaNode container) {

    final ListSchemaNode projListSchemaNode = (ListSchemaNode) container
            .getDataChildByName(project);

    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> odlProjectContainerBldr = Builders
            .containerBuilder(container);

    final MapNode projectMap = createProjectList(projListSchemaNode);
    odlProjectContainerBldr.addChild(projectMap);

    final ContainerNode odlProjectContainer = odlProjectContainerBldr
            .build();

    return odlProjectContainer;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:DataTreeCandidateValidatorTest.java

示例13: addCompositeChild

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
AbstractNodeDataWithSchema addCompositeChild(final DataSchemaNode schema) {
    final CompositeNodeDataWithSchema newChild;

    if (schema instanceof ListSchemaNode) {
        newChild = new ListNodeDataWithSchema(schema);
    } else if (schema instanceof LeafListSchemaNode) {
        newChild = new LeafListNodeDataWithSchema(schema);
    } else if (schema instanceof ContainerSchemaNode) {
        newChild = new ContainerNodeDataWithSchema(schema);
    } else if (schema instanceof YangModeledAnyXmlSchemaNode) {
        newChild = new YangModeledAnyXmlNodeDataWithSchema((YangModeledAnyXmlSchemaNode)schema);
    } else {
        newChild = new CompositeNodeDataWithSchema(schema);
    }

    addCompositeChild(newChild);
    return newChild;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:19,代码来源:CompositeNodeDataWithSchema.java

示例14: initDataTree

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
private static void initDataTree() {

        inMemoryDataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL, context);

        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();

        final ContainerSchemaNode chipsListContSchemaNode = (ContainerSchemaNode) mainModule.getDataChildByName(chips);
        final ContainerNode chipsContainer = createChipsContainer(chipsListContSchemaNode);
        final YangInstanceIdentifier path1 = YangInstanceIdentifier.of(chips);
        initialDataTreeModification.write(path1, chipsContainer);

        final ContainerSchemaNode devTypesListContSchemaNode = (ContainerSchemaNode) mainModule
                .getDataChildByName(deviceTypeStr);
        final ContainerNode deviceTypesContainer = createDevTypeStrContainer(devTypesListContSchemaNode);
        final YangInstanceIdentifier path2 = YangInstanceIdentifier.of(deviceTypeStr);
        initialDataTreeModification.write(path2, deviceTypesContainer);

        initialDataTreeModification.ready();
        final DataTreeCandidate writeChipsCandidate = inMemoryDataTree.prepare(initialDataTreeModification);

        inMemoryDataTree.commit(writeChipsCandidate);

        LOG.debug("{}", inMemoryDataTree);
    }
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:DataTreeCandidateValidatorTest2.java

示例15: testParseList

import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; //导入依赖的package包/类
@Test
public void testParseList() throws Exception {
    final SchemaContext context = TestUtils.loadModules(getClass().getResource("/bugs/bug394-retest").toURI());
    final Module bug394 = TestUtils.findModule(context, "bug394").get();
    final Module bug394_ext = TestUtils.findModule(context, "bug394-ext").get();

    final ContainerSchemaNode logrecords = (ContainerSchemaNode) bug394.getDataChildByName(QName.create(
            bug394.getQNameModule(), "logrecords"));
    assertNotNull(logrecords);

    final List<UnknownSchemaNode> nodes = logrecords.getUnknownSchemaNodes();
    assertEquals(2, nodes.size());

    final List<ExtensionDefinition> extensions = bug394_ext.getExtensionSchemaNodes();
    assertEquals(3, extensions.size());

    assertTrue(extensions.contains(nodes.get(0).getExtensionDefinition()));
    assertTrue(extensions.contains(nodes.get(1).getExtensionDefinition()));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:20,代码来源:Bug394Test.java


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