• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CollectionNodeBuilder类的典型用法和代码示例

java 1次浏览

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

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

示例1: testExtractSegments

点赞 3

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
@Test
public void testExtractSegments() {
    // to be extracted from
    final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> builder = Builders.unkeyedListBuilder();
    builder.withNodeIdentifier(SEGMENTS_NID);
    builder.addChild(SET_SEGMENT);
    builder.addChild(SEQ_SEGMENT);

    // expected
    final List<AsNumber> sequences = new ArrayList<>();
    sequences.add(new AsNumber(1L));
    sequences.add(new AsNumber(2L));
    sequences.add(new AsNumber(3L));
    final List<Segments> expected = new ArrayList<>();
    expected.add(new SegmentsBuilder()
            .setAsSet(Lists.newArrayList(new AsNumber(11L), new AsNumber(10L))).build());
    expected.add(new SegmentsBuilder().setAsSequence(sequences).build());
    // test
    final List<Segments> actual = this.state.extractSegments(builder.build());
    assertEquals(expected.size(), actual.size());
    assertEquals(Sets.newHashSet(1, 2, 3), Sets.newHashSet(1, 3, 2));
    assertEquals(Sets.newHashSet(expected.get(0).getAsSet()), Sets.newHashSet(actual.get(0).getAsSet()));
    assertEquals(expected.get(1), actual.get(1));
}
 

开发者ID:opendaylight,
项目名称:bgpcep,
代码行数:25,
代码来源:BasePathSelectorTest.java

示例2: createCon3Node

点赞 3

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static ContainerNode createCon3Node() {

        final CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder = Builders
                .mapBuilder();
        mapBuilder.withNodeIdentifier(new NodeIdentifier(list3InChoice));

        mapBuilder.addChild(createList3Entry("k1", "val1", "valA", "valX"));
        mapBuilder.addChild(createList3Entry("k2", "val2", "valB", "valY"));

        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choiceBuilder = Builders
                .choiceBuilder();
        choiceBuilder.withNodeIdentifier(new NodeIdentifier(choiceInCon3));

        choiceBuilder.addChild(mapBuilder.build());

        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> containerBuilder = Builders
                .containerBuilder();
        containerBuilder.withNodeIdentifier(new NodeIdentifier(con3));

        containerBuilder.addChild(choiceBuilder.build());

        return containerBuilder.build();
    }
 

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

示例3: createProjectList

点赞 3

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode createProjectList(
        final ListSchemaNode projListSchemaNode) {

    final CollectionNodeBuilder<MapEntryNode, MapNode> projectMapBldr = Builders
            .mapBuilder(projListSchemaNode);

    final MapEntryNode projMapEntry1 = createProjectListEntry("Yangtools",
            "Yangtools description ...", "Leader of Yangtools",
            "Owner of Yangtools", projListSchemaNode);
    final MapEntryNode projMapEntry2 = createProjectListEntry("MD-SAL",
            "MD-SAL description ...", "Leader of MD-SAL",
            "Owner of MD-SAL", projListSchemaNode);
    final MapEntryNode projMapEntry3 = createProjectListEntry("Controller",
            "Controller description ...", "Leader of Controller",
            "Owner of Controller", projListSchemaNode);

    projectMapBldr.addChild(projMapEntry1);
    projectMapBldr.addChild(projMapEntry2);
    projectMapBldr.addChild(projMapEntry3);

    final MapNode projectMap = projectMapBldr.build();

    return projectMap;
}
 

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

示例4: createBasicContributorList

