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


Java TreeType类代码示例

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


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

示例1: InMemoryDOMDataStore

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
public InMemoryDOMDataStore(final String name, final LogicalDatastoreType type,
        final ExecutorService dataChangeListenerExecutor,
        final int maxDataChangeListenerQueueSize, final boolean debugTransactions) {
    this.name = Preconditions.checkNotNull(name);
    this.dataChangeListenerExecutor = Preconditions.checkNotNull(dataChangeListenerExecutor);
    this.debugTransactions = debugTransactions;

    dataChangeListenerNotificationManager =
            new QueuedNotificationManager<>(this.dataChangeListenerExecutor,
                    DCL_NOTIFICATION_MGR_INVOKER, maxDataChangeListenerQueueSize,
                    "DataChangeListenerQueueMgr");
    changePublisher = new InMemoryDOMStoreTreeChangePublisher(this.dataChangeListenerExecutor, maxDataChangeListenerQueueSize);

    switch (type) {
        case CONFIGURATION:
            dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
            break;
        case OPERATIONAL:
            dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
            break;
        default:
            throw new IllegalArgumentException("Data store " + type + " not supported");
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:InMemoryDOMDataStore.java

示例2: DistributedShardChangePublisher

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
public DistributedShardChangePublisher(final DataStoreClient client,
                                       final AbstractDataStore distributedDataStore,
                                       final DOMDataTreeIdentifier prefix,
                                       final Map<DOMDataTreeIdentifier, ChildShardContext> childShards) {
    this.distributedDataStore = distributedDataStore;
    // TODO keeping the whole dataTree thats contained in subshards doesn't seem like a good idea
    // maybe the whole listener logic would be better in the backend shards where we have direct access to the
    // dataTree and wont have to cache it redundantly.
    this.dataTree = InMemoryDataTreeFactory.getInstance().create(
            TreeType.valueOf(prefix.getDatastoreType().name()), prefix.getRootIdentifier());

    dataTree.setSchemaContext(distributedDataStore.getActorContext().getSchemaContext());

    this.shardPath = prefix.getRootIdentifier();
    this.childShards = childShards;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:DistributedShardChangePublisher.java

示例3: createSnapshot

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
private static ShardSnapshotState createSnapshot() {
    final TipProducingDataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
    dataTree.setSchemaContext(SchemaContextHelper.select(SchemaContextHelper.CARS_YANG,
            SchemaContextHelper.PEOPLE_YANG));

    DataTreeSnapshot snapshot = dataTree.takeSnapshot();

    DataTreeModification modification = snapshot.newModification();

    modification.merge(CarsModel.BASE_PATH, CarsModel.create());
    modification.merge(PeopleModel.BASE_PATH, PeopleModel.create());
    modification.ready();
    dataTree.commit(dataTree.prepare(modification));

    return new ShardSnapshotState(new MetadataShardDataTreeSnapshot(dataTree.takeSnapshot().readNode(
            YangInstanceIdentifier.EMPTY).get()));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:ShardRecoveryCoordinatorTest.java

示例4: setUp

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);

    dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
    dataTree.setSchemaContext(SCHEMA_CONTEXT);

    realModification = dataTree.takeSnapshot().newModification();
    proxyModification = Reflection.newProxy(DataTreeModification.class, (proxy, method, args) -> {
        try {
            method.invoke(mockModification, args);
            return method.invoke(realModification, args);
        } catch (InvocationTargetException e) {
            throw e.getCause();
        }
    });

    pruningDataTreeModification = new PruningDataTreeModification(proxyModification, dataTree, SCHEMA_CONTEXT);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:PruningDataTreeModificationTest.java

示例5: testWriteRootNode

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
@Test
public void testWriteRootNode() throws Exception {
    final DataTree localDataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
    localDataTree.setSchemaContext(SCHEMA_CONTEXT);

    DataTreeModification mod = localDataTree.takeSnapshot().newModification();
    mod.write(CarsModel.BASE_PATH, CarsModel.create());
    mod.ready();
    localDataTree.validate(mod);
    localDataTree.commit(localDataTree.prepare(mod));

    NormalizedNode<?, ?> normalizedNode = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY).get();
    pruningDataTreeModification.write(YangInstanceIdentifier.EMPTY, normalizedNode);
    dataTree.commit(getCandidate());

    Optional<NormalizedNode<?, ?>> actual = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY);
    assertEquals("Root present", true, actual.isPresent());
    assertEquals("Root node", normalizedNode, actual.get());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:PruningDataTreeModificationTest.java

示例6: testWriteRootNodeWithInvalidChild

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
@Test
public void testWriteRootNodeWithInvalidChild() throws Exception {
    final Shard mockShard = Mockito.mock(Shard.class);

    ShardDataTree shardDataTree = new ShardDataTree(mockShard, SCHEMA_CONTEXT, TreeType.CONFIGURATION);
    NormalizedNode<?, ?> root = shardDataTree.readNode(YangInstanceIdentifier.EMPTY).get();

    NormalizedNode<?, ?> normalizedNode = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(root.getNodeType())).withChild(
                    ImmutableNodes.containerNode(AUG_CONTAINER)).build();
    pruningDataTreeModification.write(YangInstanceIdentifier.EMPTY, normalizedNode);
    dataTree.commit(getCandidate());

    Optional<NormalizedNode<?, ?>> actual = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY);
    assertEquals("Root present", true, actual.isPresent());
    assertEquals("Root node", root, actual.get());

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

示例7: from

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
public static ModificationApplyOperation from(final DataSchemaNode schemaNode,
        final DataTreeConfiguration treeConfig) {
    if (treeConfig.getTreeType() == TreeType.CONFIGURATION) {
        Preconditions.checkArgument(schemaNode.isConfiguration(),
            "Supplied %s does not belongs to configuration tree.", schemaNode.getPath());
    }
    if (schemaNode instanceof ContainerSchemaNode) {
        final ContainerSchemaNode containerSchema = (ContainerSchemaNode) schemaNode;
        if (containerSchema.isPresenceContainer()) {
            return new PresenceContainerModificationStrategy(containerSchema, treeConfig);
        }

        return new StructuralContainerModificationStrategy(containerSchema, treeConfig);
    } else if (schemaNode instanceof ListSchemaNode) {
        return fromListSchemaNode((ListSchemaNode) schemaNode, treeConfig);
    } else if (schemaNode instanceof ChoiceSchemaNode) {
        return new ChoiceModificationStrategy((ChoiceSchemaNode) schemaNode, treeConfig);
    } else if (schemaNode instanceof LeafListSchemaNode) {
        return fromLeafListSchemaNode((LeafListSchemaNode) schemaNode, treeConfig);
    } else if (schemaNode instanceof LeafSchemaNode) {
        return new LeafModificationStrategy((LeafSchemaNode) schemaNode);
    }
    throw new IllegalArgumentException("Not supported schema node type for " + schemaNode.getClass());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:SchemaAwareApplyOperation.java

示例8: forTree

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
static CaseEnforcer forTree(final CaseSchemaNode schema, final DataTreeConfiguration treeConfig) {
    final TreeType type = treeConfig.getTreeType();
    final Builder<NodeIdentifier, DataSchemaNode> childrenBuilder = ImmutableMap.builder();
    final Builder<AugmentationIdentifier, AugmentationSchemaNode> augmentationsBuilder = ImmutableMap.builder();
    if (SchemaAwareApplyOperation.belongsToTree(type, schema)) {
        for (final DataSchemaNode child : schema.getChildNodes()) {
            if (SchemaAwareApplyOperation.belongsToTree(type, child)) {
                childrenBuilder.put(NodeIdentifier.create(child.getQName()), child);
            }
        }
        for (final AugmentationSchemaNode augment : schema.getAvailableAugmentations()) {
            if (augment.getChildNodes().stream()
                    .anyMatch(child -> SchemaAwareApplyOperation.belongsToTree(type, child))) {
                augmentationsBuilder.put(SchemaUtils.getNodeIdentifierForAugmentation(augment), augment);
            }
        }
    }

    final Map<NodeIdentifier, DataSchemaNode> children = childrenBuilder.build();
    final Map<AugmentationIdentifier, AugmentationSchemaNode> augmentations = augmentationsBuilder.build();
    return children.isEmpty() ? null
            : new CaseEnforcer(children, augmentations, MandatoryLeafEnforcer.forContainer(schema, treeConfig));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:CaseEnforcer.java

示例9: getTreeType

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
public TreeType getTreeType() {
    switch (datastoreContext.getLogicalStoreType()) {
        case CONFIGURATION:
            return TreeType.CONFIGURATION;
        case OPERATIONAL:
            return TreeType.OPERATIONAL;
        default:
            throw new IllegalStateException("Unhandled logical store type "
                    + datastoreContext.getLogicalStoreType());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:Shard.java

示例10: NormalizedNodeAggregator

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
private NormalizedNodeAggregator(final YangInstanceIdentifier rootIdentifier,
        final List<Optional<NormalizedNode<?, ?>>> nodes, final SchemaContext schemaContext,
        LogicalDatastoreType logicalDatastoreType) {
    this.rootIdentifier = rootIdentifier;
    this.nodes = nodes;
    this.dataTree = InMemoryDataTreeFactory.getInstance().create(
            logicalDatastoreType == LogicalDatastoreType.CONFIGURATION ? TreeType.CONFIGURATION :
                TreeType.OPERATIONAL);
    this.dataTree.setSchemaContext(schemaContext);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:NormalizedNodeAggregator.java

示例11: ShardDataTree

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
ShardDataTree(final Shard shard, final SchemaContext schemaContext, final TreeType treeType,
        final YangInstanceIdentifier root,
        final ShardDataTreeChangeListenerPublisher treeChangeListenerPublisher,
        final ShardDataChangeListenerPublisher dataChangeListenerPublisher, final String logContext,
        final ShardDataTreeMetadata<?>... metadata) {
    this(shard, schemaContext, InMemoryDataTreeFactory.getInstance().create(treeType, root),
            treeChangeListenerPublisher, dataChangeListenerPublisher, logContext, metadata);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:ShardDataTree.java

示例12: setUp

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
@Before
public void setUp() {
    peopleSchemaContext = SchemaContextHelper.select(SchemaContextHelper.PEOPLE_YANG);
    carsSchemaContext = SchemaContextHelper.select(SchemaContextHelper.CARS_YANG);

    final Shard mockShard = Mockito.mock(Shard.class);

    peopleDataTree = new ShardDataTree(mockShard, peopleSchemaContext, TreeType.OPERATIONAL);
    coordinator = ShardRecoveryCoordinator.create(peopleDataTree, "foobar", FOO_LOGGER);
    coordinator.startLogRecoveryBatch(10);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:ShardRecoveryCoordinatorTest.java

示例13: createCar

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
private DataTreeCandidateTip createCar() {
    final TipProducingDataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
    dataTree.setSchemaContext(carsSchemaContext);

    final DataTreeSnapshot snapshot = dataTree.takeSnapshot();

    final DataTreeModification modification = snapshot.newModification();

    modification.merge(CarsModel.BASE_PATH, CarsModel.create());
    modification.ready();
    return dataTree.prepare(modification);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:ShardRecoveryCoordinatorTest.java

示例14: newSnapshot

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
private static Snapshot newSnapshot(YangInstanceIdentifier path, NormalizedNode<?, ?> node)
        throws Exception {
    DataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
    dataTree.setSchemaContext(SchemaContextHelper.full());
    AbstractShardTest.writeToStore(dataTree, path, node);
    NormalizedNode<?, ?> root = AbstractShardTest.readStore(dataTree, YangInstanceIdentifier.EMPTY);

    return Snapshot.create(new ShardSnapshotState(new MetadataShardDataTreeSnapshot(root)),
            Collections.<ReplicatedLogEntry>emptyList(), 2, 1, 2, 1, 1, "member-1", null);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:DatastoreSnapshotRestoreTest.java

示例15: testUnmodifiedRootCandidate

import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; //导入依赖的package包/类
@Test
public void testUnmodifiedRootCandidate() throws Exception {
    final TipProducingDataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
    dataTree.setSchemaContext(SchemaContextHelper.select(SchemaContextHelper.CARS_YANG));

    DataTreeModification modification = dataTree.takeSnapshot().newModification();
    modification.ready();
    candidate = dataTree.prepare(modification);

    CommitTransactionPayload payload = CommitTransactionPayload.create(nextTransactionId(), candidate);
    assertCandidateEquals(candidate, payload.getCandidate().getValue());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:CommitTransactionPayloadTest.java


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