本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.UsesNode类的典型用法代码示例。如果您正苦于以下问题:Java UsesNode类的具体用法?Java UsesNode怎么用?Java UsesNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UsesNode类属于org.opendaylight.yangtools.yang.model.api包,在下文中一共展示了UsesNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emitUsesNode
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
private void emitUsesNode(final UsesNode usesNode) {
if (super.emitUses && !usesNode.isAddedByUses() && !usesNode.isAugmenting()) {
super.writer.startUsesNode(usesNode.getGroupingPath().getLastComponent());
/*
* FIXME: BUG-2444: whenNode / *(ifFeatureNode ) statusNode //
* Optional F : descriptionNode // Optional referenceNode //
* Optional
*/
for (final Entry<SchemaPath, SchemaNode> refine : usesNode.getRefines().entrySet()) {
emitRefine(refine);
}
for (final AugmentationSchemaNode aug : usesNode.getAugmentations()) {
emitUsesAugmentNode(aug);
}
super.writer.endNode();
}
}
示例2: emitAugment
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
private void emitAugment(final AugmentationSchemaNode augmentation) {
super.writer.startAugmentNode(augmentation.getTargetPath());
// FIXME: BUG-2444: whenNode //Optional
// FIXME: BUG-2444: *(ifFeatureNode )
emitDocumentedNode(augmentation);
for (final UsesNode uses : augmentation.getUses()) {
emitUsesNode(uses);
}
for (final DataSchemaNode childNode : augmentation.getChildNodes()) {
if (childNode instanceof CaseSchemaNode) {
emitCaseNode((CaseSchemaNode) childNode);
} else {
emitDataSchemaNode(childNode);
}
}
emitUnknownStatementNodes(augmentation.getUnknownSchemaNodes());
emitNotifications(augmentation.getNotifications());
emitActions(augmentation.getActions());
super.writer.endNode();
}
示例3: testUses
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Test
public void testUses() {
final Module testModule = TestUtils.findModule(context, "main-impl").get();
assertNotNull(testModule);
final Set<AugmentationSchemaNode> augmentations = testModule.getAugmentations();
assertEquals(1, augmentations.size());
final Iterator<AugmentationSchemaNode> augmentIterator = augmentations.iterator();
final AugmentationSchemaNode augment = augmentIterator.next();
final CaseSchemaNode caseNode = (CaseSchemaNode) augment.getDataChildByName(
QName.create(testModule.getQNameModule(), "main-impl"));
assertNotNull(caseNode);
final ContainerSchemaNode container = (ContainerSchemaNode) caseNode.getDataChildByName(QName.create(
testModule.getQNameModule(), "notification-service"));
assertNotNull(container);
assertEquals(1, container.getUses().size());
final UsesNode usesNode = container.getUses().iterator().next();
assertNotNull(usesNode);
assertTrue(usesNode.getGroupingPath().toString()
.contains("[(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)service-ref]"));
assertEquals(1, usesNode.getRefines().size());
}
示例4: testCorrectAugment
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Test
public void testCorrectAugment() throws Exception {
context = TestUtils.loadModules(getClass().getResource("/augment-to-extension-test/correct-augment").toURI());
final Module devicesModule = TestUtils.findModule(context, "augment-module").get();
final ContainerSchemaNode devicesContainer = (ContainerSchemaNode) devicesModule.getDataChildByName(QName
.create(devicesModule.getQNameModule(), "my-container"));
final Set<UsesNode> uses = devicesContainer.getUses();
boolean augmentationIsInContainer = false;
for (final UsesNode usesNode : uses) {
final Set<AugmentationSchemaNode> augmentations = usesNode.getAugmentations();
for (final AugmentationSchemaNode augmentationSchema : augmentations) {
augmentationIsInContainer = true;
}
}
assertTrue(augmentationIsInContainer);
}
示例5: test
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Test
public void test() throws Exception {
final SchemaContext schemaContext = StmtTestUtils.parseYangSources("/bugs/bug5942");
assertNotNull(schemaContext);
final DataSchemaNode root = schemaContext.getDataChildByName(QName.create("foo", "2016-06-02", "root"));
assertTrue(root instanceof ContainerSchemaNode);
final Set<UsesNode> uses = ((ContainerSchemaNode) root).getUses();
assertEquals(1, uses.size());
final UsesNode usesNode = uses.iterator().next();
assertEquals(Optional.of("uses description"), usesNode.getDescription());
assertEquals(Optional.of("uses reference"), usesNode.getReference());
assertEquals(Status.DEPRECATED, usesNode.getStatus());
assertEquals(new RevisionAwareXPathImpl("0!=1", false), usesNode.getWhenCondition().get());
final List<UnknownSchemaNode> unknownSchemaNodes = usesNode.getUnknownSchemaNodes();
assertEquals(1, unknownSchemaNodes.size());
final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.iterator().next();
assertEquals("argument", unknownSchemaNode.getNodeParameter());
assertEquals(QName.create("foo", "2016-06-02", "e"), unknownSchemaNode.getExtensionDefinition().getQName());
}
示例6: isDependencyContainer
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
private static boolean isDependencyContainer(final DataNodeContainer dataNodeContainer) {
if(dataNodeContainer.getUses().size() != 1) {
return false;
}
UsesNode onlyUses = dataNodeContainer.getUses().iterator().next();
if(onlyUses.getGroupingPath().getLastComponent().equals(ServiceRef.QNAME) == false) {
return false;
}
return getChildNodeSizeWithoutUses(dataNodeContainer) == 0;
}
示例7: findQNameFromGrouping
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
/**
* Find "proper" qname of unknown node in case it comes from a grouping
*/
private static QName findQNameFromGrouping(final DataNodeContainer subtree, final SchemaContext ctx, final UnknownSchemaNode unknownSchemaNode, final String localIdentityName) {
QName identityQName = null;
for (UsesNode usesNode : subtree.getUses()) {
SchemaNode dataChildByName = SchemaContextUtil.findDataSchemaNode(ctx, usesNode.getGroupingPath());
Module m = SchemaContextUtil.findParentModule(ctx, dataChildByName);
List<UnknownSchemaNode> unknownSchemaNodes = dataChildByName.getUnknownSchemaNodes();
if(Collections2.transform(unknownSchemaNodes, UNKNOWN_NODE_TO_STRING).contains(UNKNOWN_NODE_TO_STRING.apply(unknownSchemaNode))) {
identityQName = QName.create(dataChildByName.getQName(), localIdentityName);
}
}
return identityQName;
}
示例8: emitDataNodeContainer
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
private void emitDataNodeContainer(final DataNodeContainer input) {
for (final TypeDefinition<?> typedef : input.getTypeDefinitions()) {
emitTypedefNode(typedef);
}
for (final GroupingDefinition grouping : input.getGroupings()) {
emitGrouping(grouping);
}
for (final DataSchemaNode child : input.getChildNodes()) {
emitDataSchemaNode(child);
}
for (final UsesNode usesNode : input.getUses()) {
emitUsesNode(usesNode);
}
}
示例9: testCorrectPathIntoUnsupportedTarget
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Test
public void testCorrectPathIntoUnsupportedTarget() throws Exception {
context = TestUtils.loadModules(getClass().getResource(
"/augment-to-extension-test/correct-path-into-unsupported-target").toURI());
final Module devicesModule = TestUtils.findModule(context, "augment-module").get();
final ContainerSchemaNode devicesContainer = (ContainerSchemaNode) devicesModule.getDataChildByName(
QName.create(devicesModule.getQNameModule(), "my-container"));
final Set<UsesNode> uses = devicesContainer.getUses();
for (final UsesNode usesNode : uses) {
assertTrue(usesNode.getAugmentations().isEmpty());
}
}
示例10: getIdentitiesToRpcs
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
private static Multimap<QName/* of identity */, RpcDefinition> getIdentitiesToRpcs(
final SchemaContext schemaCtx) {
Multimap<QName, RpcDefinition> result = HashMultimap.create();
for (Module currentModule : schemaCtx.getModules()) {
// Find all identities in current module for later identity->rpc mapping
Set<QName> allIdentitiesInModule =
Sets.newHashSet(Collections2.transform(currentModule.getIdentities(), SchemaNode::getQName));
for (RpcDefinition rpc : currentModule.getRpcs()) {
ContainerSchemaNode input = rpc.getInput();
if (input != null) {
for (UsesNode uses : input.getUses()) {
// Check if the rpc is config rpc by looking for input argument rpc-context-ref
Iterator<QName> pathFromRoot = uses.getGroupingPath().getPathFromRoot().iterator();
if (!pathFromRoot.hasNext() ||
!pathFromRoot.next().equals(ConfigConstants.RPC_CONTEXT_REF_GROUPING_QNAME)) {
continue;
}
for (SchemaNode refinedNode : uses.getRefines().values()) {
for (UnknownSchemaNode unknownSchemaNode : refinedNode
.getUnknownSchemaNodes()) {
if (ConfigConstants.RPC_CONTEXT_INSTANCE_EXTENSION_QNAME
.equals(unknownSchemaNode.getNodeType())) {
String localIdentityName = unknownSchemaNode
.getNodeParameter();
QName identityQName = QName.create(
currentModule.getNamespace(),
currentModule.getRevision(),
localIdentityName);
Preconditions.checkArgument(allIdentitiesInModule.contains(identityQName),
"Identity referenced by rpc not found. Identity: %s, rpc: %s", localIdentityName, rpc);
result.put(identityQName, rpc);
}
}
}
}
}
}
}
return result;
}
示例11: getUses
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Override
public Set<UsesNode> getUses() {
// TODO Auto-generated method stub
return null;
}
示例12: getUses
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Override
public Set<UsesNode> getUses() {
return getCurrentSchema().getUses();
}
示例13: getUses
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Override
public Set<UsesNode> getUses() {
return Collections.emptySet();
}
示例14: getUses
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
@Override
public Set<UsesNode> getUses() {
return ImmutableSet.of();
}
示例15: AbstractEffectiveDocumentedDataNodeContainer
import org.opendaylight.yangtools.yang.model.api.UsesNode; //导入依赖的package包/类
protected AbstractEffectiveDocumentedDataNodeContainer(final StmtContext<A, D, ?> ctx) {
super(ctx);
Map<QName, DataSchemaNode> mutableChildNodes = new LinkedHashMap<>();
Set<GroupingDefinition> mutableGroupings = new HashSet<>();
Set<UsesNode> mutableUses = new HashSet<>();
Set<TypeDefinition<?>> mutableTypeDefinitions = new LinkedHashSet<>();
Set<DataSchemaNode> mutablePublicChildNodes = new LinkedHashSet<>();
for (EffectiveStatement<?, ?> stmt : effectiveSubstatements()) {
if (stmt instanceof DataSchemaNode) {
final DataSchemaNode dataSchemaNode = (DataSchemaNode) stmt;
if (!mutableChildNodes.containsKey(dataSchemaNode.getQName())) {
/**
* Add case short hand when augmenting choice with short hand
**/
if (this instanceof AugmentationSchemaNode
&& !(stmt instanceof CaseSchemaNode || stmt instanceof ChoiceSchemaNode)
&& YangValidationBundles.SUPPORTED_CASE_SHORTHANDS.contains(stmt.statementDefinition())
&& Boolean.TRUE.equals(ctx.getFromNamespace(AugmentToChoiceNamespace.class, ctx))) {
final ImplicitCaseSchemaNode caseShorthand = new ImplicitCaseSchemaNode(dataSchemaNode);
mutableChildNodes.put(caseShorthand.getQName(), caseShorthand);
mutablePublicChildNodes.add(caseShorthand);
} else {
mutableChildNodes.put(dataSchemaNode.getQName(), dataSchemaNode);
mutablePublicChildNodes.add(dataSchemaNode);
}
} else {
throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, stmt);
}
}
if (stmt instanceof UsesNode) {
UsesNode usesNode = (UsesNode) stmt;
if (!mutableUses.contains(usesNode)) {
mutableUses.add(usesNode);
} else {
throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, stmt);
}
}
if (stmt instanceof TypedefEffectiveStatement) {
TypedefEffectiveStatement typeDef = (TypedefEffectiveStatement) stmt;
TypeDefinition<?> type = typeDef.getTypeDefinition();
if (!mutableTypeDefinitions.contains(type)) {
mutableTypeDefinitions.add(type);
} else {
throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, stmt);
}
}
if (stmt instanceof GroupingDefinition) {
GroupingDefinition grp = (GroupingDefinition) stmt;
if (!mutableGroupings.contains(grp)) {
mutableGroupings.add(grp);
} else {
throw EffectiveStmtUtils.createNameCollisionSourceException(ctx, stmt);
}
}
}
this.childNodes = ImmutableMap.copyOf(mutableChildNodes);
this.groupings = ImmutableSet.copyOf(mutableGroupings);
this.publicChildNodes = ImmutableSet.copyOf(mutablePublicChildNodes);
this.typeDefinitions = ImmutableSet.copyOf(mutableTypeDefinitions);
this.uses = ImmutableSet.copyOf(mutableUses);
}