点赞 3

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode createBasicContributorList(
        final ListSchemaNode contributorListSchemaNode) {

    final CollectionNodeBuilder<MapEntryNode, MapNode> contributorMapBldr = Builders
            .mapBuilder(contributorListSchemaNode);

    final MapEntryNode contributorMapEntry1 = createContributorListEntry(
            "Leader of Yangtools", "Yangtools Leader name", "Yangtools",
            "Yangtools description ...", contributorListSchemaNode);
    final MapEntryNode contributorMapEntry2 = createContributorListEntry(
            "Leader of MD-SAL", "MD-SAL Leader name", "MD-SAL",
            "MD-SAL description ...", contributorListSchemaNode);
    final MapEntryNode contributorMapEntry3 = createContributorListEntry(
            "Leader of Controller", "Controller Leader name", "Controller",
            "Controller description ...", contributorListSchemaNode);

    contributorMapBldr.addChild(contributorMapEntry1);
    contributorMapBldr.addChild(contributorMapEntry2);
    contributorMapBldr.addChild(contributorMapEntry3);

    final MapNode contributorMap = contributorMapBldr.build();

    return contributorMap;
}
 

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

示例5: createDeviceList

点赞 3

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode createDeviceList(final ListSchemaNode deviceListSchemaNode) {

        final CollectionNodeBuilder<MapEntryNode, MapNode> devicesMapBldr = Builders.mapBuilder(deviceListSchemaNode);

        devicesMapBldr.addChild(createDeviceListEntry("dev_type_1", "typedesc1", 123456, "192.168.0.1",
                deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("dev_type_2", "typedesc2", 123457, "192.168.0.1",
                deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("dev_type_2", "typedesc3", 123457, "192.168.0.1",
                deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("dev_type_1", "typedesc2", 123458, "192.168.0.1",
                deviceListSchemaNode));
        devicesMapBldr
                .addChild(createDeviceListEntry("unknown", "unknown", 123457, "192.168.0.1", deviceListSchemaNode));

        return devicesMapBldr.build();
    }
 

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

示例6: buildInnerList

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode buildInnerList(final int index, final int elements ) {
    CollectionNodeBuilder<MapEntryNode, MapNode> innerList = ImmutableNodes.mapNodeBuilder(InnerList.QNAME);

    final String itemStr = "Item-" + String.valueOf(index) + "-";
    for (int i = 0; i < elements; i++) {
        innerList.addChild(ImmutableNodes.mapEntryBuilder()
                            .withNodeIdentifier(new NodeIdentifierWithPredicates(InnerList.QNAME, IL_NAME, i))
                            .withChild(ImmutableNodes.leafNode(IL_NAME, i))
                            .withChild(ImmutableNodes.leafNode(IL_VALUE, itemStr + String.valueOf(i)))
                            .build());
    }
    return innerList.build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:14,
代码来源:DomListBuilder.java

示例7: initInnerListItems

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode initInnerListItems(final int count) {
    final CollectionNodeBuilder<MapEntryNode, MapNode> mapEntryBuilder = ImmutableNodes
            .mapNodeBuilder(BenchmarkModel.INNER_LIST_QNAME);

    for (int i = 1; i <= count; ++i) {
        mapEntryBuilder
                .withChild(ImmutableNodes.mapEntry(BenchmarkModel.INNER_LIST_QNAME, BenchmarkModel.NAME_QNAME, i));
    }
    return mapEntryBuilder.build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:11,
代码来源:AbstractInMemoryWriteTransactionBenchmark.java

示例8: outerNode

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private DataContainerChild<?, ?> outerNode(int... ids) {
    CollectionNodeBuilder<MapEntryNode, MapNode> outer = ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME);
    for(int id: ids) {
        outer.addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, id));
    }

    return outer.build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:9,
代码来源:ShardedDOMDataBrokerDelegatingReadWriteTransactionTest.java

示例9: writeOneTopMultipleNested

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static final WriteTransactionCustomizer writeOneTopMultipleNested(
        final String topName, final String... nestedName) {
    final CollectionNodeBuilder<MapEntryNode, OrderedMapNode> nestedMapBuilder = nestedMap();
    for (final String nestedItem : nestedName) {
        nestedMapBuilder.addChild(nestedList(nestedItem).build());
    }

    final ContainerNode data = top().addChild(
            topLevelMap().addChild(
                    topLevelList(topName)
                            .addChild(nestedMapBuilder.build()).build())
                    .build()).build();

    return DatastoreTestTask.simpleWrite(TOP_LEVEL, data);
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:16,
代码来源:AbstractDataChangeListenerTest.java

示例10: outerNode

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static DataContainerChild<?, ?> outerNode(final int... ids) {
    CollectionNodeBuilder<MapEntryNode, MapNode> outer = ImmutableNodes.mapNodeBuilder(OUTER_LIST_QNAME);
    for (int id: ids) {
        outer.addChild(ImmutableNodes.mapEntry(OUTER_LIST_QNAME, ID_QNAME, id));
    }

    return outer.build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:9,
代码来源:TestModel.java

示例11: innerNode

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static DataContainerChild<?, ?> innerNode(final String... names) {
    CollectionNodeBuilder<MapEntryNode, MapNode> outer = ImmutableNodes.mapNodeBuilder(INNER_LIST_QNAME);
    for (String name: names) {
        outer.addChild(ImmutableNodes.mapEntry(INNER_LIST_QNAME, NAME_QNAME, name));
    }

    return outer.build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:9,
代码来源:TestModel.java

示例12: createFamily

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static ContainerNode createFamily() {
    final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
        familyContainerBuilder = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
                new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));

    final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder = mapNodeBuilder(CHILDREN_QNAME);

    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        firstChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        secondChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);

    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        firstGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
                FIRST_GRAND_CHILD_ID);
    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        secondGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
                SECOND_GRAND_CHILD_ID);

    firstGrandChildBuilder.withChild(ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME, FIRST_GRAND_CHILD_ID))
            .withChild(ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, FIRST_GRAND_CHILD_NAME));

    secondGrandChildBuilder.withChild(ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
            .withChild(ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, SECOND_GRAND_CHILD_NAME));

    firstChildBuilder.withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
            .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
            .withChild(mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(firstGrandChildBuilder.build()).build());

    secondChildBuilder.withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
            .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
            .withChild(mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(firstGrandChildBuilder.build()).build());

    childrenBuilder.withChild(firstChildBuilder.build());
    childrenBuilder.withChild(secondChildBuilder.build());

    return familyContainerBuilder.withChild(childrenBuilder.build()).build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:39,
