标签: osgi-bundle

OSGi容器中的Camel:将InterceptStrategy应用于所有驼峰上下文

我有几个软件包(A,B和C)部署到OSGi容器,每个包含一个CamelContext和一些路由.我有另一个包(M),CamelContext带有一个路由(用于收集监控数据)和一个InterceptStrategybean.我希望InterceptStrategyM中的bean自动应用于CamelContext容器中的所有其他s(即A,B和C中的那些),而不必修改其他bundle.

最终,目标是将每个数据从CamelContextM中窃听到路线中,而不必对A,B或C进行任何更改以明确路由Exchange.这种方法或类似的方法是否可行?

所有CamelContexts都是使用Spring XML配置的.


更新:附加上下文

捆绑包A,B和C包含负责处理数据的核心产品.Bundle M包含一个可选的监控工具,用于测量流经A,B和C的数据的某些参数.目前,添加可选工具需要更改A,B和C中的路由以添加额外的Processors来丰富Exchange使用监控数据并在<to />端点之前读取监控数据.

目标是能够将Bundle M放入已经过验证的A,B和C系统; 并使其自动应用于现有路由,而无需修改现有和工作捆绑包的配置.这可以接受的进行修改,以A,B和C,以支持这一点,只要改变不会导致A,B和C依靠M上运行(即ABC仍然必须运行不M).

如果有比使用拦截器更好的方法,我对此持开放态度.主要目标是:

  1. 保持A,B和C与M分离(特别是在开发期间)
  2. 确保将M与A,B和C集成在一起尽可能简单
  3. 允许集成M而无需手动更改A,B或C.

java osgi apache-camel interceptor osgi-bundle

22
推荐指数
1
解决办法
597
查看次数

管理OSGi依赖地狱

更新2:由于我的博客有点死,链接降级,所以你可以在这里查看文章:

https://www.dropbox.com/s/xvobgzqnl43kcda/Managing_OSGi_Transitive_Dependencies__Part_1____CitizenRandom.pdf?dl=0

https://www.dropbox.com/s/0bdooux4yhrf8lf/Managing%20OSGi%20Transitive%20Dependencies%20%28...pdf?dl=0

https://www.dropbox.com/s/km3mxqah6oy23iq/Why%20using%20Require-Bundle%20is%20a%20bad%20pract...pdf?dl=0

https://www.dropbox.com/s/mtenchtjopcrmr8/How%20many%20ways%20can%20we%20import%20bundles%20in%20OSGi_%20_%20CitizenRandom.pdf?dl=0

https://www.dropbox.com/s/sldxynx3fl8vn61/Managing%20OSGi%20Transitive%20Dependencies%20%282...pdf?dl=0

我有一个maven项目,使用我的POM.XML中配置的非常有名的felix maven bundle插件,方法如下:

<packaging>bundle</packaging>

(...)

<plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
                    <Bundle-Version>${project.version}</Bundle-Version>
                    <Export-Package>jlifx.*</Export-Package>
                    <!-- <Embed-Dependency>*</Embed-Dependency> -->
                </instructions>
            </configuration>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

然后我的POM中也包含一些1级/级别的依赖项:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-all</artifactId>
        <version>5.0.0.Alpha1</version>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

现在我的问题开始了...如果我做mvn安装我将使用它非常棒的MANIFEST.MF和我所有的,但我不会得到其他依赖捆绑包,这意味着如果我抓住我的捆绑文件并将其放在我的OSGi框架实例上我会得到类似"无法解决1.0:缺少需求[1.0] osgi.wiring.package;(&(osgi.wiring.package = etc ......")

因此,我发现创建我的第一级依赖项包的一种方法是在我的POM中创建一个配置文件,如下所示:

<profiles>
    <!-- http://www.lucamasini.net/Home/osgi-with-felix/creating-osgi-bundles-of-your-maven-dependencies -->
    <!-- -Pcreate-osgi-bundles-from-dependencies bundle:wrap -->
    <profile>
        <id>create-osgi-bundles-from-dependencies</id>
        <build>
            <directory>${basedir}/bundles</directory>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId> …
Run Code Online (Sandbox Code Playgroud)

java dependencies osgi maven osgi-bundle

20
推荐指数
2
解决办法
7261
查看次数

dependencies.dependency.version'缺少错误

我正在尝试使用apache maven创建一个包.当我运行mvn clean install命令时,它给出了以下错误:

javax.servlet缺少dependencies.dependency.version':servlet-api.jar

我把'servlet-api.jar'放在我项目的资源文件夹中

任何人都可以告诉我应该在哪里放置该jar文件?

