You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by mcheung63 <mc...@hotmail.com> on 2013/10/18 17:26:56 UTC

回覆: adopt to OSGi

thanks Richard


thanks
from Peter

-------- 原有訊息 --------
由: "Richard S. Hall" <he...@ungoverned.org>
日期: 2013-10-17  21:10  (GMT+08:00)
至: users@felix.apache.org
主題: Re: adopt to OSGi

On 10/17/13 00:31 , Peter Cheung wrote:
> Dear All    I have a app, which is a debugger, it works with qemu and bochs. I am planning to support more VM, so I want to independent the middle part to OSGi. I am not sure i am doing it correctly:
> 1) I changed my app to start felix immediately after main(), in the activator, i create a new object which is the original app. So my original app is running inside OSGi container completely, this will let me avoid class-casting error.
> 2) I got two new projects : Interface project and Impl project. The interface project doesn't have to be a bundle. Both host app and impl project just include it in maven. Is it the best practice? or I have to make it as a bundle? but i don't see advantage.

If the host app has to access it then it can *not* be in a bundle
(unless you plan to only access it via reflection or some other
proxy-like means in the host app).

What you will likely want to do is to include the interface in your host
app and then configure the framework to export the interface package via
the see bundle (see config property
org.osgi.framework.system.packages.extras). Then in your bundles you
import the interface package which will get it from the system bundle
(which will get it from the class loaded that loaded the framework and
is most likely the app class loader). Thus the host app and the bundles
inside the framework will all be using the same class definition.

Do *not* include multiple copies of the interface in the host and/or
bundles.

Keep in mind that as an OSGi newbie you are picking one of the more
complicated use cases as your starting point...

-> richard

> Thanksfrom Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org