diff --git a/akka-persistence/akka-persistence-voldemort/src/main/scala/VoldemortStorageBackend.scala b/akka-persistence/akka-persistence-voldemort/src/main/scala/VoldemortStorageBackend.scala index 6849aa09b2..6915a7bca8 100644 --- a/akka-persistence/akka-persistence-voldemort/src/main/scala/VoldemortStorageBackend.scala +++ b/akka-persistence/akka-persistence-voldemort/src/main/scala/VoldemortStorageBackend.scala @@ -11,13 +11,14 @@ import se.scalablesolutions.akka.util.Helpers._ import se.scalablesolutions.akka.config.Config.config import voldemort.client._ -import collection.mutable.{Set, HashSet, ArrayBuffer} import java.lang.String import voldemort.utils.ByteUtils -import collection.immutable.{SortedSet, TreeSet} import voldemort.versioning.Versioned -import java.util.Map import collection.JavaConversions +import java.nio.ByteBuffer +import collection.immutable.{IndexedSeq, SortedSet, TreeSet} +import collection.mutable.{Map, Set, HashSet, ArrayBuffer} +import java.util.{Map => JMap} private[akka] object VoldemortStorageBackend extends @@ -25,26 +26,27 @@ MapStorageBackend[Array[Byte], Array[Byte]] with VectorStorageBackend[Array[Byte]] with RefStorageBackend[Array[Byte]] with Logging { - - /** - * Concat the owner+key+lenght of owner so owned data will be colocated - * Store the length of owner as last byte to work around the rare case - * where ownerbytes1 + keybytes1 == ownerbytes2 + keybytes2 but ownerbytes1 != ownerbytes2 - */ - private def mapKey(owner: String, key: Array[Byte]): Array[Byte] = { - val ownerBytes: Array[Byte] = owner.getBytes("UTF-8") - val ownerLenghtByte = ownerBytes.length.byteValue - val theMapKey = new Array[Byte](ownerBytes.length + key.length + 1) - System.arraycopy(ownerBytes, 0, theMapKey, 0, ownerBytes.length) - System.arraycopy(key, 0, theMapKey, ownerBytes.length, key.length) - theMapKey.update(theMapKey.length - 1, ownerLenghtByte) - theMapKey + val bootstrapUrl: String = config.getString("akka.storage.voldemort.bootstrap.url", "tcp://localhost:6666") + val refStore = config.getString("akka.storage.voldemort.store.ref", "Refs") + val mapKeyStore = config.getString("akka.storage.voldemort.store.map.key", "MapKeys") + val mapValueStore = config.getString("akka.storage.voldemort.store.map.value", "MapValues") + val vectorSizeStore = config.getString("akka.storage.voldemort.store.vector.size", "VectorSizes") + val vectorValueStore = config.getString("akka.storage.voldemort.store.vectore.value", "VectorValues") + val storeClientFactory = { + if (bootstrapUrl.startsWith("tcp")) { + new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl)) + } else if (bootstrapUrl.startsWith("http")) { + new HttpStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl)) + } else { + throw new IllegalArgumentException("Unknown boostrapUrl syntax" + bootstrapUrl) + } } - - var refClient: StoreClient[String, Array[Byte]] = null - var mapKeyClient: StoreClient[String, SortedSet[Array[Byte]]] = null - var mapValueClient: StoreClient[Array[Byte], Array[Byte]] = null - + var refClient: StoreClient[String, Array[Byte]] = storeClientFactory.getStoreClient(refStore) + var mapKeyClient: StoreClient[String, SortedSet[Array[Byte]]] = storeClientFactory.getStoreClient(mapKeyStore) + var mapValueClient: StoreClient[Array[Byte], Array[Byte]] = storeClientFactory.getStoreClient(mapValueStore) + var vectorSizeClient: StoreClient[String, Array[Byte]] = storeClientFactory.getStoreClient(vectorSizeStore) + var vectorValueClient: StoreClient[Array[Byte], Array[Byte]] = storeClientFactory.getStoreClient(vectorValueStore) + val underscoreBytesUTF8 = "_".getBytes("UTF-8") implicit val byteOrder = new Ordering[Array[Byte]] { override def compare(x: Array[Byte], y: Array[Byte]) = ByteUtils.compare(x, y) } @@ -74,8 +76,8 @@ MapStorageBackend[Array[Byte], Array[Byte]] with } private def getKeyValues(keys: SortedSet[Array[Byte]]): List[(Array[Byte], Array[Byte])] = { - val all: Map[Array[Byte], Versioned[Array[Byte]]] = mapValueClient.getAll(JavaConversions.asIterable(keys)) - JavaConversions.asMap(all).foldLeft(new ArrayBuffer[(Array[Byte], Array[Byte])]) { + val all: JMap[Array[Byte], Versioned[Array[Byte]]] = mapValueClient.getAll(JavaConversions.asIterable(keys)) + JavaConversions.asMap(all).foldLeft(new ArrayBuffer[(Array[Byte], Array[Byte])](all.size)) { (buf, keyVal) => { keyVal match { case (key, versioned) => { @@ -93,7 +95,7 @@ MapStorageBackend[Array[Byte], Array[Byte]] with } def getMapStorageEntryFor(name: String, key: Array[Byte]): Option[Array[Byte]] = { - val result: Array[Byte] = mapValueClient.getValue(mapKey(name, key)) + val result: Array[Byte] = mapValueClient.getValue(getKey(name, key)) result match { case null => None case _ => Some(result) @@ -104,7 +106,7 @@ MapStorageBackend[Array[Byte], Array[Byte]] with var keys = mapKeyClient.getValue(name, new TreeSet[Array[Byte]]()) keys -= key mapKeyClient.put(name, keys) - mapValueClient.delete(mapKey(name, key)) + mapValueClient.delete(getKey(name, key)) } @@ -112,13 +114,13 @@ MapStorageBackend[Array[Byte], Array[Byte]] with val keys = mapKeyClient.getValue(name, new TreeSet[Array[Byte]]()) keys.foreach { key => - mapValueClient.delete(mapKey(name, key)) + mapValueClient.delete(getKey(name, key)) } mapKeyClient.delete(name) } def insertMapStorageEntryFor(name: String, key: Array[Byte], value: Array[Byte]) = { - mapValueClient.put(mapKey(name, key), value) + mapValueClient.put(getKey(name, key), value) var keys = mapKeyClient.getValue(name, new TreeSet[Array[Byte]]()) keys += key mapKeyClient.put(name, keys) @@ -127,7 +129,7 @@ MapStorageBackend[Array[Byte], Array[Byte]] with def insertMapStorageEntriesFor(name: String, entries: List[(Array[Byte], Array[Byte])]) = { val newKeys = entries.map { case (key, value) => { - mapValueClient.put(mapKey(name, key), value) + mapValueClient.put(getKey(name, key), value) key } } @@ -137,17 +139,110 @@ MapStorageBackend[Array[Byte], Array[Byte]] with } - def getVectorStorageSizeFor(name: String): Int = 0 + def getVectorStorageSizeFor(name: String): Int = { + IntSerializer.fromBytes(vectorSizeClient.getValue(name, IntSerializer.toBytes(0))) + } - def getVectorStorageRangeFor(name: String, start: Option[Int], finish: Option[Int], count: Int): List[Array[Byte]] = null - def getVectorStorageEntryFor(name: String, index: Int): Array[Byte] = null + def getVectorStorageRangeFor(name: String, start: Option[Int], finish: Option[Int], count: Int): List[Array[Byte]] = { + val size = getVectorStorageSizeFor(name) + val st = start.getOrElse(0) + val cnt = + if (finish.isDefined) { + val f = finish.get + if (f >= st) (f - st) else count + } else { + count + } + val seq: IndexedSeq[Array[Byte]] = (st to st + cnt).map { + index => getVectorValueKey(name, index) + } - def updateVectorStorageEntryFor(name: String, index: Int, elem: Array[Byte]) = null + val all: JMap[Array[Byte], Versioned[Array[Byte]]] = vectorValueClient.getAll(JavaConversions.asIterable(seq)) - def insertVectorStorageEntriesFor(name: String, elements: List[Array[Byte]]) = null + val buf = new ArrayBuffer[Array[Byte]](seq.size) + seq.foreach { + key => { + val index = getIndexFromVectorValueKey(name, key) + var value: Array[Byte] = null + if (all.containsKey(key)) { + value = all.get(key).getValue + } else { + value = Array.empty[Byte] + } + buf.update(index, value) + } + } + buf.toList + } - def insertVectorStorageEntryFor(name: String, element: Array[Byte]) = null + def getVectorStorageEntryFor(name: String, index: Int): Array[Byte] = { + vectorValueClient.getValue(getVectorValueKey(name, index), Array.empty[Byte]) + } + + def updateVectorStorageEntryFor(name: String, index: Int, elem: Array[Byte]) = { + val size = getVectorStorageSizeFor(name) + vectorValueClient.put(getVectorValueKey(name, index), elem) + if (size < index + 1) { + vectorSizeClient.put(name, IntSerializer.toBytes(index + 1)) + } + } + + def insertVectorStorageEntriesFor(name: String, elements: List[Array[Byte]]) = { + var size = getVectorStorageSizeFor(name) + elements.foreach { + element => + vectorValueClient.put(getVectorValueKey(name, size), element) + size += 1 + } + vectorSizeClient.put(name, IntSerializer.toBytes(size)) + } + + def insertVectorStorageEntryFor(name: String, element: Array[Byte]) = { + insertVectorStorageEntriesFor(name, List(element)) + } + + + /** + * Concat the ownerlenght+owner+key+ of owner so owned data will be colocated + * Store the length of owner as first byte to work around the rare case + * where ownerbytes1 + keybytes1 == ownerbytes2 + keybytes2 but ownerbytes1 != ownerbytes2 + */ + def getKey(owner: String, key: Array[Byte]): Array[Byte] = { + val ownerBytes: Array[Byte] = owner.getBytes("UTF-8") + val ownerLenghtBytes: Array[Byte] = IntSerializer.toBytes(owner.length) + val theKey = new Array[Byte](ownerLenghtBytes.length + ownerBytes.length + key.length) + System.arraycopy(ownerLenghtBytes, 0, theKey, 0, ownerLenghtBytes.length) + System.arraycopy(ownerBytes, 0, theKey, ownerLenghtBytes.length, ownerBytes.length) + System.arraycopy(key, 0, theKey, ownerLenghtBytes.length + ownerBytes.length, key.length) + theKey + } + + def getVectorValueKey(owner: String, index: Int): Array[Byte] = { + val indexbytes = IntSerializer.toBytes(index) + val theIndexKey = new Array[Byte](underscoreBytesUTF8.length + indexbytes.length) + System.arraycopy(underscoreBytesUTF8, 0, theIndexKey, 0, underscoreBytesUTF8.length) + System.arraycopy(indexbytes, 0, theIndexKey, underscoreBytesUTF8.length, indexbytes.length) + getKey(owner, theIndexKey) + } + + def getIndexFromVectorValueKey(owner: String, key: Array[Byte]): Int = { + val indexBytes = new Array[Byte](IntSerializer.bytesPerInt) + System.arraycopy(key, key.length - IntSerializer.bytesPerInt - 1, indexBytes, 0, IntSerializer.bytesPerInt) + IntSerializer.fromBytes(indexBytes) + } + + object IntSerializer { + val bytesPerInt = java.lang.Integer.SIZE / java.lang.Byte.SIZE + + def toBytes(i: Int) = ByteBuffer.wrap(new Array[Byte](bytesPerInt)).putInt(i).array() + + def fromBytes(bytes: Array[Byte]) = ByteBuffer.wrap(bytes).getInt() + + def toString(obj: Int) = obj.toString + + def fromString(str: String) = str.toInt + } } \ No newline at end of file diff --git a/akka-persistence/akka-persistence-voldemort/src/test/resources/cluster.xml b/akka-persistence/akka-persistence-voldemort/src/test/resources/cluster.xml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/akka-persistence/akka-persistence-voldemort/src/test/resources/config/cluster.xml b/akka-persistence/akka-persistence-voldemort/src/test/resources/config/cluster.xml new file mode 100644 index 0000000000..dcf806b0ca --- /dev/null +++ b/akka-persistence/akka-persistence-voldemort/src/test/resources/config/cluster.xml @@ -0,0 +1,14 @@ + + + akka-test + + + 0 + localhost + 8081 + 6666 + 6667 + + 0,1,2,3 + + diff --git a/akka-persistence/akka-persistence-voldemort/src/test/resources/config/server.properties b/akka-persistence/akka-persistence-voldemort/src/test/resources/config/server.properties new file mode 100644 index 0000000000..1e6af91e2d --- /dev/null +++ b/akka-persistence/akka-persistence-voldemort/src/test/resources/config/server.properties @@ -0,0 +1 @@ +node.id=0 diff --git a/akka-persistence/akka-persistence-voldemort/src/test/resources/stores.xml b/akka-persistence/akka-persistence-voldemort/src/test/resources/config/stores.xml similarity index 54% rename from akka-persistence/akka-persistence-voldemort/src/test/resources/stores.xml rename to akka-persistence/akka-persistence-voldemort/src/test/resources/config/stores.xml index f031238e59..b0491ea9a4 100644 --- a/akka-persistence/akka-persistence-voldemort/src/test/resources/stores.xml +++ b/akka-persistence/akka-persistence-voldemort/src/test/resources/config/stores.xml @@ -6,7 +6,7 @@ 1 1 1 - bdb + memory client string @@ -23,10 +23,10 @@ 1 1 1 - bdb + memory client - + identity identity @@ -39,7 +39,40 @@ 1 1 1 - bdb + memory + client + + string + utf8 + + + java-serialization + + + + VectorValues + 1 + 1 + 1 + 1 + 1 + memory + client + + identity + + + identity + + + + VectorSizes + 1 + 1 + 1 + 1 + 1 + memory client string diff --git a/akka-persistence/akka-persistence-voldemort/src/test/resources/server.properties b/akka-persistence/akka-persistence-voldemort/src/test/resources/server.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/akka-persistence/akka-persistence-voldemort/src/test/scala/EmbeddedVoldemort.scala b/akka-persistence/akka-persistence-voldemort/src/test/scala/EmbeddedVoldemort.scala new file mode 100644 index 0000000000..5631542a78 --- /dev/null +++ b/akka-persistence/akka-persistence-voldemort/src/test/scala/EmbeddedVoldemort.scala @@ -0,0 +1,33 @@ +package se.scalablesolutions.akka.persistence.voldemort + +import org.scalatest.matchers.ShouldMatchers +import se.scalablesolutions.akka.util.UUID +import voldemort.server.{VoldemortServer, VoldemortConfig} +import org.scalatest.{Suite, BeforeAndAfterAll, FunSuite} +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import voldemort.utils.Utils +import java.io.File + +@RunWith(classOf[JUnitRunner]) +trait EmbeddedVoldemort extends BeforeAndAfterAll { + this: Suite => + var server: VoldemortServer = null + + override protected def beforeAll(): Unit = { + + try { + val dir = "./akka-persistence/akka-persistence-voldemort/src/test/resources" + val home = new File(dir) + val config = VoldemortConfig.loadFromVoldemortHome(home.getCanonicalPath) + server = new VoldemortServer(config) + server.start + } catch { + case e => e.printStackTrace + } + } + + override protected def afterAll(): Unit = { + server.stop + } +} \ No newline at end of file diff --git a/akka-persistence/akka-persistence-voldemort/src/test/scala/VoldemortStorageBackendSuite.scala b/akka-persistence/akka-persistence-voldemort/src/test/scala/VoldemortStorageBackendSuite.scala index b11a4bba35..68f1ebed0f 100644 --- a/akka-persistence/akka-persistence-voldemort/src/test/scala/VoldemortStorageBackendSuite.scala +++ b/akka-persistence/akka-persistence-voldemort/src/test/scala/VoldemortStorageBackendSuite.scala @@ -2,16 +2,51 @@ package se.scalablesolutions.akka.persistence.voldemort import org.scalatest.FunSuite import org.scalatest.matchers.ShouldMatchers -import se.scalablesolutions.akka.util.UUID +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import se.scalablesolutions.akka.persistence.voldemort.VoldemortStorageBackend._ +import se.scalablesolutions.akka.util.{Logging, UUID} +import collection.immutable.TreeSet - -/** - * - */ - -class VoldemortStorageBackendSuite extends FunSuite with ShouldMatchers { - - test("UUID generation looks like"){ - System.out.println(UUID.newUuid.toString) +@RunWith(classOf[JUnitRunner]) +class VoldemortStorageBackendSuite extends FunSuite with ShouldMatchers with EmbeddedVoldemort with Logging { + test("that ref storage and retrieval works") { + refClient.put("testRef", "testRefValue".getBytes("UTF-8")) + new String(refClient.getValue("testRef", Array.empty[Byte]), "UTF-8") should be("testRefValue") } + + test("that map key storage and retrieval works") { + val mapKeys = new TreeSet[Array[Byte]] + "key1".getBytes + mapKeyClient.put("testMapKey", mapKeys) + val returned = mapKeyClient.getValue("testMapKey", new TreeSet[Array[Byte]]) + returned should equal(mapKeys) + } + + test("that map value storage and retrieval works") { + val key = "keyForTestingMapValueClient".getBytes("UTF-8") + val value = "value for testing map value client".getBytes("UTF-8") + mapValueClient.put(key, value) + mapValueClient.getValue(key) should equal(value) + } + + test("that vector size storage and retrieval works") { + val key = "vectorKey" + vectorSizeClient.put(key, IntSerializer.toBytes(17)) + vectorSizeClient.getValue(key) should equal(IntSerializer.toBytes(17)) + } + + test("that vector value storage and retrieval works") { + val key = "vectorValueKey" + val index = 3 + val value = "some bytes".getBytes("UTF-8") + val vecKey = getVectorValueKey(key, index) + try{ + val idx = getIndexFromVectorValueKey(key, vecKey) + vectorValueClient.put(vecKey, value) + vectorValueClient.get(vecKey) should equal(value) + } catch{ + case e => e.printStackTrace + } + } + } \ No newline at end of file diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index fe4fb19584..b74dfea6e2 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -1,4 +1,4 @@ - /*---------------------------------------------------------------------------\ +/*---------------------------------------------------------------------------\ | Copyright (C) 2009-2010 Scalable Solutions AB | \---------------------------------------------------------------------------*/ @@ -17,13 +17,14 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- override def compileOptions = super.compileOptions ++ - Seq("-deprecation", - "-Xmigration", - "-Xcheckinit", - "-Xstrict-warnings", - "-Xwarninit", - "-encoding", "utf8") - .map(x => CompileOption(x)) + Seq("-deprecation", + "-Xmigration", + "-Xcheckinit", + "-Xstrict-warnings", + "-Xwarninit", + "-encoding", "utf8") + .map(x => CompileOption(x)) + override def javaCompileOptions = JavaCompileOption("-Xlint:unchecked") :: super.javaCompileOptions.toList // ------------------------------------------------------------------------------------------------------------------- @@ -32,25 +33,28 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val deployPath = info.projectPath / "deploy" lazy val distPath = info.projectPath / "dist" + def distName = "%s_%s-%s.zip".format(name, buildScalaVersion, version) - lazy val dist = zipTask(allArtifacts, "dist", distName) dependsOn (`package`) describedAs("Zips up the distribution.") + + lazy val dist = zipTask(allArtifacts, "dist", distName) dependsOn (`package`) describedAs ("Zips up the distribution.") // ------------------------------------------------------------------------------------------------------------------- // All repositories *must* go here! See ModuleConigurations below. // ------------------------------------------------------------------------------------------------------------------- object Repositories { - lazy val AkkaRepo = MavenRepository("Akka Repository", "http://scalablesolutions.se/akka/repository") - lazy val CodehausRepo = MavenRepository("Codehaus Repo", "http://repository.codehaus.org") - lazy val EmbeddedRepo = MavenRepository("Embedded Repo", (info.projectPath / "embedded-repo").asURL.toString) + lazy val AkkaRepo = MavenRepository("Akka Repository", "http://scalablesolutions.se/akka/repository") + lazy val CodehausRepo = MavenRepository("Codehaus Repo", "http://repository.codehaus.org") + lazy val EmbeddedRepo = MavenRepository("Embedded Repo", (info.projectPath / "embedded-repo").asURL.toString) lazy val FusesourceSnapshotRepo = MavenRepository("Fusesource Snapshots", "http://repo.fusesource.com/nexus/content/repositories/snapshots") - lazy val GuiceyFruitRepo = MavenRepository("GuiceyFruit Repo", "http://guiceyfruit.googlecode.com/svn/repo/releases/") - lazy val JBossRepo = MavenRepository("JBoss Repo", "https://repository.jboss.org/nexus/content/groups/public/") - lazy val JavaNetRepo = MavenRepository("java.net Repo", "http://download.java.net/maven/2") + lazy val GuiceyFruitRepo = MavenRepository("GuiceyFruit Repo", "http://guiceyfruit.googlecode.com/svn/repo/releases/") + lazy val JBossRepo = MavenRepository("JBoss Repo", "https://repository.jboss.org/nexus/content/groups/public/") + lazy val JavaNetRepo = MavenRepository("java.net Repo", "http://download.java.net/maven/2") lazy val SonatypeSnapshotRepo = MavenRepository("Sonatype OSS Repo", "http://oss.sonatype.org/content/repositories/releases") - lazy val SunJDMKRepo = MavenRepository("Sun JDMK Repo", "http://wp5.e-taxonomy.eu/cdmlib/mavenrepo") - lazy val CasbahRepoReleases = MavenRepository("Casbah Release Repo", "http://repo.bumnetworks.com/releases") - lazy val ClojarsRepo = MavenRepository("Clojars Repo", "http://clojars.org/repo") + lazy val SunJDMKRepo = MavenRepository("Sun JDMK Repo", "http://wp5.e-taxonomy.eu/cdmlib/mavenrepo") + lazy val CasbahRepoReleases = MavenRepository("Casbah Release Repo", "http://repo.bumnetworks.com/releases") + lazy val ClojarsRepo = MavenRepository("Clojars Repo", "http://clojars.org/repo") + lazy val OracleRepo = MavenRepository("Oracle Repo", "http://download.oracle.com/maven") } // ------------------------------------------------------------------------------------------------------------------- @@ -61,44 +65,45 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- import Repositories._ - lazy val atmosphereModuleConfig = ModuleConfiguration("org.atmosphere", SonatypeSnapshotRepo) - lazy val jettyModuleConfig = ModuleConfiguration("org.eclipse.jetty", sbt.DefaultMavenRepository) + lazy val atmosphereModuleConfig = ModuleConfiguration("org.atmosphere", SonatypeSnapshotRepo) + lazy val jettyModuleConfig = ModuleConfiguration("org.eclipse.jetty", sbt.DefaultMavenRepository) lazy val guiceyFruitModuleConfig = ModuleConfiguration("org.guiceyfruit", GuiceyFruitRepo) // lazy val hawtdispatchModuleConfig = ModuleConfiguration("org.fusesource.hawtdispatch", FusesourceSnapshotRepo) - lazy val jbossModuleConfig = ModuleConfiguration("org.jboss", JBossRepo) - lazy val jdmkModuleConfig = ModuleConfiguration("com.sun.jdmk", SunJDMKRepo) - lazy val jmsModuleConfig = ModuleConfiguration("javax.jms", SunJDMKRepo) - lazy val jmxModuleConfig = ModuleConfiguration("com.sun.jmx", SunJDMKRepo) + lazy val jbossModuleConfig = ModuleConfiguration("org.jboss", JBossRepo) + lazy val jdmkModuleConfig = ModuleConfiguration("com.sun.jdmk", SunJDMKRepo) + lazy val jmsModuleConfig = ModuleConfiguration("javax.jms", SunJDMKRepo) + lazy val jmxModuleConfig = ModuleConfiguration("com.sun.jmx", SunJDMKRepo) lazy val jerseyContrModuleConfig = ModuleConfiguration("com.sun.jersey.contribs", JavaNetRepo) - lazy val jerseyModuleConfig = ModuleConfiguration("com.sun.jersey", JavaNetRepo) - lazy val jgroupsModuleConfig = ModuleConfiguration("jgroups", JBossRepo) - lazy val multiverseModuleConfig = ModuleConfiguration("org.multiverse", CodehausRepo) - lazy val nettyModuleConfig = ModuleConfiguration("org.jboss.netty", JBossRepo) - lazy val scalaTestModuleConfig = ModuleConfiguration("org.scalatest", ScalaToolsSnapshots) - lazy val logbackModuleConfig = ModuleConfiguration("ch.qos.logback",sbt.DefaultMavenRepository) - lazy val atomikosModuleConfig = ModuleConfiguration("com.atomikos",sbt.DefaultMavenRepository) - lazy val casbahRelease = ModuleConfiguration("com.novus",CasbahRepoReleases) - lazy val voldemortModuleConfig = ModuleConfiguration("voldemort", ClojarsRepo) - lazy val embeddedRepo = EmbeddedRepo // This is the only exception, because the embedded repo is fast! + lazy val jerseyModuleConfig = ModuleConfiguration("com.sun.jersey", JavaNetRepo) + lazy val jgroupsModuleConfig = ModuleConfiguration("jgroups", JBossRepo) + lazy val multiverseModuleConfig = ModuleConfiguration("org.multiverse", CodehausRepo) + lazy val nettyModuleConfig = ModuleConfiguration("org.jboss.netty", JBossRepo) + lazy val scalaTestModuleConfig = ModuleConfiguration("org.scalatest", ScalaToolsSnapshots) + lazy val logbackModuleConfig = ModuleConfiguration("ch.qos.logback", sbt.DefaultMavenRepository) + lazy val atomikosModuleConfig = ModuleConfiguration("com.atomikos", sbt.DefaultMavenRepository) + lazy val casbahRelease = ModuleConfiguration("com.novus", CasbahRepoReleases) + lazy val voldemortModuleConfig = ModuleConfiguration("voldemort", ClojarsRepo) + lazy val sleepycatModuleConfig = ModuleConfiguration("com.sleepycat", OracleRepo) + lazy val embeddedRepo = EmbeddedRepo // This is the only exception, because the embedded repo is fast! // ------------------------------------------------------------------------------------------------------------------- // Versions // ------------------------------------------------------------------------------------------------------------------- - lazy val ATMO_VERSION = "0.6.1" - lazy val CAMEL_VERSION = "2.4.0" - lazy val CASSANDRA_VERSION = "0.6.1" - lazy val DISPATCH_VERSION = "0.7.4" + lazy val ATMO_VERSION = "0.6.1" + lazy val CAMEL_VERSION = "2.4.0" + lazy val CASSANDRA_VERSION = "0.6.1" + lazy val DISPATCH_VERSION = "0.7.4" lazy val HAWT_DISPATCH_VERSION = "1.0" - lazy val JACKSON_VERSION = "1.2.1" - lazy val JERSEY_VERSION = "1.2" - lazy val MULTIVERSE_VERSION = "0.6.1" - lazy val SCALATEST_VERSION = "1.2-for-scala-2.8.0.final-SNAPSHOT" - lazy val LOGBACK_VERSION = "0.9.24" - lazy val SLF4J_VERSION = "1.6.0" - lazy val SPRING_VERSION = "3.0.3.RELEASE" - lazy val ASPECTWERKZ_VERSION = "2.2.1" - lazy val JETTY_VERSION = "7.1.4.v20100610" + lazy val JACKSON_VERSION = "1.2.1" + lazy val JERSEY_VERSION = "1.2" + lazy val MULTIVERSE_VERSION = "0.6.1" + lazy val SCALATEST_VERSION = "1.2-for-scala-2.8.0.final-SNAPSHOT" + lazy val LOGBACK_VERSION = "0.9.24" + lazy val SLF4J_VERSION = "1.6.0" + lazy val SPRING_VERSION = "3.0.3.RELEASE" + lazy val ASPECTWERKZ_VERSION = "2.2.1" + lazy val JETTY_VERSION = "7.1.4.v20100610" // ------------------------------------------------------------------------------------------------------------------- // Dependencies @@ -112,14 +117,14 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val aopalliance = "aopalliance" % "aopalliance" % "1.0" % "compile" - lazy val atmo = "org.atmosphere" % "atmosphere-annotations" % ATMO_VERSION % "compile" + lazy val atmo = "org.atmosphere" % "atmosphere-annotations" % ATMO_VERSION % "compile" lazy val atmo_jbossweb = "org.atmosphere" % "atmosphere-compat-jbossweb" % ATMO_VERSION % "compile" - lazy val atmo_jersey = "org.atmosphere" % "atmosphere-jersey" % ATMO_VERSION % "compile" - lazy val atmo_runtime = "org.atmosphere" % "atmosphere-runtime" % ATMO_VERSION % "compile" - lazy val atmo_tomcat = "org.atmosphere" % "atmosphere-compat-tomcat" % ATMO_VERSION % "compile" + lazy val atmo_jersey = "org.atmosphere" % "atmosphere-jersey" % ATMO_VERSION % "compile" + lazy val atmo_runtime = "org.atmosphere" % "atmosphere-runtime" % ATMO_VERSION % "compile" + lazy val atmo_tomcat = "org.atmosphere" % "atmosphere-compat-tomcat" % ATMO_VERSION % "compile" lazy val atmo_weblogic = "org.atmosphere" % "atmosphere-compat-weblogic" % ATMO_VERSION % "compile" - lazy val atomikos_transactions = "com.atomikos" % "transactions" % "3.2.3" % "compile" + lazy val atomikos_transactions = "com.atomikos" % "transactions" % "3.2.3" % "compile" lazy val atomikos_transactions_api = "com.atomikos" % "transactions-api" % "3.2.3" % "compile" lazy val atomikos_transactions_jta = "com.atomikos" % "transactions-jta" % "3.2.3" % "compile" @@ -138,9 +143,9 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val dispatch_http = "net.databinder" % "dispatch-http_2.8.0" % DISPATCH_VERSION % "compile" lazy val dispatch_json = "net.databinder" % "dispatch-json_2.8.0" % DISPATCH_VERSION % "compile" - lazy val jetty = "org.eclipse.jetty" % "jetty-server" % JETTY_VERSION % "compile" - lazy val jetty_util = "org.eclipse.jetty" % "jetty-util" % JETTY_VERSION % "compile" - lazy val jetty_xml = "org.eclipse.jetty" % "jetty-xml" % JETTY_VERSION % "compile" + lazy val jetty = "org.eclipse.jetty" % "jetty-server" % JETTY_VERSION % "compile" + lazy val jetty_util = "org.eclipse.jetty" % "jetty-util" % JETTY_VERSION % "compile" + lazy val jetty_xml = "org.eclipse.jetty" % "jetty-xml" % JETTY_VERSION % "compile" lazy val jetty_servlet = "org.eclipse.jetty" % "jetty-servlet" % JETTY_VERSION % "compile" lazy val guicey = "org.guiceyfruit" % "guice-all" % "2.0" % "compile" @@ -149,14 +154,14 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val hawtdispatch = "org.fusesource.hawtdispatch" % "hawtdispatch-scala" % HAWT_DISPATCH_VERSION % "compile" - lazy val jackson = "org.codehaus.jackson" % "jackson-mapper-asl" % JACKSON_VERSION % "compile" - lazy val jackson_core = "org.codehaus.jackson" % "jackson-core-asl" % JACKSON_VERSION % "compile" - lazy val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % JACKSON_VERSION % "compile" + lazy val jackson = "org.codehaus.jackson" % "jackson-mapper-asl" % JACKSON_VERSION % "compile" + lazy val jackson_core = "org.codehaus.jackson" % "jackson-core-asl" % JACKSON_VERSION % "compile" + lazy val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % JACKSON_VERSION % "compile" - lazy val jersey = "com.sun.jersey" % "jersey-core" % JERSEY_VERSION % "compile" - lazy val jersey_json = "com.sun.jersey" % "jersey-json" % JERSEY_VERSION % "compile" - lazy val jersey_server = "com.sun.jersey" % "jersey-server" % JERSEY_VERSION % "compile" - lazy val jersey_contrib = "com.sun.jersey.contribs" % "jersey-scala" % JERSEY_VERSION % "compile" + lazy val jersey = "com.sun.jersey" % "jersey-core" % JERSEY_VERSION % "compile" + lazy val jersey_json = "com.sun.jersey" % "jersey-json" % JERSEY_VERSION % "compile" + lazy val jersey_server = "com.sun.jersey" % "jersey-server" % JERSEY_VERSION % "compile" + lazy val jersey_contrib = "com.sun.jersey.contribs" % "jersey-scala" % JERSEY_VERSION % "compile" lazy val jgroups = "jgroups" % "jgroups" % "2.9.0.GA" % "compile" @@ -190,56 +195,64 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val sjson = "sjson.json" % "sjson" % "0.8-SNAPSHOT-2.8.0" % "compile" - lazy val slf4j = "org.slf4j" % "slf4j-api" % SLF4J_VERSION % "compile" + lazy val slf4j = "org.slf4j" % "slf4j-api" % SLF4J_VERSION % "compile" - lazy val logback = "ch.qos.logback" % "logback-classic" % LOGBACK_VERSION % "compile" + lazy val logback = "ch.qos.logback" % "logback-classic" % LOGBACK_VERSION % "compile" lazy val logback_core = "ch.qos.logback" % "logback-core" % LOGBACK_VERSION % "compile" - lazy val spring_beans = "org.springframework" % "spring-beans" % SPRING_VERSION % "compile" + lazy val spring_beans = "org.springframework" % "spring-beans" % SPRING_VERSION % "compile" lazy val spring_context = "org.springframework" % "spring-context" % SPRING_VERSION % "compile" lazy val stax_api = "javax.xml.stream" % "stax-api" % "1.0-2" % "compile" lazy val thrift = "com.facebook" % "thrift" % "r917130" % "compile" - lazy val voldemort = "voldemort" % "voldemort" % "0.81" % "compile" - lazy val voldemort_contrib = "voldemort" % "voldemort-contrib" % "0.81" % "compile" + lazy val voldemort = "voldemort" % "voldemort" % "0.81" % "compile" + lazy val voldemort_contrib = "voldemort" % "voldemort-contrib" % "0.81" % "compile" + lazy val voldemort_needs_log4j = "log4j" % "log4j" % "1.2.16" % "compile" - lazy val werkz = "org.codehaus.aspectwerkz" % "aspectwerkz-nodeps-jdk5" % ASPECTWERKZ_VERSION % "compile" - lazy val werkz_core = "org.codehaus.aspectwerkz" % "aspectwerkz-jdk5" % ASPECTWERKZ_VERSION % "compile" + lazy val werkz = "org.codehaus.aspectwerkz" % "aspectwerkz-nodeps-jdk5" % ASPECTWERKZ_VERSION % "compile" + lazy val werkz_core = "org.codehaus.aspectwerkz" % "aspectwerkz-jdk5" % ASPECTWERKZ_VERSION % "compile" // Test - lazy val camel_spring = "org.apache.camel" % "camel-spring" % CAMEL_VERSION % "test" - lazy val cassandra_clhm = "org.apache.cassandra" % "clhm-production" % CASSANDRA_VERSION % "test" - lazy val commons_coll = "commons-collections" % "commons-collections" % "3.2.1" % "test" - lazy val google_coll = "com.google.collections" % "google-collections" % "1.0" % "test" - lazy val high_scale = "org.apache.cassandra" % "high-scale-lib" % CASSANDRA_VERSION % "test" - lazy val testJetty = "org.eclipse.jetty" % "jetty-server" % JETTY_VERSION % "test" - lazy val testJettyWebApp= "org.eclipse.jetty" % "jetty-webapp" % JETTY_VERSION % "test" + lazy val camel_spring = "org.apache.camel" % "camel-spring" % CAMEL_VERSION % "test" + lazy val cassandra_clhm = "org.apache.cassandra" % "clhm-production" % CASSANDRA_VERSION % "test" + lazy val commons_coll = "commons-collections" % "commons-collections" % "3.2.1" % "test" + lazy val google_coll = "com.google.collections" % "google-collections" % "1.0" % "test" + lazy val high_scale = "org.apache.cassandra" % "high-scale-lib" % CASSANDRA_VERSION % "test" + lazy val testJetty = "org.eclipse.jetty" % "jetty-server" % JETTY_VERSION % "test" + lazy val testJettyWebApp = "org.eclipse.jetty" % "jetty-webapp" % JETTY_VERSION % "test" - lazy val junit = "junit" % "junit" % "4.5" % "test" - lazy val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" - lazy val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test" + lazy val junit = "junit" % "junit" % "4.5" % "test" + lazy val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" + lazy val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test" + + //voldemort testing /home/sclasen/projects/akka/akka-persistence-voldemort/src/test/resources/ + lazy val jdom = "org.jdom" % "jdom" % "1.1" % "test" + lazy val vold_jetty = "org.mortbay.jetty" % "jetty" % "6.1.18" % "test" + lazy val velocity = "org.apache.velocity" % "velocity" % "1.6.2" % "test" + lazy val bdb = "com.sleepycat" % "je" % "4.0.103" % "test" + lazy val dbcp = "commons-dbcp" % "commons-dbcp" % "1.2.2" % "test" } // ------------------------------------------------------------------------------------------------------------------- // Subprojects // ------------------------------------------------------------------------------------------------------------------- - lazy val akka_actor = project("akka-actor", "akka-actor", new AkkaActorProject(_)) + lazy val akka_actor = project("akka-actor", "akka-actor", new AkkaActorProject(_)) lazy val akka_typed_actor = project("akka-typed-actor", "akka-typed-actor", new AkkaTypedActorProject(_), akka_actor) - lazy val akka_remote = project("akka-remote", "akka-remote", new AkkaRemoteProject(_), akka_typed_actor) - lazy val akka_amqp = project("akka-amqp", "akka-amqp", new AkkaAMQPProject(_), akka_remote) - lazy val akka_http = project("akka-http", "akka-http", new AkkaHttpProject(_), akka_remote, akka_camel) - lazy val akka_camel = project("akka-camel", "akka-camel", new AkkaCamelProject(_), akka_remote) + lazy val akka_remote = project("akka-remote", "akka-remote", new AkkaRemoteProject(_), akka_typed_actor) + lazy val akka_amqp = project("akka-amqp", "akka-amqp", new AkkaAMQPProject(_), akka_remote) + lazy val akka_http = project("akka-http", "akka-http", new AkkaHttpProject(_), akka_remote, akka_camel) + lazy val akka_camel = project("akka-camel", "akka-camel", new AkkaCamelProject(_), akka_remote) lazy val akka_persistence = project("akka-persistence", "akka-persistence", new AkkaPersistenceParentProject(_)) - lazy val akka_spring = project("akka-spring", "akka-spring", new AkkaSpringProject(_), akka_remote, akka_camel) - lazy val akka_jta = project("akka-jta", "akka-jta", new AkkaJTAProject(_), akka_remote) - lazy val akka_kernel = project("akka-kernel", "akka-kernel", new AkkaKernelProject(_), - akka_remote, akka_jta, akka_http, akka_spring, akka_camel, akka_persistence, akka_amqp) - lazy val akka_osgi = project("akka-osgi", "akka-osgi", new AkkaOSGiParentProject(_)) - lazy val akka_samples = project("akka-samples", "akka-samples", new AkkaSamplesParentProject(_)) + lazy val akka_spring = project("akka-spring", "akka-spring", new AkkaSpringProject(_), akka_remote, akka_camel) + lazy val akka_jta = project("akka-jta", "akka-jta", new AkkaJTAProject(_), akka_remote) + lazy val akka_kernel = project("akka-kernel", "akka-kernel", new AkkaKernelProject(_), + akka_remote, akka_jta, akka_http, akka_spring, akka_camel, akka_persistence, akka_amqp) + lazy val akka_osgi = project("akka-osgi", "akka-osgi", new AkkaOSGiParentProject(_)) + lazy val akka_samples = project("akka-samples", "akka-samples", new AkkaSamplesParentProject(_)) // ------------------------------------------------------------------------------------------------------------------- // Miscellaneous @@ -253,37 +266,37 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { (IMPLEMENTATION_TITLE, "Akka"), (IMPLEMENTATION_URL, "http://akkasource.org"), (IMPLEMENTATION_VENDOR, "The Akka Project") - )).toList ::: - getMainClass(false).map(MainClass(_)).toList + )).toList ::: + getMainClass(false).map(MainClass(_)).toList // create a manifest with all akka jars and dependency jars on classpath override def manifestClassPath = Some(allArtifacts.getFiles - .filter(_.getName.endsWith(".jar")) - .filter(!_.getName.contains("servlet_2.4")) - .filter(!_.getName.contains("scala-library")) - .map("lib_managed/scala_%s/compile/".format(buildScalaVersion) + _.getName) - .mkString(" ") + - " config/" + - " scala-library.jar" + - " dist/akka-actor_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-typed-actor_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-remote_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-http_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-camel_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-amqp_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-persistence-common_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-persistence-redis_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-persistence-mongo_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-persistence-cassandra_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-kernel_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-spring_%s-%s.jar".format(buildScalaVersion, version) + - " dist/akka-jta_%s-%s.jar".format(buildScalaVersion, version) + .filter(_.getName.endsWith(".jar")) + .filter(!_.getName.contains("servlet_2.4")) + .filter(!_.getName.contains("scala-library")) + .map("lib_managed/scala_%s/compile/".format(buildScalaVersion) + _.getName) + .mkString(" ") + + " config/" + + " scala-library.jar" + + " dist/akka-actor_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-typed-actor_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-remote_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-http_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-camel_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-amqp_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-persistence-common_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-persistence-redis_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-persistence-mongo_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-persistence-cassandra_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-kernel_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-spring_%s-%s.jar".format(buildScalaVersion, version) + + " dist/akka-jta_%s-%s.jar".format(buildScalaVersion, version) ) //Exclude slf4j1.5.11 from the classpath, it's conflicting... override def fullClasspath(config: Configuration): PathFinder = { super.fullClasspath(config) --- - (super.fullClasspath(config) ** "slf4j*1.5.11.jar") + (super.fullClasspath(config) ** "slf4j*1.5.11.jar") } override def mainResources = super.mainResources +++ @@ -304,57 +317,60 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { //override def documentOptions = encodingUtf8.map(SimpleDocOption(_)) override def packageDocsJar = defaultJarPath("-docs.jar") - override def packageSrcJar= defaultJarPath("-sources.jar") + + override def packageSrcJar = defaultJarPath("-sources.jar") + override def packageToPublishActions = super.packageToPublishActions ++ Seq(packageDocs, packageSrc) override def pomExtra = 2009 - http://akkasource.org - - Scalable Solutions AB - http://scalablesolutions.se - - - - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - + http://akkasource.org + + Scalable Solutions AB + http://scalablesolutions.se + + + + Apache 2 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + // publish to local mvn import Process._ lazy val publishLocalMvn = runMvnInstall + def runMvnInstall = task { for (absPath <- akkaArtifacts.getPaths) { val artifactRE = """(.*)/dist/(.*)-(.*).jar""".r val artifactRE(path, artifactId, artifactVersion) = absPath val command = "mvn install:install-file" + - " -Dfile=" + absPath + - " -DgroupId=se.scalablesolutions.akka" + - " -DartifactId=" + artifactId + - " -Dversion=" + version + - " -Dpackaging=jar -DgeneratePom=true" + " -Dfile=" + absPath + + " -DgroupId=se.scalablesolutions.akka" + + " -DartifactId=" + artifactId + + " -Dversion=" + version + + " -Dpackaging=jar -DgeneratePom=true" command ! log } None - } dependsOn(dist) describedAs("Run mvn install for artifacts in dist.") + } dependsOn (dist) describedAs ("Run mvn install for artifacts in dist.") // ------------------------------------------------------------------------------------------------------------------- // akka-actor subproject // ------------------------------------------------------------------------------------------------------------------- class AkkaActorProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { - val configgy = Dependencies.configgy - val hawtdispatch = Dependencies.hawtdispatch - val multiverse = Dependencies.multiverse - val jsr166x = Dependencies.jsr166x - val slf4j = Dependencies.slf4j - val logback = Dependencies.logback - val logback_core = Dependencies.logback_core + val configgy = Dependencies.configgy + val hawtdispatch = Dependencies.hawtdispatch + val multiverse = Dependencies.multiverse + val jsr166x = Dependencies.jsr166x + val slf4j = Dependencies.slf4j + val logback = Dependencies.logback + val logback_core = Dependencies.logback_core // testing - val junit = Dependencies.junit + val junit = Dependencies.junit val scalatest = Dependencies.scalatest } @@ -363,13 +379,13 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaTypedActorProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { - val aopalliance = Dependencies.aopalliance - val werkz = Dependencies.werkz - val werkz_core = Dependencies.werkz_core - val guicey = Dependencies.guicey + val aopalliance = Dependencies.aopalliance + val werkz = Dependencies.werkz + val werkz_core = Dependencies.werkz_core + val guicey = Dependencies.guicey // testing - val junit = Dependencies.junit + val junit = Dependencies.junit val scalatest = Dependencies.scalatest } @@ -379,22 +395,22 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { class AkkaRemoteProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { val commons_codec = Dependencies.commons_codec - val commons_io = Dependencies.commons_io + val commons_io = Dependencies.commons_io val dispatch_http = Dependencies.dispatch_http val dispatch_json = Dependencies.dispatch_json - val guicey = Dependencies.guicey - val h2_lzf = Dependencies.h2_lzf - val jackson = Dependencies.jackson - val jackson_core = Dependencies.jackson_core - val jgroups = Dependencies.jgroups - val jta_1_1 = Dependencies.jta_1_1 - val netty = Dependencies.netty - val protobuf = Dependencies.protobuf - val sbinary = Dependencies.sbinary - val sjson = Dependencies.sjson + val guicey = Dependencies.guicey + val h2_lzf = Dependencies.h2_lzf + val jackson = Dependencies.jackson + val jackson_core = Dependencies.jackson_core + val jgroups = Dependencies.jgroups + val jta_1_1 = Dependencies.jta_1_1 + val netty = Dependencies.netty + val protobuf = Dependencies.protobuf + val sbinary = Dependencies.sbinary + val sjson = Dependencies.sjson // testing - val junit = Dependencies.junit + val junit = Dependencies.junit val scalatest = Dependencies.scalatest override def bndImportPackage = "javax.transaction;version=1.1" :: super.bndImportPackage.toList @@ -406,13 +422,13 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { class AkkaAMQPProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { val commons_io = Dependencies.commons_io - val rabbit = Dependencies.rabbit - val protobuf = Dependencies.protobuf + val rabbit = Dependencies.rabbit + val protobuf = Dependencies.protobuf // testing - val junit = Dependencies.junit + val junit = Dependencies.junit val multiverse = Dependencies.multiverse - val scalatest = Dependencies.scalatest + val scalatest = Dependencies.scalatest } // ------------------------------------------------------------------------------------------------------------------- @@ -420,28 +436,28 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaHttpProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { - val annotation = Dependencies.annotation - val atmo = Dependencies.atmo - val atmo_jbossweb = Dependencies.atmo_jbossweb - val atmo_jersey = Dependencies.atmo_jersey - val atmo_runtime = Dependencies.atmo_runtime - val atmo_tomcat = Dependencies.atmo_tomcat - val atmo_weblogic = Dependencies.atmo_weblogic - val jetty = Dependencies.jetty - val jetty_util = Dependencies.jetty_util - val jetty_xml = Dependencies.jetty_xml - val jetty_servlet = Dependencies.jetty_servlet + val annotation = Dependencies.annotation + val atmo = Dependencies.atmo + val atmo_jbossweb = Dependencies.atmo_jbossweb + val atmo_jersey = Dependencies.atmo_jersey + val atmo_runtime = Dependencies.atmo_runtime + val atmo_tomcat = Dependencies.atmo_tomcat + val atmo_weblogic = Dependencies.atmo_weblogic + val jetty = Dependencies.jetty + val jetty_util = Dependencies.jetty_util + val jetty_xml = Dependencies.jetty_xml + val jetty_servlet = Dependencies.jetty_servlet val jackson_core_asl = Dependencies.jackson_core_asl - val jersey = Dependencies.jersey - val jersey_contrib = Dependencies.jersey_contrib - val jersey_json = Dependencies.jersey_json - val jersey_server = Dependencies.jersey_server - val jsr311 = Dependencies.jsr311 - val stax_api = Dependencies.stax_api + val jersey = Dependencies.jersey + val jersey_contrib = Dependencies.jersey_contrib + val jersey_json = Dependencies.jersey_json + val jersey_server = Dependencies.jersey_server + val jsr311 = Dependencies.jsr311 + val stax_api = Dependencies.stax_api // testing - val junit = Dependencies.junit - val mockito = Dependencies.mockito + val junit = Dependencies.junit + val mockito = Dependencies.mockito val scalatest = Dependencies.scalatest } @@ -476,7 +492,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { class AkkaPersistenceCommonProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { val commons_pool = Dependencies.commons_pool - val thrift = Dependencies.thrift + val thrift = Dependencies.thrift } // ------------------------------------------------------------------------------------------------------------------- @@ -485,7 +501,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { class AkkaRedisProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { val commons_codec = Dependencies.commons_codec - val redis = Dependencies.redis + val redis = Dependencies.redis override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil } @@ -506,30 +522,38 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaCassandraProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { - val cassandra = Dependencies.cassandra + val cassandra = Dependencies.cassandra // testing val cassandra_clhm = Dependencies.cassandra_clhm - val commons_coll = Dependencies.commons_coll - val google_coll = Dependencies.google_coll - val high_scale = Dependencies.high_scale + val commons_coll = Dependencies.commons_coll + val google_coll = Dependencies.google_coll + val high_scale = Dependencies.high_scale override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil } - // ------------------------------------------------------------------------------------------------------------------- - // akka-persistence-voldemort subproject - // ------------------------------------------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------------------------------------------- + // akka-persistence-voldemort subproject + // ------------------------------------------------------------------------------------------------------------------- - class AkkaVoldemortProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { - val voldemort = Dependencies.voldemort - val voldemort_contrib = Dependencies.voldemort_contrib + class AkkaVoldemortProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { + val voldemort = Dependencies.voldemort + val voldemort_contrib = Dependencies.voldemort_contrib + val voldemort_needs_log4j = Dependencies.voldemort_needs_log4j - //testing - val scalatest = Dependencies.scalatest - override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil - } + //testing + val scalatest = Dependencies.scalatest + val google_coll = Dependencies.google_coll + val jdom = Dependencies.jdom + val jetty = Dependencies.vold_jetty + val velocity = Dependencies.velocity + val bdb = Dependencies.bdb + val dbcp = Dependencies.dbcp + + override def testOptions = TestFilter((name: String) => name.endsWith("Suite")) :: Nil + } @@ -545,13 +569,13 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaSpringProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { - val spring_beans = Dependencies.spring_beans + val spring_beans = Dependencies.spring_beans val spring_context = Dependencies.spring_context // testing val camel_spring = Dependencies.camel_spring - val junit = Dependencies.junit - val scalatest = Dependencies.scalatest + val junit = Dependencies.junit + val scalatest = Dependencies.scalatest } // ------------------------------------------------------------------------------------------------------------------- @@ -559,7 +583,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaJTAProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { - val atomikos_transactions = Dependencies.atomikos_transactions + val atomikos_transactions = Dependencies.atomikos_transactions val atomikos_transactions_api = Dependencies.atomikos_transactions_api val atomikos_transactions_jta = Dependencies.atomikos_transactions_jta //val jta_1_1 = Dependencies.jta_1_1 @@ -575,15 +599,18 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { new AkkaOSGiDependenciesBundleProject(_), akka_kernel, akka_jta) // akka_kernel does not depend on akka_jta (why?) therefore we list akka_jta here lazy val akka_osgi_assembly = project("akka-osgi-assembly", "akka-osgi-assembly", new AkkaOSGiAssemblyProject(_), akka_osgi_dependencies_bundle, akka_remote, akka_amqp, akka_http, - akka_camel, akka_spring, akka_jta, akka_persistence.akka_persistence_common, - akka_persistence.akka_persistence_redis, akka_persistence.akka_persistence_mongo, - akka_persistence.akka_persistence_cassandra) + akka_camel, akka_spring, akka_jta, akka_persistence.akka_persistence_common, + akka_persistence.akka_persistence_redis, akka_persistence.akka_persistence_mongo, + akka_persistence.akka_persistence_cassandra) } class AkkaOSGiDependenciesBundleProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin { override def bndClasspath = compileClasspath + override def bndPrivatePackage = Seq("") + override def bndImportPackage = Seq("*;resolution:=optional") + override def bndExportPackage = Seq( "org.aopalliance.*;version=1.0.0", @@ -611,36 +638,36 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { val scala_bundle = "com.weiglewilczek.scala-lang-osgi" % "scala-library" % buildScalaVersion % "compile" intransitive // Camel bundles - val camel_core = Dependencies.camel_core.intransitive + val camel_core = Dependencies.camel_core.intransitive val fusesource_commonman = "org.fusesource.commonman" % "commons-management" % "1.0" intransitive // Spring bundles - val spring_beans = Dependencies.spring_beans.intransitive - val spring_context = Dependencies.spring_context.intransitive - val spring_aop = "org.springframework" % "spring-aop" % SPRING_VERSION % "compile" intransitive - val spring_asm = "org.springframework" % "spring-asm" % SPRING_VERSION % "compile" intransitive - val spring_core = "org.springframework" % "spring-core" % SPRING_VERSION % "compile" intransitive + val spring_beans = Dependencies.spring_beans.intransitive + val spring_context = Dependencies.spring_context.intransitive + val spring_aop = "org.springframework" % "spring-aop" % SPRING_VERSION % "compile" intransitive + val spring_asm = "org.springframework" % "spring-asm" % SPRING_VERSION % "compile" intransitive + val spring_core = "org.springframework" % "spring-core" % SPRING_VERSION % "compile" intransitive val spring_expression = "org.springframework" % "spring-expression" % SPRING_VERSION % "compile" intransitive - val spring_jms = "org.springframework" % "spring-jms" % SPRING_VERSION % "compile" intransitive - val spring_tx = "org.springframework" % "spring-tx" % SPRING_VERSION % "compile" intransitive + val spring_jms = "org.springframework" % "spring-jms" % SPRING_VERSION % "compile" intransitive + val spring_tx = "org.springframework" % "spring-tx" % SPRING_VERSION % "compile" intransitive - val commons_codec = Dependencies.commons_codec.intransitive - val commons_io = Dependencies.commons_io.intransitive - val commons_pool = Dependencies.commons_pool.intransitive - val guicey = Dependencies.guicey.intransitive - val jackson = Dependencies.jackson.intransitive - val jackson_core = Dependencies.jackson_core.intransitive - val jsr311 = Dependencies.jsr311.intransitive - val jta_1_1 = Dependencies.jta_1_1.intransitive - val netty = Dependencies.netty.intransitive - val commons_fileupload = "commons-fileupload" % "commons-fileupload" % "1.2.1" % "compile" intransitive - val jms_1_1 = "org.apache.geronimo.specs" % "geronimo-jms_1.1_spec" % "1.1.1" % "compile" intransitive - val joda = "joda-time" % "joda-time" % "1.6" intransitive + val commons_codec = Dependencies.commons_codec.intransitive + val commons_io = Dependencies.commons_io.intransitive + val commons_pool = Dependencies.commons_pool.intransitive + val guicey = Dependencies.guicey.intransitive + val jackson = Dependencies.jackson.intransitive + val jackson_core = Dependencies.jackson_core.intransitive + val jsr311 = Dependencies.jsr311.intransitive + val jta_1_1 = Dependencies.jta_1_1.intransitive + val netty = Dependencies.netty.intransitive + val commons_fileupload = "commons-fileupload" % "commons-fileupload" % "1.2.1" % "compile" intransitive + val jms_1_1 = "org.apache.geronimo.specs" % "geronimo-jms_1.1_spec" % "1.1.1" % "compile" intransitive + val joda = "joda-time" % "joda-time" % "1.6" intransitive override def packageAction = task { val libs: Seq[Path] = managedClasspath(config("compile")).get.toSeq - val prjs: Seq[Path] = info.dependencies.toSeq.asInstanceOf[Seq[DefaultProject]] map { _.jarPath } + val prjs: Seq[Path] = info.dependencies.toSeq.asInstanceOf[Seq[DefaultProject]] map {_.jarPath} val all = libs ++ prjs val destination = outputPath / "bundles" FileUtilities.copyFlat(all, destination, log) @@ -691,7 +718,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { - + @@ -702,8 +729,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { class AkkaSampleSecurityProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) { val commons_codec = Dependencies.commons_codec - val jsr250 = Dependencies.jsr250 - val jsr311 = Dependencies.jsr311 + val jsr250 = Dependencies.jsr250 + val jsr311 = Dependencies.jsr311 } class AkkaSampleOSGiProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin { @@ -740,63 +767,71 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- def removeDupEntries(paths: PathFinder) = - Path.lazyPathFinder { - val mapped = paths.get map { p => (p.relativePath, p) } - (Map() ++ mapped).values.toList - } + Path.lazyPathFinder { + val mapped = paths.get map {p => (p.relativePath, p)} + (Map() ++ mapped).values.toList + } def allArtifacts = { Path.fromFile(buildScalaInstance.libraryJar) +++ - (removeDupEntries(runClasspath filter ClasspathUtilities.isArchive) +++ - ((outputPath ##) / defaultJarName) +++ - mainResources +++ - mainDependencies.scalaJars +++ - descendents(info.projectPath / "scripts", "run_akka.sh") +++ - descendents(info.projectPath / "scripts", "akka-init-script.sh") +++ - descendents(info.projectPath / "dist", "*.jar") +++ - descendents(info.projectPath / "deploy", "*.jar") +++ - descendents(path("lib") ##, "*.jar") +++ - descendents(configurationPath(Configurations.Compile) ##, "*.jar")) - .filter(jar => // remove redundant libs - !jar.toString.endsWith("stax-api-1.0.1.jar") || - !jar.toString.endsWith("scala-library-2.7.7.jar") - ) + (removeDupEntries(runClasspath filter ClasspathUtilities.isArchive) +++ + ((outputPath ##) / defaultJarName) +++ + mainResources +++ + mainDependencies.scalaJars +++ + descendents(info.projectPath / "scripts", "run_akka.sh") +++ + descendents(info.projectPath / "scripts", "akka-init-script.sh") +++ + descendents(info.projectPath / "dist", "*.jar") +++ + descendents(info.projectPath / "deploy", "*.jar") +++ + descendents(path("lib") ##, "*.jar") +++ + descendents(configurationPath(Configurations.Compile) ##, "*.jar")) + .filter(jar => // remove redundant libs + !jar.toString.endsWith("stax-api-1.0.1.jar") || + !jar.toString.endsWith("scala-library-2.7.7.jar") + ) } - def akkaArtifacts = descendents(info.projectPath / "dist", "*" + buildScalaVersion + "-" + version + ".jar") + def akkaArtifacts = descendents(info.projectPath / "dist", "*" + buildScalaVersion + "-" + version + ".jar") // ------------------------------------------------------------ class AkkaDefaultProject(info: ProjectInfo, val deployPath: Path) extends DefaultProject(info) with DeployProject with OSGiProject { lazy val sourceArtifact = Artifact(this.artifactID, "sources", "jar", Some("sources"), Nil, None) lazy val docsArtifact = Artifact(this.artifactID, "docs", "jar", Some("docs"), Nil, None) + override def runClasspath = super.runClasspath +++ (AkkaParentProject.this.info.projectPath / "config") + override def testClasspath = super.testClasspath +++ (AkkaParentProject.this.info.projectPath / "config") + override def packageDocsJar = this.defaultJarPath("-docs.jar") - override def packageSrcJar = this.defaultJarPath("-sources.jar") + + override def packageSrcJar = this.defaultJarPath("-sources.jar") + override def packageToPublishActions = super.packageToPublishActions ++ Seq(this.packageDocs, this.packageSrc) } } -trait DeployProject { self: BasicScalaProject => +trait DeployProject { + self: BasicScalaProject => // defines where the deployTask copies jars to def deployPath: Path - lazy val dist = deployTask(jarPath, packageDocsJar, packageSrcJar, deployPath, true, true, true) dependsOn( - `package`, packageDocs, packageSrc) describedAs("Deploying") + lazy val dist = deployTask(jarPath, packageDocsJar, packageSrcJar, deployPath, true, true, true) dependsOn ( + `package`, packageDocs, packageSrc) describedAs ("Deploying") + def deployTask(jar: Path, docs: Path, src: Path, toDir: Path, genJar: Boolean, genDocs: Boolean, genSource: Boolean) = task { def gen(jar: Path, toDir: Path, flag: Boolean, msg: String): Option[String] = - if (flag) { - log.info(msg + " " + jar) - FileUtilities.copyFile(jar, toDir / jar.name, log) - } else None + if (flag) { + log.info(msg + " " + jar) + FileUtilities.copyFile(jar, toDir / jar.name, log) + } else None gen(jar, toDir, genJar, "Deploying bits") orElse - gen(docs, toDir, genDocs, "Deploying docs") orElse - gen(src, toDir, genSource, "Deploying sources") + gen(docs, toDir, genDocs, "Deploying docs") orElse + gen(src, toDir, genSource, "Deploying sources") } } -trait OSGiProject extends BNDPlugin { self: DefaultProject => +trait OSGiProject extends BNDPlugin { + self: DefaultProject => override def bndExportPackage = Seq("se.scalablesolutions.akka.*;version=%s".format(projectVersion.value)) }