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/07 05:55:09 UTC

svn commit: r961100 [1/2] - in /activemq/sandbox/activemq-apollo-actor: ./ activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/ activemq-broker/src/test/ide-resources/ activemq-broker/src/test/resources/ activemq-broker/src/test/scala/org/...

Author: chirino
Date: Wed Jul  7 03:55:07 2010
New Revision: 961100

URL: http://svn.apache.org/viewvc?rev=961100&view=rev
Log:
making progress on the web module

Added:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/LoggingTracker.scala
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/util/
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/util/BaseService.java
      - copied, changed from r961099, activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/BaseService.java
    activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala
    activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala
    activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala
      - copied, changed from r961099, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala
Removed:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/CompletionTracker.scala
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/BaseService.java
Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/BaseService.scala
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index
    activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/scala/org/apache/activemq/apollo/jaxb/BrokerConfig.java
    activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
    activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala
    activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala
    activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala
    activemq/sandbox/activemq-apollo-actor/pom.xml
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-flow/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-flow/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-jmx/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-jmx/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-network/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-network/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-openwire/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-openwire/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-queue/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-queue/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-spring/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/activemq-spring/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/distribution/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/hawtdb/src/test/eclipse-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/hawtdb/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/hawtdb/src/test/resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/kahadb/src/test/eclipse-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/kahadb/src/test/ide-resources/log4j.properties
    activemq/sandbox/activemq-apollo-actor/sandbox/kahadb/src/test/resources/log4j.properties

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/BaseService.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/BaseService.scala?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/BaseService.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/BaseService.scala Wed Jul  7 03:55:07 2010
@@ -31,27 +31,35 @@ trait BaseService extends Service {
 
   sealed class State {
     override def toString = getClass.getSimpleName
+    def isCreated = false
+    def isStarting = false
+    def isStarted = false
+    def isStopping = false
+    def isStopped= false
+    def isFailed= false
   }
 
   trait CallbackSupport {
     var callbacks:List[Runnable] = Nil
     def << (r:Runnable) = if(r!=null) { callbacks ::= r }
-    def done = callbacks.foreach(_.run)
+    def done = { callbacks.foreach(_.run); callbacks=Nil }
   }
 
-  object CREATED extends State
-  class  STARTING extends State with CallbackSupport
-  object STARTED extends State
-  class  STOPPING extends State with CallbackSupport
-  object STOPPED extends State
+  protected object CREATED extends State { override def isCreated = true  }
+  protected class  STARTING extends State with CallbackSupport { override def isStarting = true  }
+  protected object FAILED extends State { override def isFailed = true  }
+  protected object STARTED extends State { override def isStarted = true  }
+  protected class  STOPPING extends State with CallbackSupport { override def isStopping = true  }
+  protected object STOPPED extends State { override def isStopped = true  }
 
   val dispatchQueue:DispatchQueue
 
   final def start() = start(null)
   final def stop() = stop(null)
 
+  @volatile
   protected var _serviceState:State = CREATED
-  protected def serviceState = _serviceState
+  def serviceState = _serviceState
 
   private def error(msg:String) {
     try {
@@ -67,10 +75,17 @@ trait BaseService extends Service {
       val state = new STARTING()
       state << onCompleted
       _serviceState = state
-      _start(^{
-        _serviceState = STARTED
-        state.done
-      })
+      try {
+        _start(^ {
+          _serviceState = STARTED
+          state.done
+        })
+      }
+      catch {
+        case e:Exception =>
+          _serviceState = FAILED
+          state.done
+      }
     }
     def done = {
       if( onCompleted!=null ) {
@@ -103,10 +118,17 @@ trait BaseService extends Service {
         val state = new STOPPING
         state << onCompleted
         _serviceState = state
-        _stop(^{
-          _serviceState = STOPPED
-          state.done
-        })
+        try {
+          _stop(^ {
+            _serviceState = STOPPED
+            state.done
+          })
+        }
+        catch {
+          case e:Exception =>
+            _serviceState = FAILED
+            state.done
+        }
       case state:STOPPING =>
         state << onCompleted
       case STOPPED =>

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala Wed Jul  7 03:55:07 2010
@@ -259,7 +259,7 @@ class Broker() extends Service with Disp
 
         state = STARTING
 
-        val tracker = new CompletionTracker("broker startup", dispatchQueue)
+        val tracker = new LoggingTracker("broker startup", dispatchQueue)
         for (virtualHost <- virtualHosts.values) {
           virtualHost.start(tracker.task("virtual host: "+virtualHost))
         }
@@ -284,7 +284,7 @@ class Broker() extends Service with Disp
     def stop(onCompleted:Runnable): Unit = ^ {
       if (state == RUNNING) {
         state = STOPPING
-        val tracker = new CompletionTracker("broker shutdown", dispatchQueue)
+        val tracker = new LoggingTracker("broker shutdown", dispatchQueue)
 
         // Stop accepting connections..
         for (server <- transportServers) {
@@ -324,7 +324,7 @@ class Broker() extends Service with Disp
    * Helper method to help stop broker services and log error if they fail to start.
    * @param server
    */
-  private def stopService(service: Service, tracker:CompletionTracker): Unit = {
+  private def stopService(service: Service, tracker:LoggingTracker): Unit = {
     try {
       service.stop(tracker.task(service.toString))
     } catch {

Added: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/LoggingTracker.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/LoggingTracker.scala?rev=961100&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/LoggingTracker.scala (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/LoggingTracker.scala Wed Jul  7 03:55:07 2010
@@ -0,0 +1,51 @@
+/**
+ * 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
+
+import java.util.concurrent.{CountDownLatch, TimeUnit}
+import java.util.HashSet
+import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch.{TaskTracker, DispatchQueue}
+
+/**
+ * <p>
+ * A TaskTracker which logs an informational message if that tasks don't complete
+ * within the timeout.
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class LoggingTracker(name:String, parent:DispatchQueue=getGlobalQueue) extends TaskTracker(name, parent) with Logging {
+
+  timeout = 1000;
+
+  override protected def log = LoggingTracker
+
+  override protected def onTimeout(duration:Long, tasks: List[String]):Long = {
+    info("%s is taking a long time (%d seconds). Waiting on %s", name, (duration/1000), tasks)
+    timeout
+  }
+
+}
+
+object LoggingTracker extends Log {
+  def apply[R](name:String, parent:DispatchQueue=getGlobalQueue)(func: (LoggingTracker)=>Unit ) = {
+    val t = new LoggingTracker(name, parent)
+    func(t)
+    t.await
+  }
+}

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BaseBrokerPerfSupport.scala Wed Jul  7 03:55:07 2010
@@ -441,7 +441,7 @@ abstract class BaseBrokerPerfSupport ext
 
     def stopServices() = {
       stopping.set(true);
-      val tracker = new CompletionTracker("test shutdown")
+      val tracker = new LoggingTracker("test shutdown")
       for (broker <- brokers) {
         broker.stop(tracker.task("broker"));
       }
@@ -456,7 +456,7 @@ abstract class BaseBrokerPerfSupport ext
     }
 
     def startBrokers() = {
-      val tracker = new CompletionTracker("test broker startup")
+      val tracker = new LoggingTracker("test broker startup")
       for (broker <- brokers) {
         broker.start(tracker.task("broker"));
       }
@@ -465,12 +465,12 @@ abstract class BaseBrokerPerfSupport ext
 
 
     def startClients() = {
-      var tracker = new CompletionTracker("test consumer startup")
+      var tracker = new LoggingTracker("test consumer startup")
       for (connection <- consumers) {
         connection.start(tracker.task(connection.toString));
       }
       tracker.await
-      tracker = new CompletionTracker("test producer startup")
+      tracker = new LoggingTracker("test producer startup")
       for (connection <- producers) {
         connection.start(tracker.task(connection.toString));
       }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/resources/org/apache/activemq/apollo/jaxb/jaxb.index Wed Jul  7 03:55:07 2010
@@ -14,6 +14,6 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ------------------------------------------------------------------------
-BrokerXml
-KahaDBStoreXml
-MemoryStoreXml
+BrokerConfig
+KahaDBStoreConfig
+MemoryStoreConfig

Modified: activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/scala/org/apache/activemq/apollo/jaxb/BrokerConfig.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/scala/org/apache/activemq/apollo/jaxb/BrokerConfig.java?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/scala/org/apache/activemq/apollo/jaxb/BrokerConfig.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/scala/org/apache/activemq/apollo/jaxb/BrokerConfig.java Wed Jul  7 03:55:07 2010
@@ -29,9 +29,15 @@ import javax.xml.bind.annotation.XmlRoot
 @XmlAccessorType(XmlAccessType.FIELD)
 public class BrokerConfig {
 	
-	@XmlAttribute(name="name")
-	public String name;
-	
+	@XmlAttribute(name="id")
+	public String id;
+
+    /**
+     * Used to track config revisions.
+     */
+    @XmlAttribute(name="rev")
+    public int rev;
+
     @XmlElement(name="virtual-host")
     public List<VirtualHostConfig> virtualHosts = new ArrayList<VirtualHostConfig>();
     @XmlElement(name="transport-server")
@@ -62,11 +68,11 @@ public class BrokerConfig {
 		this.connectUris = connectUris;
 	}
 
-    public String getName() {
-        return name;
+    public String getId() {
+        return id;
     }
 
-    public void setName(String name) {
-        this.name = name;
+    public void setId(String id) {
+        this.id = id;
     }
 }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-selector/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,16 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
-#log4j.appender.console.layout.ConversionPattern=%-5p %-80m | %c%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-store/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java Wed Jul  7 03:55:07 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.transport.tcp;
 
-import org.apache.activemq.apollo.BaseService;
+import org.apache.activemq.apollo.util.BaseService;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportListener;
 import org.apache.activemq.wireformat.WireFormat;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-tcp/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-transport/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Copied: activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/util/BaseService.java (from r961099, activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/BaseService.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/util/BaseService.java?p2=activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/util/BaseService.java&p1=activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/BaseService.java&r1=961099&r2=961100&rev=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/BaseService.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/java/org/apache/activemq/apollo/util/BaseService.java Wed Jul  7 03:55:07 2010
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activemq.apollo;
+package org.apache.activemq.apollo.util;
 
 import org.apache.activemq.Service;
 import org.fusesource.hawtdispatch.DispatchQueue;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala Wed Jul  7 03:55:07 2010
@@ -27,6 +27,8 @@ import org.apache.activemq.apollo.broker
  */
 object BrokerRegistry {
 
+  var configStore:ConfigStore = _
+
   private val _brokers = new HashMap[String, Broker]()
 
   def get(id:String) = _brokers.synchronized {

Added: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala?rev=961100&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala Wed Jul  7 03:55:07 2010
@@ -0,0 +1,241 @@
+/**
+ * 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
+
+import broker._
+import jaxb.{VirtualHostConfig, PropertiesReader, BrokerConfig}
+import java.util.regex.Pattern
+import javax.xml.stream.{XMLOutputFactory, XMLInputFactory}
+import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.apache.activemq.util.{Hasher, IOHelper}
+import java.util.concurrent.{TimeUnit, ExecutorService, Executors}
+import org.fusesource.hawtbuf.{ByteArrayInputStream, ByteArrayOutputStream}
+import org.apache.activemq.Service
+import javax.xml.bind.{Marshaller, JAXBContext}
+import java.io.{OutputStreamWriter, File}
+
+/**
+ * <p>
+ * Defines an interface to access and update persistent broker configurations.
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+trait ConfigStore extends Service {
+
+  def listBrokerConfigs(cb: (List[String]) => Unit):Unit
+
+  def getBrokerConfig(id:String, cb: (Option[BrokerConfig]) => Unit):Unit
+
+  def putBrokerConfig(config:BrokerConfig, cb: (Boolean) => Unit):Unit
+
+  def removeBrokerConfig(id:String, rev:Int, cb: (Boolean) => Unit):Unit
+
+}
+
+/**
+ * <p>
+ * A simple ConfigStore implementation which only support one broker configuration
+ * stored in an XML file.
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class FileConfigStore extends ConfigStore with BaseService with Logging {
+  override protected def log: Log = FileConfigStore
+
+  object StoredBrokerConfig {
+    def apply(rev:Int, config:BrokerConfig) = {
+      val data = marshall(config)
+      new StoredBrokerConfig(config.id, rev, data, Hasher.JENKINS.hash(data, data.length))
+    }
+  }
+  case class StoredBrokerConfig(id:String, rev:Int, data:Array[Byte], hash:Int)
+
+  val context = JAXBContext.newInstance("org.apache.activemq.apollo.jaxb")
+  val unmarshaller = context.createUnmarshaller
+  val marshaller = context.createMarshaller
+  marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, java.lang.Boolean.TRUE )
+  val inputfactory = XMLInputFactory.newInstance
+
+  var file:File = new File("activemq.xml")
+  var latest:StoredBrokerConfig = null
+  var readOnly = false
+
+  val dispatchQueue = createQueue("config store")
+
+  // can't do blocking IO work on the dispatchQueue :(
+  // so... use an executor
+  var ioWorker:ExecutorService = null
+
+  protected def _start(onCompleted:Runnable) = {
+    ioWorker = Executors.newSingleThreadExecutor
+    ioWorker.execute(^{
+      startup(onCompleted)
+    })
+  }
+
+
+  def startup(onCompleted:Runnable) = {
+
+      file = file.getCanonicalFile;
+      file.getParentFile.mkdir
+      // Find the latest rev
+      val files = file.getParentFile.listFiles
+      val regex = (Pattern.quote(file.getName+".")+"""(\d)$""").r
+      var revs:List[Int] = Nil
+      if( files!=null ) {
+        for( file <- files) {
+          file.getName match {
+            case regex(ver)=>
+              revs ::= Integer.parseInt(ver)
+            case _ =>
+          }
+        }
+      }
+      revs = revs.sortWith((x,y)=> x < y)
+
+      val last = revs.lastOption.map{ rev=>
+        read(rev, fileRev(rev))
+      } match {
+        case None =>
+          if( !file.exists ) {
+            if( readOnly ) {
+              throw new Exception("file does not exsit: "+file)
+            } else {
+              write(StoredBrokerConfig(1, defaultConfig))
+            }
+          } else {
+            if( readOnly ) {
+              read(1, file)
+            } else {
+              write(read(1, file))
+            }
+          }
+        case Some(x)=> x
+      }
+
+      dispatchQueue {
+        latest = last
+        schedualNextUpdateCheck
+        onCompleted.run
+      }
+  }
+  protected def _stop(onCompleted:Runnable) = {
+    ioWorker.submit(^{
+      onCompleted.run
+    })
+    ioWorker.shutdown
+  }
+
+  def listBrokerConfigs(cb: (List[String]) => Unit) = callback(cb) {
+    List(latest.id)
+  } >>: dispatchQueue
+
+  def getBrokerConfig(id:String, cb: (Option[BrokerConfig]) => Unit) = callback(cb) {
+    if( latest.id == id ) {
+      Some(unmarshall(latest.data))
+    } else {
+      None
+    }
+  } >>: dispatchQueue
+
+  def putBrokerConfig(config:BrokerConfig, cb: (Boolean) => Unit) = callback(cb) {
+    if( latest.id == config.id && latest.rev==config.rev) {
+      config.rev += 1
+      latest = write(StoredBrokerConfig(config.rev, config))
+      true
+    } else {
+      false
+    }
+  } >>: dispatchQueue
+
+  def removeBrokerConfig(id:String, rev:Int, cb: (Boolean) => Unit) = callback(cb) {
+    // not supported.
+    false
+  } >>: dispatchQueue
+
+  private def fileRev(rev:Int) = new File(file.getParent, file.getName+"."+rev)
+
+  private def schedualNextUpdateCheck:Unit = dispatchQueue.after(1, TimeUnit.SECONDS) {
+    if( serviceState.isStarted ) {
+      ioWorker {
+        try {
+          val config = read(0, file)
+          dispatchQueue {
+            if (latest.hash != config.hash) {
+              // looks like user has manually edited the file
+              // on the file system.. treat that like an update.. so we
+              // store the change as a revision.
+
+            }
+            schedualNextUpdateCheck
+          }
+        }
+        catch {
+          case e:Exception =>
+            // error reading the file..
+            // TODO: updated it to the latest valid version.
+          schedualNextUpdateCheck
+        }
+      }
+    }
+  }
+
+
+
+  private def defaultConfig() = {
+    val host = new VirtualHostConfig
+    host.hostNames.add("default")
+
+    val config = new BrokerConfig
+    config.id = "default"
+    config.transportServers.add("tcp://0.0.0.0:61613?wireFormat=multi")
+    config.connectUris.add("tcp://localhost:61613")
+    config.virtualHosts.add(host)
+    config
+  }
+
+  private def read(rev:Int, file: File): StoredBrokerConfig = {
+    val data = IOHelper.readBytes(file)
+    val config = unmarshall(data) // validates the xml
+    val hash = Hasher.JENKINS.hash(data, data.length)
+    StoredBrokerConfig(config.id, rev, data, hash)
+  }
+
+  private  def write(config:StoredBrokerConfig) = {
+    // write to the files..
+    IOHelper.writeBinaryFile(file, config.data)
+    IOHelper.writeBinaryFile(fileRev(config.rev), config.data)
+    config
+  }
+
+  def unmarshall(in:Array[Byte]) = {
+    val bais = new ByteArrayInputStream(in);
+    val reader = inputfactory.createXMLStreamReader(bais)
+    val properties = new PropertiesReader(reader)
+    unmarshaller.unmarshal(properties).asInstanceOf[BrokerConfig]
+  }
+
+  def marshall(in:BrokerConfig) = {
+    val baos = new ByteArrayOutputStream
+    marshaller.marshal(in, new OutputStreamWriter(baos));
+    baos.toByteArray
+  }
+}
+
+object FileConfigStore extends Log
\ No newline at end of file

Modified: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala Wed Jul  7 03:55:07 2010
@@ -18,11 +18,12 @@ package org.apache.activemq.apollo.web
 
 import com.google.inject.servlet.GuiceServletContextListener
 import org.fusesource.scalate.guice.ScalateModule
-import com.google.inject.Guice
 import javax.servlet.ServletContextEvent
 import org.apache.activemq.transport.TransportFactory
-import org.apache.activemq.apollo.BrokerRegistry
-import org.apache.activemq.apollo.broker.{CompletionTracker, Broker}
+import org.apache.activemq.apollo.broker.{LoggingTracker, Broker}
+import org.apache.activemq.apollo.{FileConfigStore, ConfigStore, BrokerRegistry}
+import java.io.File
+import com.google.inject.{Inject, Provides, Guice, Singleton}
 
 /**
  * A servlet context listener which registers
@@ -36,12 +37,17 @@ class ServletContextListener extends Gui
 
   override def contextInitialized(servletContextEvent: ServletContextEvent) = {
 
+
     // todo: replace this with info accessed from a configuration store.
     // register/start brokers we are managing.
     try {
+      BrokerRegistry.configStore = createConfigStore
+
       broker = createBroker();
       BrokerRegistry.add(broker);
-      broker.start
+      LoggingTracker("broker startup") { tracker=>
+        broker.start(tracker.task())
+      }
     }
     catch {
       case e:Exception =>
@@ -52,32 +58,24 @@ class ServletContextListener extends Gui
     super.contextInitialized(servletContextEvent);
   }
 
-  def createBroker(): Broker = {
-    val broker = new Broker()
-    broker.name = "default"
-    broker.transportServers.add(TransportFactory.bind("tcp://localhost:10000?wireFormat=multi"))
-    broker.connectUris.add("tcp://localhost:10000")
-    broker
-  }
-
   override def contextDestroyed(servletContextEvent: ServletContextEvent) = {
     super.contextDestroyed(servletContextEvent);
 
     // un-register/stop brokers we are managing.
     if( broker!=null ) {
-      val tracker = new CompletionTracker("broker shutdown")
       BrokerRegistry.remove(broker.name);
-      broker.stop(tracker.task(broker.name))
-      tracker.await()
+      LoggingTracker("broker shutdown") { tracker =>
+        broker.stop(tracker.task(broker.name))
+        BrokerRegistry.configStore.stop(tracker.task("config store"))
+      }
     }
   }
 
   def getInjector = Guice.createInjector(new ScalateModule() {
 
-    // TODO add some custom provider methods here
-    // which can then be injected into resources or templates
-    //
-    // @Provides def createSomething = new MyThing()
+    @Singleton
+    @Provides
+    def provideConfigStore:ConfigStore = createConfigStore
 
     // lets add any package names which contain JAXRS resources
     // https://jersey.dev.java.net/issues/show_bug.cgi?id=485
@@ -87,5 +85,23 @@ class ServletContextListener extends Gui
       super.resourcePackageNames
   })
 
+  def createConfigStore():ConfigStore = {
+    println("created store")
+    val store = new FileConfigStore
+    store.file = new File("activemq.xml")
+    LoggingTracker("config store startup") { tracker=>
+      println("starting store")
+      store.start(tracker.task())
+    }
+    println("store started")
+    store
+  }
 
+  def createBroker(): Broker = {
+    val broker = new Broker()
+    broker.name = "default"
+    broker.transportServers.add(TransportFactory.bind("tcp://localhost:10000?wireFormat=multi"))
+    broker.connectUris.add("tcp://localhost:10000")
+    broker
+  }
 }
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala?rev=961100&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala Wed Jul  7 03:55:07 2010
@@ -0,0 +1,68 @@
+/**
+ * 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.web.resources;
+
+import java.lang.String
+import javax.ws.rs._
+import reflect.{BeanProperty}
+/**
+ * <p>
+ * The BrokerStatus is the root container of the runtime status of a broker.
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+case class BrokerStatus(parent:Broker, @BeanProperty id:String) extends Resource {
+  @GET
+  def get() = this
+
+  @Path("virtual-hosts")
+  def virtualHosts :Array[VirtualHostStatus] = null
+  @Path("virtual-hosts/{id}")
+  def virtualHost(@PathParam("id") id : String):VirtualHostStatus = null
+
+  @Path("connectors")
+  def connectors :Array[ConnectorStatus] = null
+  @Path("connectors/{id}")
+  def connector(@PathParam("id") id : String):ConnectorStatus = null
+
+  @Path("connections")
+  def connections :Array[ConnectionStatus] = null
+  @Path("connections/{id}")
+  def connection(@PathParam("id") id : String):ConnectionStatus = null
+}
+
+case class VirtualHostStatus(parent:BrokerStatus, @BeanProperty id: String) extends Resource {
+  var state:String = null
+  @GET
+  def get() = this
+}
+
+case class ConnectorStatus(parent:BrokerStatus, @BeanProperty id: String) extends Resource {
+  var state:String = "unknown";
+  var accepted:Long = 0;
+  @GET
+  def get() = this
+}
+
+case class ConnectionStatus(parent:BrokerStatus, @BeanProperty id:String) extends Resource {
+  var state:String = "unknown";
+  var readCounter:Long = 0;
+  var writeCounter:Long = 0;
+  @GET
+  def get() = this
+}

Modified: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala Wed Jul  7 03:55:07 2010
@@ -17,15 +17,18 @@
 package org.apache.activemq.apollo.web.resources
 
 import java.lang.String
-import org.fusesource.scalate.rest.{Container, ContainerResource}
 import com.sun.jersey.api.NotFoundException
 import javax.ws.rs._
-import core.MediaType
+import core.{Response, Context}
 import org.fusesource.scalate.util.Logging
-import reflect.{BeanProperty, BeanInfo}
-import org.codehaus.jackson.annotate.JsonProperty
+import reflect.{BeanProperty}
 import com.sun.jersey.api.view.ImplicitProduces
 import org.apache.activemq.apollo.jaxb.BrokerConfig
+import com.google.inject.servlet.RequestScoped
+import org.apache.activemq.apollo.{BrokerRegistry, ConfigStore}
+import org.fusesource.hawtdispatch.Future
+import Response._
+import Response.Status._
 
 /**
  * Defines the default representations to be used on resources
@@ -33,83 +36,93 @@ import org.apache.activemq.apollo.jaxb.B
 @ImplicitProduces(Array("text/html;qs=5"))
 @Produces(Array("application/json", "application/xml","text/xml"))
 trait Resource extends Logging {
+
+  def result[T](value:Status, message:Any=null):T = {
+    val response = status(value);
+    if( message!=null ) {
+      response.entity(message)
+    }
+    throw new WebApplicationException(response.build)
+  }
+
 }
 
+/**
+ * Manages a collection of broeker resources.
+ */
 @Path("/")
 class Root() extends Resource {
 
+  @Context
+  var configStore:ConfigStore = BrokerRegistry.configStore;
+
   @GET
   def get() = this
 
-  @BeanProperty
-  var brokers: Array[Broker] = Array(
-    new Broker(this, "default"),
-    new Broker(this, "example")
-  )
+  case class BrokerRef(@BeanProperty id:String, @BeanProperty href:String)
 
-  @Path("{id}")
-  def broker(@PathParam("id") id : String): Broker = {
-    if( id == "default" || id=="example" ) {
-      new Broker(this, id)
-    } else {
-      throw new NotFoundException("Broker " + id + " not found")
-    }
+  def getBrokers: Array[BrokerRef] = {
+    Future[List[String]] { cb=>
+      configStore.listBrokerConfigs(cb)
+    }.map(x=> new BrokerRef(x, x)).toArray[BrokerRef]
   }
+
+  @Path("{id}")
+  def broker(@PathParam("id") id : String): Broker = new Broker(this, id)
 }
 
-case class Broker(parent:Root, @BeanProperty @BeanProperty id: String) extends Resource {
+/**
+ * A broker resource is used to represent the configuration and runtime status of a broker.
+ */
+case class Broker(parent:Root, @BeanProperty id: String) extends Resource {
+
+  @Context
+  var configStore:ConfigStore = BrokerRegistry.configStore;
+
+  case class BrokerSummary(@BeanProperty id:String, @BeanProperty config_rev:Int, @BeanProperty config_href:String, @BeanProperty status_href:String)
+
   @GET
-  def get():AnyRef = {
-    if( id == "default") {
-      val config = new BrokerConfig();
-      config.setName(id);
-      return config
-    } else {
-      return null;
-    }
+  def get() = {
+    val c = config()
+    new BrokerSummary(id, c.rev, "config/"+c.rev, "status")
   }
 
-  @Path("status")
-  def status = BrokerStatus(this, id)
-}
+  @GET @Path("config")
+  def getConfig():BrokerConfig = {
+    config()
+  }
 
-case class BrokerStatus(parent:Broker, @BeanProperty id:String) extends Resource {
-  @GET
-  def get() = this
+  private def config() = {
+    Future[Option[BrokerConfig]] { cb=>
+      configStore.getBrokerConfig(id, cb)
+    }.getOrElse(result(NOT_FOUND))
+  }
 
-  @Path("virtual-hosts")
-  def virtualHosts :Array[VirtualHostStatus] = null
-  @Path("virtual-hosts/{id}")
-  def virtualHost(@PathParam("id") id : String):VirtualHostStatus = null
-
-  @Path("connectors")
-  def connectors :Array[ConnectorStatus] = null
-  @Path("connectors/{id}")
-  def connector(@PathParam("id") id : String):ConnectorStatus = null
-
-  @Path("connections")
-  def connections :Array[ConnectionStatus] = null
-  @Path("connections/{id}")
-  def connection(@PathParam("id") id : String):ConnectionStatus = null
-}
+  @GET @Path("config/{rev}")
+  def getConfig(@PathParam("rev") rev:Int):BrokerConfig = {
+    // that rev may have gone away..
+    var c = config()
+    c.rev==rev || result(NOT_FOUND)
+    c
+  }
 
-case class VirtualHostStatus(parent:BrokerStatus, @BeanProperty id: String) extends Resource {
-  var state:String = null
-  @GET
-  def get() = this
-}
+  @PUT @Path("config/{rev}")
+  def put(@PathParam("rev") rev:Int, config:BrokerConfig) = {
+    config.id = id;
+    config.rev = rev
+    Future[Boolean] { cb=>
+      configStore.putBrokerConfig(config, cb)
+    } || result(NOT_FOUND)
+  }
 
-case class ConnectorStatus(parent:BrokerStatus, @BeanProperty id: String) extends Resource {
-  var state:String = "unknown";
-  var accepted:Long = 0;
-  @GET
-  def get() = this
-}
+  @DELETE @Path("config/{rev}")
+  def delete(@PathParam("rev") rev:Int) = {
+    Future[Boolean] { cb=>
+      configStore.removeBrokerConfig(id, rev, cb)
+    } || result(NOT_FOUND)
+  }
 
-case class ConnectionStatus(parent:BrokerStatus, @BeanProperty id:String) extends Resource {
-  var state:String = "unknown";
-  var readCounter:Long = 0;
-  var writeCounter:Long = 0;
-  @GET
-  def get() = this
+  @Path("status")
+  def status = BrokerStatus(this, id)
 }
+

Copied: activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala (from r961099, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala&r1=961099&r2=961100&rev=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala Wed Jul  7 03:55:07 2010
@@ -16,8 +16,11 @@
  */
 package org.apache.activemq.apollo
 
-import java.util.HashMap
-import org.apache.activemq.apollo.broker.Broker
+import broker.LoggingTracker
+import java.io.File
+import java.util.concurrent.{TimeUnit, CountDownLatch}
+import org.fusesource.hawtdispatch.Future
+import org.fusesource.scalate.test.FunSuiteSupport
 
 /**
  * <p>
@@ -25,19 +28,26 @@ import org.apache.activemq.apollo.broker
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-object BrokerRegistry {
+class FileConfigStoreTest extends FunSuiteSupport {
+  test("file config store") {
 
-  private val _brokers = new HashMap[String, Broker]()
-
-  def get(id:String) = _brokers.synchronized {
-    _brokers.get(id)
-  }
-
-  def add(broker:Broker) = _brokers.synchronized {
-    _brokers.put(broker.name, broker)
+    val store = new FileConfigStore
+    store.file = new File("activemq.xml")
+    store
+
+    LoggingTracker("config store startup") { tracker=>
+      store.start(tracker.task())
+    }
+
+    expect(List("default")) {
+      Future[List[String]]{ x=>
+        store.listBrokerConfigs(x)
+      }
+    }
+
+    LoggingTracker("config store stop") { tracker=>
+      store.stop(tracker.task())
+    }
   }
+}
 
-  def remove(id:String) = _brokers.synchronized {
-    _brokers.remove(id)
-  }
-}
\ No newline at end of file

Modified: activemq/sandbox/activemq-apollo-actor/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/pom.xml?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/pom.xml (original)
+++ activemq/sandbox/activemq-apollo-actor/pom.xml Wed Jul  7 03:55:07 2010
@@ -95,7 +95,7 @@
     
     <jetty-version>6.1.22</jetty-version>
     <jetty-plugin-version>7.0.1.v20091125</jetty-plugin-version>
-    <scalate-version>1.1-SNAPSHOT</scalate-version>
+    <scalate-version>1.1</scalate-version>
     <servlet-api-version>2.5</servlet-api-version>
     <jackson-version>1.5.2</jackson-version>
     

Modified: activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/sandbox/activemq-all/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/sandbox/activemq-client/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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

Modified: activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/ide-resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/ide-resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/ide-resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/ide-resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -1,4 +1,4 @@
-## ------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
 ## 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.
@@ -13,15 +13,23 @@
 ## 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 for ide testing, We want to see 
-# info level output in the console.
+# The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console
-log4j.logger.org.apache.activemq=INFO
+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 %m%n
\ No newline at end of file
+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

Modified: activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/resources/log4j.properties?rev=961100&r1=961099&r2=961100&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/resources/log4j.properties (original)
+++ activemq/sandbox/activemq-apollo-actor/sandbox/activemq-dispatcher/src/test/resources/log4j.properties Wed Jul  7 03:55:07 2010
@@ -19,13 +19,13 @@
 # The logging properties used during tests..
 #
 log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO 
+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=%d | %-5p | %m%n
-log4j.appender.console.threshold=WARN
+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