代码来源:CompositeModel.java

示例13: create

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static NormalizedNode<?, ?> create() {

        // Create a list builder
        CollectionNodeBuilder<MapEntryNode, MapNode> cars =
            ImmutableMapNodeBuilder.create().withNodeIdentifier(
                new YangInstanceIdentifier.NodeIdentifier(
                    CAR_QNAME));

        // Create an entry for the car altima
        MapEntryNode altima =
            ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "altima")
                .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "altima"))
                .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("1000")))
                .build();

        // Create an entry for the car accord
        MapEntryNode honda =
            ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "accord")
                .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "accord"))
                .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("2000")))
                .build();

        cars.withChild(altima);
        cars.withChild(honda);

        return ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
            .withChild(cars.build())
            .build();

    }
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:32,
代码来源:CarsModel.java

示例14: newCarsMapNode

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static MapNode newCarsMapNode(MapEntryNode... carEntries) {
    CollectionNodeBuilder<MapEntryNode, MapNode> builder = ImmutableMapNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CAR_QNAME));
    for (MapEntryNode e : carEntries) {
        builder.withChild(e);
    }

    return builder.build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:10,
代码来源:CarsModel.java

示例15: create

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static NormalizedNode<?, ?> create() {

        // Create a list builder
        CollectionNodeBuilder<MapEntryNode, MapNode> cars =
            ImmutableMapNodeBuilder.create().withNodeIdentifier(
                new YangInstanceIdentifier.NodeIdentifier(
                    PERSON_QNAME));

        // Create an entry for the person jack
        MapEntryNode jack =
            ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jack")
                .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jack"))
                .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 100L))
                .build();

        // Create an entry for the person jill
        MapEntryNode jill =
            ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jill")
                .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jill"))
                .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 200L))
                .build();

        cars.withChild(jack);
        cars.withChild(jill);

        return ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
            .withChild(cars.build())
            .build();

    }
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:32,
代码来源:PeopleModel.java

