Hi Amar,

On Sat, Jan 19, 2013 at 11:03 AM,  <[email protected]> wrote:
> Hello,
>
> I am running a functional instance of stanbol and I have created a couple of
> osgi bundles which I embed into stanbol to run a customized enhancement
> engine.
>
> I would like to know if it is possible to add external jars to this stanbol
> instance, just like we add new osgi bundles.
>
You can not add jars that are no bundles to an OSGI environment. Such
jars need to be embedded in an OSGI bundle. The bundle that embeds
the jar can than export the required packages .

> I ask this because I would like to make use of Commons Math library in my
> osgi bundle.

The Apache Commons Math jar  (at least version 3.1.1) is an OSGI
bundle. So you can install it the same way as your own bundles and
just use it.

> I tried to export the lib folder containing the external jar, along with the
> src files during the creation of the bundle but that did not seem to help.

Embedding a Jar by using the maven bundle plugin works by (1) adding
the dependency to the jar (2) adding the <Embed-Dependency>
{artifact-id1}, {artifact-id2} <Embed-Dependency> to the configuration
of the "maven-bundle-plugin" (3) exporting the packages of the
embedded jar file that you want to have globally available in the OSGI
environment (e.g. packages of classes  you are using in interfaces of
services your bundle provides). This is best done by using the
<_exportcontents> {package1}; version={package1-version}, {package2};
version={package2-version} </_exportcontents>

The "maven-bundle-plugin" will automatically include the jars in the
bundle and set the bundle classpath accordingly.

But as mentioned above for Apache Commons Math this will not be
necessary as this module is already a valid bundle.

>
> So please let me know if it is possible, if so, how to go about doing it.
>

You might also be interested in [1] as it provides some information on
how to build custom Stanbol configuration.


best
Rupert

[1] http://stanbol.apache.org/docs/trunk/production-mode/

> cheers,
> Amar
>
> -------------------------------------------------------------------------------
> This message was sent using EURECOM Webmail: http://webmail.eurecom.fr
>



--
| Rupert Westenthaler             [email protected]
| Bodenlehenstraße 11                             ++43-699-11108907
| A-5500 Bischofshofen

Reply via email to