Domino

A lightweight Scala library for writing elegant OSGi bundle activators

License

License

GroupId

GroupId

org.helgoboss
ArtifactId

ArtifactId

domino
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

bundle
Description

Description

Domino
A lightweight Scala library for writing elegant OSGi bundle activators
Project URL

Project URL

https://github.com/helgoboss/domino
Source Code Management

Source Code Management

https://github.com/helgoboss/domino

Download domino

Dependencies

compile (7)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.0
org.scala-lang : scala-reflect jar 2.10.0
org.osgi : org.osgi.core jar 4.3.0
org.osgi : org.osgi.compendium jar 4.3.0
org.helgoboss : scala-osgi-metatype jar 1.0.0
org.helgoboss : scala-logging jar 1.0.0
org.helgoboss : capsule jar 1.1.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.scalatest : scalatest_2.10 jar 1.9.1

Project Modules

There are no modules declared in this project.

Domino

Travis CI Build Status Codacy code quality Ready Stories Gitter chat

Domino is a small library for the programming language Scala designed to support developers in writing bundle activators for the Java module system OSGi. It strives to make writing complex and highly-dynamic bundle activators as easy as possible without sacrificing the power of the OSGi API.

As such, Domino is a lightweight alternative to OSGi component models like iPOJO, Blueprint and Declarative Services. Especially for those who want to leverage the power of pure code instead of reverting to an XML- or annotation-based approach.

Features

Expressive

Domino offers an expressive DSL which reflects the event-driven nature of OSGi and allows you to define very easily when your logic is made available and when it is revoked.

Unrestrictive

Some libraries just cover the most common use cases and let you fall deeply whenever you need to do something more special. Then you suddenly find yourself bypassing the library completely. Domino tries to prevent this by staying close to the low-level OSGi API.

Type safe

Most features in Domino benefit from static typing. That means the compiler and your IDE can help you write correct code. Additionally, there’s support for using generic type parameters in the service registry.

Familiar

Instead of inventing a completely foreign DSL, Domino tries to use familiar Scala data types such as Option, List etc. whenever possible so you can make use of those many nice methods like filter or map you probably fell in love with.

Extensible

If the Domino core DSL is not enough for you, simply extend it. Do you want to run a job as long as a certain service is available? Such things can be easily integrated.

Comprehensive

Many of OSGi’s core features are natively supported by the DSL (services, configuration, bundles, meta types).

Getting started

Some lines of code often say more than 1000 words.

Wait for service and register service

import domino.DominoActivator
import org.osgi.service.http.HttpService

class MyService(httpService: HttpService)

class Activator extends DominoActivator {
  whenBundleActive {
    // Make service available as long as another
    // service is present
    whenServicePresent[HttpService] { httpService =>
      val myService = new MyService(httpService)
      myService.providesService[MyService]
    }
  }
}

Listen for configuration updates

import domino.DominoActivator

class KeyService(key: String)

class Activator extends DominoActivator {
  whenBundleActive {
    // Reregister service whenever configuration changes
    whenConfigurationActive("my_service") { conf =>
      val key = conf.getOrElse("key", "defaultKey")
      new KeyService(key).providesService[KeyService]
    }
  }
}

Read more in the complete Domino User Guide.

Download

The latest stable version is 1.1.0 and can be downloaded from Maven Central.

Maven
<dependency>
  <groupId>com.github.domino-osgi</groupId>
  <artifactId>domino_${scala.version}</artifactId>
  <version>1.1.0</version>
</dependency>
SBT
"com.github.domino-osgi" %% "domino" % "1.1.0"
Gradle
compile 'com.github.domino-osgi:domino_${scala.version}:1.1.0'
Manual

Documentation

Development

Contribute

If you want to report a bug or suggest a feature, please do it in the GitHub issues section.

If you want to provide a fix or improvement, please fork Domino and send us a pull request on GitHub. Thank you!

If you want to give general feedback, please do it in the Gitter chat.

If you want to show appreciation for the project, please "star" it on GitHub. That helps us setting our priorities.

Building Domino

Domino is build with Apache Maven and the Polygot Scala Extension. At least Maven 3.3.1 is required.

To cleanly build domino, use:

mvn clean package

To build domino for another Scala version, e.g. 2.10.5 (under a Unix-like OS), use:

SCALA_VERSION=2.10.5 mvn clean package

Creating a Release

  • Bump version in pom file

  • Update Changelog

  • Review documentation

  • Create a git tag with the version

  • Upload the release artifacts up to Maven Central

Deploy to Maven Central / Sonatype Open Source Respository (OSSRH)

Unfortunately, not all Maven plugins are ready yet for a Polyglot Maven setup, thus the current version 1.6.3 of the Maven Staging Plugin simply doen’t work.

To deploy a release to , use the shell script makerelase.sh.

Please review the variables in the script, namely the DOMINO_VERSION and the SCALA_VERSIONS.

When executed the script will create a staging-settings.xml (to which you should add your login credentials) and wait. After pressing enter it will build all artifatcs and upload them to the OSSRH Nexus where you must log-in and manually release these artifacts.

Credits

Thanks to …​

  • helgoboss for creating Domino 1.0.0

  • ScalaModules for being an inspiration, in particular for the bundle and service watching functionality

  • Nyenyec for creating the image from which the Domino logo is derived

License

Domino is licensed under the MIT License.

Changelog

Domino {master}

  • Removed Logging trait from DominoActivator. You can restore the old behavior be mixing in the trait into your activator class.

  • Improved test suite. Now we use PojoSR to test most OSGi dynamics without the need to run a separate container.

  • Fixed naming issues for service provisioning and comsumption.

Domino 1.1.0 - 2015-05-28

  • Switched Maintainer to Tobias Roeser

  • Renamed base package from org.helgoboss.domino to domino

  • Embedded former dependencies (org.helgoboss.capsule, org.helgoboss.scala-osgi-metatype, org.helgoboss.scala-logging) as sub packages

  • Switched to Polyglot Scala extension for Maven 3.3

  • Cross-Release for Scala 2.10 and 2.11

Domino 1.0.0 - 2013-03-31

  • Initial release for Scala 2.10

Versions

Version
1.0.0