domino-osgi / domino Goto Github PK
View Code? Open in Web Editor NEWOSGi dynamics made easy - A Scala DSL to master OSGi dynamics
License: MIT License
OSGi dynamics made easy - A Scala DSL to master OSGi dynamics
License: MIT License
I suppose I'm missing something or missing everything... but I do not see how an end user application should be built. In particular, I miss a sample application which shows how things are wired together.
I'm doing a small proof of concept involving SBT, sbt-osgi and Domino.
Needless to say that I have a build.sbt, not a pom.xml.
My Activator cannot be processed properly by BND (which is wired in the build by sbt-osgi) with a message that my class does not extend BundleActivator, but I know it does.
MyDominoActivator (services.internal)
+-- DominoActivator (domino)
+-- OsgiContext (domino)
+-- EmptyBundleActivator (domino)
+-- BundleActivator (org.osgi.framework)
This is a snippet showing how BND complains:
> services/osgiBundle
[info] Updating {file:/home/rgomes/workspace/alpha1/}services...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/rgomes/workspace/alpha1/services/target/scala-2.11/classes...
[error] bnd: The Bundle Activator services.internal.MyDominoActivator does not implement BundleActivator.
If I create a bundle in the usual way, extending BundleActivator, it works just fine: BND likes it and Karaf can activate the bundle as it should be.
I suppose I'm missing something... or doing something really stupid. Or both.
Could you please give some help during these baby steps?
Thanks a lot.
Migrate the documentation from the separate website to the README. I suggest to use the Asciidoctor format. We could still serve a rendered version via gh-pages branch.
Domino has a very nice type-safe syntax to consume and provide services. But the way, the API is designed, it is only possible to work with types known beforehand (compile time).
In case, were one needs to use generic collections of dependencies (their types), the Domino API (1.0.0) cannot be used, as variables can not be used in type parameter position.
Please add some API to work with generic dependency collections. Also a API to register a generic set of services would be helpful.
Example for dependencies not known at compile time:
// val services = Seq(classOf[ServiceA], classOf[ServiceB])
whenServicesPresent(services) { depsMap: Map[Class[_], Any] =>
val serviceA = depsMap(classOf[serviceA])
val serviceB = depsMap(classOf[serviceB])
}
For reference: https://issues.sonatype.org/browse/OSSRH-15715
I have a:
class OsgiCapsule extends Capsule {
which is added in a DominoActivator
whenBundleActive {
val m = new OsgiCapsule()
addCapsule(m)
I found the start on OsgiCapsule gets called immediately when I added it on addCapsule, Is that the rule?
https://github.com/domino-osgi/domino/blob/master/pom.scala#L12
https:/github.com/domino-osgi/domino
=> https://github.com/domino-osgi/domino
This would make future development and additional maintainers more easy.
Looks like some wrapped Java Collection does not support the remove operation.
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
Scala 2.10.6
Domino 1.1.1
g! stop 0
g! java.lang.UnsupportedOperationException: remove
at scala.collection.convert.Wrappers$MapWrapper$$anon$1$$anon$5.remove(Wrappers.scala:206)
at java.util.AbstractCollection.clear(Unknown Source)
at java.util.AbstractMap.clear(Unknown Source)
at org.apache.ftpserver.impl.DefaultFtpServerContext.dispose(DefaultFtpServerContext.java:198)
at org.apache.ftpserver.impl.DefaultFtpServer.stop(DefaultFtpServer.java:126)
at de.woq.XXX.sib.ftpserver.internal.FtpServerLifecycle.destroy(FtpServerLifecycle.java:87)
at de.woq.XXX.sib.ftpserver.internal.FTPServerActivator$$anonfun$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(FTPServerActivator.scala:103)
at domino.capsule.CapsuleConvenience$$anon$2.stop(CapsuleConvenience.scala:38)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
at domino.capsule.DefaultCapsuleScope.stop(DefaultCapsuleScope.scala:11)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1$$anonfun$apply$1.apply(ServiceWatching.scala:96)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1$$anonfun$apply$1.apply(ServiceWatching.scala:93)
at scala.Option.foreach(Option.scala:236)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1.apply(ServiceWatching.scala:93)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1.apply(ServiceWatching.scala:80)
at domino.service_watching.ServiceWatcherCapsule$$anon$1.removedService(ServiceWatcherCapsule.scala:46)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:956)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:864)
at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
at org.osgi.util.tracker.ServiceTracker.close(ServiceTracker.java:375)
at domino.service_watching.ServiceWatcherCapsule.stop(ServiceWatcherCapsule.scala:56)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
at domino.capsule.DefaultCapsuleScope.stop(DefaultCapsuleScope.scala:11)
at domino.configuration_watching.ConfigurationWatcherCapsule$$anonfun$stop$1.apply(ConfigurationWatcherCapsule.scala:74)
at domino.configuration_watching.ConfigurationWatcherCapsule$$anonfun$stop$1.apply(ConfigurationWatcherCapsule.scala:74)
at scala.Option.foreach(Option.scala:236)
at domino.configuration_watching.ConfigurationWatcherCapsule.stop(ConfigurationWatcherCapsule.scala:74)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
at domino.capsule.DefaultCapsuleScope.stop(DefaultCapsuleScope.scala:11)
at domino.OsgiContext$$anonfun$stop$1.apply(OsgiContext.scala:67)
at domino.OsgiContext$$anonfun$stop$1.apply(OsgiContext.scala:66)
at scala.Option.foreach(Option.scala:236)
at domino.OsgiContext$class.stop(OsgiContext.scala:66)
at domino.DominoActivator.stop(DominoActivator.scala:66)
at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:719)
at org.apache.felix.framework.Felix.stopBundle(Felix.java:2604)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1383)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.lang.Thread.run(Unknown Source)
java.lang.UnsupportedOperationException: remove
at scala.collection.convert.Wrappers$MapWrapper$$anon$1$$anon$5.remove(Wrappers.scala:206)
at java.util.AbstractCollection.clear(Unknown Source)
at java.util.AbstractMap.clear(Unknown Source)
at org.apache.ftpserver.impl.DefaultFtpServerContext.dispose(DefaultFtpServerContext.java:198)
at org.apache.ftpserver.impl.DefaultFtpServer.stop(DefaultFtpServer.java:126)
at de.woq.XXX.sib.ftpserver.internal.FtpServerLifecycle.destroy(FtpServerLifecycle.java:87)
at de.woq.XXX.sib.ftpserver.internal.FTPServerActivator$$anonfun$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(FTPServerActivator.scala:103)
at domino.capsule.CapsuleConvenience$$anon$2.stop(CapsuleConvenience.scala:38)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
at domino.capsule.DefaultCapsuleScope.stop(DefaultCapsuleScope.scala:11)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1$$anonfun$apply$1.apply(ServiceWatching.scala:96)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1$$anonfun$apply$1.apply(ServiceWatching.scala:93)
at scala.Option.foreach(Option.scala:236)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1.apply(ServiceWatching.scala:93)
at domino.service_watching.ServiceWatching$$anonfun$whenAdvancedServicePresent$1.apply(ServiceWatching.scala:80)
at domino.service_watching.ServiceWatcherCapsule$$anon$1.removedService(ServiceWatcherCapsule.scala:46)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:956)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:864)
at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
at org.osgi.util.tracker.ServiceTracker.close(ServiceTracker.java:375)
at domino.service_watching.ServiceWatcherCapsule.stop(ServiceWatcherCapsule.scala:56)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
at domino.capsule.DefaultCapsuleScope.stop(DefaultCapsuleScope.scala:11)
at domino.configuration_watching.ConfigurationWatcherCapsule$$anonfun$stop$1.apply(ConfigurationWatcherCapsule.scala:74)
at domino.configuration_watching.ConfigurationWatcherCapsule$$anonfun$stop$1.apply(ConfigurationWatcherCapsule.scala:74)
at scala.Option.foreach(Option.scala:236)
at domino.configuration_watching.ConfigurationWatcherCapsule.stop(ConfigurationWatcherCapsule.scala:74)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at domino.capsule.DefaultCapsuleScope$$anonfun$stop$1.apply(DefaultCapsuleScope.scala:11)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:79)
at domino.capsule.DefaultCapsuleScope.stop(DefaultCapsuleScope.scala:11)
at domino.OsgiContext$$anonfun$stop$1.apply(OsgiContext.scala:67)
at domino.OsgiContext$$anonfun$stop$1.apply(OsgiContext.scala:66)
at scala.Option.foreach(Option.scala:236)
at domino.OsgiContext$class.stop(OsgiContext.scala:66)
at domino.DominoActivator.stop(DominoActivator.scala:66)
at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:719)
at org.apache.felix.framework.Felix.stopBundle(Felix.java:2604)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1383)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.lang.Thread.run(Unknown Source)
ERROR: Bundle de.woq.XXX.sib.ftpserver [127] Error stopping bundle. (java.lang.UnsupportedOperationException: remove)
ERROR: Bundle de.woq.XXX.sib.ftpserver [127] Error stopping file:/home/lefou/work/woq/XXX-sib-2.0/assembly/de.woq.XXX.sib.blended.shop/target/de.woq.XXX.blended.shop-2.0.12-SNAPSHOT/profiles/XXX-shop/2.0.12-SNAPSHOT/bundles/de.woq.XXX.sib.ftpserver-2.0-SNAPSHOT.jar (org.osgi.framework.BundleException: Activator stop error in bundle de.woq.XXX.sib.ftpserver [127].)
At least: 2.10 and 2.11
The function given to whenConfigurationActive is invoked twice during bundle startup, from two different threads:, the second one is always "CM Configuration Updater (ManagedService Update: pid=...])", the first one depends on how the start happens. If it is done through the Karaf console by the user typing bundle:start, it is the "Karaf local console user karaf" thread but during auto-deploy by dropping a new jar in the deploy folder, it is the same "CM Configuration... " thread.
I'm not sure this is a bug or just a inconvenience we have to live with, but it IS inconvenient for sure...
It should redirect to com.github.domino-osgi:domino_2.10
.
I don't know, if we can create a redirect and keep to 1.0.0 at the same time, but it would be cool.
@helgoboss How do you think about it?
When I bring this into my sbt project I get this error.
Error:scalac: Class javax.servlet.ServletException not found - continuing with a stub.
The Logging
trait introduces a public log
method and lots of protected val
s. It's inherited by DominoActivator
but never used anywhere. I've seen many situation, where SLF4J was the preferred logging solution but the inherited log
variable name collided with the own logger. Also, the provided logger in not lazily acquired (despite the fact, fallbackLogger
is declared lazy) and depends on an early avaliable OSGi LogService
.
We loose nothing, if we remove it from DominoActivator
. A potential user can still simply mix the trait into the concrete activator class.
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.