osgi

Is separate OSGI bundles for api and implementation common practice?

风流意气都作罢 提交于 2019-12-03 05:13:29
I have a class with dependencies which I want to hot deploy without restarting the dependencies. The class has an interface but there's only one concrete implementation. Initially I created a single bundle with exported the interface and registered the implementation using activator and implementation classes which were not exported. However, if I update the bundle, bundles which use the registered service get restarted after the update when PackageAdmin#refreshPackages is called (this is automatic when using fileinstall). I have fixed this by creating a separate api bundle. Is this the best

Mini-OSGi that can run in a sandbox (like AppEngine or WebStart)?

余生长醉 提交于 2019-12-03 05:10:19
问题 I really like the concept of modular bundles as implemented by OSGi. I also like "managed deployment" services like Google AppEngine (for web application) or Java WebStart (for client software). These two ideas seem to complement each-other rather well conceptually. However, the OSGi standard includes a couple of features that make it impossible for implementations like Felix or Equinox to run on top of sandboxed virtual machines, such as AppEngine or Webstart. In these environments, it is

When to use ServiceLoader over something like OSGi

两盒软妹~` 提交于 2019-12-03 05:01:04
问题 Being someone who is allergic to dependencies, when would I use something like OSGi instead of the built in java 6 http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html (I want to let plugin jars just be dropped in). (FYI this is in a scala app, open to any suggestions, ServiceLoader is pretty damn close to what I want). 回答1: If ServiceLoader mostly fits your needs, that says that you're looking for service discovery via the presence of files on the class path. That's only a

Can OSGi help reduce complexity?

烈酒焚心 提交于 2019-12-03 04:49:59
问题 I saw lots of presentations on OSGi and i think it sounds promising for enforcing better modularization. Apparently "hotdeployment" and "running different versions of x in parallel" are mayor selling points too. I wonder whether what OSGi promises to solve is even an issue...? It reminded me of the early days of OO when similar claims were maid: When OO was new, the big argument was reusability. It was widely claimed that when using OO, one would only have to "write once" and could then "use

Sharing a configuration file between OSGi bundles in Apache Servicemix 4?

自作多情 提交于 2019-12-03 04:04:36
Has anyone been able to successfully share configuration between two or more bundles in SMX4? What I'm looking for is this: Have a single file in $SMX_HOME/etc/myconfiguration.cfg Have this configuration be "available" to be injected into my bundles via the OSGi Configuration Admin using Spring dm, i.e. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:osgix="http://www.springframework.org/schema/osgi-compendium" xmlns:ctx="http://www.springframework.org/schema/context"

Is there a pattern for dynamically loadable modules in Spring Boot?

◇◆丶佛笑我妖孽 提交于 2019-12-03 03:59:49
My Spring Boot Application features a content management system. I would like to be able to dynamically load new components without requiring an application restart. An example component may be loading a new video player component or ad component. Each component would likely contain its own controllers and views. What would the recommended pattern be for this, and what is a good framework to help handle this? Is OSGi an option? gtonic I'm afraid there isn't a 100% solution. There's maybe some options; let me highlight the following three: There are Spring factories , a way to (auto-)configure

Implementing dynamic plugins in Java

北战南征 提交于 2019-12-03 03:49:22
问题 I'd like to implement a dynamic plugin feature in a Java application. Ideally: The application would define an interface Plugin with a method like getCapabilities() . A plugin would be a JAR pluginX.jar containing a class PluginXImpl implementing Plugin (and maybe some others). The user would put pluginX.jar in a special directory or set a configuration parameter pointing to it. The user should not necessarily have to include pluginX.jar in their classpath. The application would find

android插件化-apkplug框架基本结构-01

僤鯓⒐⒋嵵緔 提交于 2019-12-03 03:40:26
由于框架开发更新频繁的原因一直都没有时间写出框架的基本架构让大家云里雾里的,现在框架已基本稳定和完善,我就抽出时间写写关于apkplug框架的基本架构和原理,同时也跟大家一起研究利用apkplug框架玩出更新的功能。 一 apkplug的基本架构 apkplug简单的说是一个容器它将apk文件解析并映射成Bundle ,下文我们简称Bundle为插件。如下图 每一个apk插件被映射到apkplug框架中就是一个Bundle对象,完整路径为 org.osgi.framework.Bundle 。通过这个Bundle我们能获取到插件的基本信息(本身静态属性)。 二 插件的基本结构 apkplug中的插件与OSGI标准靠齐,所以你也可以参考OSGI标准里面对Bundle的描述。不过apkplug框架还添加了一些特殊的属性(面向android) 1.插件状态: 插件状态可以通过Bundle.getState()获取 1.Bundle.UNINSTALLED 插件还未被安装(可能已卸载还为清理) 2.Bundle.INSTALLED 插件已经安装(未启动) 3.Bundle.RESOLVED 插件已经被框架正确解析(未启动) 4.Bundle.STARTING 插件正在启动(调用BundleActivator.start(BundleContext context)) 5.Bundle

android插件化-apkplug中以监听方式获取OSGI服务-09

杀马特。学长 韩版系。学妹 提交于 2019-12-03 03:40:02
我们提供 apkplug 下OSGI使用demo 源码托管地址为 http://git.oschina.net/plug/OSGIService 一 需求 通过 << apkplug中OSGI服务基本原理-08 >>我们知道怎样注册于查询OSGI Service。但查询方式必须在Service启动以后才能使用,而有时我们并不知道Service何时启动,而只需要在Service启动以后能立即获取到并使用。OSGI提供监听器的形式动态监听指定Service的注册于注销过程。 二 OSGI Service 监听代码 private ServiceReference ref=null; private printLog service=null; context.addServiceListener( new ServiceListener(){ @Override public void serviceChanged(ServiceEvent event) { switch (event.getType()) { case ServiceEvent.REGISTERED: //服务注册 if (ref == null ) { ref = event.getServiceReference(); service = (printLog) context.getService(ref);/

OSGi控制台在Eclipse插件开发中的妙用

情到浓时终转凉″ 提交于 2019-12-03 03:38:41
OSGi的实现本身有一个控制台,提供插件的查看和管理功能。而Eclipse是基于OSGi的平台应用,这样我们可以使用这个控制台辅助进行插件的管理,调试等工作… 一、管理和诊断 从事插件开发的各位同行也许都遇到过这样的问题:某个插件在发布以后无法启动,在Eclipse的插件列表中也看不到。这种情况一般是插件打包的时候出错,或者插件的依赖项不能满足。 如果项目的插件本身就比较多,或者依赖项比较多,这种问题查起来就非常痛苦。(Eclipse的插件列表会自动忽略某些无法启动的插件,无法通过Eclipse本身的插件列表排查问题) 而OSGi的控制台,允许你通过命令行的方式,对插件进行安装,卸载,启动,更新等操作,通过这样的方式进行排查。 例如,我们创建两个插件,example.TestA和example.TestB,插件B依赖插件A。然后只把插件B放到Eclipse的dropins目录下,这样我们是看不到example.TestB这个插件的,也无法使用它提供的功能。 此时,我们在启动eclipse的时候增加一个参数”- console”,就会同时启动一个控制台窗口,输入ss命令,会看到所有的bundle的信息列表: 还可以在命令后面增加参数过滤: 有的时候,这里也看不到插件,还可以使用install命令安装。 使用diag命令,可以对某个插件进行诊断: 二、在调试中应用 在插件开发过程中