Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java OSGi应用程序修补机制_Java_Osgi_Osgi Bundle - Fatal编程技术网

Java OSGi应用程序修补机制

Java OSGi应用程序修补机制,java,osgi,osgi-bundle,Java,Osgi,Osgi Bundle,是否有推荐的方法在运行时修补OSGi应用程序?我正在使用OSGi的equinox实现 如果我停止某个包并安装修补包。在运行时它将如何影响其他bundle 我看到了这一点,但它没有给出明确的答案 谢谢。我想这取决于捆绑包有多好 在第73页的《OSGi在行动》一书中有一个很好的例子 要亲自尝试: 下载 解压缩文件并使用Ant(osgi-in-action/chapter03/build.xml)构建“chapter03”示例 将chapter03/paint example/bundles/*-3.

是否有推荐的方法在运行时修补OSGi应用程序?我正在使用OSGi的equinox实现

如果我停止某个包并安装修补包。在运行时它将如何影响其他bundle

我看到了这一点,但它没有给出明确的答案


谢谢。

我想这取决于捆绑包有多好

在第73页的《OSGi在行动》一书中有一个很好的例子

要亲自尝试:

  • 下载
  • 解压缩文件并使用Ant(
    osgi-in-action/chapter03/build.xml
    )构建“chapter03”示例
  • chapter03/paint example/bundles/*-3.0.jar
    文件复制到例如
    chapter03/shell example/1
  • 为了使示例有效(请参阅),您需要执行以下操作:

  • 从下载最新的ApacheFelix框架发行版,目前为4.2.1
  • 提取
    org.apache.felix.main.distribution-4.2.1.zip
    文件
  • 提取
    felix-framework-4.2.1/bin/felix.jar
    文件
  • default.properties
    文件复制到OSGi示例的
    chapter03/shell示例/launcher.jar
  • 现在您已经准备好了一切:

    // In console window #1:
    $ cd chapter03/shell-example/
    $ java -jar launcher.jar bundles
    
    // In console window #2:
    $ telnet localhost 7070
    -> install file:1/paint-3.0.jar
    -> install file:1/shape-3.0.jar
    -> start 2
    -> install file:1/circle-3.0.jar
    -> install file:1/square-3.0.jar
    -> start 4
    -> start 5
    -> install file:1/triangle-3.0.jar
    -> start 6
    // You can now draw all three shapes.
    
    // Simulate upgrade/patch of "circle" bundle:
    -> stop 4
    // A "work in progress" sign is in place of the circles.
    // You can still move them.
    
    // Start the "circle" bundle again and they're back in the UI:
    -> start 4
    
    您可以查看示例源代码以了解他们是如何做到这一点的。
    我希望这能回答您的问题。

    这部分取决于捆绑包是使用服务还是使用导入/导出的包。服务更具活力

    如果补丁类作为导出包使用,则其使用者将拥有对原始类的引用。要强制移动到新实例,必须在控制台中或直接在“FrameworkWiring”实例上调用。(现在称为“refreshBundles”,但原理类似。)

    在一个密切相关的问题中进行了充分的讨论