Hi Cristiano,
So I guess our goal is to tweak the Cayenne build process (and code if needed)
so that it builds OSGI-compatible jars.
Let's start with the code⦠I created a diff to better demonstrate the change in
DefaultAdhocObjectFactory between Cayenne and your code:
+import java.util.List;
+
import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.di.AdhocObjectFactory;
import org.apache.cayenne.di.Inject;
@@ -102,6 +104,16 @@
return Class.forName(className, true, classLoader);
}
catch (ClassNotFoundException e) {
+ //try with the class loader registry
+ List<ClassLoader> registeredClassLoaders =
ClassLoaderRegistry.registeredClassLoaders();
+ for (ClassLoader loader : registeredClassLoaders) {
+ try {
+ return loader.loadClass(className);
+ }
+ catch (ClassNotFoundException cnfe) {
+ }
+ }
+
if (!className.endsWith("[]")) {
if ("byte".equals(className)) {
return Byte.TYPE;
I guess this is what you described in the previous message (only slightly
different naming - ClassLoaderRegistry). I couldn't find who actually populates
those extra class loaders inside ClassLoaderRegistry? Could you comment on this
please?
So other than that, I guess all we need is changing cayenne-server packaging
from "jar" to "bundle" (and configuring the bundle plugin in the pom).
Andrus
On Feb 28, 2013, at 12:19 PM, Cristiano Ghersi <[email protected]>
wrote:
> Hi Andrus,
>
> I know you have been very busy with the new upcoming release of Cayenne.
>
> I'd like to know if and when we can resume the task of Cayenne
> OSGi-fication.
>
> I'm at your disposal for every clarification.
>
> Thank you very much
> Best
> Cristiano