activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1103752 - in /activemq/activemq-apollo/trunk: ./ apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ apollo-dto/src/main/resources/org/apache/activemq/apollo/dto/ apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ apo...
Date Mon, 16 May 2011 14:35:06 GMT
Author: chirino
Date: Mon May 16 14:35:05 2011
New Revision: 1103752

URL: http://svn.apache.org/viewvc?rev=1103752&view=rev
Log:
Working on simplifying and documenting the broker's REST interface.

Added:
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
      - copied, changed from r1102632, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
      - copied, changed from r1102632, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
    activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md
Removed:
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummaryDTO.java
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/BrokerSummaryDTO.jade
Modified:
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java
    activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/BrokerStatusDTO.jade
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/ConnectorStatusDTO.jade
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.jade
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java
Mon May 16 14:35:05 2011
@@ -31,6 +31,12 @@ import java.util.List;
 public class BrokerStatusDTO extends ServiceStatusDTO {
 
     /**
+     * Version of the broker
+     */
+	@XmlAttribute
+	public String version;
+
+    /**
      * The current time on the broker machine.  In milliseconds since the epoch.
      */
 	@XmlAttribute(name="current_time")
@@ -54,12 +60,4 @@ public class BrokerStatusDTO extends Ser
     @XmlElement(name="connection")
     public List<LongIdLabeledDTO> connections = new ArrayList<LongIdLabeledDTO>();
 
-    /**
-     * The current running configuration of the object
-     */
-    @XmlElement
-    public BrokerDTO config = null;
-
-    @XmlElement
-    public AggregateQueueMetricsDTO aggregate_queue_metrics = new AggregateQueueMetricsDTO();
 }

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java
Mon May 16 14:35:05 2011
@@ -44,10 +44,4 @@ public class ConnectorStatusDTO extends 
     @XmlElement(name="connection")
     public List<LongIdLabeledDTO> connections = new ArrayList<LongIdLabeledDTO>();
 
-    /**
-     * The current running configuration of the object
-     */
-    @XmlElement
-    public ConnectorDTO config = null;
-
 }

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java
Mon May 16 14:35:05 2011
@@ -33,12 +33,6 @@ import java.util.List;
 public class VirtualHostStatusDTO extends ServiceStatusDTO {
 
     /**
-     * The status of the store
-     */
-    @XmlElementRef
-    public StoreStatusDTO store;
-
-    /**
      * Ids of all the topics running on the broker
      */
     @XmlElement(name="topics")
@@ -50,14 +44,10 @@ public class VirtualHostStatusDTO extend
     @XmlElement(name="queues")
     public List<LongIdLabeledDTO> queues = new ArrayList<LongIdLabeledDTO>();
 
-
     /**
-     * The current running configuration of the object
+     * Is the virtual host using a store.
      */
-    @XmlElement
-    public VirtualHostDTO config = null;
-
-    @XmlElement
-    public AggregateQueueMetricsDTO aggregate_queue_metrics = new AggregateQueueMetricsDTO();
+    @XmlElement(name="store")
+    public boolean store;
 
 }

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index
Mon May 16 14:35:05 2011
@@ -16,7 +16,6 @@
 # ------------------------------------------------------------------------
 BrokerDTO
 BrokerStatusDTO
-BrokerSummaryDTO
 ConnectionStatusDTO
 ConnectorDTO
 ConnectorStatusDTO

