So I finally started on the actual OSGi task. Here is what we have: > 1. Reorg Cayenne Maven structure, making cayenne-server and cayenne-client > real Maven modules instead of aggregates. We’ve discussed this a few times, > and IIRC I was the only one who opposed it :) I no longer do. We can use > <optional> and “provided” dependencies to exclude the extras like JGroups and > keep it clean.
This was done on Sunday. > 2. We need to add OSGi metadata to cayenne-server (and other Cayenne jars in > the chain… likely just cayenne-di). Just committed configs needed to turn cayenne-di.jar and cayenne-server.jar into proper OSGi bundles. I used the default configuration of maven-bundle-plugin, so every single Cayenne package is exported in the bundle. In the future we may be more specific. cayenne-di.jar has no dependencies. cayenne-server.jar has a bunch of optional dependencies, and 4 required ones: cayenne-di commons-collections commons-logging velocity Also to generate a proper OSGi version (3.2.0.M2-SNAPSHOT) I had to add a dot to our Maven versioning scheme, so the trunk is now called 3.2.M2-SNAPSHOT. Which was probably the right thing to do anyways. > 3. We need to create OsgiServerModule with an overridden AdhocObjectFactory. > This will implement refactored ClassRegistry and will load all model classes > per this example: > http://www.snip2code.com/Snippet/12313/Apache-Cayenne--correctly-load-classes-u > > 4. We may (or may not?) put those few OSGi classes in a separate > cayenne-server-osgi module (to avoid dependency on OSGi framework in the base > cayenne-server). Still TODO. Andrus On Nov 14, 2013, at 5:56 PM, Andrus Adamchik <[email protected]> wrote: > So thanks to Cristiano pinging me offline, I spent some time on reviewing > this again. I think we need to take the following steps to integrate > Abodata’s OSGi code (or follow it as a pattern when we write ours) : > > 1. Reorg Cayenne Maven structure, making cayenne-server and cayenne-client > real Maven modules instead of aggregates. We’ve discussed this a few times, > and IIRC I was the only one who opposed it :) I no longer do. We can use > <optional> and “provided” dependencies to exclude the extras like JGroups and > keep it clean. > > 2. We need to add OSGi metadata to cayenne-server (and other Cayenne jars in > the chain… likely just cayenne-di). > > 3. We need to create OsgiServerModule with an overridden AdhocObjectFactory. > This will implement refactored ClassRegistry and will load all model classes > per this example: > http://www.snip2code.com/Snippet/12313/Apache-Cayenne--correctly-load-classes-u > > > 4. We may (or may not?) put those few OSGi classes in a separate > cayenne-server-osgi module (to avoid dependency on OSGi framework in the base > cayenne-server). > > I placed #1 in my work stack (and really hope something else doesn’t pop up > that pushes it down :-/ ) I don’t think Cristiano can create sensible patches > against trunk without it. After this is done, we can discuss whether me or > Cristiano can do 2..4. > > Andrus > > On Jan 31, 2013, at 3:42 PM, Cristiano Ghersi <[email protected]> > wrote: >> Good morning, >> >> My company (Abodata, www.abodata.com) has ported Cayenne into OSGi >> environment, and we would like to contribute to Cayenne project with this >> enhancement as I posted under user mailing list on October 2012. >> >> Following your instructions, we have uploaded the full content under the >> github repo: >> https://github.com/cristianoghersi/CayenneOSGi >> >> Basically, we have packaged the source code of 3.1 version into an OSGi >> bundle called cayenne-osgi, adding some stuff to manage the particular >> classloading features of OSGi. >> Then we added also another bundle, called Cayenne-3.1-Dependencies, that >> packages all the required dependencies. >> >> I'm at complete disposal for every clarification you need. >> >> I'll wait for your feedback. >> >> Best >> cghersi > >
