osgi

How to start osgi console (Equinox)

谁都会走 提交于 2019-12-17 15:57:29
问题 I'm trying to start an OSGi console in Windows 7. I used this statement on a terminal window: java -jar org.eclipse.osgi.jar -console But it doesn't work that is nothing does happen nor doesn't appear prompt osgi> . And typing on keyboard is ineffective except for ^C that makes to reappear usual terminal prompt. Anyone has any suggestion? 回答1: Starting from Equinox 3.8.0.M4, it has a new console. So you need also these four bundles for it to run properly. org.eclipse.equinox.console.jar org

How to convert jar to OSGi bundle using eclipse and bndtools

天大地大妈咪最大 提交于 2019-12-17 15:51:51
问题 I am looking for a step by step guide to convert jar into an OSGi bundle using the eclipse bndtools plugin. I know it is possible to do it with bnd using the command line but would be nice to know how to do the same via the IDE. I might be missing something but this tutorial only explains how to create a project from scratch. 回答1: Follow the article Create Eclipse plugins (OSGi bundles) from standard jar to achieve this. Though this approach does not use Bnd, but you would be able to achieve

No access to Bundle Resource/File (OSGi)

做~自己de王妃 提交于 2019-12-17 15:51:36
问题 at the moment i'm developing an OSGi based WebApp with Jetty and Equinox (see: http://wiki.eclipse.org/Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit). Everything ist fine so far but i can't get access to some files/resources of my own bundle . The location/path is "configuration/data/config.csv" and "configuration/data/data.zip". I have tested everything: context.getBundleContext().getBundle().getEntry("config.csv"); context.getBundleContext().getBundle().getResource("config.csv"); this.getClass

How to create OSGi bundle from jar library?

早过忘川 提交于 2019-12-17 09:33:31
问题 How to create OSGi bundle from jar library? 回答1: In case you are using eclipse: There is a wizard for that. It allows you to select a number of jar libraries and creates a plug-in project (i.e. OSGi bundle) including these jars. You can find it here: File -> New -> Other ... -> Plug-in from Existing jar Archives. 回答2: In principle you just need to add OSGi metadata to the manifest There is a bundle creator for eclipse which gives a very practical way to add these entries which should be part

OSGi类加载流程

荒凉一梦 提交于 2019-12-16 15:09:41
思路 OSGi每个模块都有自己独立的classpath。如何实现这一点呢?是因为OSGi采取了不同的类加载机制: OSGi为每个bundle提供一个类加载器,该加载器能够看到bundle Jar文件内部的类和资源; 为了让bundle能互相协作,可以基于依赖关系,从一个bundle类加载器委托到另一个bundle类加载器。 Java和J2EE的类加载模型都是层次化的,只能委托给上一层类加载器; 而OSGi类加载模型则是网络图状的,可以在bundle间互相委托。—— 这样更合理,因为bundle间的依赖关系并不是层次化的 。 例如bundleA、B都依赖于bundleC,当他们访问bundleC中的类时,就会委托给bundleC的类加载器,由它来查找类;如果它发现还要依赖bundleE中的类,就会再委托给bundleE的类加载器。 优点 找不到类时的错误提示更友好。假如bundleE不存在,则bundleC就不会被解析成功,会有错误消息提示为何未能解析;而不是报错ClassNotFoundException或NoClassDefFoundError。 效率更高。在标准Java类加载模型中,总是会在classpath那一长串列表中进行查找;而OSGi类加载器能立即知道去哪里找类。 类加载步骤 Step 1: 检查是否java.*,或者在bootdelegation中定义

OSGi DS & deactivating a component manually

℡╲_俬逩灬. 提交于 2019-12-14 04:25:52
问题 Is it valid to deactivate a component in OSGi manually if I am using Declarative Services? For example, let's say I have a component, with the implementation: //component class Overseer(){ List<ServiceReference> serviceRefs = ...//populate private void doStuff(){ serviceRef = serviceRefs[i]; if(dontNeedThisAnymore){ serviceRefs.remove(serviceRef); serviceRef.getBundle().stop(); } } 回答1: The best way to do this is from another component in the same bundle, using the ComponentContext API. You

Java Open Source Framework for Service Management

百般思念 提交于 2019-12-14 04:03:23
问题 Working on a Java-based large distributed system, so there will be multiple services running across multiple machines ..... Looking for an open source framework to be able to manage these services(e.g. start/stop a service, install a new a service remotely etc.) Apache Karaf seems to be a good choice, but underneath it uses apache felix (an OSGi reference implementation) bundle which I have a hard time to really understand. In particular, it seems to be easy to define and register a service

AEM CQ with JPA (Hibernate)

假如想象 提交于 2019-12-14 03:56:53
问题 I'm working with Adobe Experience Manager (AEM) 6.4 with Service Pack 1, and the Forms Package. I have a lot of extended Properties/attributes, so I made a Database diagram. I don't want to save all the additional stuff in crx I want to save it in an Oracle database. The Database diagram is complex, so I want to USE JPA (Hibernate), at minimum. If Spring would help to make it easier to use, than that would be fine for me. I read a lot that the OSGI is working with blueprint instead of Spring,

Java classloader usage in OSGi

那年仲夏 提交于 2019-12-14 03:54:44
问题 I have a question about the usage of Java ClassLoader in OSGi. I wrote two OSGi bundles, namely server bundle and client bundle. In server bundle, I implemented BundleActivator like: public class Activator implements BundleActivator { public void start(BundleContext context) { System.out.println("[Server:Activator.java:26] " + Activator.class.getClassLoader()); context.registerService(HelloService.class, new HelloService(), null); } public void stop(BundleContext context) { System.out.println

Loading Resources with the Context Loader fails with a NullPointerException

百般思念 提交于 2019-12-14 03:49:28
问题 I'm just wondering why I cannot load a resource with the Thread context loader in Felix OSGi? Am I not supposed to touch the context loader, am I doing something wrong or is it a bug? I've a super simple bundle with a simple Activator: public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { System.out.println("Hello World!!"); String resourcePath = "META-INF/mySuperDuperResource.txt"; // works System.out.println(Activator.class