示例16: verifyCars

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static void verifyCars(final DOMStoreReadTransaction readTx, final MapEntryNode... entries)
        throws Exception {
    final Optional<NormalizedNode<?, ?>> optional = readTx.read(CarsModel.CAR_LIST_PATH).get(5, TimeUnit.SECONDS);
    assertEquals("isPresent", true, optional.isPresent());

    final CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder = ImmutableNodes.mapNodeBuilder(
            CarsModel.CAR_QNAME);
    for (final NormalizedNode<?, ?> entry: entries) {
        listBuilder.withChild((MapEntryNode) entry);
    }

    assertEquals("Car list node", listBuilder.build(), optional.get());
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:14,
代码来源:DistributedDataStoreRemotingIntegrationTest.java

示例17: addAsPath

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static void addAsPath(final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> dataContBuilder,
        final UnkeyedListEntryNode segment) {
    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> asPathContBuilder
            = ImmutableContainerNodeSchemaAwareBuilder.create();
    asPathContBuilder.withNodeIdentifier(new NodeIdentifier(AS_PATH_Q_NAME));

    final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> segments
            = ImmutableUnkeyedListNodeBuilder.create();
    segments.withNodeIdentifier(SEGMENTS_NID);
    segments.addChild(segment);
    asPathContBuilder.addChild(segments.build());
    dataContBuilder.addChild(asPathContBuilder.build());
}
 

开发者ID:opendaylight,
项目名称:bgpcep,
代码行数:14,
代码来源:BasePathSelectorTest.java

示例18: createPathInput

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static ContainerNode createPathInput(final UnkeyedListEntryNode child) {
    final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> segB = Builders.unkeyedListBuilder();
    segB.withNodeIdentifier(SEGMENTS_NID);
    if (child != null) {
        segB.addChild(child);
    }
    segB.addChild(SET_SEGMENT).addChild(SEQ_SEGMENT);
    return Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(ATTRS_EXTENSION_Q))
        .addChild(Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(QName.create(ATTRS_EXTENSION_Q, "as-path").intern()))
            .addChild(segB.build()).build()).build();
}
 

开发者ID:opendaylight,
项目名称:bgpcep,
代码行数:12,
代码来源:ExportPolicyTest.java

示例19: initInnerListItems

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode initInnerListItems(final int count) {
    final CollectionNodeBuilder<MapEntryNode, MapNode> mapEntryBuilder = ImmutableNodes
        .mapNodeBuilder(BenchmarkModel.INNER_LIST_QNAME);

    for (int i = 1; i <= count; ++i) {
        mapEntryBuilder
            .withChild(ImmutableNodes.mapEntry(BenchmarkModel.INNER_LIST_QNAME, BenchmarkModel.NAME_QNAME, i));
    }

    return mapEntryBuilder.build();
}
 

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

示例20: startUnkeyedList

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
@Override
public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) {
    checkDataNodeContainer();

    final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> builder =
            UNKNOWN_SIZE == childSizeHint ? ImmutableUnkeyedListNodeBuilder.create()
                    : ImmutableUnkeyedListNodeBuilder.create(childSizeHint);
    enter(builder.withNodeIdentifier(name));
}
 

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

示例21: startMapNode

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
@Override
public void startMapNode(final NodeIdentifier name, final int childSizeHint) {
    checkDataNodeContainer();

    final CollectionNodeBuilder<MapEntryNode, MapNode> builder = UNKNOWN_SIZE == childSizeHint
            ? ImmutableMapNodeBuilder.create() : ImmutableMapNodeBuilder.create(childSizeHint);
    enter(builder.withNodeIdentifier(name));
}
 

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

示例22: startOrderedMapNode

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
@Override
public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) {
    checkDataNodeContainer();

    final CollectionNodeBuilder<MapEntryNode, OrderedMapNode> builder = UNKNOWN_SIZE == childSizeHint
            ? ImmutableOrderedMapNodeBuilder.create() : ImmutableOrderedMapNodeBuilder.create(childSizeHint);
    enter(builder.withNodeIdentifier(name));
}
 

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

