cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cristiano Ghersi (JIRA)" <>
Subject [jira] [Commented] (CAY-1882) Porting to OSGi environment
Date Thu, 14 Nov 2013 14:59:21 GMT


Cristiano Ghersi commented on CAY-1882:

1) Code to change:
1.a) A new class ClassRegistry has to be added in the org.apache.cayenne.di.spi package. Find
attached the class code.
1.b) A Cayenne class (org.apache.cayenne.di.spi.DefaultAdhocObjectFactory) has also to be
modified to be able to search in the ClassRegistry for classes. Find attached the class code.

2) Maven generation for OSGi: Maven can generate an OSGi Bundle adding automatically all the
dependencies, based on the maven project dependencies and source analysis. To generate an
OSGi bundle some changes are needed in the pom.xml (or files if you are working on multiple
projects) file. First of all it is necessary to change the packaging type of the project from
jar to bundle as it is show in this snippet:
<project xmlns="" xmlns:xsi=""
        <name>Cayenne OSGified</name>

Then it is necessary to add a plugin to the build section:
                                <Export-Package>org.apache.cayenne, org.apache.cayenne.*</Export-Package>
Finally you can generate the bundle jar
$ cd cayenne-osgi # or navigate to the root directory of the cayenne osgi project
$ mvn org.apache.felix:maven-bundle-plugin:bundle
The bundle jar can be found in cayenne-osgi/target/cayenne-osgi.jar
Feel free to change this procedure according to your experience!

3) Use in production environment.
To use Cayenne under OSGi environment, the user needs to place the following snippet at the
initialization of Cayenne stuff:

> Porting to OSGi environment
> ---------------------------
>                 Key: CAY-1882
>                 URL:
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.1B1, 3.1B2, 3.2M1
>         Environment: OSGi
>            Reporter: Cristiano Ghersi
>              Labels: class_loader, osgi
>             Fix For: 3.2M2
> Cayenne framework doesn't run under OSGi environments as class-loading problems arise
in the dynamic loading of autogenerated classes by Cayenne Modeler.

This message was sent by Atlassian JIRA

View raw message