activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1053958 - in /activemq/activemq-apollo/trunk: ./ apollo-distro/ apollo-jdbm2/ apollo-jdbm2/src/ apollo-jdbm2/src/main/ apollo-jdbm2/src/main/proto/ apollo-jdbm2/src/main/resources/ apollo-jdbm2/src/main/resources/META-INF/ apollo-jdbm2/src...
Date Thu, 30 Dec 2010 18:09:46 GMT
Author: chirino
Date: Thu Dec 30 18:09:43 2010
New Revision: 1053958

URL: http://svn.apache.org/viewvc?rev=1053958&view=rev
Log:
Adding a jdbm2 based store.

Added:
    activemq/activemq-apollo/trunk/apollo-jdbm2/
    activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/proto/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/proto/data.proto
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/jdbm2/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/jaxb.index
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Client.scala
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreFactory.scala
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreDTO.java
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.java
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/package-info.java
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/jdbm2/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/jdbm2/dto/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.jade
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/ide-resources/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/ide-resources/log4j.properties   (with props)
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/log4j.properties   (with props)
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/jdbm2/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/simple.xml
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreBenchmark.scala
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/XmlCodecTest.java
Modified:
    activemq/activemq-apollo/trunk/apollo-distro/pom.xml
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-distro/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/pom.xml?rev=1053958&r1=1053957&r2=1053958&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-distro/pom.xml Thu Dec 30 18:09:43 2010
@@ -45,6 +45,11 @@
       <artifactId>apollo-bdb</artifactId>
       <version>1.0-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-jdbm2</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
     <!--<dependency>-->
       <!--<groupId>org.apache.activemq</groupId>-->
       <!--<artifactId>apollo-cassandra</artifactId>-->

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml Thu Dec 30 18:09:43 2010
@@ -0,0 +1,164 @@
+<?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>1.0-SNAPSHOT</version>
+    <relativePath>../apollo-scala</relativePath>
+  </parent>
+
+  <groupId>org.apache.activemq</groupId>
+  <artifactId>apollo-jdbm2</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>${project.artifactId}</name>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-broker</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.fusesource.jdbm</groupId>
+      <artifactId>jdbm</artifactId>
+      <version>${jdbm-version}</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.fusesource.hawtbuf</groupId>
+      <artifactId>hawtbuf-proto</artifactId>
+      <version>${hawtbuf-version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j-version}</version>
+    </dependency>
+
+    <!-- Since we implement a jade template to display the JDBM status -->
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-web</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <type>jar</type>
+      <classifier>slim</classifier>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>${servlet-api-version}</version>
+      <scope>provided</scope>
+    </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-broker</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-util</artifactId>
+      <version>1.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>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>${slf4j-version}</version>
+      <scope>test</scope>
+    </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>
+      
+      <plugin>
+        <groupId>org.fusesource.scalate</groupId>
+        <artifactId>maven-scalate-plugin</artifactId>
+        <version>${scalate-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>precompile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      
+    </plugins>
+  </build>
+
+</project>

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/proto/data.proto
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/proto/data.proto?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/proto/data.proto (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/proto/data.proto Thu Dec 30 18:09:43 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.broker.store.jdbm2.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-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/store-factory.index Thu Dec 30 18:09:43 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.broker.store.jdbm2.JDBM2StoreFactory

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index Thu Dec 30 18:09:43 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.broker.store.jdbm2.dto

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/jaxb.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/jaxb.index?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/jaxb.index (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/jaxb.index Thu Dec 30 18:09:43 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.
+# ------------------------------------------------------------------------
+JDBM2StoreDTO
+JDBM2StoreStatusDTO

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Client.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Client.scala?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Client.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Client.scala Thu Dec 30 18:09:43 2010
@@ -0,0 +1,467 @@
+/**
+ * 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.broker.store.jdbm2
+
+import dto.JDBM2StoreDTO
+import java.{lang=>jl}
+import java.{util=>ju}
+
+import java.util.concurrent.atomic.AtomicInteger
+import collection.mutable.ListBuffer
+import org.apache.activemq.apollo.broker.store._
+import org.apache.activemq.apollo.util._
+import jdbm._
+import btree.BTree
+import htree.HTree
+import java.util.Comparator
+import model._
+import java.io.Serializable
+import jdbm.helper._
+
+object JDBM2Client extends Log {
+
+  object MessageRecordSerializer extends Serializer[MessageRecord] {
+
+    def serialize(out: SerializerOutput, v: MessageRecord) = {
+      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)
+      pb.freeze.writeUnframed(out)
+    }
+
+    def deserialize(in: SerializerInput) = {
+      val pb =  MessagePB.FACTORY.parseUnframed(in)
+      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
+    }
+  }
+
+  object QueueRecordSerializer extends Serializer[QueueRecord] {
+
+    def serialize(out: SerializerOutput, v: QueueRecord) = {
+      val pb = new QueuePB.Bean
+      pb.setKey(v.key)
+      pb.setBindingData(v.binding_data)
+      pb.setBindingKind(v.binding_kind)
+      pb.freeze.writeUnframed(out)
+    }
+
+    def deserialize(in: SerializerInput) = {
+      val pb = QueuePB.FACTORY.parseUnframed(in)
+      val rc = new QueueRecord
+      rc.key = pb.getKey
+      rc.binding_data = pb.getBindingData
+      rc.binding_kind = pb.getBindingKind
+      rc
+    }
+  }
+
+  object QueueEntryRecordSerializer extends Serializer[QueueEntryRecord] {
+
+    def serialize(out: SerializerOutput, v: QueueEntryRecord) = {
+      val pb = new QueueEntryPB.Bean
+      pb.setQueueKey(v.queue_key)
+      pb.setQueueSeq(v.entry_seq)
+      pb.setMessageKey(v.message_key)
+      pb.setAttachment(v.attachment)
+      pb.setSize(v.size)
+      pb.setRedeliveries(v.redeliveries)
+      pb.freeze.writeUnframed(out)
+    }
+
+    def deserialize(in: SerializerInput) = {
+      val pb =  QueueEntryPB.FACTORY.parseUnframed(in)
+      val rc = new QueueEntryRecord
+      rc.queue_key = pb.getQueueKey
+      rc.entry_seq = pb.getQueueSeq
+      rc.message_key = pb.getMessageKey
+      rc.attachment = pb.getAttachment
+      rc.size = pb.getSize
+      rc.redeliveries = pb.getRedeliveries.toShort
+      rc
+    }
+  }
+
+  object QueueEntryKeySerializer extends Serializer[(Long,Long)] {
+    def serialize(out: SerializerOutput, v: (Long,Long)) = {
+      out.writePackedLong(v._1)
+      out.writePackedLong(v._2)
+    }
+
+    def deserialize(in: SerializerInput) = {
+      (in.readPackedLong, in.readPackedLong)
+    }
+  }
+
+  class QueueEntryKeyComparator extends Comparator[(Long,Long)] with Serializable {
+    def compare(o1: (Long, Long), o2: (Long, Long)) = {
+      val rc = o1._1.compareTo(o2._1)
+      if( rc==0 ) {
+        o1._2.compareTo(o2._2)
+      } else {
+        rc
+      }
+    }
+  }
+
+  val QueueEntryKeyComparator = new QueueEntryKeyComparator
+
+  final class RichBTree[K,V](val self: BTree[K,V]) {
+
+    def cursor(func: (K,V) => Boolean): Unit = {
+      val browser = self.browse
+      val entry = new Tuple[K,V]
+      while( browser.getNext(entry) && func(entry.getKey, entry.getValue) ) {
+      }
+    }
+
+    def cursor_range(start_inclusive:K, end_exclusive:K)(func: (K,V)=>Unit): Unit = {
+      val browser = self.browse(start_inclusive)
+      val entry = new Tuple[K,V]
+      def in_range = self.getComparator.compare(entry.getKey,end_exclusive) < 0
+      while( browser.getNext(entry) && in_range ) {
+        func(entry.getKey, entry.getValue)
+      }
+    }
+
+  }
+
+  implicit def to_rich_btree[K,V](x: BTree[K,V]) = new RichBTree[K,V](x)
+
+  final class RichHTree[K,V](val self: HTree[K,V]) {
+
+    def cursor(func: (K,V) => Boolean): Unit = {
+      val i = self.keys
+      var keep_going = true
+      while( keep_going && i.hasNext() ) {
+        val key = i.next
+        val value = self.find(key)
+        keep_going = func(key, value)
+      }
+    }
+
+  }
+
+  implicit def to_rich_btree[K,V](x: HTree[K,V]) = new RichHTree[K,V](x)
+
+}
+
+/**
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class JDBM2Client(store: JDBM2Store) {
+
+  import JDBM2Client._
+
+
+  def dispatchQueue = store.dispatch_queue
+
+  /////////////////////////////////////////////////////////////////////
+  //
+  // Public interface used by the BDBStore
+  //
+  /////////////////////////////////////////////////////////////////////
+
+  var config: JDBM2StoreDTO = null
+
+  var recman:RecordManager = _
+
+  var queues_db:HTree[Long, QueueRecord] = _
+  var entries_db:BTree[(Long,Long), QueueEntryRecord] = _
+  var messages_db:HTree[Long, MessageRecord] = _
+  var message_refs_db:HTree[Long, java.lang.Integer] = _
+
+  var last_message_key = 0L
+  var last_queue_key = 0L
+
+  def start() = {
+
+    config.directory.mkdirs
+
+    import FileSupport._
+    recman = RecordManagerFactory.createRecordManager((config.directory / "jdbm2").getCanonicalPath)
+
+    def init_btree[K, V](name: String, key_comparator:Comparator[K]=ComparableComparator.INSTANCE.asInstanceOf[Comparator[K]], key_serializer:Serializer[K]=null, value_serializer:Serializer[V]=null) = {
+      val recid = recman.getNamedObject(name)
+      var rc: BTree[K, V] = if (recid == 0) {
+        val rc = BTree.createInstance[K, V](recman, key_comparator, key_serializer, value_serializer);
+        recman.setNamedObject(name, rc.getRecid)
+        rc
+      } else {
+        BTree.load[K, V](recman, recid)
+      }
+      rc.setKeySerializer(key_serializer)
+      rc.setValueSerializer(value_serializer)
+      rc
+    }
+
+    def init_htree[K, V](name: String, key_serializer:Serializer[K]=null, value_serializer:Serializer[V]=null) = {
+      val recid = recman.getNamedObject(name)
+      var rc: HTree[K, V] = if (recid == 0) {
+        val rc = HTree.createInstance[K, V](recman, key_serializer, value_serializer);
+        recman.setNamedObject(name, rc.getRecid)
+        rc
+      } else {
+        HTree.load[K, V](recman, recid, key_serializer, value_serializer)
+      }
+      rc
+    }
+
+
+    transaction {
+      messages_db = init_htree("messages", value_serializer = MessageRecordSerializer)
+      message_refs_db = init_htree("message_refs")
+      queues_db = init_htree("queues", value_serializer = QueueRecordSerializer)
+      entries_db = init_btree("enttries", new QueueEntryKeyComparator, QueueEntryKeySerializer, QueueEntryRecordSerializer)
+
+      last_message_key = Option(recman.getNamedObject("last_message_key")).map(_.longValue).getOrElse(0L)
+      last_queue_key = Option(recman.getNamedObject("last_queue_key")).map(_.longValue).getOrElse(0L)
+    }
+
+  }
+
+  def stop() = {
+    recman.close
+    recman = null;
+  }
+
+  def transaction[T](func: => T): T = {
+    var ok = false
+    try {
+      val rc = func
+      ok = true
+      rc
+    } finally {
+      if(ok){
+        recman.commit
+      } else {
+        recman.rollback
+      }
+    }
+  }
+
+
+  def purge() = {
+    def delete_files = {
+      if( config.directory.isDirectory ) {
+        config.directory.listFiles.filter(_.getName.startsWith("jdbm2.")).foreach(_.delete)
+      }
+    }
+    if( recman!=null ) {
+      stop
+      delete_files
+      start
+    } else {
+      delete_files
+    }
+  }
+
+  def addQueue(record: QueueRecord, callback:Runnable) = {
+    transaction {
+      if( record.key > last_queue_key ) {
+        last_queue_key = record.key
+        recman.setNamedObject("last_queue_key", last_queue_key)
+      }
+      queues_db.put(record.key, record)
+    }
+    callback.run
+  }
+
+  def add_and_get[K](db:HTree[K,java.lang.Integer], key:K, amount:Int):Int = {
+    db.find(key) match {
+      case null =>
+        if( amount!=0 ) {
+          db.put(key, amount)
+        }
+        amount
+
+      case value =>
+        val counter = value.intValue
+        val update = counter + amount
+        if( update == 0 ) {
+          db.remove(key)
+        } else {
+          db.put(key, update)
+        }
+        update
+    }
+  }
+
+  def compact = {
+    val gc = ListBuffer[Long]()
+    message_refs_db.cursor { (key, refs)=>
+      if( refs == 0 ) {
+        gc += key
+      }
+      true
+    }
+    transaction {
+      gc.foreach { key=>
+        message_refs_db.remove(key)
+        messages_db.remove(key)
+      }
+    }
+    recman.defrag
+  }
+
+  def add_message_reference(key:Long)={
+    message_refs_db.find(key) match {
+      case null =>
+        message_refs_db.put(key, 1)
+      case value =>
+        message_refs_db.put(key, value.intValue+1)
+    }
+  }
+
+  def remove_message_reference(key:Long)={
+    message_refs_db.find(key) match {
+      case null =>
+        message_refs_db.put(key, 0)
+      case value =>
+        message_refs_db.put(key, value.intValue-1)
+    }
+  }
+
+  def removeQueue(queue_key: Long, callback:Runnable) = {
+    transaction {
+      queues_db.remove(queue_key)
+      entries_db.cursor_range( (queue_key, 0L), (queue_key+1, 0L)) { (key,value)=>
+        entries_db.remove(key)
+        val queue_entry:QueueEntryRecord = value
+        remove_message_reference(queue_entry.message_key)
+      }
+    }
+    callback.run
+  }
+
+  def store(uows: Seq[JDBM2Store#DelayableUOW], callback:Runnable) {
+    transaction {
+      uows.foreach { uow =>
+        uow.actions.foreach { case (msg, action) =>
+
+          if (action.messageRecord != null) {
+            messages_db.put(action.messageRecord.key, action.messageRecord)
+            if( action.messageRecord.key > last_message_key ) {
+              last_message_key = action.messageRecord.key
+              recman.setNamedObject("last_message_key", last_message_key)
+            }
+          }
+
+          action.enqueues.foreach { queue_entry =>
+            entries_db.insert((queue_entry.queue_key, queue_entry.entry_seq), queue_entry, true)
+            add_message_reference(queue_entry.message_key)
+          }
+
+          action.dequeues.foreach { queue_entry =>
+            entries_db.remove((queue_entry.queue_key, queue_entry.entry_seq))
+            remove_message_reference(queue_entry.message_key)
+          }
+
+        }
+      }
+    }
+    callback.run
+  }
+
+  def listQueues: Seq[Long] = {
+    val rc = ListBuffer[Long]()
+    queues_db.cursor { (key, _) =>
+      rc += key
+      true // to continue cursoring.
+    }
+    rc
+  }
+
+  def getQueue(queue_key: Long): Option[QueueRecord] = {
+    Option(queues_db.find(queue_key))
+  }
+
+  def listQueueEntryGroups(queue_key: Long, limit: Int) : Seq[QueueEntryRange] = {
+    var rc = ListBuffer[QueueEntryRange]()
+    var group:QueueEntryRange = null
+
+    entries_db.cursor_range( (queue_key, 0L), (queue_key+1, 0L)) { (key,entry)=>
+
+      val seq = key._2
+
+      if( group == null ) {
+        group = new QueueEntryRange
+        group.first_entry_seq = seq
+      }
+
+      group.last_entry_seq = seq
+      group.count += 1
+      group.size += entry.size
+
+      if( group.count == limit) {
+        rc += group
+        group = null
+      }
+    }
+
+    if( group!=null ) {
+      rc += group
+    }
+    rc
+  }
+
+  def getQueueEntries(queue_key: Long, firstSeq:Long, lastSeq:Long): Seq[QueueEntryRecord] = {
+    var rc = ListBuffer[QueueEntryRecord]()
+    entries_db.cursor_range( (queue_key, firstSeq), (queue_key, lastSeq+1)) { (_,entry)=>
+      rc += entry
+    }
+    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 =  requests.flatMap { case (message_key, callback)=>
+      val record = metric_load_from_index_counter.time {
+        Option(messages_db.find(message_key))
+      }
+      record match {
+        case None =>
+        debug("Message not indexed: %s", message_key)
+        callback(None)
+        None
+        case Some(x) => Some((record, callback))
+      }
+    }
+
+    records.foreach { case (record, callback)=>
+      callback( record )
+    }
+
+  }
+
+
+  def getLastMessageKey:Long = last_message_key
+
+  def getLastQueueKey:Long = last_queue_key
+
+}

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala Thu Dec 30 18:09:43 2010
@@ -0,0 +1,290 @@
+/**
+ * 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.broker.store.jdbm2
+
+import dto.{JDBM2StoreDTO, JDBM2StoreStatusDTO}
+import java.util.concurrent.atomic.AtomicLong
+import collection.Seq
+import org.fusesource.hawtdispatch._
+import java.io.File
+import java.util.concurrent._
+import org.apache.activemq.apollo.broker.store._
+import org.apache.activemq.apollo.util._
+import ReporterLevel._
+import org.fusesource.hawtdispatch.ListEventAggregator
+import org.apache.activemq.apollo.dto.{StoreStatusDTO, IntMetricDTO, TimeMetricDTO, StoreDTO}
+import org.apache.activemq.apollo.util.OptionSupport._
+import scala.util.continuations._
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object JDBM2Store extends Log {
+  val DATABASE_LOCKED_WAIT_DELAY = 10 * 1000;
+
+  /**
+   * Creates a default a configuration object.
+   */
+  def defaultConfig() = {
+    val rc = new JDBM2StoreDTO
+    rc.directory = new File("activemq-data")
+    rc
+  }
+
+  /**
+   * Validates a configuration object.
+   */
+  def validate(config: JDBM2StoreDTO, reporter:Reporter):ReporterLevel = {
+    new Reporting(reporter) {
+      if( config.directory==null ) {
+        error("The jdbm2 store directory property must be configured.")
+      }
+    }.result
+  }
+}
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class JDBM2Store extends DelayingStoreSupport with DispatchLogging {
+
+  import JDBM2Store._
+
+  override def log: Log = JDBM2Store
+
+  var next_queue_key = new AtomicLong(1)
+  var next_msg_key = new AtomicLong(1)
+
+  var executor:ExecutorService = _
+  var read_executor:ExecutorService = _
+  var config:JDBM2StoreDTO = defaultConfig
+  val client = new JDBM2Client(this)
+
+  override def toString = "jdbm2 store"
+
+  def flush_delay = config.flush_delay.getOrElse(100)
+  
+  protected def get_next_msg_key = next_msg_key.getAndIncrement
+
+  protected def store(uows: Seq[DelayableUOW])(callback: =>Unit) = {
+    executor {
+      client.store(uows, ^{
+        dispatch_queue {
+          callback
+        }
+      })
+    }
+  }
+
+  def configure(config: StoreDTO, reporter: Reporter) = configure(config.asInstanceOf[JDBM2StoreDTO], reporter)
+
+  def configure(config: JDBM2StoreDTO, reporter: Reporter) = {
+    if ( JDBM2Store.validate(config, reporter) < ERROR ) {
+      if( service_state.is_started ) {
+        // TODO: apply changes while he broker is running.
+        reporter.report(WARN, "Updating jdbm2 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(on_completed: Runnable) = {
+    info("Starting jdbm2 store at: '%s'", config.directory)
+    executor = Executors.newFixedThreadPool(1, new ThreadFactory(){
+      def newThread(r: Runnable) = {
+        val rc = new Thread(r, "jdbm2 store io write")
+        rc.setDaemon(true)
+        rc
+      }
+    })
+    client.config = config
+    executor {
+      client.start()
+      next_msg_key.set( client.getLastMessageKey +1 )
+      next_queue_key.set( client.getLastQueueKey +1 )
+      poll_stats
+      poll_compact
+      on_completed.run
+    }
+  }
+
+  protected def _stop(on_completed: Runnable) = {
+    new Thread() {
+      override def run = {
+        info("Stopping jdbm2 store at: '%s'", config.directory)
+        executor.shutdown
+        executor.awaitTermination(60, TimeUnit.SECONDS)
+        executor = null
+        client.stop
+        on_completed.run
+      }
+    }.start
+  }
+
+  /////////////////////////////////////////////////////////////////////
+  //
+  // Implementation of the Store interface
+  //
+  /////////////////////////////////////////////////////////////////////
+
+  /**
+   * Deletes all stored data from the store.
+   */
+  def purge(callback: =>Unit) = {
+    executor {
+      client.purge()
+      next_queue_key.set(1)
+      next_msg_key.set(1)
+      callback
+    }
+  }
+
+
+  /**
+   * Ges the last queue key identifier stored.
+   */
+  def get_last_queue_key(callback:(Option[Long])=>Unit):Unit = {
+    executor {
+      callback(Some(client.getLastQueueKey))
+    }
+  }
+
+  def add_queue(record: QueueRecord)(callback: (Boolean) => Unit) = {
+    executor {
+     client.addQueue(record, ^{ callback(true) })
+    }
+  }
+
+  def remove_queue(queueKey: Long)(callback: (Boolean) => Unit) = {
+    executor {
+      client.removeQueue(queueKey,^{ callback(true) })
+    }
+  }
+
+  def get_queue(queueKey: Long)(callback: (Option[QueueRecord]) => Unit) = {
+    executor {
+      callback( client.getQueue(queueKey) )
+    }
+  }
+
+  def list_queues(callback: (Seq[Long]) => Unit) = {
+    executor {
+      callback( client.listQueues )
+    }
+  }
+
+  val load_source = createSource(new ListEventAggregator[(Long, (Option[MessageRecord])=>Unit)](), dispatch_queue)
+  load_source.setEventHandler(^{drain_loads});
+  load_source.resume
+
+
+  def load_message(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 ^{
+      client.loadMessages(data)
+    }
+  }
+
+  def list_queue_entry_ranges(queueKey: Long, limit: Int)(callback: (Seq[QueueEntryRange]) => Unit) = {
+    executor ^{
+      callback( client.listQueueEntryGroups(queueKey, limit) )
+    }
+  }
+
+  def list_queue_entries(queueKey: Long, firstSeq: Long, lastSeq: Long)(callback: (Seq[QueueEntryRecord]) => Unit) = {
+    executor ^{
+      callback( client.getQueueEntries(queueKey, firstSeq, lastSeq) )
+    }
+  }
+
+
+  private def keep_polling = {
+    val ss = service_state
+    ss.is_starting || ss.is_started
+  }
+
+  def poll_compact:Unit = {
+    def the_meat = {
+      if( keep_polling ) {
+        reset {
+          compact
+          poll_compact
+        }
+      }
+    }
+    val interval = config.compact_interval.getOrElse(60)
+    if( interval>=0 ) {
+      dispatch_queue.dispatchAfter(interval, TimeUnit.SECONDS, ^{ the_meat })
+    }
+  }
+
+
+  def compact = executor ! {
+    client.compact
+  }
+
+
+  def poll_stats:Unit = {
+    def displayStats = {
+      if( keep_polling ) {
+
+        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
+      }
+    }
+
+    dispatch_queue.dispatchAfter(1, TimeUnit.SECONDS, ^{ displayStats })
+  }
+
+  def get_store_status(callback:(StoreStatusDTO)=>Unit) = dispatch_queue {
+    val rc = new JDBM2StoreStatusDTO
+
+    rc.state = service_state.toString
+    rc.state_since = service_state.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-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreFactory.scala?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreFactory.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreFactory.scala Thu Dec 30 18:09:43 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.broker.store.jdbm2
+
+import dto.JDBM2StoreDTO
+import org.apache.activemq.apollo.broker.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 JDBM2StoreFactory extends StoreFactory.Provider {
+
+  def create(config: StoreDTO) = {
+    if( config.isInstanceOf[JDBM2StoreDTO]) {
+      new JDBM2Store
+    } else {
+      null
+    }
+  }
+
+   def validate(config: StoreDTO, reporter:Reporter):ReporterLevel = {
+     if( config.isInstanceOf[JDBM2StoreDTO]) {
+       JDBM2Store.validate(config.asInstanceOf[JDBM2StoreDTO], reporter)
+     } else {
+       null
+     }
+   }
+}

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreDTO.java?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreDTO.java (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreDTO.java Thu Dec 30 18:09:43 2010
@@ -0,0 +1,40 @@
+/**
+ * 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.broker.store.jdbm2.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="jdbm2_store")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class JDBM2StoreDTO extends StoreDTO {
+
+    @XmlAttribute
+    public File directory;
+
+    @XmlAttribute
+    public Integer compact_interval;
+
+}

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.java?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.java (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.java Thu Dec 30 18:09:43 2010
@@ -0,0 +1,38 @@
+/**
+ * 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.broker.store.jdbm2.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="jdbm2_store_status")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class JDBM2StoreStatusDTO extends StoreStatusDTO {
+
+    @XmlElement(name="message_load_batch_size")
+    public IntMetricDTO message_load_batch_size;
+
+}

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/package-info.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/package-info.java?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/package-info.java (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/package-info.java Thu Dec 30 18:09:43 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.broker.store.jdbm2.dto;
+

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.jade
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.jade?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.jade (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/webapp/WEB-INF/org/apache/activemq/apollo/broker/store/jdbm2/dto/JDBM2StoreStatusDTO.jade Thu Dec 30 18:09:43 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.
+
+- import org.apache.activemq.apollo.dto._
+- import it._
+- val helper = new org.apache.activemq.apollo.web.resources.ViewHelper
+- import helper._
+- import java.util.concurrent.TimeUnit._
+
+.breadcumbs
+  a(href={strip_resolve(".")}) Back
+
+p state: #{state} for #{ uptime(state_since) }
+
+h2 Cancel Stats
+p canceled message stores: #{canceled_message_counter}
+p canceled message enqueues: #{canceled_enqueue_counter}
+
+h2 Flush Stats
+p flushed message stores: #{flushed_message_counter}
+p flushed message enqueues: #{flushed_enqueue_counter}
+
+h2 Store Latency Stats
+
+- def show(name:String, value:TimeMetricDTO)
+  p #{name} : average #{value.avg(MILLISECONDS)} ms,  min #{value.min(MILLISECONDS)} ms, max #{value.max(MILLISECONDS)} ms, #{value.count} events
+
+- show("Message load latency", message_load_latency)
+- show("UOW flush latency", flush_latency)

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/ide-resources/log4j.properties?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/ide-resources/log4j.properties (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/ide-resources/log4j.properties Thu Dec 30 18:09:43 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-jdbm2/src/test/ide-resources/log4j.properties
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/log4j.properties?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/log4j.properties (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/log4j.properties Thu Dec 30 18:09:43 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-jdbm2/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/simple.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/simple.xml?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/simple.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/resources/org/apache/activemq/apollo/broker/store/jdbm2/dto/simple.xml Thu Dec 30 18:09:43 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 xmlns="http://activemq.apache.org/schema/activemq/apollo">
+    <virtual_host enabled="true" id="vh-local">
+        <host_name>localhost</host_name>
+        <jdbm2_store directory="activemq-data"/>
+    </virtual_host>
+</broker>

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreBenchmark.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreBenchmark.scala?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreBenchmark.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreBenchmark.scala Thu Dec 30 18:09:43 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.broker.store.jdbm2
+
+import org.apache.activemq.apollo.broker.store.StoreBenchmarkSupport
+import org.apache.activemq.apollo.broker.store.Store
+
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class JDBM2StoreBenchmark extends StoreBenchmarkSupport {
+
+  def create_store(flushDelay:Long):Store = {
+    val rc = new JDBM2Store
+    rc.config.flush_delay = flushDelay
+    rc
+  }
+
+}

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala Thu Dec 30 18:09:43 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.broker.store.jdbm2
+
+import org.apache.activemq.apollo.broker.store.{Store, StoreFunSuiteSupport}
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class JDBM2StoreTest extends StoreFunSuiteSupport {
+
+  def create_store(flushDelay:Long):Store = {
+    val rc = new JDBM2Store
+    rc.config.flush_delay = flushDelay
+    rc
+  }
+
+}

Added: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/XmlCodecTest.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/XmlCodecTest.java?rev=1053958&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/XmlCodecTest.java (added)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/dto/XmlCodecTest.java Thu Dec 30 18:09:43 2010
@@ -0,0 +1,53 @@
+/**
+ * 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.broker.store.jdbm2.dto;
+
+import org.apache.activemq.apollo.dto.BrokerDTO;
+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("localhost", host.host_names.get(0));
+
+        assertNotNull( host.store );
+        assertTrue( host.store instanceof JDBM2StoreDTO);
+
+    }
+
+
+}

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1053958&r1=1053957&r2=1053958&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Thu Dec 30 18:09:43 2010
@@ -101,6 +101,7 @@
     <hawtdb-version>1.6-SNAPSHOT</hawtdb-version>
     <hawtbuf-version>1.3-SNAPSHOT</hawtbuf-version>
     
+    <jdbm-version>2.0.0-SNAPSHOT</jdbm-version>
     <bdb-version>4.1.6</bdb-version>
     <jasypt-version>1.6</jasypt-version>
 
@@ -156,6 +157,7 @@
     <module>apollo-tcp</module>
     <module>apollo-hawtdb</module>
     <module>apollo-bdb</module>
+    <module>apollo-jdbm2</module>
     <module>apollo-dto</module>
     <module>apollo-stomp</module>
     <module>apollo-web</module>



Mime
View raw message