示例23: create

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static CollectionNodeBuilder<MapEntryNode, MapNode> create(final MapNode node) {
    if (!(node instanceof ImmutableMapNode)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableMapNodeBuilder((ImmutableMapNode) node);
}
 

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

示例24: create

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static CollectionNodeBuilder<MapEntryNode, OrderedMapNode> create(final MapNode node) {
    if (!(node instanceof ImmutableOrderedMapNode)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableOrderedMapNodeBuilder((ImmutableOrderedMapNode) node);
}
 

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

示例25: create

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> create(final UnkeyedListNode node) {
    if (!(node instanceof ImmutableUnkeyedListNode)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableUnkeyedListNodeBuilder((ImmutableUnkeyedListNode) node);
}
 

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

示例26: create

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static CollectionNodeBuilder<MapEntryNode, OrderedMapNode> create(final ListSchemaNode schema,
    final MapNode node) {
    if (!(node instanceof ImmutableOrderedMapNode)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableOrderedMapNodeSchemaAwareBuilder(schema, (ImmutableOrderedMapNode) node);
}
 

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

示例27: create

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static CollectionNodeBuilder<MapEntryNode, MapNode> create(final ListSchemaNode schema, final MapNode node) {
    if (!(node instanceof ImmutableMapNode)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableMapNodeSchemaAwareBuilder(schema, (ImmutableMapNode) node);
}
 

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

示例28: createDevTypeList

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode createDevTypeList(final ListSchemaNode devTypeListSchemaNode) {

        final CollectionNodeBuilder<MapEntryNode, MapNode> devTypeMapBldr = Builders.mapBuilder(devTypeListSchemaNode);

        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type1_1", "dev_type2_1", "dev_type3_1", "typedesc1",
                devTypeListSchemaNode));
        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type1_2", "dev_type2_2", "dev_type3_2", "typedesc2",
                devTypeListSchemaNode));
        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type1_3", "dev_type2_3", "dev_type3_3", "typedesc3",
                devTypeListSchemaNode));

        return devTypeMapBldr.build();
    }
 

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

示例29: createDeviceList

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode createDeviceList(final ListSchemaNode deviceListSchemaNode) {

        final CollectionNodeBuilder<MapEntryNode, MapNode> devicesMapBldr = Builders.mapBuilder(deviceListSchemaNode);

        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_1", "dev_type2_1", "dev_type3_1", "typedesc1", 123456,
                "192.168.0.1", deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_2", "dev_type2_2", "dev_type3_2", "typedesc1", 123457,
                "192.168.0.1", deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_1", "dev_type2_2", "dev_type3_3", "typedesc2", 123458,
                "192.168.0.1", deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("unk11", "unk22", "unk33", "unk_desc2", 123457, "192.168.0.1",
                deviceListSchemaNode));

        return devicesMapBldr.build();
    }
 

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

示例30: createDevice2List

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static MapNode createDevice2List(final ListSchemaNode deviceListSchemaNode) {

        final CollectionNodeBuilder<MapEntryNode, MapNode> devicesMapBldr = Builders.mapBuilder(deviceListSchemaNode);

        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_3", "dev_type2_3", "dev_type3_3", "typedesc3", 123459,
                "192.168.0.1", deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_3", "dev_type2_3", "dev_type3_3", "typedesc2", 123460,
                "192.168.0.1", deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_3", "dev_type2_2", "dev_type3_1", "typedesc1", 123461,
                "192.168.0.1", deviceListSchemaNode));
        devicesMapBldr.addChild(createDeviceListEntry("unk1", "unk2", "unk3", "unk_desc", 123462, "192.168.0.1",
                deviceListSchemaNode));

        return devicesMapBldr.build();
    }
 

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

示例31: immutableMapNodeBuilderTest

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
@Test
public void immutableMapNodeBuilderTest() {
    final LinkedList<MapEntryNode> mapEntryNodeColl = new LinkedList<>();
    mapEntryNodeColl.add(LIST_MAIN_CHILD_3);
    final CollectionNodeBuilder<MapEntryNode, MapNode> collectionNodeBuilder = ImmutableMapNodeBuilder.create(1);
    assertNotNull(collectionNodeBuilder);
    collectionNodeBuilder.withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST);
    collectionNodeBuilder.withValue(mapEntryNodeColl);
    final MapNode mapNode = collectionNodeBuilder.build();
    final MapNode mapNodeSchemaAware = ImmutableMapNodeSchemaAwareBuilder.create(list, getImmutableMapNode())
            .build();
    assertNotNull(mapNodeSchemaAware);
    assertNotNull(Builders.mapBuilder(mapNode));
}
 

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

