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


Java SchemaPath类代码示例

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


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

示例1: retrievedSchemaContext

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
private void retrievedSchemaContext(final SchemaContext schemaContext) {
    log.debug("{}: retrievedSchemaContext", logName());

    final Collection<SchemaPath> schemaPaths = RpcUtil.decomposeRpcService(rpcInterface, schemaContext,
        rpcFilter());
    if (schemaPaths.isEmpty()) {
        log.warn("{}: interface {} has no accptable entries, assuming it is satisfied", logName(), rpcInterface);
        setSatisfied();
        return;
    }

    rpcSchemaPaths = ImmutableSet.copyOf(schemaPaths);
    log.debug("{}: Got SchemaPaths: {}", logName(), rpcSchemaPaths);

    // First get the DOMRpcService OSGi service. This will be used to register a listener to be notified
    // when the underlying DOM RPC service is available.
    retrieveService("DOMRpcService", DOMRpcService.class, this::retrievedDOMRpcService);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:AbstractInvokableServiceMetadata.java

示例2: decomposeRpcService

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
static Collection<SchemaPath> decomposeRpcService(final Class<RpcService> service,
        final SchemaContext schemaContext, final Predicate<RpcRoutingStrategy> filter) {
    final QNameModule moduleName = BindingReflections.getQNameModule(service);
    final Module module = schemaContext.findModuleByNamespaceAndRevision(moduleName.getNamespace(),
            moduleName.getRevision());
    LOG.debug("Resolved service {} to module {}", service, module);

    final Collection<RpcDefinition> rpcs = module.getRpcs();
    final Collection<SchemaPath> ret = new ArrayList<>(rpcs.size());
    for (RpcDefinition rpc : rpcs) {
        final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(rpc);
        if (filter.test(strategy)) {
            ret.add(rpc.getPath());
        }
    }

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

示例3: remove

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
DOMRpcRoutingTable remove(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcs) {
    if (rpcs.isEmpty()) {
        return this;
    }

    // First decompose the identifiers to a multimap
    final ListMultimap<SchemaPath, YangInstanceIdentifier> toRemove = decomposeIdentifiers(rpcs);

    // Now iterate over existing entries, modifying them as appropriate...
    final Builder<SchemaPath, AbstractDOMRpcRoutingTableEntry> b = ImmutableMap.builder();
    for (Entry<SchemaPath, AbstractDOMRpcRoutingTableEntry> e : this.rpcs.entrySet()) {
        final List<YangInstanceIdentifier> removed = new ArrayList<>(toRemove.removeAll(e.getKey()));
        if (!removed.isEmpty()) {
            final AbstractDOMRpcRoutingTableEntry ne = e.getValue().remove(implementation, removed);
            if (ne != null) {
                b.put(e.getKey(), ne);
            }
        } else {
            b.put(e);
        }
    }

    // All done, whatever is in toRemove, was not there in the first place
    return new DOMRpcRoutingTable(b.build(), schemaContext);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:26,代码来源:DOMRpcRoutingTable.java

示例4: createRpcEntry

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
private static AbstractDOMRpcRoutingTableEntry createRpcEntry(final SchemaContext context, final SchemaPath key,
        final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> implementations) {
    final RpcDefinition rpcDef = findRpcDefinition(context, key);
    if (rpcDef == null) {
        return new UnknownDOMRpcRoutingTableEntry(key, implementations);
    }

    final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(rpcDef);
    if (strategy.isContextBasedRouted()) {
        return new RoutedDOMRpcRoutingTableEntry(rpcDef, YangInstanceIdentifier.of(strategy.getLeaf()),
            implementations);

    }

    return new GlobalDOMRpcRoutingTableEntry(rpcDef, implementations);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:DOMRpcRoutingTable.java

示例5: invokeRpc

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final SchemaPath type, final NormalizedNode<?, ?> input) {
    final AbstractDOMRpcRoutingTableEntry entry = rpcs.get(type);
    if (entry == null) {
        return Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(
            new DOMRpcImplementationNotAvailableException("No implementation of RPC %s available", type));
    }

    return entry.invokeRpc(input);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:DOMRpcRoutingTable.java

示例6: registerNotificationListener

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
@Override
public synchronized <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener, final Collection<SchemaPath> types) {
    final ListenerRegistration<T> reg = new AbstractListenerRegistration<T>(listener) {
        @Override
        protected void removeRegistration() {
            final ListenerRegistration<T> me = this;

            synchronized (DOMNotificationRouter.this) {
                replaceListeners(ImmutableMultimap.copyOf(Multimaps.filterValues(listeners, input -> input != me)));
            }
        }
    };

    if (!types.isEmpty()) {
        final Builder<SchemaPath, ListenerRegistration<? extends DOMNotificationListener>> b = ImmutableMultimap.builder();
        b.putAll(listeners);

        for (final SchemaPath t : types) {
            b.put(t, reg);
        }

        replaceListeners(b.build());
    }

    return reg;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:DOMNotificationRouter.java

示例7: getNotificationClasses

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Set<Class<? extends Notification>> getNotificationClasses(final Set<SchemaPath> interested) {
    final Set<Class<? extends Notification>> result = new HashSet<>();
    final Set<NotificationDefinition> knownNotifications = runtimeContext().getSchemaContext().getNotifications();
    for (final NotificationDefinition notification : knownNotifications) {
        if (interested.contains(notification.getPath())) {
            try {
                result.add((Class<? extends Notification>) runtimeContext().getClassForSchema(notification));
            } catch (final IllegalStateException e) {
                // Ignore
                LOG.warn("Class for {} is currently not known.", notification.getPath(), e);
            }
        }
    }
    return result;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:BindingToNormalizedNodeCodec.java

示例8: testDeviation

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
@Test
public void testDeviation() throws ReactorException {
    final SchemaContext context = RFC7950Reactors.defaultReactor().newBuild()
            .addSource(sourceForResource("/model/bar.yang"))
            .addSource(sourceForResource("/context-test/deviation-test.yang"))
            .buildEffective();

    final Module testModule = context.findModule("deviation-test", Revision.of("2013-02-27")).get();
    final Set<Deviation> deviations = testModule.getDeviations();
    assertEquals(1, deviations.size());
    final Deviation dev = deviations.iterator().next();

    assertEquals(Optional.of("system/user ref"), dev.getReference());

    final URI expectedNS = URI.create("urn:opendaylight.bar");
    final Revision expectedRev = Revision.of("2013-07-03");
    final List<QName> path = new ArrayList<>();
    path.add(QName.create(expectedNS, expectedRev, "interfaces"));
    path.add(QName.create(expectedNS, expectedRev, "ifEntry"));
    final SchemaPath expectedPath = SchemaPath.create(path, true);

    assertEquals(expectedPath, dev.getTargetPath());
    assertEquals(DeviateKind.ADD, dev.getDeviates().iterator().next().getDeviateType());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:YangParserWithContextTest.java

示例9: test

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
@Test
public void test() throws Exception {
    final SchemaContext schemaContext = YangParserTestUtils.parseYangResource("/bug7246/yang/rpc-test.yang");
    final JsonParser parser = new JsonParser();
    final JsonElement expextedJson = parser
            .parse(new FileReader(new File(getClass().getResource("/bug7246/json/expected-output.json").toURI())));

    final DataContainerChild<? extends PathArgument, ?> inputStructure = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(qN("my-name")))
            .withChild(ImmutableNodes.leafNode(new NodeIdentifier(qN("my-name")), "my-value")).build();
    final SchemaPath rootPath = SchemaPath.create(true, qN("my-name"), qN("input"));
    final Writer writer = new StringWriter();
    final String jsonOutput = normalizedNodeToJsonStreamTransformation(schemaContext, rootPath, writer,
            inputStructure);
    final JsonElement serializedJson = parser.parse(jsonOutput);

    assertEquals(expextedJson, serializedJson);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:19,代码来源:Bug7246Test.java

示例10: create

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
static JaxenXPath create(final Converter<String, QNameModule> converter, final SchemaPath schemaPath,
        final String xpath) throws JaxenException {
    final BaseXPath compiled = new BaseXPath(xpath) {
        private static final long serialVersionUID = 1L;

        @Override
        protected ContextSupport getContextSupport() {
            throw new UnsupportedOperationException(xpath);
        }
    };

    final Expr expr = compiled.getRootExpr();
    LOG.debug("Compiled {} to expression {}", xpath, expr);

    new ExprWalker(new ExprListener() {
        // FIXME: perform expression introspection to understand things like apex, etc.
    }).walk(expr);

    return new JaxenXPath(converter, schemaPath, compiled);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:JaxenXPath.java

示例11: testDeviationsSupportedInSomeModules

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
@Test
public void testDeviationsSupportedInSomeModules() throws Exception {
    final SetMultimap<QNameModule, QNameModule> modulesWithSupportedDeviations =
            ImmutableSetMultimap.<QNameModule, QNameModule>builder()
            .put(foo, bar)
            .put(foo, baz)
            .put(bar, baz)
            .build();

    final ListenableFuture<SchemaContext> lf = createSchemaContext(modulesWithSupportedDeviations, FOO, BAR, BAZ,
            FOOBAR);
    assertTrue(lf.isDone());
    final SchemaContext schemaContext = lf.get();
    assertNotNull(schemaContext);

    assertNull(SchemaContextUtil.findDataSchemaNode(schemaContext, SchemaPath.create(true, myFooContA)));
    assertNull(SchemaContextUtil.findDataSchemaNode(schemaContext, SchemaPath.create(true, myFooContB)));
    assertNotNull(SchemaContextUtil.findDataSchemaNode(schemaContext, SchemaPath.create(true, myFooContC)));
    assertNull(SchemaContextUtil.findDataSchemaNode(schemaContext, SchemaPath.create(true, myBarContA)));
    assertNotNull(SchemaContextUtil.findDataSchemaNode(schemaContext, SchemaPath.create(true, myBarContB)));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:22,代码来源:SchemaContextFactoryDeviationsTest.java

示例12: createAbsoluteLeafRefPath

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
/**
 * Create an absolute leafref path.
 *
 * @param leafRefPath leafRefPath
 * @param contextNodeSchemaPath contextNodeSchemaPath
 * @param module module
 * @return LeafRefPath object
 */
public static LeafRefPath createAbsoluteLeafRefPath(
        final LeafRefPath leafRefPath, final SchemaPath contextNodeSchemaPath,
        final Module module) {

    if (leafRefPath.isAbsolute()) {
        return leafRefPath;
    }

    final Deque<QNameWithPredicate> absoluteLeafRefTargetPathList = schemaPathToXPathQNames(
            contextNodeSchemaPath, module);
    final Iterator<QNameWithPredicate> leafRefTgtPathFromRootIterator = leafRefPath.getPathFromRoot().iterator();

    while (leafRefTgtPathFromRootIterator.hasNext()) {
        final QNameWithPredicate qname = leafRefTgtPathFromRootIterator.next();
        if (qname.equals(QNameWithPredicate.UP_PARENT)) {
            absoluteLeafRefTargetPathList.removeLast();
        } else {
            absoluteLeafRefTargetPathList.add(qname);
        }
    }

    return LeafRefPath.create(absoluteLeafRefTargetPathList, true);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:32,代码来源:LeafRefUtils.java

示例13: choiceCaseTest

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
@Test
public void choiceCaseTest() throws Exception {
    final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug6771/choice-case");
    assertNotNull(context);

    final QName myChoice = QName.create(NS, "my-choice");
    final QName caseOne = QName.create(NS, "one");
    final QName caseTwo = QName.create(NS, "two");
    final QName caseThree = QName.create(NS, "three");
    final QName containerOne = QName.create(NS, "container-one");
    final QName containerTwo = QName.create(NS, "container-two");
    final QName containerThree = QName.create(NS, "container-three");

    verifyLeafType(SchemaContextUtil.findDataSchemaNode(context,
            SchemaPath.create(true, ROOT, myChoice, caseOne, containerOne, LEAF_CONT_B)));
    verifyLeafType(SchemaContextUtil.findDataSchemaNode(context,
            SchemaPath.create(true, ROOT, myChoice, caseTwo, containerTwo, LEAF_CONT_B)));
    verifyLeafType(SchemaContextUtil.findDataSchemaNode(context,
            SchemaPath.create(true, ROOT, myChoice, caseThree, containerThree, INNER_CONTAINER, LEAF_CONT_B)));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:Bug6771Test.java

示例14: findParentSchemaNodesOnPath

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
/**
 * Finds schema node for given path in schema context. This method performs lookup in both the namespace
 * of groupings and the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs, actions,
 * notifications, anydatas and anyxmls according to Rfc6050/Rfc7950 section 6.2.1.
 *
 * <p>
 * This method returns collection of SchemaNodes, because name conflicts can occur between the namespace
 * of groupings and namespace of data nodes. This method finds and collects all schema nodes that matches supplied
 * SchemaPath and returns them all as collection of schema nodes.
 *
 * @param schemaContext
 *            schema context
 * @param path
 *            path
 * @return collection of schema nodes on path
 */
public static Collection<SchemaNode> findParentSchemaNodesOnPath(final SchemaContext schemaContext,
        final SchemaPath path) {
    final Collection<SchemaNode> currentNodes = new ArrayList<>();
    final Collection<SchemaNode> childNodes = new ArrayList<>();
    currentNodes.add(requireNonNull(schemaContext));
    for (final QName qname : path.getPathFromRoot()) {
        for (final SchemaNode current : currentNodes) {
            childNodes.addAll(findChildSchemaNodesByQName(current, qname));
        }
        currentNodes.clear();
        currentNodes.addAll(childNodes);
        childNodes.clear();
    }

    return currentNodes;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:33,代码来源:SchemaUtils.java

示例15: newBinaryBuilder

import org.opendaylight.yangtools.yang.model.api.SchemaPath; //导入依赖的package包/类
public static LengthRestrictedTypeBuilder<BinaryTypeDefinition> newBinaryBuilder(
        @Nonnull final BinaryTypeDefinition baseType, @Nonnull final SchemaPath path) {
    return new LengthRestrictedTypeBuilder<BinaryTypeDefinition>(baseType, path) {
        @Override
        BinaryTypeDefinition buildType(final @Nullable LengthConstraint constraint) {
            return new RestrictedBinaryType(getBaseType(), getPath(), getUnknownSchemaNodes(), constraint);
        }

        @Override
        LengthConstraint typeLengthConstraints() {
            /**
             * Length constraint imposed on YANG binary type by our implementation. byte[].length is an integer,
             * capping our ability to support arbitrary binary data.
             */
            return JavaLengthConstraints.INTEGER_SIZE_CONSTRAINTS;
        }
    };
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:19,代码来源:RestrictedTypes.java


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