cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Cayenne under OSGi
Date Sun, 24 Nov 2013 16:15:44 GMT
So this is done. Cristiano, appreciate if you could try it in your environment. An example
of how to use Cayenne with OSGi is available on GitHub [1]. Here is how you bootstrap it in
your own module:

  Module osgiModule = OsgiModuleBuilder.forProject(Activator.class).withDriver(Driver.class).module();
  return new ServerRuntime("cayenne-osgi-example.xml", osgiModule);

As you see, no need to enumerate your classes. Also I suspect instead of binding the driver,
in a real OSGi environment Cayenne stack will need to refer to some OSGi service that encapsulates
the DataSource. We can provide integrations for that too. And don’t forget to stop it when
you your bundle is stopped, as you don’t want to keep Cayenne threads and other resources
hanging around, eventually killing your container:

  cayenneRuntime.shutdown();

Cheers,
Andrus


[1] https://github.com/andrus/cayenne-osgi-example
Mime
View raw message