示例32: topLevelMap

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
protected static CollectionNodeBuilder<MapEntryNode, MapNode> topLevelMap() {
    return ImmutableNodes.mapNodeBuilder(TopLevelList.QNAME);
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:4,
代码来源:AbstractDataChangeListenerTest.java

示例33: nestedMap

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
protected static CollectionNodeBuilder<MapEntryNode, OrderedMapNode> nestedMap() {
    return Builders.orderedMapBuilder().withNodeIdentifier(new NodeIdentifier(NestedList.QNAME));
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:4,
代码来源:AbstractDataChangeListenerTest.java

示例34: createFamily

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static ContainerNode createFamily() {
    final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
        familyContainerBuilder = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
                    new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));

    final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
            mapNodeBuilder(CHILDREN_QNAME);

    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        firstChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        secondChildBuilder = mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);

    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        firstGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
                FIRST_GRAND_CHILD_ID);
    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
        secondGrandChildBuilder = mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
                SECOND_GRAND_CHILD_ID);

    firstGrandChildBuilder
            .withChild(
                    ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
                            FIRST_GRAND_CHILD_ID)).withChild(
            ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
                    FIRST_GRAND_CHILD_NAME));

    secondGrandChildBuilder.withChild(
            ImmutableNodes
                    .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
            .withChild(
                    ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
                            SECOND_GRAND_CHILD_NAME));

    firstChildBuilder
            .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
            .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
            .withChild(
                    mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
                            firstGrandChildBuilder.build()).build());


    secondChildBuilder
            .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
            .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
            .withChild(
                    mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
                            firstGrandChildBuilder.build()).build());

    childrenBuilder.withChild(firstChildBuilder.build());
    childrenBuilder.withChild(secondChildBuilder.build());

    return familyContainerBuilder.withChild(childrenBuilder.build()).build();
}
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:55,
代码来源:TestModel.java

示例35: ensureListExists

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private CheckedFuture<Void, TransactionCommitFailedException> ensureListExists() {

        final CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder = ImmutableNodes.mapNodeBuilder(ID_INT);

        // hardcoded initial list population for parallel produce-transactions testing on multiple nodes
        for (int i = 1; i < MAX_PREFIX; i++) {
            mapBuilder.withChild(
                    ImmutableNodes.mapEntryBuilder(ID_INT, ID, PREFIX_TEMPLATE + i)
                            .withChild(ImmutableNodes.mapNodeBuilder(ITEM).build())
                            .build());
        }
        final MapNode mapNode = mapBuilder.build();

        final ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(ID_INTS))
                .withChild(mapNode)
                .build();

        final DOMDataTreeProducer producer = domDataTreeService.createProducer(Collections.singleton(
                new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY)));

        final DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(false);

        final DOMDataTreeWriteCursor cursor =
                tx.createCursor(new DOMDataTreeIdentifier(
                        LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY));

        cursor.merge(containerNode.getIdentifier(), containerNode);
        cursor.close();

        final CheckedFuture<Void, TransactionCommitFailedException> future = tx.submit();
        Futures.addCallback(future, new FutureCallback<Void>() {
            @Override
            public void onSuccess(@Nullable final Void result) {
                try {
                    LOG.debug("Closing producer for initial list.");
                    producer.close();
                } catch (DOMDataTreeProducerException e) {
                    LOG.warn("Error while closing producer.", e);
                }
            }

            @Override
            public void onFailure(final Throwable throwable) {
                //NOOP handled by the caller of this method.
            }
        });
        return future;
    }
 

开发者ID:hashsdn,
项目名称:hashsdn-controller,
代码行数:50,
代码来源:PrefixShardHandler.java

