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 2011/06/13 17:18:14 UTC
svn commit: r1135136 - in /activemq/activemq-apollo/trunk:
apollo-dto/src/main/java/org/apache/activemq/apollo/dto/
apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/
apollo-website/src/documentation/
Author: chirino
Date: Mon Jun 13 15:18:13 2011
New Revision: 1135136
URL: http://svn.apache.org/viewvc?rev=1135136&view=rev
Log:
Documented updates to the tabular REST api access bits.
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DataPageDTO.java
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
activemq/activemq-apollo/trunk/apollo-website/src/documentation/management-api.md
Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DataPageDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DataPageDTO.java?rev=1135136&r1=1135135&r2=1135136&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DataPageDTO.java (original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DataPageDTO.java Mon Jun 13 15:18:13 2011
@@ -37,8 +37,8 @@ public class DataPageDTO {
/**
*/
- @XmlAttribute(name="row_max")
- public int row_max;
+ @XmlAttribute(name="page_size")
+ public int page_size;
/**
*/
@@ -64,7 +64,7 @@ public class DataPageDTO {
DataPageDTO that = (DataPageDTO) o;
if (page != that.page) return false;
- if (row_max != that.row_max) return false;
+ if (page_size != that.page_size) return false;
if (total_pages != that.total_pages) return false;
if (total_rows != that.total_rows) return false;
if (headers != null ? !headers.equals(that.headers) : that.headers != null) return false;
@@ -76,7 +76,7 @@ public class DataPageDTO {
@Override
public int hashCode() {
int result = page;
- result = 31 * result + row_max;
+ result = 31 * result + page_size;
result = 31 * result + total_pages;
result = 31 * result + (int) (total_rows ^ (total_rows >>> 32));
result = 31 * result + (headers != null ? headers.hashCode() : 0);
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=1135136&r1=1135135&r2=1135136&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 Mon Jun 13 15:18:13 2011
@@ -310,10 +310,10 @@ case class BrokerResource() extends Reso
val rc = new DataPageDTO
rc.page = page
- rc.row_max = page_size
+ rc.page_size = page_size
def total_pages(x:Int,y:Int) = if(x==0) 1 else { x/y + (if ( x%y == 0 ) 0 else 1) }
- rc.total_pages = total_pages(records.length, rc.row_max)
+ rc.total_pages = total_pages(records.length, rc.page_size)
rc.total_rows = records.length
rc.headers = headers
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=1135136&r1=1135135&r2=1135136&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 Mon Jun 13 15:18:13 2011
@@ -51,63 +51,84 @@ Example:
$ curl -u "admin:password" \
'http://localhost:61680/broker/connections.json'
- [
- [
- "*"
- ],
- {
- "id":"4",
- "state":"STARTED",
- "state_since":1306848325102,
- "read_counter":103,
- "write_counter":239110628,
- "transport":"tcp",
- "protocol":"stomp",
- "remote_address":"/127.0.0.1:61775",
- "protocol_version":"1.0",
- "user":"admin",
- "waiting_on":"client request",
- "subscription_count":1
- },
- {
- "id":"5",
- "state":"STARTED",
- "state_since":1306848325102,
- "read_counter":227739229,
- "write_counter":113,
- "transport":"tcp",
- "protocol":"stomp",
- "remote_address":"/127.0.0.1:61776",
- "protocol_version":"1.0",
- "user":"admin",
- "waiting_on":"blocked sending to: org.apache.activemq.apollo.broker.Queue$$anon$1@13765e9b",
- "subscription_count":0
- }
- ]
+
+Results in a [Data Page](./api/apollo-dto/org/apache/activemq/apollo/dto/DataPageDTO.html) :
+
+{pygmentize:: js}
+{
+ "page":0,
+ "page_size":100,
+ "total_pages":1,
+ "total_rows":2,
+ "headers":[
+ "*"
+ ],
+ "rows":[
+ {
+ "id":"4",
+ "state":"STARTED",
+ "state_since":1306848325102,
+ "read_counter":103,
+ "write_counter":239110628,
+ "transport":"tcp",
+ "protocol":"stomp",
+ "remote_address":"/127.0.0.1:61775",
+ "protocol_version":"1.0",
+ "user":"admin",
+ "waiting_on":"client request",
+ "subscription_count":1
+ },
+ {
+ "id":"5",
+ "state":"STARTED",
+ "state_since":1306848325102,
+ "read_counter":227739229,
+ "write_counter":113,
+ "transport":"tcp",
+ "protocol":"stomp",
+ "remote_address":"/127.0.0.1:61776",
+ "protocol_version":"1.0",
+ "user":"admin",
+ "waiting_on":"blocked sending to: org.apache.activemq.apollo.broker.Queue$$anon$1@13765e9b",
+ "subscription_count":0
+ }
+ ]
+}
+{pygmentiz}
-The results are an array of records with the first record acting as a header
-records describing the fields selected. The `*` field means all the record's
-fields were selected. To narrow down the selected fields you can add
+The `*` header field means the record was selected. To narrow down the selected fields you can add
multiple `f` query parameters to pick the fields you want to retrieve.
Example:
$ curl -u "admin:password" \
'http://localhost:61680/broker/connections.json?f=id&f=read_counter'
+
+Results in :
+
+{pygmentize:: js}
+{
+ "page":0,
+ "page_size":100,
+ "total_pages":1,
+ "total_rows":2,
+ "headers":[
+ "id",
+ "read_counter"
+ ],
+ "rows":[
[
- [
- "id",
- "read_counter"
- ],
- [
- "7",
- 110733109
- ],
- [
- "6",
- 103
- ]
+ "7",
+ 110733109
+ ],
+ [
+ "6",
+ 103
]
+ ]
+}
+{pygmentiz}
+
If you want to narrow down the records which get selected, you can set a `q`
query parameter to SQL 92 style where clause which uses the record's fields