Domino
  • Intro
  • Getting started
  • Features
  • Development
  • OSGi dynamics made easy

    Lightweight Scala library for writing elegant OSGi bundle activators

    Latest version
    1.0.0 2013-03-31
    License
    MIT

    Get started GitHub

Project moved

Domino's project page and all of its documentation has moved to GitHub. There you will also find new versions. This page is kept for historical reasons only.

Write elegant OSGi bundle activators in Scala


What is Domino?

And how does it compare to other projects?

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.

Getting started

Usage

because some lines of code often say more than 1000 words

Wait for service and register service

import org.helgoboss.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 org.helgoboss.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]
    }
  }
}

Download and installation

  • domino-1.0.0.jar
  • domino-sources-1.0.0.jar
  • domino-scaladoc-1.0.0.jar
  • Please note that the library JAR doesn't include dependencies and therefore is not suited for using Domino in your project. If you want to use Domino, I strongly recommend you to use a build tool with automatic dependency resolution (like Maven, Gradle or SBT). If you really want to manage dependencies yourself, please refer to the installation instruction tab Manual.

Install

  • Maven
  • SBT
  • Gradle
  • Manual
  • <dependency>
        <groupId>org.helgoboss</groupId>
        <artifactId>domino</artifactId>
        <version>1.0.0</version>
      </dependency>
  • "org.helgoboss" % "domino" % "1.0.0"
  • "org.helgoboss:domino:1.0.0"
    1. Download the Domino JAR and all of its dependencies in the modules section.
    2. Make those JARs available in the classpath of your project.

Docs

  • User guide
  • Scaladoc
  • FAQ

Community

  • Source Code (at GitHub)
  • Forum (Google Groups)

Features

what makes it special

Expressive

intuitive, elegant

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

no painful workarounds

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

all the way

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

feels natural

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

with ease

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

covering OSGi's core

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

Development

Build

  1. Find the GitHub project of the module that you want to build by following the corresponding link in the modules section. Check out the sources from there.
  2. Build the module using Maven:
    mvn clean install

Credits go to

  • 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

Changelog

1.0.0 2013-03-31 JAR | Sources JAR | Scaladoc JAR | GitHub
  • Initial release

Roadmap

1.x
  • Better unit tests

  • Container tests

  • Support for more core services (events, preferences)

  • Type safe configuration extraction with metatypes

Modules

Most of my projects are developed in a modular fashion. That means they are made up by several modules which can be used independently. Here's the list of the modules that make up the latest version of Domino.

Group Artifact Version Download
org.helgoboss domino 1.0.0 JAR
org.helgoboss capsule 1.1.0 JAR
org.helgoboss scala-logging 1.0.0 JAR
org.helgoboss scala-osgi-metatype 1.0.0 JAR
org.osgi org.osgi.compendium 4.3.0 JAR
org.osgi org.osgi.core 4.3.0 JAR
org.scala-lang scala-library 2.10.0 JAR
org.scala-lang scala-reflect 2.10.0 JAR

About Me

I'm a musician and developer with special interest in music software, web technologies and film music.

Get Distracted

I invite you to take a little break and listen to some of my music.

Follow Me

GitHub Twitter YouTube

© 2022 Benjamin Klum, Helgoboss Projects
Legal Disclosure Privacy Statement Terms & Conditions
Back to top