示例36: exportedAttributes

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
ContainerNode exportedAttributes(final ContainerNode attributes, final Long localAs) {
    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> containerBuilder = Builders.containerBuilder();
    containerBuilder.withNodeIdentifier(attributes.getIdentifier());

    // First filter out non-transitive attributes
    // FIXME: removes MULTI_EXIT_DISC, too.
    spliceTransitives(containerBuilder, attributes);

    final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> segmentsBuilder = Builders.unkeyedListBuilder();
    segmentsBuilder.withNodeIdentifier(this.asPathSegments);

    final Optional<NormalizedNode<?, ?>> maybeOldAsSegments = NormalizedNodes.findNode(attributes, this.asPathContainer, this.asPathSegments);
    if (maybeOldAsSegments.isPresent() && !((UnkeyedListNode) maybeOldAsSegments.get()).getValue().isEmpty()) {

        /*
         * We need to check the first segment.
         * If it has as-set then new as-sequence with local AS is prepended.
         * If it has as-sequence, we may add local AS when it has less than 255 elements.
         * Otherwise we need to create new as-sequence for local AS.
         */

        final ListNodeBuilder<Object,LeafSetEntryNode<Object>> asSequenceBuilder = Builders.orderedLeafSetBuilder();
        // add local AS
        asSequenceBuilder.withNodeIdentifier(this.asPathSequence).addChild(Builders.leafSetEntryBuilder().withNodeIdentifier(
            new NodeWithValue<>(this.asNumberQname, localAs)).withValue(localAs).build());

        final Iterator<UnkeyedListEntryNode> oldAsSegments = ((UnkeyedListNode) maybeOldAsSegments.get()).getValue().iterator();
        final UnkeyedListEntryNode firstSegment = oldAsSegments.next();
        final LeafSetNode<?> reusableAsSeq = reusableSegment(firstSegment);
        // first segment contains as-sequence with less then 255 elements and it's append to local AS
        if (reusableAsSeq != null) {
            for (final LeafSetEntryNode<?> child : reusableAsSeq.getValue())  {
                asSequenceBuilder.withChild(Builders.leafSetEntryBuilder().withNodeIdentifier(new NodeWithValue<>(
                        this.asNumberQname, child.getValue())).withValue(child.getValue()).build());
            }
        }
        // Add the new first segment
        segmentsBuilder.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(this.asPathSegments).withChild(asSequenceBuilder.build()).build());

        // When first segment contains as-set or full as-sequence, append it
        if (reusableAsSeq == null) {
            segmentsBuilder.withChild(firstSegment);
        }

        // Add all subsequent segments
        while (oldAsSegments.hasNext()) {
            segmentsBuilder.withChild(oldAsSegments.next());
        }
    } else {
        // Segments are completely empty, create a completely new AS_PATH container with
        // a single entry
        segmentsBuilder.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(this.asPathSegments).withChild(
            Builders.orderedLeafSetBuilder().withNodeIdentifier(this.asPathSequence).addChild(
                Builders.leafSetEntryBuilder().withNodeIdentifier(new NodeWithValue<>(this.asNumberQname, localAs))
                .withValue(localAs).build()).build()).build());
    }

    containerBuilder.withChild(Builders.containerBuilder().withNodeIdentifier(this.asPathContainer).withChild(segmentsBuilder.build()).build());
    return containerBuilder.build();
}
 

开发者ID:opendaylight,
项目名称:bgpcep,
代码行数:61,
代码来源:AttributeOperations.java

示例37: lst12Node

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
private static DataContainerChild<? extends PathArgument, ?> lst12Node() {
    CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> lst12Builder = Builders.unkeyedListBuilder()
            .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lst12")));
    lst12Builder.withChild(lst12Entry1Node());
    return lst12Builder.build();
}
 

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

示例38: mapNodeBuilder

点赞 2

import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; //导入依赖的package包/类
public static CollectionNodeBuilder<MapEntryNode, MapNode> mapNodeBuilder() {
    return ImmutableMapNodeBuilder.create();
}
 

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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)