[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Embedding Equinox Example

Why so complicated??

Craig: to launch either Felix 2.0 or Equinox 3.5 (and probably
Knopflerfish, not sure which versions though) embedded within a larger
Java application, you can simply use the new launching API included in
OSGi R4.2... see section 6.2 of the Core specification. Assuming you
are running on Java6, this allows you to choose the framework
implementation simply by putting the relevant JAR on your
application's classpath.

You asked for code so here it is:

    FrameworkFactory factory = ServiceLoader.load(FrameworkFactory.class);
    Map config = new HashMap();
    // Add some config properties to the map, if required
    Framework framework = factory.newFramework(config);
    framework.start();

Kind regards,
Neil

On Tue, Jan 26, 2010 at 10:35 PM, Phil Borlin
<rancidfishbreath@xxxxxxxxx> wrote:
> Probably the easiest way is to download the Eclipse SDK if you don't
> have it already.
>
> In the menu go to File -> New -> Project.
> Select Plug-in Project and click next.
> Name it something like com.yourdomain.test (or whatever) and click next
> Make sure "This plug-in will make contributions to the UI" is unchecked.
> Make sure you click the "Yes" radio button next to "Would you like to
> create a rich client application"
> Click Next
> Select the "Headless Hello RCP" template and click Finish.
>
> This will create two classes:
> Application and Activator. ÂThere is plenty of documentation on what
> you can do with the Activator so I won't go into it. ÂOpen up the
> Application class and treat the start method as you would a main
> method in a traditional Java program. ÂFor example you can set up your
> JFrame here or whatever you want.
>
> Next take a look at your MANIFEST.MF file. ÂEclipse provides a nice UI
> to edit this or you can go straight to the MANIFEST.MF tab and hand
> edit it.
>
> Lastly go to the Overview tab of the MANIFEST.MF file and look for the
> section entitled "Testing". ÂThere are hyperlinks to run or debug your
> program.
>
> That's it. ÂThe platform takes care of initializing osgi and loading
> bundles for you and you are now free to add your own bundles.
>
> Phil
>
>
> On Tue, Jan 26, 2010 at 2:32 PM, Â<craig@xxxxxxxxxxxxxxxxx> wrote:
>> Hi,
>>
>> Sorry if this is not the right place for this question, I could not find
>> an equinox-users mailing list.
>>
>> I have a Swing based application that is able to be extended via a plugin
>> model and we would like to improve this ability by basing it upon OSGI.
>>
>> I have implemented a POC of this using Apache Felix, based on the
>> instructions on this page:
>>
>> http://felix.apache.org/site/launching-and-embedding-apache-felix.html
>>
>> Now I would like to try the POC using Equinox so we can compare and
>> contrast so we can pick one to move forward with.
>>
>> However, I am having trouble finding any documentation similar to the
>> Felix page I mentioned above. Basically I am looking for an in-code
>> example (not a command-line example) of how to instantiate an OSGI
>> Framework based on Equinox.
>>
>> Does anyone know of any documentation or a code example that shows this
>> for a simple use case?
>>
>> Thanks in advance.
>>
>> ----------------
>> Craig S. Dickson
>> http://craigsdickson.com
>> http://twitter.com/craigsdickson
>> _______________________________________________
>> equinox-dev mailing list
>> equinox-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/equinox-dev
>>
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/equinox-dev
>