本文整理了Java中io.fd.honeycomb.translate.util.YangDAG
类的一些代码示例,展示了YangDAG
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangDAG
类的具体详情如下:
包路径:io.fd.honeycomb.translate.util.YangDAG
类名称:YangDAG
[英]Directed acyclic graph representing ordering relationships between schema nodes represented as wildcarded InstanceIdentifiers. Maintains topological order of vertices. Feature is used by translation layer if more nodes are affected in single read/write transaction.
[中]表示通配符InstanceIdentifier表示的模式节点之间的排序关系的有向无环图。保持顶点的拓扑顺序。如果在单个读/写事务中有更多节点受到影响,转换层将使用该功能。
代码示例来源:origin: io.fd.honeycomb/minimal-distribution-core
@Override
protected WriterRegistry create() {
final FlatWriterRegistryBuilder builder = new FlatWriterRegistryBuilder(new YangDAG());
writerFactories
.stream()
.forEach(it -> it.init(builder));
return builder.build();
}
}
代码示例来源:origin: io.fd.honeycomb/translate-utils
@Override
public AbstractSubtreeManagerRegistryBuilderBuilder<S, R> addBefore(@Nonnull final S handler,
@Nonnull final Collection<InstanceIdentifier<?>> relatedTypes) {
final InstanceIdentifier<?> targetType = RWUtils.makeIidWildcarded(handler.getManagedDataObjectType());
checkWriterNotPresentYet(targetType);
dag.addVertex(targetType);
relatedTypes.stream()
.map(RWUtils::makeIidWildcarded)
.forEach(dag::addVertex);
relatedTypes.stream()
.map(RWUtils::makeIidWildcarded)
.forEach(type -> dag.addEdge(targetType, type));
handlersMap.put(targetType, handler);
return this;
}
代码示例来源:origin: io.fd.honeycomb/translate-utils
protected ImmutableMap<InstanceIdentifier<?>, S> getMappedHandlers() {
final ImmutableMap.Builder<InstanceIdentifier<?>, S> builder = ImmutableMap.builder();
// Iterate writer types according to their relationships from graph
dag.iterator().forEachRemaining(handlerType -> {
// There might be types stored just for relationship sake, no real writer, ignoring those
if (handlersMap.containsKey(handlerType)) {
builder.put(handlerType, handlersMap.get(handlerType));
}
});
// TODO HONEYCOMB-171 we could optimize subtree handlers, if there is a dedicated handler for a node managed by a subtree
// handler, recreate the subtree handler with a subset of handled child nodes
// This way it is not necessary to change the configuration of subtree writer, just to add a dedicated child
// writer
return builder.build();
}
}
代码示例来源:origin: io.fd.honeycomb/translate-utils
/**
* Add handler without any special relationship to any other type.
*/
@Override
public AbstractSubtreeManagerRegistryBuilderBuilder<S, R> add(@Nonnull final S handler) {
// Make IID wildcarded just in case
// + the way InstanceIdentifier.create + equals work for Identifiable items is unexpected, meaning updates would
// not be matched to writers in registry
final InstanceIdentifier<?> targetType = RWUtils.makeIidWildcarded(handler.getManagedDataObjectType());
checkWriterNotPresentYet(targetType);
dag.addVertex(targetType);
handlersMap.put(targetType, handler);
return this;
}
代码示例来源:origin: io.fd.honeycomb/translate-utils
@Override
public AbstractSubtreeManagerRegistryBuilderBuilder<S, R> addAfter(@Nonnull final S handler,
@Nonnull final Collection<InstanceIdentifier<?>> relatedTypes) {
final InstanceIdentifier<?> targetType = RWUtils.makeIidWildcarded(handler.getManagedDataObjectType());
checkWriterNotPresentYet(targetType);
dag.addVertex(targetType);
relatedTypes.stream()
.map(RWUtils::makeIidWildcarded)
.forEach(dag::addVertex);
// set edge to indicate before relationship, just reversed
relatedTypes.stream()
.map(RWUtils::makeIidWildcarded)
.forEach(type -> dag.addEdge(type, targetType));
handlersMap.put(targetType, handler);
return this;
}
代码示例来源:origin: io.fd.honeycomb/minimal-distribution-core
@Override
protected ReaderRegistry create() {
final CompositeReaderRegistryBuilder builder = new CompositeReaderRegistryBuilder(new YangDAG());
readerFactories.stream()
.forEach(it -> it.init(builder));
return builder.build();
}
代码示例来源:origin: io.fd.honeycomb/translate-utils
/**
* Add handler with relationship: to be executed before handler handling relatedType.
*/
@Override
public AbstractSubtreeManagerRegistryBuilderBuilder<S, R> addBefore(@Nonnull final S handler,
@Nonnull final InstanceIdentifier<?> relatedType) {
final InstanceIdentifier<?> targetType = RWUtils.makeIidWildcarded(handler.getManagedDataObjectType());
final InstanceIdentifier<?> wildcardedRelatedType = RWUtils.makeIidWildcarded(relatedType);
checkWriterNotPresentYet(targetType);
dag.addVertex(targetType);
dag.addVertex(wildcardedRelatedType);
dag.addEdge(targetType, wildcardedRelatedType);
handlersMap.put(targetType, handler);
return this;
}
代码示例来源:origin: io.fd.honeycomb/translate-utils
/**
* Add handler with relationship: to be executed after handler handling relatedType.
*/
@Override
public AbstractSubtreeManagerRegistryBuilderBuilder<S, R> addAfter(@Nonnull final S handler,
@Nonnull final InstanceIdentifier<?> relatedType) {
final InstanceIdentifier<?> targetType = RWUtils.makeIidWildcarded(handler.getManagedDataObjectType());
final InstanceIdentifier<?> wildcardedRelatedType = RWUtils.makeIidWildcarded(relatedType);
checkWriterNotPresentYet(targetType);
dag.addVertex(targetType);
dag.addVertex(wildcardedRelatedType);
// set edge to indicate before relationship, just reversed
dag.addEdge(wildcardedRelatedType, targetType);
handlersMap.put(targetType, handler);
return this;
}
内容来源于网络,如有侵权,请联系作者删除!