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.
- 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
ormap
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).
Some lines of code often say more than 1000 words.
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]
}
}
}
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.
The latest stable version is 1.1.5 and can be downloaded from Maven Central.
- Maven
<dependency>
<groupId>com.github.domino-osgi</groupId>
<artifactId>domino_${scala.version}</artifactId>
<version>1.1.5</version>
</dependency>
- Mill
ivy"com.github.domino-osgi::domino:1.1.5"
- SBT
"com.github.domino-osgi" %% "domino" % "1.1.5"
- Gradle
compile 'com.github.domino-osgi:domino_${scala.version}:1.1.5'
- Manual
-
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.
Domino is build with the Mill build tool.
To cleanly build domino, you can use the bundles start script or your locally installed mill executable:
./millw clean package
-
Bump version in
build.sc
file -
Update Changelog
-
Review documentation
-
Create a git tag with the version
-
Upload the release artifacts up to Maven Central
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
Domino is licensed under the MIT License.
-
Support for Scala 2.13
-
Bumped supported Scala versions to latest releases
-
Added option to log currently unsatisfied service watchers
-
Removed
Logging
trait fromDominoActivator
. You can restore the old behavior be mixing in the trait into your activator class. -
Improved test suite and implemented more tests. Now we use PojoSR to test OSGi dynamics without the need to run a separate container.
-
Fixed naming issues for service provisioning and comsumption.
-
Fixed unnecessary re-configuration issues with
whenConfigurationActive
andwhenFactoryConfigurationActive
.
-
Switched Maintainer to Tobias Roeser
-
Renamed base package from
org.helgoboss.domino
todomino
-
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