| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!-- |
| 3 |
~ Copyright 2009-2013 Roland Huss |
| 4 |
~ |
| 5 |
~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 |
~ you may not use this file except in compliance with the License. |
| 7 |
~ You may obtain a copy of the License at |
| 8 |
~ |
| 9 |
~ http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
~ |
| 11 |
~ Unless required by applicable law or agreed to in writing, software |
| 12 |
~ distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
~ See the License for the specific language governing permissions and |
| 15 |
~ limitations under the License. |
| 16 |
--> |
| 17 |
|
| 18 |
<section id="list"> |
| 19 |
<title>Listing MBeans (list)</title> |
| 20 |
<para> |
| 21 |
The list operation collects information about accessible |
| 22 |
MBeans. This information includes the MBean names, their |
| 23 |
attributes, operations and notifications along with type |
| 24 |
information and description (as far as they are provided by the |
| 25 |
MBean author which doesn't seem to be often the case). |
| 26 |
</para> |
| 27 |
<section id="get-list"> |
| 28 |
<title>GET list request</title> |
| 29 |
<para> |
| 30 |
The GET request format for a Jolokia list request is |
| 31 |
</para> |
| 32 |
<synopsis><![CDATA[<base-url>/list/<inner path>]]></synopsis> |
| 33 |
<para> |
| 34 |
The <literal><inner path></literal>, as described in <xref linkend="paths"/> |
| 35 |
specifies a subset of the complete response. You can |
| 36 |
use this to select a specific domain, MBean or |
| 37 |
attribute/operation. See the next section for the format of the |
| 38 |
complete response. |
| 39 |
</para> |
| 40 |
</section> |
| 41 |
|
| 42 |
<section id="post-list"> |
| 43 |
<title>POST list request</title> |
| 44 |
<para> |
| 45 |
A list POST request has the following keys: |
| 46 |
</para> |
| 47 |
<table> |
| 48 |
<title>POST list Request</title> |
| 49 |
<thead> |
| 50 |
<tr> |
| 51 |
<td>Key</td> |
| 52 |
<td>Description</td> |
| 53 |
<td>Example</td> |
| 54 |
</tr> |
| 55 |
</thead> |
| 56 |
<tr> |
| 57 |
<td><constant>type</constant></td> |
| 58 |
<td><emphasis role="bold">list</emphasis></td> |
| 59 |
<td/> |
| 60 |
</tr> |
| 61 |
<tr> |
| 62 |
<td><constant>path</constant></td> |
| 63 |
<td> |
| 64 |
Inner path for accessing the value of a subset of the complete list |
| 65 |
(<xref linkend="paths"/>). |
| 66 |
</td> |
| 67 |
<td><literal>java.lang/type=Memory/attr</literal></td> |
| 68 |
</tr> |
| 69 |
</table> |
| 70 |
<para> |
| 71 |
The following request fetches the information about the MBean <literal>java.lang:type=Memory</literal> |
| 72 |
</para> |
| 73 |
<programlisting><![CDATA[ |
| 74 |
{ |
| 75 |
"type":"LIST", |
| 76 |
"path":"java.lang/type=Memory" |
| 77 |
}]]></programlisting> |
| 78 |
</section> |
| 79 |
|
| 80 |
<section id="response-list"> |
| 81 |
<title>List response</title> |
| 82 |
<para> |
| 83 |
The <constant>value</constant> has the following format: |
| 84 |
</para> |
| 85 |
<programlisting><![CDATA[ |
| 86 |
{ |
| 87 |
<domain> : |
| 88 |
{ |
| 89 |
<prop list> : |
| 90 |
{ |
| 91 |
"attr" : |
| 92 |
{ |
| 93 |
<attr name> : |
| 94 |
{ |
| 95 |
"type" : <attribute type>, |
| 96 |
"desc" : <textual description of attribute>, |
| 97 |
"rw" : true/false |
| 98 |
}, |
| 99 |
.... |
| 100 |
}, |
| 101 |
"op" : |
| 102 |
{ |
| 103 |
<operation name> : |
| 104 |
{ |
| 105 |
"args" : [ |
| 106 |
{ |
| 107 |
"type" : <argument type> |
| 108 |
"name" : <argument name> |
| 109 |
"desc" : <textual description of argument> |
| 110 |
}, |
| 111 |
..... |
| 112 |
], |
| 113 |
"ret" : <return type>, |
| 114 |
"desc" : <textual description of operation> |
| 115 |
}, |
| 116 |
..... |
| 117 |
}, |
| 118 |
"not" : |
| 119 |
{ |
| 120 |
"name" : <name>, |
| 121 |
"desc" : <desc>, |
| 122 |
"types" : [ <type1>, <type2> ] |
| 123 |
} |
| 124 |
}, |
| 125 |
.... |
| 126 |
}, |
| 127 |
.... |
| 128 |
}]]></programlisting> |
| 129 |
<para> |
| 130 |
The <literal>domain name</literal> and the <literal>property |
| 131 |
list</literal> together uniquely identify a single MBean. The |
| 132 |
property list is in the so called <emphasis>canonical |
| 133 |
order</emphasis>, i.e. in the form |
| 134 |
<literal><![CDATA["<key1>=<val1>,<key2>=<val2>,.."]]></literal> |
| 135 |
where the keys are ordered alphabetically. Each MBean has zero |
| 136 |
or more attributes and operations which can be reached in an |
| 137 |
MBeans JSON object with the keys <constant>attr</constant> and |
| 138 |
<constant>op</constant> respectively. Within these groups the |
| 139 |
contained information is explained above in the schema and |
| 140 |
consist of Java types for attributes, arguments and return |
| 141 |
values, descriptive information and whether an attribute is |
| 142 |
writable (<constant>rw</constant> == <constant>true</constant>) or |
| 143 |
read-only. |
| 144 |
</para> |
| 145 |
<para> |
| 146 |
As for reading attributes you can fetch a subset of this information using an |
| 147 |
path. E.g a path of <literal>domain/prop-list</literal> would return the value for a single |
| 148 |
bean only. For example, a request |
| 149 |
<informalexample> |
| 150 |
<literallayout class="monospaced"><![CDATA[http://localhost:8080/jolokia/list/java.lang/type=Memory]]></literallayout> |
| 151 |
</informalexample> |
| 152 |
results in an answer |
| 153 |
</para> |
| 154 |
<programlisting><![CDATA[ |
| 155 |
{ |
| 156 |
"value": |
| 157 |
{ |
| 158 |
"op": |
| 159 |
{ |
| 160 |
"gc": |
| 161 |
{ |
| 162 |
"args":[], |
| 163 |
"ret":"void", |
| 164 |
"desc":"gc" |
| 165 |
} |
| 166 |
}, |
| 167 |
"class":"sun.management.MemoryImpl", |
| 168 |
"attr": |
| 169 |
{ |
| 170 |
"NonHeapMemoryUsage": |
| 171 |
{ |
| 172 |
"type":"javax.management.openmbean.CompositeData", |
| 173 |
"rw":false, |
| 174 |
"desc":"NonHeapMemoryUsage" |
| 175 |
}, |
| 176 |
"Verbose": |
| 177 |
{ |
| 178 |
"type":"boolean", |
| 179 |
"rw":true, |
| 180 |
"desc":"Verbose" |
| 181 |
}, |
| 182 |
"HeapMemoryUsage": |
| 183 |
{ |
| 184 |
"type":"javax.management.openmbean.CompositeData", |
| 185 |
"rw":false, |
| 186 |
"desc":"HeapMemoryUsage" |
| 187 |
}, |
| 188 |
"ObjectPendingFinalizationCount": |
| 189 |
{ |
| 190 |
"type":"int", |
| 191 |
"rw":false, |
| 192 |
"desc":"ObjectPendingFinalizationCount" |
| 193 |
} |
| 194 |
} |
| 195 |
}, |
| 196 |
"status":200, |
| 197 |
"request": |
| 198 |
{ |
| 199 |
"type":"list", |
| 200 |
"path":"java.lang\/type=Memory" |
| 201 |
} |
| 202 |
}]]></programlisting> |
| 203 |
</section> |
| 204 |
|
| 205 |
<section> |
| 206 |
<title>Restrict depth of the returned tree</title> |
| 207 |
<para> |
| 208 |
The optional parameter <literal>maxDepth</literal> can be used |
| 209 |
to restrict the depth of the return tree. Two value are |
| 210 |
possible: A <literal>maxDepth</literal> of 1 restricts the |
| 211 |
return value to a map with the JMX domains as keys, a |
| 212 |
<literal>maxDepth</literal> of 2 truncates the map returned to |
| 213 |
the domain names (first level) and the MBean's properties |
| 214 |
(second level). The final values of the maps don't have any |
| 215 |
meaning and are dummy values. |
| 216 |
</para> |
| 217 |
</section> |
| 218 |
</section> |