更新:这是我的pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

 <parent>
   <artifactId>felix-parent</artifactId>
   <groupId>org.apache.felix</groupId>
   <version>2.1</version>
   <relativePath>../pom/pom.xml</relativePath>
 </parent>

 <modelVersion>4.0.0</modelVersion>

 <artifactId>maven-bundle-plugin</artifactId>
 <version>2.4.1-SNAPSHOT</version>
 <packaging>maven-plugin</packaging>

 <name>Maven Bundle Plugin</name>
 <description>
  Provides a maven plugin that supports creating an OSGi bundle
  from the contents of the compilation classpath along with its
  resources and dependencies. Plus a zillion other features.
  The plugin uses the Bnd tool (http://www.aqute.biz/Code/Bnd)
 </description>

 <scm>
  <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/bundleplugin</connection>
  <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/bundleplugin</developerConnection>
  <url>http://svn.apache.org/repos/asf/felix/trunk/bundleplugin</url>
 </scm>

 <build>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
     <source>1.5</source>
     <target>1.5</target>
    </configuration>
   </plugin> …
Run Code Online (Sandbox Code Playgroud)

java maven-2 osgi-bundle

19
推荐指数
2
解决办法
6万
查看次数

如何在Karaf上使用频繁的本地快照包部署?

我决定在OSGI和Karaf之上构建一个应用程序 - 我真的很喜欢这个东西.但是,我在本地开发机器上进行日常部署时遇到了一些困难.我的意思是..我做了一个改变,然后我想在我当地的Karaf实例上进行测试.它可能发生在每小时几次.

我现在这样做的方式是创建一个JAR包的maven构建,然后将其复制到Karaf的deploy目录中.我认为它根本不优雅.

我试图寻找一种方法(谷歌).我读到了Karaf的功能,但似乎尽管它是一个很好的机制来部署整个应用程序,但它并没有解决我的问题.据我所知,它不会检查我的SNAPSHOT jar的新版本是否出现在我当地的maven回购中,对吗?

osgi maven apache-karaf osgi-bundle karaf

18
推荐指数
1
解决办法
7274
查看次数

bundle的激活器无效

我正试图在eclipse中创建一个简单的插件.当我运行应用程序时,我在日志文件中看到此错误:

org.osgi.framework.BundleException:bundle org.xy的bundle org.xyActivator的激活器无效.

你对这个错误有任何想法吗?

java eclipse osgi eclipse-plugin osgi-bundle

16
推荐指数
1
解决办法
3万
查看次数

OSGI包中Bundle-Classpath的预期用例是什么?

我试图了解OSGI包中Bundle-Classpath的预期用例.

以下是我的理解,请帮助我理解这是否正确.

假设我正在创建一个OSGI捆绑包,该捆绑包将部署在其他捆绑包的生态系统中.我正在处理的捆绑包需要一些其他捆绑包,但它们不会在这个生态系统中加载/导出,而且我无法控制生态系统的输出.在这种情况下,我可以将这些包放在某个目录(比如'lib')中,这些目录成为我的捆绑包的一部分.这些包也应该从Bundle-Classpath引用,因此可以加载它们.

  • 这是Bundle-Classpath的正确用例吗?
  • 这些额外的包也会被加载到OSGI容器中吗?它们导出的包可以用于其他包吗?

osgi osgi-bundle

16
推荐指数
2
解决办法
2万
查看次数

OSGI和微服务之间的区别

当你想选择比微服务OSGI模块有什么我可以用微服务做,我不能与OSGI的模块呢?

osgi osgi-bundle microservices

15
推荐指数
2
解决办法
6473
查看次数

osgi应用程序中的非osgi库使用

是否可以将非osgi库与OSGi应用程序一起使用?

举个例子,我正在开发一个基于语义的搜索引擎,我正在使用第三方自然语言处理库(http://wiki.opencog.org/w/RelEx_Dependency_Relationship_Extractor).

是否有可能将这样一个不支持OSGi的库作为几个jar文件与我的OSGi应用程序接口?

java integration osgi jar osgi-bundle

13
推荐指数
2
解决办法
9811
查看次数

将现有JAR转换为OSGi-bundle

我有一个JAR文件,我需要转换为OSGi包.我没有JAR文件的原始源代码.

我尝试使用以下答案:如何从jar库创建OSGi包?

但是,它们已经过时了.

编辑:我需要转换几个,但固定数量的罐子.

java osgi intellij-idea osgi-bundle

9
推荐指数
1
解决办法
1万
查看次数

如何使用 bnd/maven-bundle-plugin 从 jar 依赖项将资源文件包含到 osgi 包中?

我正在使用maven-bundle-pluginbnd有效)。

从源中包含资源文件很简单。

例如,在构建期间将资源文件 ( src/main/resources/some.xml) 移动到target目录 ( target/classes/some.xml)下,可以使用以下<Include-Resource>指令将其包含到包中:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>3.0.1</version>
    <extensions>true</extensions>
    <configuration>
        <instructions>
            <Include-Resource>
                some.xml=target/classes/some.xml,
            </Include-Resource>
        </instructions>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

让我们有一个依赖:

<dependency>
    <groupId>com.example</groupId>
    <artifactId>library</artifactId>
    <version>1.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

如何在依赖中引用资源文件jar

换句话说,如何

所以来自依赖项之一的资源出现在输出包中jar

osgi bnd maven-bundle-plugin osgi-bundle

8
推荐指数
1
解决办法
8969
查看次数