001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel.api.management.mbean; 018 019import javax.management.openmbean.CompositeType; 020import javax.management.openmbean.OpenDataException; 021import javax.management.openmbean.OpenType; 022import javax.management.openmbean.SimpleType; 023import javax.management.openmbean.TabularType; 024 025/** 026 * Various JMX openmbean types used by Camel. 027 */ 028public final class CamelOpenMBeanTypes { 029 030 private CamelOpenMBeanTypes() { 031 } 032 033 public static TabularType listEndpointServicesTabularType() throws OpenDataException { 034 CompositeType ct = listEndpointServicesCompositeType(); 035 return new TabularType( 036 "listEndpointServices", "Lists all the endpoint services in the registry", ct, 037 new String[] { "component", "dir", "serviceUrl", "endpointUri" }); 038 } 039 040 public static CompositeType listEndpointServicesCompositeType() throws OpenDataException { 041 return new CompositeType( 042 "endpoints", "Endpoint Services", 043 new String[] { 044 "component", "dir", "protocol", "serviceUrl", "metadata", "endpointUri", "routeId", "hits" }, 045 new String[] { 046 "Component", "Direction", "Protocol", "Service Url", "Metadata", "Endpoint Uri", "Route Id", "Hits" }, 047 new OpenType[] { 048 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 049 SimpleType.STRING, SimpleType.STRING, SimpleType.LONG }); 050 } 051 052 public static TabularType listRestServicesTabularType() throws OpenDataException { 053 CompositeType ct = listRestServicesCompositeType(); 054 return new TabularType( 055 "listRestServices", "Lists all the rest services in the registry", ct, new String[] { "url", "method" }); 056 } 057 058 public static CompositeType listRestServicesCompositeType() throws OpenDataException { 059 return new CompositeType( 060 "rests", "Rest Services", 061 new String[] { 062 "url", "baseUrl", "basePath", "uriTemplate", "method", "consumes", "produces", "inType", "outType", 063 "kind", "state", "description" }, 064 new String[] { 065 "Url", "Base Url", "Base Path", "Uri Template", "Method", "Consumes", "Produces", "Input Type", 066 "Output Type", "Kind", "State", "Description" }, 067 new OpenType[] { 068 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 069 SimpleType.STRING, SimpleType.STRING, 070 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING }); 071 } 072 073 public static TabularType listEndpointsTabularType() throws OpenDataException { 074 CompositeType ct = listEndpointsCompositeType(); 075 return new TabularType("listEndpoints", "Lists all the endpoints in the registry", ct, new String[] { "url" }); 076 } 077 078 public static CompositeType listEndpointsCompositeType() throws OpenDataException { 079 return new CompositeType( 080 "endpoints", "Endpoints", 081 new String[] { "url", "static", "dynamic" }, 082 new String[] { "Url", "Static", "Dynamic" }, 083 new OpenType[] { SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN }); 084 } 085 086 public static TabularType listExchangeFactoryTabularType() throws OpenDataException { 087 CompositeType ct = listExchangeFactoryCompositeType(); 088 return new TabularType("listExchangeFactory", "Lists all the exchange factories", ct, new String[] { "url" }); 089 } 090 091 public static CompositeType listExchangeFactoryCompositeType() throws OpenDataException { 092 return new CompositeType( 093 "factories", "Factories", 094 new String[] { "url", "routeId", "capacity", "pooled", "created", "acquired", "released", "discarded" }, 095 new String[] { "Url", "RouteId", "Capacity", "Pooled", "Created", "Acquired", "Released", "Discarded" }, 096 new OpenType[] { 097 SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.LONG, 098 SimpleType.LONG, SimpleType.LONG, SimpleType.LONG }); 099 } 100 101 public static TabularType listRuntimeEndpointsTabularType() throws OpenDataException { 102 CompositeType ct = listRuntimeEndpointsCompositeType(); 103 return new TabularType( 104 "listRuntimeEndpoints", "Lists all the input and output endpoints gathered during runtime", ct, 105 new String[] { "index" }); 106 } 107 108 public static CompositeType listRuntimeEndpointsCompositeType() throws OpenDataException { 109 return new CompositeType( 110 "endpoints", "Endpoints", 111 new String[] { "index", "url", "routeId", "direction", "static", "dynamic", "hits" }, 112 new String[] { "Index", "Url", "Route Id", "Direction", "Static", "Dynamic", "Hits" }, 113 new OpenType[] { 114 SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, 115 SimpleType.BOOLEAN, SimpleType.LONG }); 116 } 117 118 public static TabularType listComponentsTabularType() throws OpenDataException { 119 CompositeType ct = listComponentsCompositeType(); 120 return new TabularType("listComponents", "Lists all the components", ct, new String[] { "name" }); 121 } 122 123 public static CompositeType listComponentsCompositeType() throws OpenDataException { 124 return new CompositeType( 125 "components", "Components", 126 new String[] { 127 "name", "title", "syntax", "description", "label", "deprecated", "secret", "status", "type", "groupId", 128 "artifactId", "version" }, 129 new String[] { 130 "Name", "Title", "Syntax", "Description", "Label", "Deprecated", "Secret", "Status", "Type", "GroupId", 131 "ArtifactId", "Version" }, 132 new OpenType[] { 133 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 134 SimpleType.STRING, 135 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 136 SimpleType.STRING }); 137 } 138 139 public static TabularType listAwaitThreadsTabularType() throws OpenDataException { 140 CompositeType ct = listAwaitThreadsCompositeType(); 141 return new TabularType("listAwaitThreads", "Lists blocked threads by the routing engine", ct, new String[] { "id" }); 142 } 143 144 public static CompositeType listAwaitThreadsCompositeType() throws OpenDataException { 145 return new CompositeType( 146 "threads", "Threads", 147 new String[] { "id", "name", "exchangeId", "routeId", "nodeId", "duration" }, 148 new String[] { "Thread Id", "Thread name", "ExchangeId", "RouteId", "NodeId", "Duration" }, 149 new OpenType[] { 150 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 151 SimpleType.STRING }); 152 } 153 154 public static TabularType listEipsTabularType() throws OpenDataException { 155 CompositeType ct = listEipsCompositeType(); 156 return new TabularType("listEips", "Lists all the EIPs", ct, new String[] { "name" }); 157 } 158 159 public static CompositeType listEipsCompositeType() throws OpenDataException { 160 return new CompositeType( 161 "eips", "EIPs", 162 new String[] { "name", "title", "description", "label", "status", "type" }, 163 new String[] { "Name", "Title", "Description", "Label", "Status", "Type" }, 164 new OpenType[] { 165 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 166 SimpleType.STRING }); 167 } 168 169 public static TabularType listInflightExchangesTabularType() throws OpenDataException { 170 CompositeType ct = listInflightExchangesCompositeType(); 171 return new TabularType("listInflightExchanges", "Lists inflight exchanges", ct, new String[] { "exchangeId" }); 172 } 173 174 public static CompositeType listInflightExchangesCompositeType() throws OpenDataException { 175 return new CompositeType( 176 "exchanges", "Exchanges", 177 new String[] { "exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration" }, 178 new String[] { "Exchange Id", "From RouteId", "RouteId", "NodeId", "Elapsed", "Duration" }, 179 new OpenType[] { 180 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 181 SimpleType.STRING }); 182 } 183 184 public static TabularType choiceTabularType() throws OpenDataException { 185 CompositeType ct = choiceCompositeType(); 186 return new TabularType("choice", "Choice statistics", ct, new String[] { "predicate" }); 187 } 188 189 public static CompositeType choiceCompositeType() throws OpenDataException { 190 return new CompositeType( 191 "predicates", "Predicates", 192 new String[] { "predicate", "language", "matches" }, 193 new String[] { "Predicate", "Language", "Matches" }, 194 new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.LONG }); 195 } 196 197 public static TabularType doTryTabularType() throws OpenDataException { 198 CompositeType ct = doTryCompositeType(); 199 return new TabularType("doTry", "doTry statistics", ct, new String[] { "exception" }); 200 } 201 202 public static CompositeType doTryCompositeType() throws OpenDataException { 203 return new CompositeType( 204 "exceptions", "Exception types", 205 new String[] { "exception", "predicate", "language", "matches" }, 206 new String[] { "Exception", "Predicate", "Language", "Matches" }, 207 new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG }); 208 } 209 210 public static TabularType loadbalancerExceptionsTabularType() throws OpenDataException { 211 CompositeType ct = loadbalancerExceptionsCompositeType(); 212 return new TabularType("exception", "Exception statistics", ct, new String[] { "exception" }); 213 } 214 215 public static CompositeType loadbalancerExceptionsCompositeType() throws OpenDataException { 216 return new CompositeType( 217 "exceptions", "Exceptions", 218 new String[] { "exception", "failures" }, 219 new String[] { "Exception", "Failures" }, 220 new OpenType[] { SimpleType.STRING, SimpleType.LONG }); 221 } 222 223 public static TabularType endpointsUtilizationTabularType() throws OpenDataException { 224 CompositeType ct = endpointsUtilizationCompositeType(); 225 return new TabularType("endpointsUtilization", "Endpoint utilization statistics", ct, new String[] { "url" }); 226 } 227 228 public static CompositeType endpointsUtilizationCompositeType() throws OpenDataException { 229 return new CompositeType( 230 "endpoints", "Endpoints", 231 new String[] { "url", "hits" }, 232 new String[] { "Url", "Hits" }, 233 new OpenType[] { SimpleType.STRING, SimpleType.LONG }); 234 } 235 236 public static TabularType listTransformersTabularType() throws OpenDataException { 237 CompositeType ct = listTransformersCompositeType(); 238 return new TabularType( 239 "listTransformers", "Lists all the transformers in the registry", ct, new String[] { "name", "from", "to" }); 240 } 241 242 public static CompositeType listTransformersCompositeType() throws OpenDataException { 243 return new CompositeType( 244 "transformers", "Transformers", 245 new String[] { "name", "from", "to", "static", "dynamic", "description" }, 246 new String[] { "Name", "From", "To", "Static", "Dynamic", "Description" }, 247 new OpenType[] { 248 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 249 SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.STRING }); 250 } 251 252 public static TabularType listValidatorsTabularType() throws OpenDataException { 253 CompositeType ct = listValidatorsCompositeType(); 254 return new TabularType("listValidators", "Lists all the validators in the registry", ct, new String[] { "type" }); 255 } 256 257 public static CompositeType listValidatorsCompositeType() throws OpenDataException { 258 return new CompositeType( 259 "validators", "Validators", 260 new String[] { "type", "static", "dynamic", "description" }, 261 new String[] { "Type", "Static", "Dynamic", "Description" }, 262 new OpenType[] { SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.STRING }); 263 } 264 265 public static CompositeType camelHealthDetailsCompositeType() throws OpenDataException { 266 return new CompositeType( 267 "healthDetails", "Health Details", 268 new String[] { 269 "id", "group", "state", "enabled", "message", "failureUri", "failureCount", "failureStackTrace", 270 "readiness", "liveness" }, 271 new String[] { 272 "ID", "Group", "State", "Enabled", "Message", "Failure Uri", "Failure Count", "Failure StackTrace", 273 "Readiness", "Liveness" }, 274 new OpenType[] { 275 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.STRING, 276 SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN }); 277 } 278 279 public static TabularType camelHealthDetailsTabularType() throws OpenDataException { 280 CompositeType ct = camelHealthDetailsCompositeType(); 281 return new TabularType("healthDetails", "Health Details", ct, new String[] { "id" }); 282 } 283 284 public static CompositeType camelRoutePropertiesCompositeType() throws OpenDataException { 285 return new CompositeType( 286 "routeProperties", "Route Properties", 287 new String[] { "key", "value" }, 288 new String[] { "Key", "Value" }, 289 new OpenType[] { SimpleType.STRING, SimpleType.STRING }); 290 } 291 292 public static TabularType camelRoutePropertiesTabularType() throws OpenDataException { 293 CompositeType ct = camelRoutePropertiesCompositeType(); 294 return new TabularType("routeProperties", "Route Properties", ct, new String[] { "key" }); 295 } 296 297 public static TabularType supervisingRouteControllerRouteStatusTabularType() throws OpenDataException { 298 CompositeType ct = supervisingRouteControllerRouteStatusCompositeType(); 299 return new TabularType( 300 "routeStatus", "Lists detailed status about all the routes (incl failure details for routes failed to start)", 301 ct, new String[] { "index" }); 302 } 303 304 public static CompositeType supervisingRouteControllerRouteStatusCompositeType() throws OpenDataException { 305 return new CompositeType( 306 "routes", "Routes", 307 new String[] { 308 "index", "routeId", "status", "supervising", "attempts", "elapsed", "last", "error", "stacktrace" }, 309 new String[] { 310 "Index", "Route Id", "Status", "Supervising", "Attempts", "Elapsed", "Since Last Attempt", "Error", 311 "Stacktrace" }, 312 new OpenType[] { 313 SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, 314 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING }); 315 } 316 317 public static CompositeType camelVariablesCompositeType() throws OpenDataException { 318 return new CompositeType( 319 "variables", "Variables", 320 new String[] { "id", "key", "className", "value" }, 321 new String[] { "Id", "Key", "className", "Value" }, 322 new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING }); 323 } 324 325 public static TabularType camelVariablesTabularType() throws OpenDataException { 326 CompositeType ct = camelVariablesCompositeType(); 327 return new TabularType("variables", "Variables", ct, new String[] { "id", "key" }); 328 } 329 330 public static TabularType listBackoffTaskTabularType() throws OpenDataException { 331 CompositeType ct = listBackoffTaskCompositeType(); 332 return new TabularType( 333 "listBackoff", "Lists all the backoff tasks", ct, 334 new String[] { "name" }); 335 } 336 337 public static CompositeType listBackoffTaskCompositeType() throws OpenDataException { 338 return new CompositeType( 339 "tasks", "Tasks", 340 new String[] { 341 "name", "kind", "status", "attempts", "delay", "elapsed", "firstTime", "lastTime", "nextTime", 342 "failure" }, 343 new String[] { 344 "Name", "Kind", "Status", "Attempts", "Delay", "Elapsed", "FirstTime", "LastTime", "NextTime", 345 "Failure" }, 346 new OpenType[] { 347 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, 348 SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING }); 349 } 350 351 public static TabularType listInternalTaskTabularType() throws OpenDataException { 352 CompositeType ct = listInternalTaskCompositeType(); 353 return new TabularType( 354 "listTask", "Lists all the internal tasks", ct, 355 new String[] { "name" }); 356 } 357 358 public static CompositeType listInternalTaskCompositeType() throws OpenDataException { 359 return new CompositeType( 360 "tasks", "Tasks", 361 new String[] { 362 "name", "kind", "status", "attempts", "delay", "elapsed", "firstTime", "lastTime", "nextTime", 363 "failure" }, 364 new String[] { 365 "Name", "Kind", "Status", "Attempts", "Delay", "Elapsed", "FirstTime", "LastTime", "NextTime", 366 "Failure" }, 367 new OpenType[] { 368 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, 369 SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING }); 370 } 371 372}