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.
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]
}
}
}
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]
}
}
}
Learn more on Domino's project website.