• osgi实战学习之路:4.Bundle


    </pre></h1><h1 style="margin:0 0 0 40px; border:none; padding:0px"><pre name="code" class="java">源码下载

    pan.baidu.com/s/1qWmD39E
    

    Bundle是什么?
    
    
    一个Bundle能够理解为osgi的一个模块
    Bundle是一个标准的jar,仅仅是在META-INF/MANIFEST.MF中增加Bundle元数据的描写叙述
    
    Bundle元数据标识
    
    
    Bundle-ManifestVersion: 2
    Bundle-Name: student-model
    Bundle-SymbolicName: com.demo.student-model
    Bundle-Version: 0.0.1.SNAPSHOT




    Export-Package


    导出Bundle的某些包中的代码让其他Bundle訪问,以逗号分隔

    Export-Package: org.student.model;version="0.0.1.SNAPSHOT"


    Import-Package


    导入其他Bundle的包中的代码,以逗号分隔

    Import-Package: org.osgi.framework;version="[1.5,2)",org.student.model;v
     ersion="[0.0,1)",org.student.management;version="[0.0,1)"



    demo中Bundle依赖图










    demo中Manifest


    student-model:
    Manifest-Version: 1.0
    Bnd-LastModified: 1403962466615
    Build-Jdk: 1.6.0_41
    Built-By: Administrator
    Bundle-ManifestVersion: 2
    Bundle-Name: student-model
    Bundle-SymbolicName: com.demo.student-model
    Bundle-Version: 0.0.1.SNAPSHOT
    Created-By: Apache Maven Bundle Plugin
    Export-Package: org.student.model;version="0.0.1.SNAPSHOT"
    Tool: Bnd-2.1.0.20130426-122213
    

    student-management
    Manifest-Version: 1.0
    Bnd-LastModified: 1403962467467
    Build-Jdk: 1.6.0_41
    Built-By: Administrator
    Bundle-ManifestVersion: 2
    Bundle-Name: student-management
    Bundle-SymbolicName: com.demo.student-management
    Bundle-Version: 0.0.1.SNAPSHOT
    Created-By: Apache Maven Bundle Plugin
    Export-Package: org.student.management;uses:="org.student.model";version
     ="0.0.1.SNAPSHOT"
    Import-Package: org.student.model;version="[0.0,1)"
    Tool: Bnd-2.1.0.20130426-122213
    

    student-management-impl
    Manifest-Version: 1.0
    Bnd-LastModified: 1403962467667
    Build-Jdk: 1.6.0_41
    Built-By: Administrator
    Bundle-Activator: org.student.management.impl.StudentManagementActivator
    Bundle-ManifestVersion: 2
    Bundle-Name: student-management-impl
    Bundle-SymbolicName: com.demo.student-management-impl
    Bundle-Version: 0.0.1.SNAPSHOT
    Created-By: Apache Maven Bundle Plugin
    Import-Package: org.osgi.framework;version="[1.5,2)",org.student.model;v
     ersion="[0.0,1)",org.student.management;version="[0.0,1)"
    Tool: Bnd-2.1.0.20130426-122213
    

    student-management-main
    Manifest-Version: 1.0
    Bnd-LastModified: 1403962467881
    Build-Jdk: 1.6.0_41
    Built-By: Administrator
    Bundle-Activator: org.student.management.main.MainActivator
    Bundle-ManifestVersion: 2
    Bundle-Name: student-management-main
    Bundle-SymbolicName: com.demo.student-management-main
    Bundle-Version: 0.0.1.SNAPSHOT
    Created-By: Apache Maven Bundle Plugin
    Export-Package: org.student.management.main;uses:="org.osgi.framework";v
     ersion="0.0.1.SNAPSHOT"
    Import-Package: org.osgi.framework;version="[1.5,2)",org.student.model;v
     ersion="[0.0,1)",org.student.management;version="[0.0,1)"
    Tool: Bnd-2.1.0.20130426-122213
    



    部署到karaf:


    bundle:install wrap:mvn:com.demo/student-model/0.0.1-SNAPSHOT
    bundle:start 80
    bundle:install wrap:mvn:com.demo/student-management/0.0.1-SNAPSHOT
    bundle:start 81
    bundle:install wrap:mvn:com.demo/student-management-impl/0.0.1-SNAPSHOT
    bundle:start 82
    bundle:install wrap:mvn:com.demo/student-management-main/0.0.1-SNAPSHOT
    bundle:start 83



  • 相关阅读:
    vue简单的富文本实现(亲测可以)
    做手机兼容性看友盟手机统计
    压测并发数上不去的原因分析(泽嵩大佬说的)
    跨域问题解决
    jmeter压力测试报Address already in use: connect错误
    选择器(可搜索)+气泡提示组件
    2020
    Redis集群搭建采坑总结
    echarts自定义背景图片
    百度ECharts地图Json数据在线下载(geoJson)
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10533505.html
  • Copyright © 2020-2023  润新知