domino
package domino
Contains Domino, a lightweight Scala library for writing elegant OSGi bundle activators.
For getting started, please see DominoActivator, the main entry point to the Domino DSL. Each sub package contains functionality for a specific part of the DSL.
- Alphabetic
- By Inheritance
- domino
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
abstract
class
DominoActivator extends OsgiContext with CapsuleConvenience with BundleWatching with ConfigurationWatching with ServiceConsuming with ServiceProviding with ServiceWatching
This is the main entry point to the Domino DSL.
This is the main entry point to the Domino DSL.
By having your bundle activator extend from this class, you get full access to the Domino DSL. In most cases DominoActivator is all you need because it mixes in all the other functionality.
Note that if you use watchServices or watchBundles, you might additionally want to import the relevant watcher events.
Example 1: Wait for a service
package org.example.domino_test_one import domino.DominoActivator import org.osgi.service.http.HttpService class MyService(httpService: HttpService) class Activator extends DominoActivator { whenBundleActive { // Make MyService available as long as HttpService is present whenServicePresent[HttpService] { httpService => val myService = new MyService(httpService) myService.providesService[MyService] } } }
Example 2: Listen for configuration changes
package org.example.domino_test_two import domino.DominoActivator class KeyService(key: String) class Activator extends DominoActivator { whenBundleActive { // Reregister KeyService whenever configuration changes whenConfigurationActive("my_service") { conf => val key = conf.get("key") map { _.asInstanceOf[String] } getOrElse "defaultKey" new KeyService(key).providesService[KeyService] } } }
- Note
I suggest extending from this class instead of mixing in the subpackage traits. Then you don't need to recompile your bundle if minor internal changes are made to Domino. This results in greater upwards compatibility.
-
trait
DominoImplicits extends AnyRef
Provides common implicit conversions.
Provides common implicit conversions. This is used by the other traits.
-
trait
EmptyBundleActivator extends BundleActivator
A bundle activator which contains empty
start
andstop
methods.A bundle activator which contains empty
start
andstop
methods. This is the basis for the trait OsgiContext which hooks into thestart
andstop
methods.- See also
-
trait
OsgiContext extends DynamicCapsuleContext with EmptyBundleActivator
Provides the basis for the Domino DSL by binding the bundle lifecycle to a capsule scope.
Provides the basis for the Domino DSL by binding the bundle lifecycle to a capsule scope.
- See also
-
class
RichServiceReference[S <: AnyRef] extends AnyRef
Wrapper for a service reference which adds methods to resolve the corresponding service.
Value Members
-
object
DominoUtil
Contains utility methods used throughout Domino.