OSGI配置子系统的方式——feature配置子系统
来源:互联网 发布:韩智慧知乎 编辑:程序博客网 时间:2024/05/22 03:33
---------------------------
1、在\features\src\main\features\features.xml中配置feature。
<feature name='odl-blog-example' version='${project.version}' description="Sd-Otn :: Noth-">
<feature version='${project.version}'>odl-blog-fcmanager</feature>
<bundle>mvn:com.csdn.blog/example-api/${blog.version}</bundle>
<bundle>mvn:com.csdn.blog/example-impl/${blog.version}</bundle>
<configfile finalname="${configfile.directory}/54-example.xml">
mvn:com.csdn.blog/example-config/${blog.version}/xml/config
</configfile>
</feature>
-------------------------------------------
2、example\impl\src\main\yang创建module,并将第3步的所依赖的服务注册到yang生成的实例中,如果是纯osgi框架则需要从BundleContext中获取依赖的服务。BundleContext可以获取整个osgi所有的服务。
module csdnblogmoudle-impl {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:blog:csdnblogmoudle:impl";
prefix "csdnblogmoudleimpl";
import config { prefix config; revision-date 2017-9-25; }
import otherservice1-api { prefix cim; revision-date 2017-9-25; }
import otherservice2-api { prefix route; revision-date 2017-9-25 }
import otherservice3-api { prefix traffic; revision-date 2017-9-25; }
import opendaylight-md-sal-binding { prefix mdsal; revision-date 2017-9-25; }
organization "CSDN";
description
"Module definition for CSDN.";
revision "2017-9-25" {
description "Initial revision.";
}
identity csdnblogmoudle-impl {
base config:module-type;
config:java-name-prefix Csdnblogmoudleimpl;
}
augment "/config:modules/config:module/config:configuration" {
case csdnblogmoudle-impl {
when "/config:modules/config:module/config:type = 'csdnblogmoudle-impl'";
container rpc-registry {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity mdsal:binding-rpc-registry;
}
}
}
container data-broker {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity mdsal:binding-async-data-broker;
}
}
}
container notification-service {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity mdsal:binding-notification-service;
}
}
}
container otherservice-name1 {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity otherservice1:otherservice1-service;
}
}
}
}
}
}
-------------------------------
3、在example\config\src\main\resources\initial创建54-example.xml,并将本bundle的服务注册到osgi中。
<?xml version="1.0" encoding="UTF-8"?>
<snapshot>
<required-capabilities>
<capability>
urn:opendaylight:params:xml:ns:yang:blog:otherservice1:api?module=otherservice1-api&revision=2016-01-13
</capability>
</required-capabilities>
<configuration>
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<module>
<type xmlns:northadapteripplusoimpl="urn:opendaylight:params:xml:ns:yang:blog:csdnblogmoudle:impl">
csdnblogmoudleimpl:csdnblogmoudle-impl
</type>
<name>csdnblogmoudleimpl-service-impl</name>
<rpc-registry>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
<name>binding-rpc-broker</name>
</rpc-registry>
<data-broker>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
binding:binding-async-data-broker
</type>
<name>binding-data-broker</name>
</data-broker>
<notification-service>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
binding:binding-notification-service
</type>
<name>binding-notification-broker</name>
</notification-service>
<otherservicemanager>
<type xmlns:tramapi="urn:opendaylight:params:xml:ns:yang:blog:other:service:api">
tramapi:other-service
</type>
<name>other-service</name>
</otherservicemanager>
</module>
</modules>
</data>
</configuration>
</snapshot>
1、在\features\src\main\features\features.xml中配置feature。
<feature name='odl-blog-example' version='${project.version}' description="Sd-Otn :: Noth-">
<feature version='${project.version}'>odl-blog-fcmanager</feature>
<bundle>mvn:com.csdn.blog/example-api/${blog.version}</bundle>
<bundle>mvn:com.csdn.blog/example-impl/${blog.version}</bundle>
<configfile finalname="${configfile.directory}/54-example.xml">
mvn:com.csdn.blog/example-config/${blog.version}/xml/config
</configfile>
</feature>
-------------------------------------------
2、example\impl\src\main\yang创建module,并将第3步的所依赖的服务注册到yang生成的实例中,如果是纯osgi框架则需要从BundleContext中获取依赖的服务。BundleContext可以获取整个osgi所有的服务。
module csdnblogmoudle-impl {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:blog:csdnblogmoudle:impl";
prefix "csdnblogmoudleimpl";
import config { prefix config; revision-date 2017-9-25; }
import otherservice1-api { prefix cim; revision-date 2017-9-25; }
import otherservice2-api { prefix route; revision-date 2017-9-25 }
import otherservice3-api { prefix traffic; revision-date 2017-9-25; }
import opendaylight-md-sal-binding { prefix mdsal; revision-date 2017-9-25; }
organization "CSDN";
description
"Module definition for CSDN.";
revision "2017-9-25" {
description "Initial revision.";
}
identity csdnblogmoudle-impl {
base config:module-type;
config:java-name-prefix Csdnblogmoudleimpl;
}
augment "/config:modules/config:module/config:configuration" {
case csdnblogmoudle-impl {
when "/config:modules/config:module/config:type = 'csdnblogmoudle-impl'";
container rpc-registry {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity mdsal:binding-rpc-registry;
}
}
}
container data-broker {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity mdsal:binding-async-data-broker;
}
}
}
container notification-service {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity mdsal:binding-notification-service;
}
}
}
container otherservice-name1 {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity otherservice1:otherservice1-service;
}
}
}
}
}
}
-------------------------------
3、在example\config\src\main\resources\initial创建54-example.xml,并将本bundle的服务注册到osgi中。
<?xml version="1.0" encoding="UTF-8"?>
<snapshot>
<required-capabilities>
<capability>
urn:opendaylight:params:xml:ns:yang:blog:otherservice1:api?module=otherservice1-api&revision=2016-01-13
</capability>
</required-capabilities>
<configuration>
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<module>
<type xmlns:northadapteripplusoimpl="urn:opendaylight:params:xml:ns:yang:blog:csdnblogmoudle:impl">
csdnblogmoudleimpl:csdnblogmoudle-impl
</type>
<name>csdnblogmoudleimpl-service-impl</name>
<rpc-registry>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
<name>binding-rpc-broker</name>
</rpc-registry>
<data-broker>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
binding:binding-async-data-broker
</type>
<name>binding-data-broker</name>
</data-broker>
<notification-service>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
binding:binding-notification-service
</type>
<name>binding-notification-broker</name>
</notification-service>
<otherservicemanager>
<type xmlns:tramapi="urn:opendaylight:params:xml:ns:yang:blog:other:service:api">
tramapi:other-service
</type>
<name>other-service</name>
</otherservicemanager>
</module>
</modules>
</data>
</configuration>
</snapshot>
阅读全文
0 0
- OSGI配置子系统的方式——feature配置子系统
- 一个子系统的配置
- 内核时间子系统的配置
- Makefile和Kconfig配置项目——Input子系统fingerprint
- 网络子系统33_网桥设备的配置更新
- 详细讲解Oracle I/O子系统的配置和设计
- H2的存储子系统——MvStore
- Linux网络子系统之---- PHY 配置
- Linux网络子系统之---- PHY 配置
- 路由子系统——Scope
- Android之Input子系统配置更新导致的Activity重启
- Windows下Linux虚拟机的配置以及Win10 linux子系统开启
- 子系统设计和FishiGUI的子系统设计
- Dubbo之——分布式服务子系统的划分
- JAVAEE——网上订购子系统的开发(终)
- 网络子系统64_设备ip地址配置
- Linux USB子系统(2) 设备、配置、接口、端点
- 内核包括的子系统
- POJ 1170 0-1背包变形
- ISBN编号的国家地区语言代码,出版社代码规则,中国出版社ISBN代码
- Ubuntu16.04 安装 TensorFlow GPU--cuda,cudnn
- 动态规划经典入门级题目*2及详解
- nodejs 后台server中的 sql server 分页 sql
- OSGI配置子系统的方式——feature配置子系统
- 正则表达式常用操作符
- 数学公式
- 《算法-algorithm》第一章实验二 乱序检查
- Servlet学习第三天
- vector和list的使用及区别
- 数据增强在卷积神经网络中的应用
- pwnable之memcpy
- Linux之Apache下日志文件error.log过大的解决方法