cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gustavo Morozowski" <morovas...@gmail.com>
Subject Re: osgi bundles
Date Wed, 18 Jul 2007 22:51:04 GMT
I've checked with the jetty project, from version 6.1.5 onward they jars
will be OSGi "enabled", and they are using the same maven plugin I talked
about. And Spring-OSGi is also using it, so I think it's a good start :)

The first step is to use the plugin to generate the manifests. I modified
the pom.xml from the rt/core to include:

<packaging>bundle</packaging>

This is the package specifier to create osgi manifests.

- <#> <plugin>
      <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <extensions>true</extensions>
 - <#>       <configuration>
 - <#>           <instructions>
                  <Private-Package>org.apache.cxf.*</Private-Package>
                  <Bundle-Version>1.0.0</Bundle-Version>
         </instructions>
     </configuration>
</plugin>

Here I am telling the plugin that all packages are private to the jar. So
the resulting manifest is:

Manifest-Version: 1
Bundle-Vendor: Apache Software Foundation
Private-Package: META-INF.cxf,META-INF.services,org.apache.cxf,
org.apache.cxf.attachment,
org.apache.cxf.binding,org.apache.cxf.bus,org.apache.cxf.bus.extension,
[...]
Bundle-Version: 1.0.0
Bundle-Name: Apache CXF Runtime Core
Created-By: Bnd-0.0.106
Bundle-ManifestVersion: 2
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Include-Resource: src/main/resources/
Bundle-DocURL: http://www.apache.org/
Bundle-SymbolicName: org.apache.cxf.cxf-rt-core
Import-Package: com.ibm.wsdl.extensions.schema,com.ibm.wsdl.extensions.soap,
javax.activation,javax.annotation,javax.jws,javax.jws.soap,javax.mail,
javax.mail.internet,
javax.management,javax.net.ssl,javax.wsdl,
[...]

The important sessions here are Private-Package, Import-Package and
Export-Package (not seen in this example). In OSGi dependency is specified
in package level, so Import-Package declares the needed packages to import
and is automatically created by the plugin.

The Export-Package lists the packages exported by the jar to other packages.
It's important to understand that the osgi runtime enforces this visibility,
so even if you declare public classes inside a jar they will not be seen to
other jars unless they are exported. The Private-Package is the opposite.

So the first step will be to write this definitions. At first I will export
all packages and see how it works. As I am not a maven guru I would need
some advice which pom.xml put the necessary <repository> and
<pluginRepositories> sections needed by the plugin (probably in the root
pom?).

I would like to point to more detailed references:

Bundle Plugin for Maven:
http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html

Bnd tool this plugin is based:
http://www.aqute.biz/Code/Bnd

Sample use of this tool to wrap hibernate as osgi bundle:
http://www.aqute.biz/Code/BndHibernate

Getting Started with OSGi series:
http://neilbartlett.name/blog/osgi-articles<http://neilbartlett.name/blog/osgi-articles/>

Gustavo

On 7/12/07, Oisin Hurley <ohurley@iona.com> wrote:
>
> > I see that there's a open ticket (
> > http://issues.apache.org/jira/browse/CXF-490) for creating OSGi
> > bundles. I
> > have made a small experiment to include the maven bundle plugin (
> > http://cwiki.apache.org/FELIX/maven-bundle-plugin-bnd.html) in the
> > runtime
> > core jar to gererate osgi compatible manifests. If there is
> > interest I could
> > give more details and help with this ticket.
>
> Definitely some interest from me, Gustavo, let's have some more
> details :)
>
>   cheers
>    --oh
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>

Mime
View raw message