diff --git a/akka-osgi/akka-dependencies-bundle/pom.xml b/akka-osgi/akka-dependencies-bundle/pom.xml
deleted file mode 100644
index 74d1792be4..0000000000
--- a/akka-osgi/akka-dependencies-bundle/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
- 4.0.0
-
-
- se.scalablesolutions.akka
- akka-osgi-parent
- 0.7-SNAPSHOT
-
-
- akka-dependencies-bundle
- Akka Dependencies Bundle
-
-
-
- akka-kernel
- se.scalablesolutions.akka
- ${project.version}
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
-
- *;resolution:=optional
-
-
-
- !test.*,
-
-
- !scala.*,
- !org.apache.commons.io.*,
- !org.codehaus.jackson.*,
- !org.codehaus.jettison.*,
- !org.jboss.netty.*,
-
-
- !se.scalablesolutions.akka.*,
-
-
- *;-split-package:=merge-first
-
-
-
-
-
-
-
-
diff --git a/akka-osgi/akka-sample-osgi/pom.xml b/akka-osgi/akka-sample-osgi/pom.xml
deleted file mode 100644
index bd48ca2392..0000000000
--- a/akka-osgi/akka-sample-osgi/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
- 4.0.0
-
- akka-sample-osgi
- Akka OSGi Sample Module
-
- jar
-
-
- akka-osgi-parent
- se.scalablesolutions.akka
- 0.7-SNAPSHOT
-
-
-
-
- akka-core
- se.scalablesolutions.akka
- ${project.version}
-
-
- org.osgi
- org.osgi.core
-
-
- org.osgi
- org.osgi.compendium
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- se.scalablesolutions.akka.osgi.sample.Activator
-
- se.scalablesolutions.akka.osgi.sample
-
-
-
-
-
-
-
-
diff --git a/akka-osgi/akka-sample-osgi/src/main/scala/Activator.scala b/akka-osgi/akka-sample-osgi/src/main/scala/Activator.scala
deleted file mode 100644
index 7925a2705f..0000000000
--- a/akka-osgi/akka-sample-osgi/src/main/scala/Activator.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-
-package se.scalablesolutions.akka.osgi.sample
-
-import org.osgi.framework.{BundleContext, BundleActivator}
-import se.scalablesolutions.akka.config.ScalaConfig._
-import se.scalablesolutions.akka.actor.{Supervisor, SupervisorFactory}
-
-class Activator extends BundleActivator {
-
- var supervisor: Supervisor = _
-
- val ping = new Ping
-
- def start(context: BundleContext) {
- println("Starting Akka OSGi sample")
-
- supervisor = SupervisorFactory(
- SupervisorConfig(
- RestartStrategy(OneForOne, 3, 100, List(classOf[Exception])),
- Supervise(ping, LifeCycle(Permanent)) :: Nil)).newInstance
-
- supervisor.start
- println("Supervisor: " + supervisor)
-
- println("Sending ping")
- ping send CounterMessage(0)
-
- }
-
- def stop(context: BundleContext) {
- println("Stopping Akka OSGi sample")
-
- supervisor.stop
- }
-
-}
\ No newline at end of file
diff --git a/akka-osgi/akka-sample-osgi/src/main/scala/Actors.scala b/akka-osgi/akka-sample-osgi/src/main/scala/Actors.scala
deleted file mode 100644
index 008ea98ef1..0000000000
--- a/akka-osgi/akka-sample-osgi/src/main/scala/Actors.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-
-package se.scalablesolutions.akka.osgi.sample
-
-import se.scalablesolutions.akka.actor.Actor
-
-case class CounterMessage(counter: Int)
-
-class Ping extends Actor {
- def receive = {
- case CounterMessage(i) => println("Got message " + i)
- }
-}
-
-class Pong extends Actor {
- def receive = {
- case _ =>
- }
-}
diff --git a/akka-osgi/deployer/pom.xml b/akka-osgi/deployer/pom.xml
deleted file mode 100644
index db35d10dc1..0000000000
--- a/akka-osgi/deployer/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
- 4.0.0
-
-
- se.scalablesolutions.akka
- akka-osgi-parent
- 0.7-SNAPSHOT
-
-
- akka-deployer
- Akka Deployer
-
-
-
- org.scala-lang
- scala-library
- ${scala.version}
-
-
- org.osgi
- org.osgi.core
-
-
- org.osgi
- org.osgi.compendium
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- se.scalablesolutions.akka.osgi.deployer.Activator
- se.scalablesolutions.akka.osgi.deployer.*
-
-
-
-
-
-
-
diff --git a/akka-osgi/deployer/src/main/scala/Activator.scala b/akka-osgi/deployer/src/main/scala/Activator.scala
deleted file mode 100644
index d12b63ba16..0000000000
--- a/akka-osgi/deployer/src/main/scala/Activator.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-
-package se.scalablesolutions.akka.osgi.deployer
-
-import org.osgi.framework.{BundleContext, BundleActivator}
-import java.io.File
-
-class Activator extends BundleActivator {
-
- private val AKKA_DEPLOYER_DIR = "akka.deployer.dir"
- private val AKKA_DEPLOYER_POLL = "akka.deployer.poll"
-
- private var watcher: DirWatcher = _
-
- def start(context: BundleContext) {
- var bundlesDir = context.getProperty(AKKA_DEPLOYER_DIR)
- bundlesDir = if (bundlesDir == null) "akka" else bundlesDir
-
- // check dir exists
- if (new File(bundlesDir).listFiles == null) {
- System.out.println("DirInstaller WARNING: Directory '" + bundlesDir + "' does not exist!")
- return
- }
-
- var interval = context.getProperty(AKKA_DEPLOYER_POLL)
- interval = if (interval == null) "2000" else interval
-
- watcher = new DirWatcher(context, bundlesDir, interval.toInt)
- watcher.startWatching
- }
-
- def stop(context: BundleContext) {
- if (watcher != null)
- watcher.stopWatching
- }
-
-}
diff --git a/akka-osgi/deployer/src/main/scala/DirWatcher.scala b/akka-osgi/deployer/src/main/scala/DirWatcher.scala
deleted file mode 100644
index 4d4292604c..0000000000
--- a/akka-osgi/deployer/src/main/scala/DirWatcher.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-
-package se.scalablesolutions.akka.osgi.deployer
-
-import org.osgi.util.tracker.ServiceTracker
-import java.io.File
-import org.osgi.service.packageadmin.PackageAdmin
-import org.osgi.framework.{Bundle, BundleContext}
-
-class DirWatcher(context: BundleContext, bundlesDir: String, interval: Int) {
-
- private var running = false
-
- private final var timestamps = Map[String, Long]()
-
- private val packageAdminTracker = new ServiceTracker(context, classOf[PackageAdmin].getName, null)
- packageAdminTracker.open
-
- def startWatching {
- if (running) return
- running = true
- new Thread {
- override def run {
- try {
- while (running) {
- val found = getAllFiles(bundlesDir)
- analyseNewState(found)
- Thread.sleep(interval)
- }
- }
- catch {
- case e: InterruptedException =>
- }
- }
- }.start()
- }
-
- def stopWatching {
- running = false
- }
-
- private def getAllFiles(dirName: String): List[File] = {
- val content = new File(dirName).listFiles
- val files = content.filter(_.isFile).toList
- val childs = content.filter(_.isDirectory).toList.flatMap(d => getAllFiles(d.getCanonicalPath))
- files ::: childs
- }
-
- private def analyseNewState(found: List[File]) {
- println("FOUND:" + found)
-
- // new or updated
- val changed = found.filter(f => timestamps.getOrElse(f.getCanonicalPath, -1L) < f.lastModified)
- changed.foreach {f =>
- val name = f.getCanonicalPath
- timestamps += (name -> f.lastModified)
- if (name.endsWith(".jar")) installOrUpdateBundle(name)
- }
- println("CHANGED:" + changed)
-
- // removed
- val removed = timestamps.filter(f => !found.map(_.getCanonicalPath).contains(f._1))
- removed.foreach {f =>
- context.getBundles.filter(b => b.getLocation.equals("file:" + f._1)).foreach(_.uninstall)
- timestamps -= f._1
- }
- println("REMOVED:" + removed)
-
- if (changed.size + removed.size > 0)
- startAllAndRefresh()
-
- println("")
- }
-
- private def startAllAndRefresh() {
- context.getBundles.filter(b => b.getState != Bundle.ACTIVE && !isFragment(b)).foreach {b =>
- try {
- b.start
- } catch {
- case e: Exception => {
- System.out.println("Problems starting bundle: " + b)
- e.printStackTrace
- }
- }
- }
-
- val admin = this.packageAdminTracker.getService.asInstanceOf[PackageAdmin]
- System.out.println("DirInstaller: Refreshing packages")
- admin.refreshPackages(null)
- }
-
-
- private def isFragment(b: Bundle): Boolean = {
- var admin: PackageAdmin = this.packageAdminTracker.getService.asInstanceOf[PackageAdmin]
- return admin.getBundleType(b) == PackageAdmin.BUNDLE_TYPE_FRAGMENT
- }
-
-
- private def installOrUpdateBundle(s: String) {
- for (b <- context.getBundles) {
- if (b.getLocation.endsWith(s)) {
- System.out.println("DirInstaller: Updating bundle [" + b.getSymbolicName + "]")
- b.stop
- b.update
- return
- }
- }
- System.out.println("DirInstaller: Installing bundle [" + s + "]")
- context.installBundle("file:" + s)
- }
-
-
-}
\ No newline at end of file
diff --git a/akka-osgi/karaf/pom.xml b/akka-osgi/karaf/pom.xml
deleted file mode 100644
index aaf297a82c..0000000000
--- a/akka-osgi/karaf/pom.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
- 4.0.0
-
-
- akka-osgi-parent
- se.scalablesolutions.akka
- 0.7-SNAPSHOT
-
-
- akka-karaf
- Akka OSGi Karaf Distribution
- pom
-
-
- http://www.apache.org/dist/felix/apache-felix-karaf-1.4.0.tar.gz
- apache-felix-karaf-1.4.0
-
-
-
-
-
- akka-dependencies-bundle
- se.scalablesolutions.akka
- ${project.version}
-
-
-
-
- scala-library
- org.scala-lang-osgi
- 2.7.7
-
-
- commons-io
- commons-io
- 1.4
-
-
- org.codehaus.jackson
- jackson-core-asl
- 1.2.1
-
-
- org.codehaus.jackson
- jackson-mapper-asl
- 1.2.1
-
-
- org.jboss.netty
- netty
- 3.2.0.ALPHA3
-
-
-
-
- akka-core
- se.scalablesolutions.akka
- ${project.version}
-
-
- akka-deployer
- se.scalablesolutions.akka
- ${project.version}
-
-
- akka-sample-osgi
- se.scalablesolutions.akka
- ${project.version}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-antrun-plugin
-
- generate-resources
- generate-resources
-
-
-
-
-
-
-
-
- run
-
-
-
-
-
- maven-assembly-plugin
-
-
- src/main/assembly/runtime.xml
-
-
-
-
- make-distribution-dir
- package
-
- directory-single
-
-
-
- make-distribution-zip
- package
-
- single
-
-
-
-
-
-
-
-
diff --git a/akka-osgi/karaf/src/main/assembly/runtime.xml b/akka-osgi/karaf/src/main/assembly/runtime.xml
deleted file mode 100644
index 2fe4ef12cd..0000000000
--- a/akka-osgi/karaf/src/main/assembly/runtime.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
- runtime
-
- zip
-
- false
-
-
- src/main/resources/runtime
-
-
-
- target/generated/runtime
-
-
-
-
-
-
- se.scalablesolutions.akka:akka-deployer
-
- ${karaf.root.dir}/akka
- false
- false
- false
-
-
-
- se.scalablesolutions.akka:akka-deployer
-
- ${karaf.root.dir}/deploy
- false
- false
- false
-
-
-
diff --git a/akka-osgi/pom.xml b/akka-osgi/pom.xml
deleted file mode 100644
index 9748335c9b..0000000000
--- a/akka-osgi/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
- 4.0.0
-
-
- se.scalablesolutions.akka
- akka
- 0.7-SNAPSHOT
-
-
- akka-osgi-parent
- Akka OSGi Parent
-
- pom
-
-
- 4.2.0
-
-
-
- deployer
- akka-dependencies-bundle
- akka-sample-osgi
- karaf
-
-
-
-
-
- org.osgi
- org.osgi.core
- ${osgi.version}
- provided
-
-
- org.osgi
- org.osgi.compendium
- ${osgi.version}
- provided
-
-
-
-
-
diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala
index a26396c8e8..d3491f6a3f 100644
--- a/project/build/AkkaProject.scala
+++ b/project/build/AkkaProject.scala
@@ -10,6 +10,8 @@ import java.util.jar.Attributes
import java.util.jar.Attributes.Name._
import java.io.File
+import com.weiglewilczek.bnd4sbt.BNDPlugin
+
class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
// ------------------------------------------------------------
@@ -65,6 +67,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
lazy val akka_jta = project("akka-jta", "akka-jta", new AkkaJTAProject(_), akka_core)
lazy val akka_kernel = project("akka-kernel", "akka-kernel", new AkkaKernelProject(_),
akka_core, akka_http, akka_spring, akka_camel, akka_persistence, akka_amqp)
+ lazy val akka_osgi = project("akka-osgi", "akka-osgi", new AkkaOSGiParentProject(_))
// functional tests in java
lazy val akka_fun_test = project("akka-fun-test-java", "akka-fun-test-java", new AkkaFunTestProject(_), akka_kernel)
@@ -273,6 +276,29 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
val jta_spec = "org.apache.geronimo.specs" % "geronimo-jta_1.1_spec" % "1.1.1" % "compile"
}
+ // ================= OSGi Packaging ==================
+ class AkkaOSGiBundleProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin {
+ override def bndClasspath = compileClasspath
+ override def bndPrivatePackage = Set("")
+ override def bndExportPackage = Set("se.scalablesolutions.akka.*;version=0.9")
+ }
+
+ class AkkaOSGiAssemblyProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
+ // FIXME: Find out how to replace mvn-assembly within SBT
+
+ //override def packageAction = task {
+ //FileUtilities.copy(info.dependencies.map(_.outputPath), "XXX", true, true, log)
+ //None
+ //} dependsOn(compile) describedAs("Creates the OSGi distribution.")
+ }
+
+ class AkkaOSGiParentProject(info: ProjectInfo) extends ParentProject(info) {
+ lazy val akka_osgi_bundle = project("akka-osgi-bundle", "akka-osgi-bundle",
+ new AkkaOSGiBundleProject(_), akka_kernel)
+ lazy val akka_osgi_assembly = project("akka-osgi-assembly", "akka-osgi-assembly",
+ new AkkaOSGiAssemblyProject(_), akka_osgi_bundle)
+ }
+
// ================= TEST ==================
class AkkaFunTestProject(info: ProjectInfo) extends DefaultProject(info) {
val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % "1.2.1" % "compile"
diff --git a/project/plugins/Plugins.scala b/project/plugins/Plugins.scala
index f36c65ed13..895df56970 100644
--- a/project/plugins/Plugins.scala
+++ b/project/plugins/Plugins.scala
@@ -5,4 +5,6 @@ class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
val spdeSbt = "us.technically.spde" % "spde-sbt-plugin" % "0.4.1"
// val repo = "GH-pages repo" at "http://mpeltonen.github.com/maven/"
// val idea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT"
-}
\ No newline at end of file
+
+ lazy val bnd4sbt = "com.weiglewilczek" % "bnd4sbt" % "0.4"
+}