Copied: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
(from r1102632, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala?p2=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala&r1=1102632&r2=1103752&rev=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
Mon May 16 14:35:05 2011
@@ -16,19 +16,16 @@
  */
 package org.apache.activemq.apollo.web.resources;
 
-import javax.ws.rs.Path
 import javax.ws.rs._
 import core.Response
 import Response.Status._
-import java.util.List
 import org.apache.activemq.apollo.dto._
 import java.{lang => jl}
 import org.fusesource.hawtdispatch._
 import org.apache.activemq.apollo.broker._
-import collection.mutable.ListBuffer
 import scala.util.continuations._
-import java.util.concurrent.{ConcurrentLinkedQueue, CountDownLatch}
-import scala.collection.{Iterable, JavaConversions}
+import scala.collection.Iterable
+import javax.xml.soap.SOAPMessage
 
 /**
  * <p>
@@ -38,53 +35,17 @@ import scala.collection.{Iterable, JavaC
  *
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
+@Path("/")
 @Produces(Array("application/json", "application/xml","text/xml", "text/html;qs=5"))
-case class RuntimeResource(parent:BrokerResource) extends Resource(parent) {
+case class BrokerResource() extends Resource() {
 
-  @POST
-  @Path("action/shutdown")
-  def command_shutdown:Unit = {
-    info("JVM shutdown requested via web interface")
-
-    // do the the exit async so that we don't
-    // kill the current request.
-    Broker.BLOCKABLE_THREAD_POOL {
-      Thread.sleep(200);
-      System.exit(0)
-    }
-  }
-
-  def concurrent_map[T,R](values:Iterable[T])(dqf:(T)=>DispatchQueue)(func:T=>R) =
{
-    Future.all( values.map { t=>
-      dqf(t).future { func(t) }
-    })
-  }
-
-  private def with_broker[T](func: (org.apache.activemq.apollo.broker.Broker, Option[T]=>Unit)=>Unit):T
= {
-    BrokerRegistry.list.headOption match {
-      case None=> result(NOT_FOUND)
-      case Some(broker)=>
-        val f = Future[Option[T]]()
-        broker.dispatch_queue {
-          func(broker, f)
-        }
-        f().getOrElse(result(NOT_FOUND))
-    }
-  }
-
-  private def with_virtual_host[T](id:String)(func: (VirtualHost, Option[T]=>Unit)=>Unit):T
= {
+  @Path("config")
+  def config_resource:ConfigurationResource = {
     with_broker { case (broker, cb) =>
-      broker.virtual_hosts.valuesIterator.find( _.id == id) match {
-        case Some(virtualHost)=>
-          virtualHost.dispatch_queue {
-            func(virtualHost, cb)
-          }
-        case None=> cb(None)
-      }
+      cb(Some(ConfigurationResource(this, broker.config)))
     }
   }
 
-
   @GET
   def get_broker():BrokerStatusDTO = {
     with_broker { case (broker, cb) =>
@@ -94,7 +55,6 @@ case class RuntimeResource(parent:Broker
       result.current_time = System.currentTimeMillis
       result.state = broker.service_state.toString
       result.state_since = broker.service_state.since
-      result.config = broker.config
 
       broker.virtual_hosts.values.foreach{ host=>
         // TODO: may need to sync /w virtual host's dispatch queue
@@ -111,15 +71,20 @@ case class RuntimeResource(parent:Broker
           result.connections.add( new LongIdLabeledDTO(id, connection.transport.getRemoteAddress
) )
         }
       }
+      cb(Some(result))
+    }
+  }
 
+  @GET
+  @Path("queue-metrics")
+  def get_queue_metrics(): AggregateQueueMetricsDTO = {
+    with_broker { case (broker, cb) =>
       get_queue_metrics(broker).onComplete{ metrics=>
-        result.aggregate_queue_metrics = metrics
-        cb(Some(result))
+        cb(Some(metrics))
       }
     }
   }
 
-
   @GET @Path("virtual-hosts")
   def virtualHosts = {
     val rc = new StringListDTO
@@ -186,46 +151,46 @@ case class RuntimeResource(parent:Broker
 
 
   @GET @Path("virtual-hosts/{id}")
-  def virtualHost(@PathParam("id") id : String):VirtualHostStatusDTO = {
-    with_virtual_host(id) { case (virtualHost,cb) =>
+  def virtual_host(@PathParam("id") id : String):VirtualHostStatusDTO = {
+    with_virtual_host(id) { case (virtual_host,cb) =>
       val result = new VirtualHostStatusDTO
-      result.id = virtualHost.id
-      result.state = virtualHost.service_state.toString
-      result.state_since = virtualHost.service_state.since
-      result.config = virtualHost.config
+      result.id = virtual_host.id
+      result.state = virtual_host.service_state.toString
+      result.state_since = virtual_host.service_state.since
+      result.store = virtual_host.store!=null
 
-      virtualHost.router.asInstanceOf[LocalRouter].topic_domain.destinations.foreach { node=>
+      virtual_host.router.asInstanceOf[LocalRouter].topic_domain.destinations.foreach { node=>
         result.topics.add(new LongIdLabeledDTO(node.id, node.name))
       }
 
-      virtualHost.router.asInstanceOf[LocalRouter].queue_domain.destinations.foreach { node=>
+      virtual_host.router.asInstanceOf[LocalRouter].queue_domain.destinations.foreach { node=>
         result.queues.add(new LongIdLabeledDTO(node.id, node.binding.label))
       }
 
-      get_queue_metrics(virtualHost).onComplete { metrics=>
-
-        result.aggregate_queue_metrics = metrics
+      cb(Some(result))
+    }
+  }
 
-        if( virtualHost.store != null ) {
-          virtualHost.store.get_store_status { x=>
-            result.store = x
-            cb(Some(result))
-          }
-        } else {
-          cb(Some(result))
-        }
+  @GET @Path("virtual-hosts/{id}/queue-metrics")
+  def virtual_host_queue_metrics(@PathParam("id") id : String): AggregateQueueMetricsDTO
= {
+    with_virtual_host(id) { case (virtualHost,cb) =>
+      get_queue_metrics(virtualHost).onComplete { metrics=>
+        cb(Some(metrics))
       }
-
     }
   }
 
   @GET @Path("virtual-hosts/{id}/store")
   def store(@PathParam("id") id : String):StoreStatusDTO = {
-    val rc =  virtualHost(id).store
-    if( rc == null ) {
-      result(NOT_FOUND)
+    with_virtual_host(id) { case (virtualHost,cb) =>
+      if(virtualHost.store!=null) {
+        virtualHost.store.get_store_status { status =>
+          cb(Some(status))
+        }
+      } else {
+        cb(None)
+      }
     }
-    rc
   }
 
   def link(connection:BrokerConnection) = {
@@ -288,7 +253,6 @@ case class RuntimeResource(parent:Broker
   @GET @Path("virtual-hosts/{id}/queues/{queue}")
   def destination_queue(@PathParam("id") id : String, @PathParam("queue") qid : Long, @QueryParam("entries")
entries:Boolean ):QueueStatusDTO = {
     with_virtual_host(id) { case (virtualHost,cb) =>
-      import JavaConversions._
       val queue = virtualHost.router.asInstanceOf[LocalRouter].queue_domain.destination_by_id.get(qid)
       status(queue, entries, cb)
     }
@@ -410,7 +374,6 @@ case class RuntimeResource(parent:Broker
           result.id = connector.id.toString
           result.state = connector.service_state.toString
           result.state_since = connector.service_state.since
-          result.config = connector.config
 
           result.accepted = connector.connection_counter.get
           connector.connections.foreach { case (id,connection) =>
@@ -475,4 +438,46 @@ case class RuntimeResource(parent:Broker
     result(strip_resolve("../../.."))
   }
 
+  @POST
+  @Path("action/shutdown")
+  def command_shutdown:Unit = {
+    info("JVM shutdown requested via web interface")
+
+    // do the the exit async so that we don't
+    // kill the current request.
+    Broker.BLOCKABLE_THREAD_POOL {
+      Thread.sleep(200);
+      System.exit(0)
+    }
+  }
+
+  def concurrent_map[T,R](values:Iterable[T])(dqf:(T)=>DispatchQueue)(func:T=>R) =
{
+    Future.all( values.map { t=>
+      dqf(t).future { func(t) }
+    })
+  }
+
+  private def with_broker[T](func: (org.apache.activemq.apollo.broker.Broker, Option[T]=>Unit)=>Unit):T
= {
+    BrokerRegistry.list.headOption match {
+      case None=> result(NOT_FOUND)
+      case Some(broker)=>
+        val f = Future[Option[T]]()
+        broker.dispatch_queue {
+          func(broker, f)
+        }
+        f().getOrElse(result(NOT_FOUND))
+    }
+  }
+
+  private def with_virtual_host[T](id:String)(func: (VirtualHost, Option[T]=>Unit)=>Unit):T
= {
+    with_broker { case (broker, cb) =>
+      broker.virtual_hosts.valuesIterator.find( _.id == id) match {
+        case Some(virtualHost)=>
+          virtualHost.dispatch_queue {
+            func(virtualHost, cb)
+          }
+        case None=> cb(None)
+      }
+    }
+  }
 }

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
Mon May 16 14:35:05 2011
@@ -17,14 +17,11 @@
 package org.apache.activemq.apollo.web.resources
 
 import javax.ws.rs._
-import core.{UriInfo, Response, Context}
-import org.fusesource.hawtdispatch._
+import core.Response
 import Response.Status._
-import Response._
-import java.net.URI
-import java.io.ByteArrayInputStream
 import org.apache.activemq.apollo.broker.ConfigStore
-import org.apache.activemq.apollo.dto.{ValueDTO, XmlCodec, BrokerDTO}
+import org.apache.activemq.apollo.dto.{XmlCodec, BrokerDTO, ValueDTO}
+import org.fusesource.hawtbuf._
 
 case class EditConfig(config:String)
 
@@ -32,7 +29,7 @@ case class EditConfig(config:String)
  * A broker resource is used to represent the configuration of a broker.
  */
 @Produces(Array("application/json", "application/xml","text/xml", "text/html;qs=5"))
-case class ConfigurationResource(parent:BrokerResource) extends Resource(parent) {
+case class ConfigurationResource(parent:BrokerResource, dto:BrokerDTO) extends Resource(parent)
{
 
   lazy val store = {
     val rc = ConfigStore()
@@ -46,6 +43,25 @@ case class ConfigurationResource(parent:
   @GET
   def get() = store.load(false)
 
+  @GET
+  @Path("runtime")
+  def runtime = {
+
+    // Encode/Decode the runtime config so that we can get a copy that
+    // we can modify..
+    val baos = new ByteArrayOutputStream
+    XmlCodec.encode(dto, baos, false)
+    val copy = XmlCodec.decode(classOf[BrokerDTO], new ByteArrayInputStream(baos.toBuffer))
+
+    // Scrub out the passwords to avoid a security leak.
+    if( copy.key_storage !=null ) {
+      copy.key_storage.password = null
+      copy.key_storage.key_password = null
+    }
+
+    copy
+  }
+
   @Produces(Array("text/html"))
   @GET
   @Path("edit")

Copied: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
(from r1102632, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala?p2=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala&r1=1102632&r2=1103752&rev=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
Mon May 16 14:35:05 2011
@@ -142,33 +142,3 @@ class ViewHelper {
   }
 }
 
-/**
- * Manages a collection of broker resources.
- */
-@Path("/")
-@Produces(Array("application/json", "application/xml","text/xml", "text/html;qs=5"))
-class BrokerResource extends Resource {
-
-  @GET
-  def get = {
-    val rc = new BrokerSummaryDTO
-    rc.manageable = BrokerRegistry.list.size > 0
-    
-    val cs = ConfigStore()
-    if( cs!=null ) {
-      val config = cs.load(false)
-      rc.configurable = cs.can_write
-    }
-    
-    rc
-  }
-
-  @Path("config")
-  def config_resource = ConfigurationResource(this)
-
-  @Path("runtime")
-  def runtime = RuntimeResource(this)
-}
-
-
-

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/BrokerStatusDTO.jade
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/BrokerStatusDTO.jade?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/BrokerStatusDTO.jade
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/BrokerStatusDTO.jade
Mon May 16 14:35:05 2011
@@ -17,10 +17,6 @@
 - val helper = new org.apache.activemq.apollo.web.resources.ViewHelper
 - import helper._
 
-.breadcumbs
-  a(href={strip_resolve(".")}) Back
-
-
 p state: #{state} #{ uptime(state_since) } ago
 
 - if( state == "STARTED" )

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/ConnectorStatusDTO.jade
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/ConnectorStatusDTO.jade?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/ConnectorStatusDTO.jade
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/ConnectorStatusDTO.jade
Mon May 16 14:35:05 2011
@@ -18,7 +18,7 @@
 .breadcumbs
   a(href={strip_resolve("..")}) Back
 
-h1 Connector: #{config.id}
+h1 Connector: #{id}
 
 p state: #{state} #{ uptime(state_since) } ago
 

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.jade
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.jade?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.jade
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.jade
Mon May 16 14:35:05 2011
@@ -20,11 +20,11 @@
 .breadcumbs
   a(href={strip_resolve("..")}) Back
 
-h1 Virtual Host: #{config.id}
+h1 Virtual Host: #{id}
 
 p state: #{state} #{ uptime(state_since) } ago
 
-- if ( store !=null )
+- if ( store )
   p
     a(href={ path("store") }) store
 

Added: activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md?rev=1103752&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md (added)
+++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md Mon
May 16 14:35:05 2011
@@ -0,0 +1,488 @@
+# Apollo ${project_version} Management REST API
+
+{:toc:2-5}
+
+## Overview
+
+Apollo's REST API runs on port 61680 by default.   If your running 
+an Apollo broker on your local machine, you  would access the 
+API at the following HTTP URL:
+
+    https://localhost:61680
+
+For all of the rest of this document, we will be leaving off that part,
+since it is the same for every API call.
+
+### Authentication
+
+The broker requires all requests against the management API to supply
+user credentials which have administration privileges.
+
+The user credentials should be supplied using via HTTP basic
+authentication. Example:
+
+    $ curl -u "admin:password" http://localhost:61680
+
+### JSON Representation
+
+The API routes are intended to be access programmatically as JSON
+services but they also provide an HTML representation so that the API
+services can easily be browsed using a standard web browser.
+
+You must set the HTTP `Accept` header to `application/json` to get the
+json representation of the data. Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680
+
+### Broker Management
+
+The route for managing the broker is:
+
+    /
+
+Doing a GET against it will provide information about the broker's
+
+  * Version
+  * Running State
+  * Virtual Hosts
+  * Connectors
+  * Connections
+  
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/
+
+Results in:
+
+{pygmentize:: js}
+{
+  "version":"${project_version}",
+  "id":"default",
+  "state":"STARTED",
+  "state_since":1305388053086,
+  "current_time":1305388817653,
+  "virtual_hosts":["localhost"],
+  "connectors":[
+    "stomps",
+    "stomp"
+  ],
+  "connections":[
+    {"id":24,"label":"/127.0.0.1:52603"},
+    {"id":25,"label":"/127.0.0.1:52604"}
+  ],
+}
+{pygmentize}
+
+### Connector Management
+
+The route for managing a connector is:
+
+    /connectors/:id
+
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/connectors/stomp
+
+Results in:
+
+{pygmentize:: js}
+{
+  "id":"stomp",
+  "state":"STARTED",
+  "state_since":1305553109899,
+  "accepted":6,
+  "connections":[
+    {"id":5,"label":"/127.0.0.1:52638"},
+    {"id":6,"label":"/127.0.0.1:52639"}
+  ]
+}
+{pygmentize}
+
+### Connection Management
+
+The route for managing a connection is:
+
+    /connections/:id
+
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/connections/5
+
+Results in:
+
+{pygmentize:: js}
+{
+  "id":"5",
+  "state":"STARTED",
+  "state_since":1305553686946,
+  "read_counter":1401476017,
+  "write_counter":99,
+  "transport":"tcp",
+  "protocol":"stomp",
+  "remote_address":"/127.0.0.1:52638",
+  "protocol_version":"1.0",
+  "user":"admin",
+  "waiting_on":"client request",
+  "subscription_count":0
+}
+{pygmentize}
+
+To shutdown a connection send a POST to:
+
+    /connections/:id/action/shutdown
+
+Example:
+
+    curl -X POST -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/connections/5/action/shutdown
+
+
+### Virtual Host Management
+
+The route for managing a virtual host is:
+
+    /virtual-hosts/:name
+
+Where `:name` is the id of a virtual host configured in the broker.
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/virtual-hosts/localhost
+
+Results in:
+
+{pygmentize:: js}
+{
+  "id":"localhost",
+  "state":"STARTED",
+  "state_since":1305390871786,
+  "topics":[
+    {"id":6,"label":"item.prices"},
+    {"id":3,"label":"inventory.level"}
+  ],
+  "queues":[
+    {"id":10,"label":"orders.req"},
+    {"id":8,"label":"orders.res"},
+  ],
+  "store":true
+}
+{pygmentize}
+
+#### Virtual Host Store Management
+
+The route for managing a virtual host's Store is:
+
+    /virtual-hosts/:name/store
+
+Where `:name` is the id of a virtual host configured in the broker.
+
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/virtual-hosts/localhost/store
+
+Results in:
+
+{pygmentize:: js}
+{
+  "@class":"org.apache.activemq.apollo.broker.store.bdb.dto.BDBStoreStatusDTO",
+  "state":"STARTED",
+  "state_since":1305554120954,
+  "canceled_message_counter":87927,
+  "flushed_message_counter":28576,
+  "canceled_enqueue_counter":87927,
+  "flushed_enqueue_counter":28576,
+  "message_load_latency":{
+    "count":0,
+    "total":0,
+    "max":0,
+    "min":0
+  },
+  "flush_latency":{
+    "count":0,
+    "total":0,
+    "max":0,
+    "min":0
+  },
+  "journal_append_latency":null,
+  "index_update_latency":null,
+  "message_load_batch_size":{
+    "count":0,
+    "total":0,
+    "max":-2147483648,
+    "min":2147483647
+  },
+  "pending_stores":0
+}
+{pygmentize}
+
+#### Queue Management
+
+The route for managing a virtual host's Queue is:
+
+    /virtual-hosts/:name/queues/:qid
+
+Where `:name` is the id of a virtual host configured in the broker and `:qid` is the id
+of the queue.
+
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/virtual-hosts/localhost/queues/1
+
+Results in:
+
+{pygmentize:: js}
+{
+  "id":1,
+  "config":{
+    "name":null,
+    "unified":null,
+    "producer_buffer":null,
+    "queue_buffer":null,
+    "consumer_buffer":null,
+    "persistent":null,
+    "swap":null,
+    "swap_range_size":null,
+    "acl":null
+  },
+  "destination":{
+    "@class":"org.apache.activemq.apollo.dto.QueueDestinationDTO",
+    "name":"load-0"
+  },
+  "metrics":{
+    "enqueue_item_counter":37828413,
+    "enqueue_size_counter":41713628436,
+    "enqueue_ts":1305554574681,
+    "dequeue_item_counter":37828413,
+    "dequeue_size_counter":41713628436,
+    "dequeue_ts":1305554574681,
+    "nack_item_counter":0,
+    "nack_size_counter":0,
+    "nack_ts":1305554121093,
+    "queue_size":0,
+    "queue_items":0,
+    "swapped_in_size":0,
+    "swapped_in_items":0,
+    "swapping_in_size":0,
+    "swapping_out_size":0,
+    "swapped_in_size_max":557056,
+    "swap_out_item_counter":16,
+    "swap_out_size_counter":17634,
+    "swap_in_item_counter":16,
+    "swap_in_size_counter":17634
+  },
+  "entries":[],
+  "producers":[
+    {
+      "kind":"connection",
+      "ref":"1",
+      "label":"/127.0.0.1:52690"
+    }
+  ],"consumers":[
+    {
+      "link":{
+        "kind":"connection",
+        "ref":"2",
+        "label":"/127.0.0.1:52691"
+      },
+      "position":37828414,
+      "acquired_count":0,
+      "acquired_size":0,
+      "total_dispatched_count":37828413,
+      "total_dispatched_size":41713628436,
+      "total_ack_count":37828413,
+      "total_nack_count":0,
+      "waiting_on":"producer"
+    }
+  ]
+}
+{pygmentize}
+
+
+#### Topic Management
+
+The route for managing a virtual host's Topic is:
+
+    /virtual-hosts/:name/topics/:tid
+
+Where `:name` is the id of a virtual host configured in the broker and `:tid` is the id
+of the topic.
+
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/virtual-hosts/localhost/topics/1
+
+Results in:
+
+{pygmentize:: js}
+{
+  "id":1,
+  "name":"load-0",
+  "config":{
+    "name":null,
+    "slow_consumer_policy":null,
+    "acl":null
+  },
+  "producers":[
+    {
+      "kind":"connection",
+      "ref":"3",
+      "label":"/127.0.0.1:52772"
+    }
+  ],
+  "consumers":[
+    {
+      "kind":"connection",
+      "ref":"4",
+      "label":"/127.0.0.1:52773"
+    }
+  ],
+  "durable_subscriptions":[
+  ]
+}
+{pygmentize}
+
+### Getting the Broker's Configuration
+
+To get current runtime configuration of the broker GET:
+
+    /config/runtime
+
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/config/runtime
+
+Results in:
+
+{pygmentize:: js}
+{
+  "notes":"\n    The default configuration with tls/ssl enabled.\n  ",
+  "virtual_hosts":[{
+    "id":"apollo-a",
+    "enabled":null,
+    "host_names":["localhost"],
+    "store":{
+      "@class":"org.apache.activemq.apollo.broker.store.bdb.dto.BDBStoreDTO",
+      "flush_delay":null,
+      "directory":"/Users/chirino/opt/apollo-a/data",
+      "read_threads":null,
+      "zero_copy":null
+    },
+    "auto_create_destinations":null,
+    "purge_on_startup":null,
+    "topics":[],
+    "queues":[],
+    "durable_subscriptions":[],
+    "regroup_connections":null,
+    "acl":{
+      "connects":[
+        {"allow":"admins","deny":null,"kind":null}
+      ]
+    },
+    "authentication":{
+      "enabled":false,
+      "domain":null,
+      "acl_principal_kinds":[],
+      "user_principal_kinds":[]
+    },
+    "router":null,
+    "log_category":null
+  }],
+  "connectors":[{
+      "id":"stomp",
+      "enabled":null,
+      "bind":"tcp://0.0.0.0:61613",
+      "protocol":null,
+      "connection_limit":2000,
+      "protocols":[],"acl":null
+    },{
+      "id":"stomps",
+      "enabled":null,
+      "bind":"tls://0.0.0.0:61614",
+      "protocol":null,
+      "connection_limit":2000,
+      "protocols":[],
+      "acl":null
+    }],
+  "client_address":null,
+  "key_storage":{
+    "file":"/opt/apollo-a/etc/keystore",
+    "password":null,
+    "key_password":null,
+    "store_type":null,
+    "trust_algorithm":null,
+    "key_algorithm":null
+  },
+  "acl":{
+    "admins":[{
+      "allow":"admins",
+      "deny":null,
+      "kind":null
+    }]
+  },
+  "web_admin":{
+    "bind":"http://127.0.0.1:61680"
+  },
+  "authentication":{
+    "enabled":null,
+    "domain":"apollo",
+    "acl_principal_kinds":[],
+    "user_principal_kinds":[]
+  },
+  "log_category":{
+    "console":"console",
+    "audit":"audit",
+    "connection":"connection",
+    "security":"security"
+  },
+  "sticky_dispatching":null
+}
+{pygmentize}
+      
+### Aggregate Queue Statistics
+
+You can get aggregate queue statistics at either the broker or virtual host level by
+using one of the following URL routes:
+
+    /queue-metrics
+    /virtual-hosts/:name/queue-metrics
+
+Example:
+
+    $ curl -H "Accept: application/json" -u "admin:password" \
+    http://localhost:61680/queue-metrics
+
+Results in:
+
+{pygmentize:: js}
+{
+  "enqueue_item_counter":0,
+  "enqueue_size_counter":0,
+  "enqueue_ts":0,
+  "dequeue_item_counter":0,
+  "dequeue_size_counter":0,
+  "dequeue_ts":0,
+  "nack_item_counter":0,
+  "nack_size_counter":0,
+  "nack_ts":0,
+  "queue_size":0,
+  "queue_items":0,
+  "swapped_in_size":0,
+  "swapped_in_items":0,
+  "swapping_in_size":0,
+  "swapping_out_size":0,
+  "swapped_in_size_max":0,
+  "swap_out_item_counter":0,
+  "swap_out_size_counter":0,
+  "swap_in_item_counter":0,
+  "swap_in_size_counter":0,
+  "queues":0
+}
+{pygmentize}

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1103752&r1=1103751&r2=1103752&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Mon May 16 14:35:05 2011
@@ -129,7 +129,7 @@
     <features-maven-plugin-version>2.1.0</features-maven-plugin-version>
     
     <osgi.fragment.host>${project.groupId}.apollo-broker</osgi.fragment.host>
-    <mvnplugins-version>1.14</mvnplugins-version>
+    <mvnplugins-version>1.15</mvnplugins-version>
   </properties>
 
   <prerequisites>



Mime
View raw message