Tag: osgi

OSGI OBR存储库托管?

有谁知道提供OBR托管我自己的Bundles的任何服务? 像github这样的东西 – 但是对于捆绑。 (如果没有 – 有没有人创建自己的OBR服务器,它有多难?) 编辑:我找到了Nexus Pro的一个解决方案,但对于凡人来说它似乎太昂贵了(因为专业的价格无处可见)。

如何使用OSGi模块化JSF / Facelets / Spring应用程序?

我正在使用非常大的JSF / Facelets应用程序,它们使用Spring进行DI / bean管理。 我的应用程序具有模块化结构,我目前正在寻找标准化模块化的方法。 我的目标是从许多模块(可能相互依赖)组成Web应用程序。 每个模块可能包含以下内容: 类; 静态资源(图像,CSS,脚本); Facelet模板; 托管bean – Spring应用程序上下文,包含请求,会话和应用程序范围的bean(替代方法是JSF托管bean); Servlet API的东西 – servlet,filter,监听器(这是可选的)。 我想避免(几乎不惜一切代价)需要将模块资源(如Facelets模板)复制或提取到WAR或扩展web.xml以获取模块的servlet,filter等。它必须足够将模块(JAR,bundle,artifact,…)添加到Web应用程序( WEB-INF/lib , bundles , plugins ,…)以使用此模块扩展Web应用程序。 目前,我使用自定义模块化解决方案来解决此任务,该解决方案主要基于使用类路径资源: 特殊资源servlet从类路径资源(JAR)提供静态资源。 Special Facelets资源解析器允许从类路径资源加载Facelet模板。 Spring通过模式classpath*:com/acme/foo/module/applicationContext.xml加载应用程序上下文classpath*:com/acme/foo/module/applicationContext.xml – 这将加载模块JAR中定义的应用程序上下文。 最后,一对委托servlet和filter将请求处理委托给模块中Spring应用程序上下文中配置的servlet和filter。 最后几天我读了很多关于OSGi的内容,我正在考虑,如何(以及如果)我可以将OSGi用作标准化的模块化方法。 我在考虑如何使用OSGi解决单个任务: 静态资源 – 想要导出静态资源的OSGi包用bundle上下文注册ResourceLoader实例。 中央ResourceServlet使用这些资源加载器从bundle加载资源。 Facelet模板 – 与上面类似,中央ResourceResolver使用bundle注册的服务。 托管bean – 如果myBean在其中一个bundle中定义, 我不知道如何使用像#{myBean.property}这样的表达式。 Servlet API的东西 – 使用像WebExtender / Pax Web这样的东西来注册servlet,filter等等。 我的问题是: 我在这里发明了一辆自行车吗? […]

登录Eclipse / OSGi插件

我开始开发一个Eclipse插件(技术上来说,一个OSGi插件),我遇到的第一个问题之一就是我似乎无法像往常一样控制commons-logging输出。 我在插件依赖项中包含了commons-logging软件包,实际上,当我记录某些内容时(在INFO或更高的严重级别),它会被记录到控制台。 但是,我似乎无法登录任何较低级别(例如DEBUG或TRACE)。 我已经指定了一个log4j.properties文件,它位于类路径上(对于运行时,就像commons-logging软件包一样),但该属性文件中的任何设置都不会对记录器的行为产生任何影响。 这是log4j.properties文件: # Log4j Logging levels, in order of decreasing importance are: # FATAL, ERROR, WARN, INFO, DEBUG, TRACE # # Root logger option log4j.rootLogger=ERROR,stdout #,LOGFILE # Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %r (%l) %t%n – %m%n 我需要做什么才能实际控制记录器的输出? 以下是一些示例输出消息,希望格式化可能与java.util.logging的默认值一致,或者向某人提供其他提示: Oct 21, 2008 11:01:23 PM com.stottlerhenke.sentinel.client.Activator start SEVERE: […]

Eclipse OSGi包重新获得另一个bundle的片段

这可能是一个简单的问题,但有时让我困惑。 我正在开发一个依赖谷歌guice的OSGi包。 Google guice有一个主要的捆绑和几个片段,如辅助注入片段。 在我的包中,我使用了辅助注入片段和从该片段导出的类。 但是在Eclipse中,我只能在另一个bundel(在本例中为guice包)上设置bundle依赖,而不是直接在片段上(辅助注入),因此Eclipse抱怨无法找到从片段中导出的类。 如何依赖bundle的片段?

如何使用OSGi片段来提供具有相同文件名的依赖于平台的本机代码?

