Database OSGi service

Components implementing this service encapsulates database connection/creation and Liquibase schema setup.

License

License

Categories

Categories

Data
GroupId

GroupId

no.priv.bang.osgi.service
ArtifactId

ArtifactId

osgi.service.database
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Database OSGi service
Components implementing this service encapsulates database connection/creation and Liquibase schema setup.

Download osgi.service.database

How to add to project

<!-- https://jarcasting.com/artifacts/no.priv.bang.osgi.service/osgi.service.database/ -->
<dependency>
    <groupId>no.priv.bang.osgi.service</groupId>
    <artifactId>osgi.service.database</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/no.priv.bang.osgi.service/osgi.service.database/
implementation 'no.priv.bang.osgi.service:osgi.service.database:1.0.0'
// https://jarcasting.com/artifacts/no.priv.bang.osgi.service/osgi.service.database/
implementation ("no.priv.bang.osgi.service:osgi.service.database:1.0.0")
'no.priv.bang.osgi.service:osgi.service.database:jar:1.0.0'
<dependency org="no.priv.bang.osgi.service" name="osgi.service.database" rev="1.0.0">
  <artifact name="osgi.service.database" type="jar" />
</dependency>
@Grapes(
@Grab(group='no.priv.bang.osgi.service', module='osgi.service.database', version='1.0.0')
)
libraryDependencies += "no.priv.bang.osgi.service" % "osgi.service.database" % "1.0.0"
[no.priv.bang.osgi.service/osgi.service.database "1.0.0"]

Dependencies

provided (1)

Group / Artifact Type Version
org.osgi : org.osgi.service.jdbc jar 1.0.0

test (7)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.1.0
org.junit.jupiter : junit-jupiter-engine jar 5.1.0
org.junit.vintage : junit-vintage-engine jar 5.1.0
org.junit.platform : junit-platform-launcher jar 1.1.0
org.junit.platform : junit-platform-runner jar 1.1.0
org.assertj : assertj-core jar 3.9.0
org.mockito : mockito-core jar 1.10.19

Project Modules

There are no modules declared in this project.

OSGi service definitions

This repository defines OSGi services I have found useful, and where I have defined similar services in more than once project.

There are no applications in this project, only service definitions.

The service definitions have been deployed to maven central.

Status of the project

https://travis-ci.org/steinarb/osgi-service.svg?branch=master https://coveralls.io/repos/steinarb/osgi-service/badge.svg https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.osgiservice%3Aosgiservice&metric=alert_status#.svg https://maven-badges.herokuapp.com/maven-central/no.priv.bang.osgiservice/osgiservice/badge.svg https://www.javadoc.io/badge/no.priv.bang.osgiservice/osgiservice.svg

SonarCloud

https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.osgiservice%3Aosgiservice&metric=ncloc#.svg https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.osgiservice%3Aosgiservice&metric=bugs#.svg https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.osgiservice%3Aosgiservice&metric=vulnerabilities#.svg https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.osgiservice%3Aosgiservice&metric=code_smells#.svg https://sonarcloud.io/api/project_badges/measure?project=no.priv.bang.osgiservice%3Aosgiservice&metric=coverage#.svg

Services defined in this project

no.priv.bang.osgiservice.database.DatabaseService

The DatabaseService provides access to an actual JDBC database instance. The DS components implementing this service typically:

  1. Receives a DataSourceFactory service
  2. From that DataSourceFactory:
    1. Creates a DataSource (by e.g. connecting to a remote RDBMS like PostgreSQL or e.g. creating an in-memory derby database)
    2. Uses liquibase to create a schema and provide initial data for the database in the DataSource

To compile code using this OSGi service, add the following dependency to your maven POM:

<dependency>
    <groupId>no.priv.bang.osgiservice</groupId>
    <artifactId>osgiservice.database</artifactId>
    <version>1.7.2</version>
    <scope>provided</scope>
</dependency>

To get runtime access to this OSGi service in apache karaf, add the following to the karaf feature definition of the OSGi bundle(s) using the interface:

<repository>mvn:no.priv.bang.osgiservice/osgiservice/1.7.2/xml/features</repository>
<feature name="myfeature">
    <feature>sb-database-osgi-service</feature>
</feature>

Alternatively, when using the karaf-maven-plugin it’s possible to add a karaf runtime feature dependency when generating a feature for your own bundle:

<dependency>
    <groupId>no.priv.bang.osgiservice</groupId>
    <artifactId>osgiservice.database</artifactId>
    <version>1.7.2</version>
    <type>xml</type>
    <classifier>features</classifier>
</dependency>

no.priv.bang.osgiservice.users.UserManagementService

The UserManagementService provides access to management of users, roles and permissions.

To compile code using this OSGi service, add the following dependency to your maven POM:

<dependency>
    <groupId>no.priv.bang.osgiservice</groupId>
    <artifactId>osgiservice.users</artifactId>
    <version>1.7.2</version>
    <scope>provided</scope>
</dependency>

To get runtime access to this OSGi service in apache karaf, add the following to the karaf feature definition of the OSGi bundle(s) using the interface:

<repository>mvn:no.priv.bang.osgiservice/osgiservice/1.7.2/xml/features</repository>
<feature name="myfeature">
    <feature>sb-database-osgi-service</feature>
</feature>

Alternatively, when using the karaf-maven-plugin it’s possible to add a karaf runtime feature dependency when generating a feature for your own bundle:

<dependency>
    <groupId>no.priv.bang.osgiservice</groupId>
    <artifactId>osgiservice.users</artifactId>
    <version>1.7.2</version>
    <type>xml</type>
    <classifier>features</classifier>
</dependency>

Release history

Version Date Description
1.7.2 [2021-04-18] Add a “Bill of Materials” (BoM)
1.7.1 [2021-04-15] Get maven dependencies and maven plugin config from a parent POM
1.7.0 [2021-04-12] Built with karaf 4.3.0 and OSGi 7
1.6.1 [2021-03-13] Fixes to the UserManagementService bean builders. Should have tested better before releasing
1.6.0 [2021-03-10] Use builders to create the beans used in the UserManagementService interface
1.5.0 [2019-12-31] Let Immutable provide hashCode() and equals() implementation to user management beans
1.4.0 [2019-10-27] Add abstract class DatabaseServiceBase implementing getConnection() and method for creating JDBC connection properties
1.3.0 [2019-10-14] Update plugins and dependencies and fix issue #1
1.2.0 [2019-03-30] Add methods to UserManagementService
1.1.0 [2019-02-17] Working javadoc, first version of the UserManagementService
1.0.0 [2018-12-19] First version of the DatabaseService

License

This code is licensed under the Apache license v. 2. See the LICENSE file for details.

Versions

Version
1.0.0