You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/07/31 12:51:38 UTC

svn commit: r981035 - in /activemq/activemq-apollo/trunk: ./ apollo-bdb/ apollo-bdb/src/ apollo-bdb/src/main/ apollo-bdb/src/main/proto/ apollo-bdb/src/main/resources/ apollo-bdb/src/main/resources/META-INF/ apollo-bdb/src/main/resources/META-INF/servi...

Author: chirino
Date: Sat Jul 31 10:51:36 2010
New Revision: 981035

URL: http://svn.apache.org/viewvc?rev=981035&view=rev
Log:
adding optional bdb storage support.

Added:
    activemq/activemq-apollo/trunk/apollo-bdb/
    activemq/activemq-apollo/trunk/apollo-bdb/pom.xml
    activemq/activemq-apollo/trunk/apollo-bdb/src/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/proto/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/proto/data.proto
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/bdb/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/bdb/dto/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/bdb/dto/jaxb.index
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBClient.scala
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStoreFactory.scala
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/HelperTrait.scala
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreDTO.java
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreStatusDTO.java
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/package-info.java
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/ide-resources/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/ide-resources/log4j.properties   (with props)
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/log4j.properties   (with props)
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/bdb/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/bdb/dto/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/bdb/dto/simple.xml
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreBenchmark.scala
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreTest.scala
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/dto/
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/dto/XmlCodecTest.java
Modified:
    activemq/activemq-apollo/trunk/apollo-stomp/pom.xml
    activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompBroker.scala
    activemq/activemq-apollo/trunk/apollo-web/pom.xml
    activemq/activemq-apollo/trunk/pom.xml