我正在使用JNotify项目来监听文件系统事件。 这取决于每个操作系统的一个本机库:处理器架构。 例如,有一个用于Windows x86的库,一个用于x86-64等的库。 整体捆绑 最初,我有一个包含JNotify Java类和本机代码的包。 本机代码在Bundle-NativeCode中声明如下: (我已经将这些格式化为bnd样式以获得更好的可读性……显然,实际的MANIFEST.MF文件已正确形成)。 Bundle-NativeCode: jnotify_64bit.dll;osname=Win32;osname=”Windows NT (unknown)”;osname = WindowsXP;osname = Windows2000;osname = Windows2003;osname = WindowsVista;osname = Windows7;osname = WindowsServer2008;osname= Windows8;osname = WindowsServer2012;processor = x86-64,\ jnotify.dll;osname=Win32;osname=”Windows NT (unknown)”;osname = WindowsXP;osname = Windows2000;osname = Windows2003;osname = WindowsVista;osname = Windows7;osname = WindowsServer2008;osname = Windows8;osname = WindowsServer2012;processor = x86,\ libjnotify.so;osname = Linux;processor = […]

如何使用OpenJDK 7编译mavenized OSGi 4.3包?

我正在尝试使用OpenJDK7针对OSGi规范4.3编译我的OSGi包但我收到错误: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project example: Compilation failure [ERROR] /tmp/baka/example/src/main/java/org/example/Activator.java:[14,24] error: type ServiceReference does not take parameters 这是我的Activator.java: package org.example; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; public class Activator implements BundleActivator { @Override public void start(BundleContext bundleContext) throws Exception { ServiceReference ref = bundleContext.getServiceReference(Runnable.class); } @Override public void stop(BundleContext bundleContext) […]

Apache Maven Assembly Plugin不支持OSGi捆绑包

我有一个Maven OSGi多模块项目。 当OSGi从各个项目模块中挑选模块jar时,该项目运行良好。 (见下文1.1.B) 。 但是,使用第二种方法时,每当我尝试使用maven-assembly-plugin将bundle存放到中央文件夹(D:/ parent / provider / target / modules)时, bundle.getRegisteredServices() (下面的视图1.1.A)都会返回null。 版本:2.6 : framework.getBundleContext().installBundle(“file:D:/parent/provider/target/modules/OSGiDmHelloWorldProvider-1.0.jar”); framework.getBundleContext().installBundle(“file:D:/parent/provider/target/modules/OSGiDmHelloWorldConsumer-1.0.jar”); 使用第二种方法查看下面的1.1.C以获得控制台输出。 1.1.A if (bundle.getRegisteredServices() != null) { for (ServiceReference serviceReference : bundle.getRegisteredServices()) System.out.println(“\tRegistered service: ” + serviceReference); } 为什么我不能用第二种方法访问捆绑包? GitHub上 我在GitHub上有一个SSCCE。 运行主课程将显示我的困境。 谢谢大家。 1.1.B package main; import java.net.URISyntaxException; import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.ServiceLoader; […]

将现有JAR转换为OSGi-bundle

我有一个JAR文件,我需要转换为OSGi包。 我没有JAR文件的原始源代码。 我尝试使用以下答案: 如何从jar库创建OSGi包? 但是,它们已经过时了。 编辑:我需要转换几个,但固定数量的jar子。

在OSGi包中加载DLL(使用JNA)

OSGi找不到我的DLL文件,我似乎无法弄清楚为什么。 目前我在我的bundle的根目录下有DLL文件( foo.dll ),我也试过在libs目录下使用它。 有问题的捆绑的清单看起来像这样: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: foobundle Bundle-SymbolicName: com.foo.bar Bundle-Version: 1.0.0 Bundle-Vendor: me Import-Package: com.sun.jna, com.sun.jna.ptr, com.sun.jna.win32 Export-Package: com.foo.bar Bundle-NativeCode: foo.dll; osname=WindowsXP; processor=x86 然后在我的JNA界面中执行loadLibrary(根据文档): public interface MyFooInterface extends com.sun.jna.Library{ static final MyFooInterface INSTANCE = (MyFooInterface)com.sun.jna.Native.loadLibrary(“foo”, MyFooInterface .class); // specific interface defs here… } 然后在另一个类中我尝试使用JNA接口 // …code int var = MyFooInterface.INSTANCE.bar(); // […]

如何从代码中启动和使用Apache Felix?

我无法从代码中找到有关启动和使用 Apache Felix的信息。 我想做一些我能够(或无法))与Apache Felix的Shell一起做的事情。 例如,如何启动模块? 请帮忙。