karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: Pluggable databases in apache karaf
Date Sat, 26 Oct 2019 15:37:51 GMT
Hi Steinar,

you do not have to build your own layer to use liquibase. Pax-jdbc-config
has a preHook that can help with this.

See
https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/service/src/main/java/net/lr/tutorial/db/service/Migrator.java
and
https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/org.ops4j.datasource-person.cfg#L4


The preHook attribute allows to select a PreHook service by name.
This service is called before the DataSource is published.

Christian


Am Sa., 26. Okt. 2019 um 16:06 Uhr schrieb Steinar Bang <sb@dod.no>:

> >>>>> jb@nanthrax.net:
>
> > Hi
> > Thanks for sharing, I will take a look.
>
> > The purpose is to have a service layer ?
>
> The purpose is to have a database that is ready to be used
> (ie. connected and with a schema) by the business logic code, and to
> make it easy to switch databases.
>
> > What's the difference with pax-jdbc and karaf JDBC feature ?
>
> It builds on top of them.
>
> pax-jdbc provides a DataSourceFactory.
>
> The components described in the blog post provides a DataSource.
>
> The addition to pax-jdbc is actually connecting to the database and
> using liquibase to set up/modify the schema and insert initial data.
>
> Ie. my application specific database DS components use pax-jdbc (in the
> case of derby) and the PostgreSQL driver to get the DataSourceFactory
>
> When the application specific database DS components receive a
> DataSourceFactory injection and they are activated, the first thing they
> do is get a DataSource from the DataSourceFactory. This DataSource is
> kept around while the DS component is active.
>
> Before exposing any service, the application specific database DS
> component will run liquibase scripts to set up/update the schema (and
> add initial data), and when the scripts have run expose the application
> specific database service.
>
>

-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

Mime
View raw message