activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1371323 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ apol...
Date Thu, 09 Aug 2012 17:20:37 GMT
Author: chirino
Date: Thu Aug  9 17:20:36 2012
New Revision: 1371323

URL: http://svn.apache.org/viewvc?rev=1371323&view=rev
Log:
Fixes APLO-179 : Remove the list of connections from the toplevel REST URI

You can now toggle if the list of connections at the broker level and the connector level.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
    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-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.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-website/src/documentation/management-api.md

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala?rev=1371323&r1=1371322&r2=1371323&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
Thu Aug  9 17:20:36 2012
@@ -129,6 +129,10 @@ class AcceptingConnector(val broker:Brok
     result.connected = connected.get
     result.protocol = Option(config.protocol).getOrElse("any")
     result.local_address = Option(socket_address).map(_.toString).getOrElse("any")
+
+    for( (id, connection) <- broker.connections if connection.connector eq this ) {
+      result.connections.add( new LongIdLabeledDTO(id, connection.transport.getRemoteAddress.toString
) )
+    }
     result
   }
 

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=1371323&r1=1371322&r2=1371323&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
Thu Aug  9 17:20:36 2012
@@ -64,14 +64,20 @@ public class BrokerStatusDTO extends Ser
     public List<String> connectors = new ArrayList<String>();
 
     /**
-     * Ids of all the connections running on the broker
+     * The total number of connections accepted by the broker since it started.
      */
-    @XmlElement(name="connection")
-    public List<LongIdLabeledDTO> connections = new ArrayList<LongIdLabeledDTO>();
+	@XmlAttribute(name="connection_counter")
+	public long connection_counter;
 
     /**
-     * The total number of connections accepted by the broker.
+     * The number of connections that this connector has currently connected.
      */
-	@XmlAttribute(name="connection_counter")
-	public long connection_counter;
+    @XmlAttribute
+    public long connected;
+
+    /**
+     * The connections that have been created via the connector.
+     */
+    @XmlElement(name="connection")
+    public List<LongIdLabeledDTO> connections = new ArrayList<LongIdLabeledDTO>();
 }

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=1371323&r1=1371322&r2=1371323&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
Thu Aug  9 17:20:36 2012
@@ -56,4 +56,10 @@ public class ConnectorStatusDTO extends 
     @XmlAttribute
     public long connected;
 
+    /**
+     * The connections that have been created via the connector.
+     */
+    @XmlElement(name="connection")
+    public List<LongIdLabeledDTO> connections = new ArrayList<LongIdLabeledDTO>();
+
 }

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala?rev=1371323&r1=1371322&r2=1371323&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
Thu Aug  9 17:20:36 2012
@@ -105,7 +105,7 @@ class BrokerResource() extends Resource 
 
   @GET
   @ApiOperation(value = "Returns a BrokerStatusDTO which contains summary information about
the broker and the JVM")
-  def get_broker():BrokerStatusDTO = {
+  def get_broker(@QueryParam("connections") connections:Boolean):BrokerStatusDTO = {
     with_broker { broker =>
       monitoring(broker) {
         val result = new BrokerStatusDTO
@@ -117,21 +117,23 @@ class BrokerResource() extends Resource 
         result.state_since = broker.service_state.since
         result.version = Broker.version
         result.connection_counter = broker.connection_id_counter.get()
+        result.connected = broker.connections.size
         broker.virtual_hosts.values.foreach{ host=>
-          // TODO: may need to sync /w virtual host's dispatch queue
           result.virtual_hosts.add( host.id )
         }
-
         broker.connectors.values.foreach{ c=>
           result.connectors.add( c.id )
         }
 
-        broker.connections.foreach { case (id,connection) =>
-          // TODO: may need to sync /w connection's dispatch queue
-          result.connections.add( new LongIdLabeledDTO(id, connection.transport.getRemoteAddress.toString
) )
+        // only include the connection list if it was requested.
+        if( !connections ) {
+          result.connections = null;
+        } else {
+          broker.connections.foreach { case (id,connection) =>
+            result.connections.add( new LongIdLabeledDTO(id, connection.transport.getRemoteAddress.toString
) )
+          }
         }
         result
-
       }
     }
   }
@@ -685,10 +687,20 @@ class BrokerResource() extends Resource 
 
   @GET @Path("/connectors/{id}")
   @ApiOperation(value = "Gets the status of the specified connector.")
-  def connector(@PathParam("id") id : String):ServiceStatusDTO = {
+  def connector(@PathParam("id") id : String, @QueryParam("connections") connections:Boolean):ServiceStatusDTO
= {
     with_connector(id) { connector =>
       monitoring(connector.broker) {
-        connector.status
+        val rc = connector.status
+
+        // only include the connection list if it was requested.
+        rc match {
+          case rc:ConnectorStatusDTO=>
+            if( !connections ) {
+              rc.connections = null
+            }
+          case _ =>
+        }
+        rc
       }
     }
   }

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=1371323&r1=1371322&r2=1371323&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
Thu Aug  9 17:20:36 2012
@@ -32,17 +32,24 @@ ul
       a(href={ path("virtual-hosts/"+x+".html") }) #{x}
 
 h2 Connectors
+
 ul
   - for( x <- connectors )
     li
       a(href={ path("connectors/"+x+".html") }) #{x}
 
 h2 Connections
-p total connections ever : #{connection_counter}
-ul
-  - for( x <- connections )
-    li
-      a(href={ path("connections/"+x.id+".html") }) #{x.label}
+p total connections since startup : #{connection_counter}
+p currently connected : #{connected}
+p
+  - if( connections==null )
+    a(href={ "broker.html?connections=true" }) Show Connections
+  - else
+    a(href={ "broker.html" }) Hide Connections
+    ul
+      - for( x <- connections )
+        li
+          a(href={ path("connections/"+x.id+".html") }) #{x.label}
 
 h2 Operating System
 p Name : #{jvm_metrics.os_name}

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=1371323&r1=1371322&r2=1371323&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
Thu Aug  9 17:20:36 2012
@@ -32,7 +32,16 @@ p state: #{state} #{ uptime(state_since)
 
 p local address: #{local_address}
 p protocol: #{protocol}
-p currently connected: #{connected}
-p total ever connected: #{connection_counter}
-
 
+h2 Connections
+p total connections since startup : #{connection_counter}
+p currently connected : #{connected}
+p
+  - if( connections==null )
+    a(href={ id+".html?connections=true" }) Show Connections
+  - else
+    a(href={ id+".html" }) Hide Connections
+    ul
+      - for( x <- connections )
+        li
+          a(href={ path("../../connections/"+x.id+".html") }) #{x.label}

Modified: 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=1371323&r1=1371322&r2=1371323&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md (original)
+++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md Thu
Aug  9 17:20:36 2012
@@ -297,11 +297,13 @@ parameter to define the order in which t
         "current_time": 1314573388707,
         "virtual_hosts": ["default"],
         "connectors": ["tls", "tcp"],
-        "connections": [],
         "connection_counter": 0
       }
       {pygmentize}
       
+      You can the `?connections=true` query parameter to have a list of connections
+      included n the result.
+      
   - route("GET", "/broker/queue-metrics.json", 200, "AggregateDestMetricsDTO")
     :markdown
       Aggregates the messaging metrics for all the queue destinations.  Example:
@@ -656,6 +658,9 @@ parameter to define the order in which t
         "connected": 12
       }
       {pygmentize}
+      
+      You can the `?connections=true` query parameter to have a list of connections
+      included n the result.
 
   - route("POST", "/broker/connectors/{connector}/action/stop.json", 303)
     :markdown



Mime
View raw message