Added: activemq/activemq-apollo/trunk/apollo-bdb/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/pom.xml?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/pom.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/pom.xml Sat Jul 31 10:51:36 2010
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements. See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version
+  2.0 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+  applicable law or agreed to in writing, software distributed under
+  the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
+  OR CONDITIONS OF ANY KIND, either express or implied. See the
+  License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.activemq</groupId>
+    <artifactId>apollo-scala</artifactId>
+    <version>6.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.activemq</groupId>
+  <artifactId>apollo-bdb</artifactId>
+  <packaging>jar</packaging>
+  <version>6.0-SNAPSHOT</version>
+
+  <name>${artifactId}</name>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-store</artifactId>
+      <version>6.0-SNAPSHOT</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>com.sleepycat</groupId>
+      <artifactId>je</artifactId>
+      <version>${bdb-version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.fusesource.hawtbuf</groupId>
+      <artifactId>hawtbuf-proto</artifactId>
+      <version>${hawtbuf-version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>${commons-logging-version}</version>
+    </dependency>
+
+    <!-- Scala Support -->
+    <dependency>
+      <groupId>org.scala-lang</groupId>
+      <artifactId>scala-library</artifactId>
+      <scope>compile</scope>
+      <version>${scala-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.scala-lang</groupId>
+      <artifactId>scala-compiler</artifactId>
+      <version>${scala-version}</version>
+      <scope>compile</scope>
+      <optional>true</optional>
+    </dependency>
+    
+    <!-- Testing Dependencies -->    
+    <dependency>
+      <groupId>org.scalatest</groupId>
+      <artifactId>scalatest</artifactId>
+      <version>${scalatest-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-store</artifactId>
+      <version>6.0-SNAPSHOT</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-util</artifactId>
+      <version>6.0-SNAPSHOT</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+      <version>${junit-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+      <version>${log4j-version}</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <groupId>org.fusesource.hawtbuf</groupId>
+        <artifactId>hawtbuf-proto</artifactId>
+        <version>${hawtbuf-version}</version>
+        <configuration>
+          <type>alt</type>
+        </configuration>
+         <executions>
+          <execution>
+            <goals>
+              <goal>compile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/proto/data.proto
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/proto/data.proto?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/proto/data.proto (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/proto/data.proto Sat Jul 31 10:51:36 2010
@@ -0,0 +1,47 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package org.apache.activemq.apollo.store.bdb.model;
+
+option java_multiple_files = true;
+
+///////////////////////////////////////////////////////////////
+// Message related operations.
+///////////////////////////////////////////////////////////////
+
+message MessagePB {
+  required int64 messageKey=1;
+  required bytes protocol = 2 [java_override_type = "AsciiBuffer"];
+  required int32 size = 3;
+  optional bytes value = 4;
+  optional int64 streamKey = 5;
+  optional int64 expiration = 6;
+}
+
+message QueuePB {
+  required int64 key=1;
+  optional bytes binding_kind = 2 [java_override_type = "AsciiBuffer"];
+  optional bytes binding_data = 3;
+}
+
+message QueueEntryPB {
+  required int64 queueKey=1;
+  required int64 queueSeq=2;
+  required int64 messageKey=3;
+  optional int32 size=4;
+  optional bytes attachment=5;
+  optional int32 redeliveries = 6;
+}

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index Sat Jul 31 10:51:36 2010
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.store.bdb.BDBStoreFactory
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index Sat Jul 31 10:51:36 2010
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.store.bdb.dto
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/bdb/dto/jaxb.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/bdb/dto/jaxb.index?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/bdb/dto/jaxb.index (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/org/apache/activemq/apollo/store/bdb/dto/jaxb.index Sat Jul 31 10:51:36 2010
@@ -0,0 +1,18 @@
+# ------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ------------------------------------------------------------------------
+BDBStoreDTO
+BDBStoreStatusDTO

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBClient.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBClient.scala?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBClient.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBClient.scala Sat Jul 31 10:51:36 2010
@@ -0,0 +1,388 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb
+
+import dto.BDBStoreDTO
+import java.{lang=>jl}
+import java.{util=>ju}
+
+import org.apache.activemq.apollo.dto.HawtDBStoreDTO
+import java.util.concurrent.atomic.AtomicInteger
+import collection.mutable.ListBuffer
+import org.apache.activemq.apollo.store._
+import org.apache.activemq.apollo.util._
+import com.sleepycat.je._
+
+object BDBClient extends Log
+/**
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class BDBClient(store: BDBStore) extends DispatchLogging {
+
+  import HelperTrait._
+
+  override def log: Log = BDBClient
+
+  def dispatchQueue = store.dispatchQueue
+
+  /////////////////////////////////////////////////////////////////////
+  //
+  // Helpers
+  //
+  /////////////////////////////////////////////////////////////////////
+
+  private def directory = config.directory
+
+  /////////////////////////////////////////////////////////////////////
+  //
+  // Public interface used by the BDBStore
+  //
+  /////////////////////////////////////////////////////////////////////
+
+  var config: BDBStoreDTO = null
+
+  var environment:Environment = _
+
+  def start() = {
+    val env_config = new EnvironmentConfig();
+    env_config.setAllowCreate(true);
+    env_config.setTransactional(true);
+    env_config.setTxnSerializableIsolation(false)
+
+    directory.mkdirs
+    environment = new Environment(directory, env_config);
+
+    with_ctx { ctx=>
+      import ctx._
+      messages_db
+      message_refs_db
+      queues_db
+    }
+  }
+
+  def stop() = {
+    environment.close
+  }
+
+  case class TxContext(tx:Transaction) {
+
+    def with_entries_db[T](queueKey:Long)(func: (Database) => T): T = {
+      val db = environment.openDatabase(tx, entries_db_name(queueKey), long_key_conf)
+      try {
+        func(db)
+      } finally {
+        db.close
+      }
+    }
+
+
+    private var _messages_db:Database = _
+    def messages_db:Database = {
+      if( _messages_db==null ) {
+        _messages_db = environment.openDatabase(tx, "messages", long_key_conf)
+      }
+      _messages_db
+    }
+
+
+    private var _message_refs_db:Database = _
+    def message_refs_db:Database = {
+      if( _message_refs_db==null ) {
+        _message_refs_db = environment.openDatabase(tx, "message_refs", long_key_conf)
+      }
+      _message_refs_db
+    }
+
+    private var _queues_db:Database = _
+    def queues_db:Database = {
+      if( _queues_db==null ) {
+        _queues_db = environment.openDatabase(tx, "queues", long_key_conf)
+      }
+      _queues_db
+    }
+
+    def close(ok:Boolean) = {
+      if( _messages_db!=null ) {
+        _messages_db.close
+      }
+      if( _message_refs_db!=null ) {
+        _message_refs_db.close
+      }
+      if( _queues_db!=null ) {
+        _queues_db.close
+      }
+
+      if(ok){
+        tx.commit
+      } else {
+        tx.abort
+      }
+    }
+
+  }
+
+
+  def with_ctx[T](func: (TxContext) => T): T = {
+    val ctx = TxContext(environment.beginTransaction(null, null));
+    var ok = false
+    try {
+      val rc = func(ctx)
+      ok = true
+      rc
+    } finally {
+      ctx.close(ok)
+    }
+  }
+
+
+  def purge() = {
+
+    with_ctx { ctx=>
+      import ctx._
+
+
+      def remove_db(name: String): Unit = {
+        try {
+          environment.removeDatabase(tx, name)
+        } catch {
+          case x: DatabaseNotFoundException =>
+        }
+      }
+
+      listQueues.foreach{ queueKey=>
+        val name = entries_db_name(queueKey)
+        remove_db(name)
+      }
+      remove_db("messages")
+      remove_db("message_refs")
+      remove_db("queues")
+
+      messages_db
+      message_refs_db
+      queues_db
+    }
+
+  }
+
+  def add_and_get[K](db:Database, key:DatabaseEntry, amount:Int, tx:Transaction):Int = {
+    db.get(tx, key) match {
+      case None =>
+        if( amount!=0 ) {
+          db.put(tx, key, amount)
+        }
+        amount
+
+      case Some(value) =>
+        val counter:Int = value
+        val update = counter + amount
+        if( update == 0 ) {
+          db.delete(tx, key)
+        } else {
+          db.put(tx, key, update)
+        }
+        update
+    }
+  }
+
+  def addQueue(record: QueueRecord, callback:Runnable) = {
+    with_ctx { ctx=>
+      import ctx._
+      queues_db.put(tx, record.key, record)
+      with_entries_db(record.key) { entriesdb=> 
+      }
+    }
+    callback.run
+  }
+
+  def removeQueue(queueKey: Long, callback:Runnable) = {
+    with_ctx { ctx=>
+      import ctx._
+
+      queues_db.delete(tx, queueKey)
+      with_entries_db(queueKey) { entries_db=>
+
+        entries_db.cursor(tx) { (key,value)=>
+          val queueEntry:QueueEntryRecord = value
+          if( add_and_get(message_refs_db, queueEntry.messageKey, -1, tx)==0 ) {
+            messages_db.delete(tx, queueEntry.messageKey)
+          }
+          true // keep cursoring..
+        }
+
+      }
+
+      environment.removeDatabase(tx, entries_db_name(queueKey))
+    }
+    callback.run
+  }
+
+  def store(uows: Seq[BDBStore#DelayableUOW], callback:Runnable) {
+    with_ctx { ctx=>
+      import ctx._
+
+      uows.foreach { uow =>
+          uow.actions.foreach {
+            case (msg, action) =>
+
+              if (action.messageRecord != null) {
+                messages_db.put(tx, action.messageRecord.key, action.messageRecord)
+              }
+
+              action.enqueues.foreach { queueEntry =>
+                with_entries_db(queueEntry.queueKey) { entries_db=>
+                  entries_db.put(tx, queueEntry.queueSeq, queueEntry)
+                  add_and_get(message_refs_db, queueEntry.messageKey, 1, tx)
+                }
+              }
+
+              action.dequeues.foreach { queueEntry =>
+                with_entries_db(queueEntry.queueKey) { entries_db=>
+                  entries_db.delete(tx, queueEntry.queueSeq)
+                  if( add_and_get(message_refs_db, queueEntry.messageKey, -1, tx)==0 ) {
+                    messages_db.delete(tx, queueEntry.messageKey)
+                  }
+                }
+              }
+          }
+      }
+    }
+    callback.run
+  }
+
+  def listQueues: Seq[Long] = {
+    val rc = ListBuffer[Long]()
+    with_ctx { ctx=>
+      import ctx._
+
+      queues_db.cursor(tx) { (key, _) =>
+        rc += key
+        true // to continue cursoring.
+      }
+    }
+
+    rc
+  }
+
+  def getQueue(queueKey: Long): Option[QueueRecord] = {
+    with_ctx { ctx=>
+      import ctx._
+      queues_db.get(tx, to_DatabaseEntry(queueKey)).map( x=> to_QueueRecord(x)  )
+    }
+  }
+
+  def listQueueEntryGroups(queueKey: Long, limit: Int) : Seq[QueueEntryRange] = {
+    var rc = ListBuffer[QueueEntryRange]()
+    with_ctx { ctx=>
+      import ctx._
+
+      with_entries_db(queueKey) { entries_db=>
+
+        var group:QueueEntryRange = null
+
+        entries_db.cursor(tx) { (key, value) =>
+
+          if( group == null ) {
+            group = new QueueEntryRange
+            group.firstQueueSeq = key
+          }
+
+          val entry:QueueEntryRecord = value
+
+          group.lastQueueSeq = key
+          group.count += 1
+          group.size += entry.size
+
+          if( group.count == limit) {
+            rc += group
+            group = null
+          }
+
+          true // to continue cursoring.
+        }
+
+        if( group!=null ) {
+          rc += group
+        }
+
+      }
+    }
+    rc
+  }
+
+  def getQueueEntries(queueKey: Long, firstSeq:Long, lastSeq:Long): Seq[QueueEntryRecord] = {
+    var rc = ListBuffer[QueueEntryRecord]()
+    with_ctx { ctx=>
+      import ctx._
+
+      with_entries_db(queueKey) { entries_db=>
+        entries_db.cursor_from(tx, to_DatabaseEntry(firstSeq)) { (key, value) =>
+          val queueSeq:Long = key
+          val entry:QueueEntryRecord = value
+          rc += entry
+          queueSeq < lastSeq
+        }
+      }
+    }
+    rc
+  }
+
+  val metric_load_from_index_counter = new TimeCounter
+  var metric_load_from_index = metric_load_from_index_counter(false)
+
+  def loadMessages(requests: ListBuffer[(Long, (Option[MessageRecord])=>Unit)]) = {
+    val records = with_ctx { ctx=>
+      import ctx._
+
+      requests.flatMap { case (messageKey, callback)=>
+        val record = metric_load_from_index_counter.time {
+          messages_db.get(tx, to_DatabaseEntry(messageKey)).map ( to_MessageRecord _ )
+        }
+        record match {
+          case None =>
+          debug("Message not indexed: %s", messageKey)
+          callback(None)
+          None
+          case Some(x) => Some((record, callback))
+        }
+      }
+    }
+
+    records.foreach { case (record, callback)=>
+      callback( record )
+    }
+
+  }
+
+
+  def getLastMessageKey:Long = {
+    with_ctx { ctx=>
+      import ctx._
+
+      messages_db.last_key(tx).map(to_long _).getOrElse(0)
+    }
+  }
+
+  def getLastQueueKey:Long = {
+    with_ctx { ctx=>
+      import ctx._
+
+      queues_db.last_key(tx).map(to_long _).getOrElse(0)
+    }
+  }
+
+}
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala Sat Jul 31 10:51:36 2010
@@ -0,0 +1,273 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb
+
+import dto.{BDBStoreDTO, BDBStoreStatusDTO}
+import java.util.concurrent.atomic.AtomicLong
+import collection.Seq
+import org.fusesource.hawtdispatch.ScalaDispatch._
+import java.io.File
+import java.util.concurrent._
+import org.apache.activemq.apollo.store._
+import org.apache.activemq.apollo.util._
+import ReporterLevel._
+import org.fusesource.hawtdispatch.ListEventAggregator
+import org.apache.activemq.apollo.dto.{StoreStatusDTO, IntMetricDTO, TimeMetricDTO, StoreDTO}
+
+object BDBStore extends Log {
+  val DATABASE_LOCKED_WAIT_DELAY = 10 * 1000;
+
+  /**
+   * Creates a default a configuration object.
+   */
+  def defaultConfig() = {
+    val rc = new BDBStoreDTO
+    rc.directory = new File("activemq-data")
+    rc
+  }
+
+  /**
+   * Validates a configuration object.
+   */
+  def validate(config: BDBStoreDTO, reporter:Reporter):ReporterLevel = {
+    new Reporting(reporter) {
+      if( config.directory==null ) {
+        error("The BDB Store directory property must be configured.")
+      }
+    }.result
+  }
+}
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class BDBStore extends DelayingStoreSupport with DispatchLogging {
+
+  import BDBStore._
+
+  override def log: Log = BDBStore
+
+  var next_queue_key = new AtomicLong(1)
+  var next_msg_key = new AtomicLong(1)
+
+  var executor_pool:ExecutorService = _
+  var config:BDBStoreDTO = defaultConfig
+  val client = new BDBClient(this)
+
+  override def toString = "hawtdb store"
+
+  def flush_delay = config.flush_delay
+  
+  protected def get_next_msg_key = next_msg_key.getAndIncrement
+
+  protected def store(uows: Seq[DelayableUOW])(callback: =>Unit) = {
+    executor_pool {
+      client.store(uows, ^{
+        dispatchQueue {
+          callback
+        }
+      })
+    }
+  }
+
+  def configure(config: StoreDTO, reporter: Reporter) = configure(config.asInstanceOf[BDBStoreDTO], reporter)
+
+  def configure(config: BDBStoreDTO, reporter: Reporter) = {
+    if ( BDBStore.validate(config, reporter) < ERROR ) {
+      if( serviceState.isStarted ) {
+        // TODO: apply changes while he broker is running.
+        reporter.report(WARN, "Updating cassandra store configuration at runtime is not yet supported.  You must restart the broker for the change to take effect.")
+      } else {
+        this.config = config
+      }
+    }
+  }
+
+  protected def _start(onCompleted: Runnable) = {
+    executor_pool = Executors.newFixedThreadPool(1, new ThreadFactory(){
+      def newThread(r: Runnable) = {
+        val rc = new Thread(r, "hawtdb store client")
+        rc.setDaemon(true)
+        rc
+      }
+    })
+    client.config = config
+    poll_stats
+    executor_pool {
+      client.start()
+      next_msg_key.set( client.getLastMessageKey +1 )
+      next_queue_key.set( client.getLastQueueKey +1 )
+      onCompleted.run
+    }
+  }
+
+  protected def _stop(onCompleted: Runnable) = {
+    new Thread() {
+      override def run = {
+        executor_pool.shutdown
+        executor_pool.awaitTermination(1, TimeUnit.DAYS)
+        executor_pool = null
+        client.stop
+        onCompleted.run
+      }
+    }.start
+  }
+
+  /////////////////////////////////////////////////////////////////////
+  //
+  // Implementation of the Store interface
+  //
+  /////////////////////////////////////////////////////////////////////
+
+  /**
+   * Deletes all stored data from the store.
+   */
+  def purge(callback: =>Unit) = {
+    executor_pool {
+      client.purge()
+      next_queue_key.set(1)
+      next_msg_key.set(1)
+      callback
+    }
+  }
+
+
+  /**
+   * Ges the last queue key identifier stored.
+   */
+  def getLastQueueKey(callback:(Option[Long])=>Unit):Unit = {
+    executor_pool {
+      callback(Some(client.getLastQueueKey))
+    }
+  }
+
+  def addQueue(record: QueueRecord)(callback: (Boolean) => Unit) = {
+    executor_pool {
+     client.addQueue(record, ^{ callback(true) })
+    }
+  }
+
+  def removeQueue(queueKey: Long)(callback: (Boolean) => Unit) = {
+    executor_pool {
+      client.removeQueue(queueKey,^{ callback(true) })
+    }
+  }
+
+  def getQueue(queueKey: Long)(callback: (Option[QueueRecord]) => Unit) = {
+    executor_pool {
+      callback( client.getQueue(queueKey) )
+    }
+  }
+
+  def listQueues(callback: (Seq[Long]) => Unit) = {
+    executor_pool {
+      callback( client.listQueues )
+    }
+  }
+
+  val load_source = createSource(new ListEventAggregator[(Long, (Option[MessageRecord])=>Unit)](), dispatchQueue)
+  load_source.setEventHandler(^{drain_loads});
+  load_source.resume
+
+
+  def loadMessage(messageKey: Long)(callback: (Option[MessageRecord]) => Unit) = {
+    message_load_latency_counter.start { end=>
+      load_source.merge((messageKey, { (result)=>
+        end()
+        callback(result)
+      }))
+    }
+  }
+
+  def drain_loads = {
+    var data = load_source.getData
+    message_load_batch_size_counter += data.size
+    executor_pool ^{
+      client.loadMessages(data)
+    }
+  }
+
+  def listQueueEntryRanges(queueKey: Long, limit: Int)(callback: (Seq[QueueEntryRange]) => Unit) = {
+    executor_pool ^{
+      callback( client.listQueueEntryGroups(queueKey, limit) )
+    }
+  }
+
+  def listQueueEntries(queueKey: Long, firstSeq: Long, lastSeq: Long)(callback: (Seq[QueueEntryRecord]) => Unit) = {
+    executor_pool ^{
+      callback( client.getQueueEntries(queueKey, firstSeq, lastSeq) )
+    }
+  }
+
+
+  implicit def toTimeMetricDTO( m: TimeMetric) = {
+    val rc = new TimeMetricDTO()
+    rc.count = m.count
+    rc.max = m.max
+    rc.min = m.min
+    rc.total = m.total
+    rc
+  }
+
+  implicit def toIntMetricDTO( m: IntMetric) = {
+    val rc = new IntMetricDTO()
+    rc.count = m.count
+    rc.max = m.max
+    rc.min = m.min
+    rc.total = m.total
+    rc
+  }
+
+  def poll_stats:Unit = {
+    def displayStats = {
+      if( serviceState.isStarted ) {
+
+        flush_latency = flush_latency_counter(true)
+        message_load_latency = message_load_latency_counter(true)
+//        client.metric_journal_append = client.metric_journal_append_counter(true)
+//        client.metric_index_update = client.metric_index_update_counter(true)
+        commit_latency = commit_latency_counter(true)
+        message_load_batch_size =  message_load_batch_size_counter(true)
+
+        poll_stats
+      }
+    }
+
+    dispatchQueue.dispatchAfter(1, TimeUnit.SECONDS, ^{ displayStats })
+  }
+
+  def storeStatusDTO(callback:(StoreStatusDTO)=>Unit) = dispatchQueue {
+    val rc = new BDBStoreStatusDTO
+
+    rc.state = serviceState.toString
+    rc.state_since = serviceState.since
+
+    rc.flush_latency = flush_latency
+    rc.message_load_latency = message_load_latency
+    rc.message_load_batch_size = message_load_batch_size
+
+//    rc.journal_append_latency = client.metric_journal_append
+//    rc.index_update_latency = client.metric_index_update
+
+    rc.canceled_message_counter = metric_canceled_message_counter
+    rc.canceled_enqueue_counter = metric_canceled_enqueue_counter
+    rc.flushed_message_counter = metric_flushed_message_counter
+    rc.flushed_enqueue_counter = metric_flushed_enqueue_counter
+
+    callback(rc)
+  }
+}

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStoreFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStoreFactory.scala?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStoreFactory.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStoreFactory.scala Sat Jul 31 10:51:36 2010
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb
+
+import dto.BDBStoreDTO
+import org.apache.activemq.apollo.store.StoreFactory
+import org.apache.activemq.apollo.dto.StoreDTO
+import org.apache.activemq.apollo.util._
+import ReporterLevel._
+
+/**
+ * <p>
+ * Hook to use a HawtDBStore when a HawtDBStoreDTO is
+ * used in a broker configuration.
+ * </p>
+ * <p>
+ * This class is discovered using the following resource file:
+ * <code>META-INF/services/org.apache.activemq.apollo/stores</code>
+ * </p>
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class BDBStoreFactory extends StoreFactory.Provider {
+
+  def create(config: StoreDTO) = {
+    if( config.isInstanceOf[BDBStoreDTO]) {
+      new BDBStore
+    } else {
+      null
+    }
+  }
+
+   def validate(config: StoreDTO, reporter:Reporter):ReporterLevel = {
+     if( config.isInstanceOf[BDBStoreDTO]) {
+       BDBStore.validate(config.asInstanceOf[BDBStoreDTO], reporter)
+     } else {
+       null
+     }
+   }
+}
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/HelperTrait.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/HelperTrait.scala?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/HelperTrait.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/HelperTrait.scala Sat Jul 31 10:51:36 2010
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb
+
+import model._
+import org.apache.activemq.apollo.store.{MessageRecord, QueueRecord, QueueEntryRecord}
+import java.util.Comparator
+import java.nio.ByteBuffer
+import com.sleepycat.je._
+import java.io.Serializable
+
+object HelperTrait {
+
+  implicit def to_MessageRecord(entry: DatabaseEntry): MessageRecord = {
+    val pb =  MessagePB.FACTORY.parseUnframed(entry.getData)
+    val rc = new MessageRecord
+    rc.key = pb.getMessageKey
+    rc.protocol = pb.getProtocol
+    rc.size = pb.getSize
+    rc.buffer = pb.getValue
+    rc.expiration = pb.getExpiration
+    rc
+  }
+
+  implicit def to_DatabaseEntry(v: MessageRecord): DatabaseEntry = {
+    val pb = new MessagePB.Bean
+    pb.setMessageKey(v.key)
+    pb.setProtocol(v.protocol)
+    pb.setSize(v.size)
+    pb.setValue(v.buffer)
+    pb.setExpiration(v.expiration)
+    new DatabaseEntry(pb.freeze.toUnframedByteArray)
+  }
+
+  implicit def to_QueueEntryRecord(entry: DatabaseEntry): QueueEntryRecord = {
+    val pb =  QueueEntryPB.FACTORY.parseUnframed(entry.getData)
+    val rc = new QueueEntryRecord
+    rc.queueKey = pb.getQueueKey
+    rc.queueSeq = pb.getQueueSeq
+    rc.messageKey = pb.getMessageKey
+    rc.attachment = pb.getAttachment
+    rc.size = pb.getSize
+    rc.redeliveries = pb.getRedeliveries.toShort
+    rc
+  }
+
+  implicit def to_DatabaseEntry(v: QueueEntryRecord): DatabaseEntry = {
+    val pb = new QueueEntryPB.Bean
+    pb.setQueueKey(v.queueKey)
+    pb.setQueueSeq(v.queueSeq)
+    pb.setMessageKey(v.messageKey)
+    pb.setAttachment(v.attachment)
+    pb.setSize(v.size)
+    pb.setRedeliveries(v.redeliveries)
+    new DatabaseEntry(pb.freeze.toUnframedByteArray)
+  }
+
+  implicit def to_QueueRecord(entry: DatabaseEntry): QueueRecord = {
+    val pb = QueuePB.FACTORY.parseUnframed(entry.getData)
+    val rc = new QueueRecord
+    rc.key = pb.getKey
+    rc.binding_data = pb.getBindingData
+    rc.binding_kind = pb.getBindingKind
+    rc
+  }
+
+  implicit def to_DatabaseEntry(v: QueueRecord): DatabaseEntry = {
+    val pb = new QueuePB.Bean
+    pb.setKey(v.key)
+    pb.setBindingData(v.binding_data)
+    pb.setBindingKind(v.binding_kind)
+    new DatabaseEntry(pb.freeze.toUnframedByteArray)
+  }
+
+
+  implicit def to_bytes(l:Long):Array[Byte] = ByteBuffer.wrap(new Array[Byte](8)).putLong(l).array()
+  implicit def to_long(bytes:Array[Byte]):Long = ByteBuffer.wrap(bytes).getLong()
+  implicit def to_DatabaseEntry(l:Long):DatabaseEntry = new DatabaseEntry(to_bytes(l))
+  implicit def to_long(value:DatabaseEntry):Long = to_long(value.getData)
+
+  implicit def to_bytes(l:Int):Array[Byte] = ByteBuffer.wrap(new Array[Byte](4)).putInt(l).array()
+  implicit def to_int(bytes:Array[Byte]):Int = ByteBuffer.wrap(bytes).getInt()
+  implicit def to_DatabaseEntry(l:Int):DatabaseEntry = new DatabaseEntry(to_bytes(l))
+  implicit def to_int(value:DatabaseEntry):Int = to_int(value.getData)
+
+
+
+  class LongComparator extends Comparator[Array[Byte]] with Serializable {
+
+    def compare(o1: Array[Byte], o2: Array[Byte]) = {
+        val v1:java.lang.Long = to_long(o1)
+        val v2:java.lang.Long = to_long(o2)
+        v1.compareTo(v2)
+    }
+    
+  }
+
+  val long_key_conf = new DatabaseConfig();
+  long_key_conf.setAllowCreate(true)
+  long_key_conf.setTransactional(true);
+  long_key_conf.setBtreeComparator(new LongComparator)
+
+  final class RichDatabase(val db: Database) extends Proxy {
+    def self: Any = db
+
+    def with_cursor[T](tx:Transaction)(func: (Cursor) => T): T = {
+      val cursor = db.openCursor(tx, null)
+      try {
+        func(cursor)
+      } finally {
+        cursor.close
+      }
+    }
+
+    def cursor(tx:Transaction)(func: (DatabaseEntry,DatabaseEntry) => Boolean): Unit = {
+      with_cursor(tx) { cursor=>
+        val key = new DatabaseEntry();
+        val data = new DatabaseEntry();
+        while ( cursor.getNext(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS && func(key, data) ) {
+        }
+      }
+    }
+
+    def cursor_from(tx:Transaction, start:DatabaseEntry)(func: (DatabaseEntry,DatabaseEntry) => Boolean): Unit = {
+      with_cursor(tx) { cursor=>
+        val key = new DatabaseEntry(start.getData)
+        val data = new DatabaseEntry();
+        if (cursor.getSearchKeyRange(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS && func(key, data) ) {
+          while (cursor.getNext(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS && func(key, data)) {
+          }
+        }
+      }
+    }
+
+    def get(tx:Transaction, key:DatabaseEntry):Option[DatabaseEntry] = {
+      val value = new DatabaseEntry()
+      if( db.get(tx, key, value, LockMode.DEFAULT) == OperationStatus.SUCCESS ) {
+        Some(value)
+      } else {
+        None
+      }
+    }
+
+    def last_key(tx:Transaction): Option[DatabaseEntry] = {
+      with_cursor(tx) { cursor=>
+        val key = new DatabaseEntry()
+        val data = new DatabaseEntry();
+        if (cursor.getPrev(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS ) {
+          Some(key)
+        } else {
+          None
+
+        }
+      }
+    }
+  }
+  implicit def DatabaseWrapper(x: Database) = new RichDatabase(x)
+
+
+  def entries_db_name(queueKey: Long): String =  "entries-" + queueKey
+
+}

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreDTO.java?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreDTO.java (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreDTO.java Sat Jul 31 10:51:36 2010
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb.dto;
+
+import org.apache.activemq.apollo.dto.StoreDTO;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.File;
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@XmlRootElement(name="bdb-store")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class BDBStoreDTO extends StoreDTO {
+
+    @XmlAttribute
+    public File directory;
+
+//    @XmlAttribute(name="archive-directory")
+//    public File archive_directory;
+//
+
+}

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreStatusDTO.java?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreStatusDTO.java (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/BDBStoreStatusDTO.java Sat Jul 31 10:51:36 2010
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb.dto;
+
+import org.apache.activemq.apollo.dto.IntMetricDTO;
+import org.apache.activemq.apollo.dto.StoreStatusDTO;
+import org.apache.activemq.apollo.dto.TimeMetricDTO;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@XmlRootElement(name="bdb-store-status")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class BDBStoreStatusDTO extends StoreStatusDTO {
+
+    @XmlElement(name="journal-append-latency")
+    public TimeMetricDTO journal_append_latency;
+
+    @XmlElement(name="index-update-latency")
+    public TimeMetricDTO index_update_latency;
+
+    @XmlElement(name="message-load-batch-size")
+    public IntMetricDTO message_load_batch_size;
+
+}
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/package-info.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/package-info.java?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/package-info.java (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/dto/package-info.java Sat Jul 31 10:51:36 2010
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * The JAXB POJOs for the
+ * The JAXB POJOs for the
+ * <a href="http://activemq.apache.org/schema/activemq/apollo/xml-configuration.html">XML Configuration</a>
+ * of the ActiveMQ Broker.
+ */
+@javax.xml.bind.annotation.XmlSchema(
+        namespace = "http://activemq.apache.org/schema/activemq/apollo",
+        elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.activemq.apollo.store.bdb.dto;
+

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/test/ide-resources/log4j.properties?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/test/ide-resources/log4j.properties (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/test/ide-resources/log4j.properties Sat Jul 31 10:51:36 2010
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=WARN, console, file
+log4j.logger.org.apache.activemq=TRACE
+
+# Console will only display warnnings
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p | %t | %m%n
+log4j.appender.console.threshold=TRACE
+
+# File appender will contain all info messages
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
+log4j.appender.file.file=target/test.log
+log4j.appender.file.append=true

Propchange: activemq/activemq-apollo/trunk/apollo-bdb/src/test/ide-resources/log4j.properties
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/log4j.properties?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/log4j.properties (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/log4j.properties Sat Jul 31 10:51:36 2010
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=WARN, console, file
+log4j.logger.org.apache.activemq=TRACE
+
+# Console will only display warnnings
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p | %t | %m%n
+log4j.appender.console.threshold=TRACE
+
+# File appender will contain all info messages
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
+log4j.appender.file.file=target/test.log
+log4j.appender.file.append=true

Propchange: activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/bdb/dto/simple.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/bdb/dto/simple.xml?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/bdb/dto/simple.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/test/resources/org/apache/activemq/apollo/store/bdb/dto/simple.xml Sat Jul 31 10:51:36 2010
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<broker basedir="./activemq-data/default" id="default" xmlns="http://activemq.apache.org/schema/activemq/apollo">
+    <virtual-host enabled="true" id="vh-local">
+        <host-name>localhost</host-name>
+        <bdb-store directory="activemq-data"/>
+    </virtual-host>
+</broker>

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreBenchmark.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreBenchmark.scala?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreBenchmark.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreBenchmark.scala Sat Jul 31 10:51:36 2010
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb
+
+import org.apache.activemq.apollo.store.StoreBenchmarkSupport
+import org.apache.activemq.apollo.store.Store
+
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class BDBStoreBenchmark extends StoreBenchmarkSupport {
+
+  def createStore(flushDelay:Long):Store = {
+    val rc = new BDBStore
+    rc.config.flush_delay = flushDelay
+    rc
+  }
+
+}

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreTest.scala?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreTest.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/BDBStoreTest.scala Sat Jul 31 10:51:36 2010
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb
+
+import org.apache.activemq.apollo.store.{Store, StoreFunSuiteSupport}
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class BDBStoreTest extends StoreFunSuiteSupport {
+
+  def createStore(flushDelay:Long):Store = {
+    val rc = new BDBStore
+    rc.config.flush_delay = flushDelay
+    rc
+  }
+
+}

Added: activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/dto/XmlCodecTest.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/dto/XmlCodecTest.java?rev=981035&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/dto/XmlCodecTest.java (added)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/store/bdb/dto/XmlCodecTest.java Sat Jul 31 10:51:36 2010
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store.bdb.dto;
+
+import org.apache.activemq.apollo.dto.BrokerDTO;
+import org.apache.activemq.apollo.dto.ConnectorDTO;
+import org.apache.activemq.apollo.dto.VirtualHostDTO;
+import org.apache.activemq.apollo.dto.XmlCodec;
+import org.junit.Test;
+
+import java.io.InputStream;
+
+import static junit.framework.Assert.*;
+
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+
+public class XmlCodecTest {
+
+    private InputStream resource(String path) {
+        return getClass().getResourceAsStream(path);
+    }
+
+    @Test
+    public void unmarshalling() throws Exception {
+        BrokerDTO dto = XmlCodec.unmarshalBrokerDTO(resource("simple.xml"));
+        assertNotNull(dto);
+        VirtualHostDTO host = dto.virtual_hosts.get(0);
+        assertEquals("vh-local", host.id);
+        assertEquals(true, host.enabled);
+        assertEquals("localhost", host.host_names.get(0));
+
+        assertNotNull( host.store );
+        assertTrue( host.store instanceof BDBStoreDTO);
+
+    }
+
+
+}

Modified: activemq/activemq-apollo/trunk/apollo-stomp/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/pom.xml?rev=981035&r1=981034&r2=981035&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/pom.xml Sat Jul 31 10:51:36 2010
@@ -56,6 +56,12 @@
       <version>6.0-SNAPSHOT</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-bdb</artifactId>
+      <version>6.0-SNAPSHOT</version>
+      <optional>true</optional>
+    </dependency>
 
     <!-- Scala Support -->
     <dependency>

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompBroker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompBroker.scala?rev=981035&r1=981034&r2=981035&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompBroker.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompBroker.scala Sat Jul 31 10:51:36 2010
@@ -20,6 +20,7 @@ import org.apache.activemq.apollo.broker
 import java.io.File
 import org.apache.activemq.apollo.dto.{CassandraStoreDTO, HawtDBStoreDTO}
 import org.apache.activemq.apollo.util._
+import org.apache.activemq.apollo.store.bdb.dto.BDBStoreDTO
 
 /**
  */
@@ -56,6 +57,11 @@ object StompBroker {
         rc.directory = new File("activemq-data")
         rc
 
+      case "bdb" =>
+        val rc = new BDBStoreDTO
+        rc.directory = new File("activemq-data")
+        rc
+
       case "cassandra" =>
         val rc = new CassandraStoreDTO
         rc.hosts.add("localhost:9160")

Modified: activemq/activemq-apollo/trunk/apollo-web/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/pom.xml?rev=981035&r1=981034&r2=981035&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-web/pom.xml Sat Jul 31 10:51:36 2010
@@ -69,6 +69,12 @@
       <version>6.0-SNAPSHOT</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-bdb</artifactId>
+      <version>6.0-SNAPSHOT</version>
+      <scope>runtime</scope>
+    </dependency>
 
     <!-- Web Framework APIs -->
     <dependency>

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=981035&r1=981034&r2=981035&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Sat Jul 31 10:51:36 2010
@@ -103,6 +103,8 @@
     <hawtdb-version>1.2</hawtdb-version>
     <hawtbuf-version>1.1</hawtbuf-version>
     
+    <bdb-version>4.0.103</bdb-version>
+    
     <jetty-version>6.1.22</jetty-version>
     <scalate-version>1.2</scalate-version>
     <servlet-api-version>2.5</servlet-api-version>
@@ -151,6 +153,7 @@
     <module>apollo-selector</module>
     <module>apollo-tcp</module>
     <module>apollo-hawtdb</module>
+    <module>apollo-bdb</module>
     <module>apollo-dto</module>
     <module>apollo-stomp</module>
     <module>apollo-web</module>
@@ -789,6 +792,12 @@
           <releases><enabled>false</enabled></releases>
         </repository>
         
+        <repository>
+          <id>oracleReleases</id>
+          <url>http://download.oracle.com/maven</url>
+          <layout>default</layout>
+        </repository>
+        
       </repositories>
       
       <pluginRepositories>