本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.RpcDefinition类的典型用法代码示例。如果您正苦于以下问题:Java RpcDefinition类的具体用法?Java RpcDefinition怎么用?Java RpcDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RpcDefinition类属于org.opendaylight.yangtools.yang.model.api包,在下文中一共展示了RpcDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: decomposeRpcService
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的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
示例2: createRpcEntry
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的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
示例3: emitBodyNodes
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
private void emitBodyNodes(final Module input) {
for (final ExtensionDefinition extension : input.getExtensionSchemaNodes()) {
emitExtension(extension);
}
for (final FeatureDefinition definition : input.getFeatures()) {
emitFeature(definition);
}
for (final IdentitySchemaNode identity : input.getIdentities()) {
emitIdentity(identity);
}
for (final Deviation deviation : input.getDeviations()) {
emitDeviation(deviation);
}
emitDataNodeContainer(input);
for (final AugmentationSchemaNode augmentation : input.getAugmentations()) {
emitAugment(augmentation);
}
for (final RpcDefinition rpc : input.getRpcs()) {
emitRpc(rpc);
}
emitNotifications(input.getNotifications());
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:27,代码来源:SchemaContextEmitter.java
示例4: testImplicitInputAndOutput
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
@Test
public void testImplicitInputAndOutput() throws Exception {
final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rpc-stmt-test/bar.yang");
assertNotNull(schemaContext);
final Module barModule = schemaContext.findModule("bar", Revision.of("2016-11-25")).get();
final Set<RpcDefinition> rpcs = barModule.getRpcs();
assertEquals(1, rpcs.size());
final RpcDefinition barRpc = rpcs.iterator().next();
final ContainerSchemaNode input = barRpc.getInput();
assertNotNull(input);
assertEquals(2, input.getChildNodes().size());
assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) input).getDeclared().getStatementSource());
final ContainerSchemaNode output = barRpc.getOutput();
assertNotNull(output);
assertEquals(2, output.getChildNodes().size());
assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) output).getDeclared().getStatementSource());
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:22,代码来源:RpcStmtTest.java
示例5: getRpcDataSchema
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
/**
* Returns RPC Input or Output Data container from RPC definition.
*
* @param schema SchemaContext in which lookup should be performed.
* @param path Schema path of RPC input/output data container
* @return Notification schema or null, if notification is not present in schema context.
*/
@Beta
@Nullable
public static ContainerSchemaNode getRpcDataSchema(@Nonnull final SchemaContext schema,
@Nonnull final SchemaPath path) {
Preconditions.checkNotNull(schema, "Schema context must not be null.");
Preconditions.checkNotNull(path, "Schema path must not be null.");
final Iterator<QName> it = path.getPathFromRoot().iterator();
Preconditions.checkArgument(it.hasNext(), "Rpc must have QName.");
final QName rpcName = it.next();
Preconditions.checkArgument(it.hasNext(), "input or output must be part of path.");
final QName inOrOut = it.next();
for (final RpcDefinition potential : schema.getOperations()) {
if (rpcName.equals(potential.getQName())) {
return SchemaNodeUtils.getRpcDataSchema(potential, inOrOut);
}
}
return null;
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:26,代码来源:SchemaContextUtil.java
示例6: FpcCodecUtils
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
/**
* Primary Constructor
* @param moduleInfos - Yang Module Information
* @param topPath - Top Path for the Utility to use
*/
public FpcCodecUtils(Iterable<? extends YangModuleInfo> moduleInfos,
YangInstanceIdentifier topPath) {
LOG.info("Building context");
TOP_PATH = topPath;
final ModuleInfoBackedContext moduleContext = SchemaManager.get();
moduleContext.addModuleInfos(moduleInfos);
context = moduleContext.tryToCreateSchemaContext().get();
if (context == null) {
LOG.info("Context could not be built");
} else {
LOG.info("Context built");
}
LOG.info("Building Binding Context");
bindingContext = BindingRuntimeContext.create(moduleContext, context);
LOG.info("Building Binding Codec Factory");
final BindingNormalizedNodeCodecRegistry bindingStreamCodecs = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())));
bindingStreamCodecs.onBindingRuntimeContextUpdated(bindingContext);
codecRegistry = bindingStreamCodecs;
Module fpcagent = context.findModuleByName("ietf-dmm-fpcagent", null);
Set<RpcDefinition> rpcList = fpcagent.getRpcs();
for(RpcDefinition rpc : rpcList){
if(rpc.getQName().getLocalName().equals("configure")){
CONFIGURE_OUTPUT_PATH = rpc.getOutput().getPath();
break;
}
}
LOG.info("Mapping service built");
}
开发者ID:opendaylight,项目名称:fpc,代码行数:37,代码来源:FpcCodecUtils.java
示例7: findRpcDefinition
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
private static RpcDefinition findRpcDefinition(final SchemaContext context, final SchemaPath schemaPath) {
if (context != null) {
final QName qname = schemaPath.getPathFromRoot().iterator().next();
final Module module = context.findModuleByNamespaceAndRevision(qname.getNamespace(), qname.getRevision());
if (module != null && module.getRpcs() != null) {
for (RpcDefinition rpc : module.getRpcs()) {
if (qname.equals(rpc.getQName())) {
return rpc;
}
}
}
}
return null;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:DOMRpcRoutingTable.java
示例8: from
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
public static RpcRoutingStrategy from(final RpcDefinition rpc) {
ContainerSchemaNode input = rpc.getInput();
if (input != null) {
for (DataSchemaNode schemaNode : input.getChildNodes()) {
Optional<QName> context = getRoutingContext(schemaNode);
if (context.isPresent()) {
return new RoutedRpcStrategy(rpc.getQName(), context.get(), schemaNode.getQName());
}
}
}
return new GlobalRpcStrategy(rpc.getQName());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:RpcRoutingStrategy.java
示例9: RpcServiceAdapter
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
RpcServiceAdapter(final Class<? extends RpcService> type, final BindingToNormalizedNodeCodec codec,
final DOMRpcService domService) {
this.type = Preconditions.checkNotNull(type);
this.codec = Preconditions.checkNotNull(codec);
this.delegate = Preconditions.checkNotNull(domService);
final ImmutableMap.Builder<Method, RpcInvocationStrategy> rpcBuilder = ImmutableMap.builder();
for (final Entry<Method, RpcDefinition> rpc : codec.getRpcMethodToSchema(type).entrySet()) {
rpcBuilder.put(rpc.getKey(), createStrategy(rpc.getKey(), rpc.getValue()));
}
rpcNames = rpcBuilder.build();
proxy = (RpcService) Proxy.newProxyInstance(type.getClassLoader(), new Class[] {type}, this);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:RpcServiceAdapter.java
示例10: createStrategy
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
private RpcInvocationStrategy createStrategy(final Method method, final RpcDefinition schema) {
final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(schema);
if (strategy.isContextBasedRouted()) {
return new RoutedStrategy(schema.getPath(), method, strategy.getLeaf());
}
return new NonRoutedStrategy(schema.getPath());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:RpcServiceAdapter.java
示例11: getRpcMethodToSchemaPath
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
public ImmutableBiMap<Method, SchemaPath> getRpcMethodToSchemaPath(final Class<? extends RpcService> key) {
final Module module = getModuleBlocking(key);
final ImmutableBiMap.Builder<Method, SchemaPath> ret = ImmutableBiMap.<Method, SchemaPath>builder();
try {
for (final RpcDefinition rpcDef : module.getRpcs()) {
final Method method = findRpcMethod(key, rpcDef);
ret.put(method, rpcDef.getPath());
}
} catch (final NoSuchMethodException e) {
throw new IllegalStateException("Rpc defined in model does not have representation in generated class.", e);
}
return ret.build();
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:BindingToNormalizedNodeCodec.java
示例12: getRpcMethodToSchema
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
public ImmutableBiMap<Method, RpcDefinition> getRpcMethodToSchema(final Class<? extends RpcService> key) {
final Module module = getModuleBlocking(key);
final ImmutableBiMap.Builder<Method, RpcDefinition> ret = ImmutableBiMap.builder();
try {
for (final RpcDefinition rpcDef : module.getRpcs()) {
final Method method = findRpcMethod(key, rpcDef);
ret.put(method, rpcDef);
}
} catch (final NoSuchMethodException e) {
throw new IllegalStateException("Rpc defined in model does not have representation in generated class.", e);
}
return ret.build();
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:BindingToNormalizedNodeCodec.java
示例13: findRpcMethod
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
private Method findRpcMethod(final Class<? extends RpcService> key, final RpcDefinition rpcDef)
throws NoSuchMethodException {
final String methodName = BindingMapping.getMethodName(rpcDef.getQName());
if ((rpcDef.getInput() != null) && isExplicitStatement(rpcDef.getInput())) {
final Class<?> inputClz = runtimeContext().getClassForSchema(rpcDef.getInput());
return key.getMethod(methodName, inputClz);
}
return key.getMethod(methodName);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:BindingToNormalizedNodeCodec.java
示例14: onGlobalContextUpdated
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
@Override
public void onGlobalContextUpdated(SchemaContext schemaContext) {
if (schemaContext != null) {
final Collection<RpcDefinition> defs = schemaContext.getOperations();
final Map<QName, RpcDefinition> newMap = new HashMap<>(defs.size());
for (final RpcDefinition operation : defs) {
newMap.put(operation.getQName(), operation);
}
// FIXME: still not completely atomic
qnameToRpc.set(ImmutableMap.copyOf(newMap));
setGlobalSchema(schemaContext);
}
}
开发者ID:opendaylight,项目名称:messaging4transport,代码行数:16,代码来源:ControllerContext.java
示例15: findDataChildSchemaByQName
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
/**
* Find child data schema node identified by its QName within a provided schema node. This method performs lookup
* in the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs, actions, notifications, anydatas
* and anyxmls according to RFC6050/RFC7950 section 6.2.1.
*
* @param node
* schema node
* @param qname
* QName
* @return data child schema node
* @throws IllegalArgumentException
* if the schema node does not allow children
*/
@Nullable
public static SchemaNode findDataChildSchemaByQName(final SchemaNode node, final QName qname) {
if (node instanceof DataNodeContainer) {
SchemaNode child = ((DataNodeContainer) node).getDataChildByName(qname);
if (child == null && node instanceof SchemaContext) {
child = tryFind(((SchemaContext) node).getOperations(), qname).orElse(null);
}
if (child == null && node instanceof NotificationNodeContainer) {
child = tryFind(((NotificationNodeContainer) node).getNotifications(), qname).orElse(null);
}
if (child == null && node instanceof ActionNodeContainer) {
child = tryFind(((ActionNodeContainer) node).getActions(), qname).orElse(null);
}
return child;
}
if (node instanceof ChoiceSchemaNode) {
return ((ChoiceSchemaNode) node).getCaseNodeByName(qname);
}
if (node instanceof RpcDefinition) {
switch (qname.getLocalName()) {
case "input":
return ((RpcDefinition) node).getInput();
case "output":
return ((RpcDefinition) node).getOutput();
default:
return null;
}
}
throw new IllegalArgumentException(String.format("Schema node %s does not allow children.", node));
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:46,代码来源:SchemaUtils.java
示例16: testValidYang11Model
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
@Test
public void testValidYang11Model() throws Exception {
final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rfc7950/bug6871/foo.yang");
assertNotNull(schemaContext);
final Module foo = schemaContext.findModule("foo", Revision.of("2016-12-14")).get();
final Set<NotificationDefinition> notifications = foo.getNotifications();
assertEquals(1, notifications.size());
final NotificationDefinition myNotification = notifications.iterator().next();
Collection<MustDefinition> mustConstraints = myNotification.getMustConstraints();
assertEquals(2, mustConstraints.size());
final Set<RpcDefinition> rpcs = foo.getRpcs();
assertEquals(1, rpcs.size());
final RpcDefinition myRpc = rpcs.iterator().next();
final ContainerSchemaNode input = myRpc.getInput();
assertNotNull(input);
mustConstraints = input.getMustConstraints();
assertEquals(2, mustConstraints.size());
final ContainerSchemaNode output = myRpc.getOutput();
assertNotNull(output);
mustConstraints = output.getMustConstraints();
assertEquals(2, mustConstraints.size());
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:28,代码来源:Bug6871Test.java
示例17: getRpcByName
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
private static RpcDefinition getRpcByName(final Module module, final String name) {
for (final RpcDefinition rpc : module.getRpcs()) {
if (rpc.getQName().getLocalName().equals(name)) {
return rpc;
}
}
return null;
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:SchemaContextUtilTest.java
示例18: testRpc
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
@Test
public void testRpc() {
Module testModule = TestUtils.findModule(context, "ietf-netconf-monitoring").get();
Set<RpcDefinition> rpcs = testModule.getRpcs();
assertEquals(1, rpcs.size());
RpcDefinition rpc = rpcs.iterator().next();
assertEquals("get-schema", rpc.getQName().getLocalName());
assertEquals(Optional.of("This operation is used to retrieve a schema from the\n"
+ "NETCONF server.\n"
+ "\n"
+ "Positive Response:\n"
+ "The NETCONF server returns the requested schema.\n"
+ "\n"
+ "Negative Response:\n"
+ "If requested schema does not exist, the <error-tag> is\n"
+ "'invalid-value'.\n"
+ "\n"
+ "If more than one schema matches the requested parameters, the\n"
+ "<error-tag> is 'operation-failed', and <error-app-tag> is\n"
+ "'data-not-unique'."), rpc.getDescription());
ContainerSchemaNode input = rpc.getInput();
assertNotNull(input);
assertEquals(3, input.getChildNodes().size());
ContainerSchemaNode output = rpc.getOutput();
assertNotNull(output);
assertEquals(1, output.getChildNodes().size());
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:32,代码来源:YinFileRpcStmtTest.java
示例19: testTypedefsInRpc
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
@Test
public void testTypedefsInRpc() throws ReactorException {
final SchemaContext schemaContext = StmtTestUtils.parseYangSources(sourceForResource("/bugs/bug6410/foo.yang"));
final Set<Module> modules = schemaContext.getModules();
assertEquals(1, modules.size());
final Module module = modules.iterator().next();
final Set<RpcDefinition> rpcs = module.getRpcs();
assertEquals(1, rpcs.size());
final RpcDefinition rpc = rpcs.iterator().next();
final Set<TypeDefinition<?>> typeDefs = rpc.getTypeDefinitions();
assertEquals(2, typeDefs.size());
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:16,代码来源:Bug6410Test.java
示例20: testRpc
import org.opendaylight.yangtools.yang.model.api.RpcDefinition; //导入依赖的package包/类
@Test
public void testRpc() {
final Set<RpcDefinition> rpcs = baz.getRpcs();
assertEquals(1, rpcs.size());
final RpcDefinition rpc = rpcs.iterator().next();
assertEquals(Optional.of("Retrieve all or part of a specified configuration."), rpc.getDescription());
assertEquals(Optional.of("RFC 6241, Section 7.1"), rpc.getReference());
}
开发者ID:opendaylight,项目名称:yangtools,代码行数:10,代码来源:YangParserTest.java
注:本文中的org.opendaylight.yangtools.yang.model.api.RpcDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论