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 2012/07/20 18:38:41 UTC
svn commit: r1363867 - in /activemq/activemq-apollo/trunk: apollo-network/
apollo-network/src/main/resources/META-INF/services/org.apache.activemq.apollo/
apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/web/
apollo-network/src/t...
Author: chirino
Date: Fri Jul 20 16:38:40 2012
New Revision: 1363867
URL: http://svn.apache.org/viewvc?rev=1363867&view=rev
Log:
Move the rest resources needed for the network module into the network module.
Added:
activemq/activemq-apollo/trunk/apollo-network/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-module.index
activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/web/
activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/web/NetworkWebModule.scala
Modified:
activemq/activemq-apollo/trunk/apollo-network/pom.xml
activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-1.xml
activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-2.xml
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/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
Modified: activemq/activemq-apollo/trunk/apollo-network/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-network/pom.xml?rev=1363867&r1=1363866&r2=1363867&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-network/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-network/pom.xml Fri Jul 20 16:38:40 2012
@@ -47,6 +47,20 @@
<artifactId>apollo-broker</artifactId>
<version>99-trunk-SNAPSHOT</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-web</artifactId>
+ <version>99-trunk-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.aggregate</groupId>
+ <artifactId>jetty-all-server</artifactId>
+ <version>${jetty-version}</version>
+ <optional>true</optional>
+ </dependency>
+
+
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
@@ -133,20 +147,8 @@
<version>99-trunk-SNAPSHOT</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>apollo-web</artifactId>
- <version>99-trunk-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
<dependency>
- <groupId>org.eclipse.jetty.aggregate</groupId>
- <artifactId>jetty-all-server</artifactId>
- <version>${jetty-version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j-version}</version>
Added: activemq/activemq-apollo/trunk/apollo-network/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-module.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-network/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-module.index?rev=1363867&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-network/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-module.index (added)
+++ activemq/activemq-apollo/trunk/apollo-network/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-module.index Fri Jul 20 16:38:40 2012
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.broker.network.web.NetworkWebModule
\ No newline at end of file
Added: activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/web/NetworkWebModule.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/web/NetworkWebModule.scala?rev=1363867&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/web/NetworkWebModule.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/web/NetworkWebModule.scala Fri Jul 20 16:38:40 2012
@@ -0,0 +1,73 @@
+package org.apache.activemq.apollo.broker.network.web
+
+import org.apache.activemq.apollo.web.resources.{HelpResourceJSON, Resource}
+import org.apache.activemq.apollo.web.WebModule
+import javax.ws.rs.{PathParam, Produces, GET, Path}
+import scala.Array
+import javax.ws.rs.core.MediaType._
+import com.wordnik.swagger.core.{Api, ApiOperation}
+import org.apache.activemq.apollo.dto.{DestinationLoadDTO, LoadStatusDTO}
+import org.apache.activemq.apollo.broker.LocalRouter
+import org.fusesource.hawtdispatch.Future
+import scala.Predef._
+import org.apache.activemq.apollo.util.Success
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+
+
+object NetworkWebModule extends WebModule {
+
+ def priority: Int = 101
+
+ override def web_resources = Set(
+ classOf[NetworkResourceJSON],
+ classOf[NetworkResourceHelp]
+ )
+
+ def root_redirect: String = "broker"
+
+}
+
+@Path( "/api/docs/network{ext:(\\.json)?}")
+@Api(value = "/api/json/network",
+ listingPath = "/api/docs/network",
+ listingClass = "org.apache.activemq.apollo.web.resources.NetworkResourceJSON")
+class NetworkResourceHelp extends HelpResourceJSON
+
+/**
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+@Path( "/api/json/network")
+@Api(value = "/api/json/network",
+ listingPath = "/api/docs/network")
+@Produces(Array("application/json"))
+case class NetworkResourceJSON() extends Resource() {
+// import WebModule._
+
+ @GET @Path("/load-status/{id}")
+ @ApiOperation(value = "Gets a report of the message load on the host.")
+ @Produces(Array(APPLICATION_JSON))
+ def topics(@PathParam("id") id : String ):LoadStatusDTO = {
+ with_virtual_host[LoadStatusDTO](id) { host =>
+ val router: LocalRouter = host
+ val queue_loads = Future.all {
+ router.local_queue_domain.destination_by_id.values.map { value =>
+ monitoring[DestinationLoadDTO](value) {
+ value.load_status
+ }
+ }
+ }
+ queue_loads.map { queue_loads=>
+ val rc = new LoadStatusDTO
+ queue_loads.flatMap(_.success_option).foreach { load=>
+ rc.queues.add(load)
+ }
+ Success(rc)
+ }
+ }
+ }
+
+}
Modified: activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-1.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-1.xml?rev=1363867&r1=1363866&r2=1363867&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-1.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-1.xml Fri Jul 20 16:38:40 2012
@@ -27,7 +27,7 @@
<network_manager>
<self id="{{host}}">
- <service kind="web_admin" address="{{web_admin.url}}/api/json/broker/virtual-hosts/{{host}}/load-status"/>
+ <service kind="web_admin" address="{{web_admin.url}}/api/json/network/load-status/{{host}}"/>
<service kind="stomp" address="tcp://0.0.0.0:{{connector.tcp.port}}"/>
</self>
<jvm_membership/>
Modified: activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-2.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-2.xml?rev=1363867&r1=1363866&r2=1363867&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-2.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-network/src/test/resources/apollo-network-2.xml Fri Jul 20 16:38:40 2012
@@ -27,7 +27,7 @@
<network_manager self="broker2">
<self id="{{host}}">
- <service kind="web_admin" address="{{web_admin.url}}/api/json/broker/virtual-hosts/{{host}}/load-status"/>
+ <service kind="web_admin" address="{{web_admin.url}}/api/json/network/load-status/{{host}}"/>
<service kind="stomp" address="tcp://0.0.0.0:{{connector.tcp.port}}"/>
</self>
<jvm_membership/>
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=1363867&r1=1363866&r2=1363867&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 Fri Jul 20 16:38:40 2012
@@ -479,29 +479,6 @@ class BrokerResource() extends Resource
}
}
- @GET @Path("/virtual-hosts/{id}/load-status")
- @ApiOperation(value = "Gets a report of the message load on the broker.")
- @Produces(Array(APPLICATION_JSON))
- def topics(@PathParam("id") id : String ):LoadStatusDTO = {
- with_virtual_host[LoadStatusDTO](id) { host =>
- val router: LocalRouter = host
- val queue_loads = Future.all {
- router.local_queue_domain.destination_by_id.values.map { value =>
- monitoring[DestinationLoadDTO](value) {
- value.load_status
- }
- }
- }
- queue_loads.map { queue_loads=>
- val rc = new LoadStatusDTO
- queue_loads.flatMap(_.success_option).foreach { load=>
- rc.queues.add(load)
- }
- Success(rc)
- }
- }
- }
-
@GET @Path("/virtual-hosts/{id}/topics")
@ApiOperation(value = "Gets a list of all the topics that exist on the broker.")
@Produces(Array(APPLICATION_JSON))
Modified: 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/RootResource.scala?rev=1363867&r1=1363866&r2=1363867&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/RootResource.scala Fri Jul 20 16:38:40 2012
@@ -31,7 +31,7 @@ case class RootResource() extends Resour
@GET
@Produces(Array(APPLICATION_JSON, APPLICATION_XML,TEXT_XML,TEXT_HTML))
- def post_connection_shutdown_and_redirect() = {
+ def get_root_direct() = {
Response.seeOther(strip_resolve(root_redirect)).build
}