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 listRestServicesTabularType() throws OpenDataException { 034 CompositeType ct = listRestServicesCompositeType(); 035 return new TabularType( 036 "listRestServices", "Lists all the rest services in the registry", ct, new String[] { "url", "method" }); 037 } 038 039 public static CompositeType listRestServicesCompositeType() throws OpenDataException { 040 return new CompositeType( 041 "rests", "Rest Services", 042 new String[] { 043 "url", "baseUrl", "basePath", "uriTemplate", "method", "consumes", "produces", "inType", "outType", 044 "state", "routeId", "description" }, 045 new String[] { 046 "Url", "Base Url", "Base Path", "Uri Template", "Method", "Consumes", "Produces", "Input Type", 047 "Output Type", "State", "Route Id", "Description" }, 048 new OpenType[] { 049 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 050 SimpleType.STRING, 051 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 052 SimpleType.STRING }); 053 } 054 055 public static TabularType listEndpointsTabularType() throws OpenDataException { 056 CompositeType ct = listEndpointsCompositeType(); 057 return new TabularType("listEndpoints", "Lists all the endpoints in the registry", ct, new String[] { "url" }); 058 } 059 060 public static CompositeType listEndpointsCompositeType() throws OpenDataException { 061 return new CompositeType( 062 "endpoints", "Endpoints", 063 new String[] { "url", "static", "dynamic" }, 064 new String[] { "Url", "Static", "Dynamic" }, 065 new OpenType[] { SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN }); 066 } 067 068 public static TabularType listExchangeFactoryTabularType() throws OpenDataException { 069 CompositeType ct = listExchangeFactoryCompositeType(); 070 return new TabularType("listExchangeFactory", "Lists all the exchange factories", ct, new String[] { "url" }); 071 } 072 073 public static CompositeType listExchangeFactoryCompositeType() throws OpenDataException { 074 return new CompositeType( 075 "factories", "Factories", 076 new String[] { "url", "routeId", "capacity", "pooled", "created", "acquired", "released", "discarded" }, 077 new String[] { "Url", "RouteId", "Capacity", "Pooled", "Created", "Acquired", "Released", "Discarded" }, 078 new OpenType[] { 079 SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.LONG, 080 SimpleType.LONG, SimpleType.LONG, SimpleType.LONG }); 081 } 082 083 public static TabularType listRuntimeEndpointsTabularType() throws OpenDataException { 084 CompositeType ct = listRuntimeEndpointsCompositeType(); 085 return new TabularType( 086 "listRuntimeEndpoints", "Lists all the input and output endpoints gathered during runtime", ct, 087 new String[] { "index" }); 088 } 089 090 public static CompositeType listRuntimeEndpointsCompositeType() throws OpenDataException { 091 return new CompositeType( 092 "endpoints", "Endpoints", 093 new String[] { "index", "url", "routeId", "direction", "static", "dynamic", "hits" }, 094 new String[] { "Index", "Url", "Route Id", "Direction", "Static", "Dynamic", "Hits" }, 095 new OpenType[] { 096 SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, 097 SimpleType.BOOLEAN, SimpleType.LONG }); 098 } 099 100 public static TabularType listComponentsTabularType() throws OpenDataException { 101 CompositeType ct = listComponentsCompositeType(); 102 return new TabularType("listComponents", "Lists all the components", ct, new String[] { "name" }); 103 } 104 105 public static CompositeType listComponentsCompositeType() throws OpenDataException { 106 return new CompositeType( 107 "components", "Components", 108 new String[] { 109 "name", "title", "syntax", "description", "label", "deprecated", "secret", "status", "type", "groupId", 110 "artifactId", "version" }, 111 new String[] { 112 "Name", "Title", "Syntax", "Description", "Label", "Deprecated", "Secret", "Status", "Type", "GroupId", 113 "ArtifactId", "Version" }, 114 new OpenType[] { 115 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 116 SimpleType.STRING, 117 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 118 SimpleType.STRING }); 119 } 120 121 public static TabularType listAwaitThreadsTabularType() throws OpenDataException { 122 CompositeType ct = listAwaitThreadsCompositeType(); 123 return new TabularType("listAwaitThreads", "Lists blocked threads by the routing engine", ct, new String[] { "id" }); 124 } 125 126 public static CompositeType listAwaitThreadsCompositeType() throws OpenDataException { 127 return new CompositeType( 128 "threads", "Threads", 129 new String[] { "id", "name", "exchangeId", "routeId", "nodeId", "duration" }, 130 new String[] { "Thread Id", "Thread name", "ExchangeId", "RouteId", "NodeId", "Duration" }, 131 new OpenType[] { 132 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 133 SimpleType.STRING }); 134 } 135 136 public static TabularType listEipsTabularType() throws OpenDataException { 137 CompositeType ct = listEipsCompositeType(); 138 return new TabularType("listEips", "Lists all the EIPs", ct, new String[] { "name" }); 139 } 140 141 public static CompositeType listEipsCompositeType() throws OpenDataException { 142 return new CompositeType( 143 "eips", "EIPs", 144 new String[] { "name", "title", "description", "label", "status", "type" }, 145 new String[] { "Name", "Title", "Description", "Label", "Status", "Type" }, 146 new OpenType[] { 147 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 148 SimpleType.STRING }); 149 } 150 151 public static TabularType listInflightExchangesTabularType() throws OpenDataException { 152 CompositeType ct = listInflightExchangesCompositeType(); 153 return new TabularType("listInflightExchanges", "Lists inflight exchanges", ct, new String[] { "exchangeId" }); 154 } 155 156 public static CompositeType listInflightExchangesCompositeType() throws OpenDataException { 157 return new CompositeType( 158 "exchanges", "Exchanges", 159 new String[] { "exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration" }, 160 new String[] { "Exchange Id", "From RouteId", "RouteId", "NodeId", "Elapsed", "Duration" }, 161 new OpenType[] { 162 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 163 SimpleType.STRING }); 164 } 165 166 public static TabularType choiceTabularType() throws OpenDataException { 167 CompositeType ct = choiceCompositeType(); 168 return new TabularType("choice", "Choice statistics", ct, new String[] { "predicate" }); 169 } 170 171 public static CompositeType choiceCompositeType() throws OpenDataException { 172 return new CompositeType( 173 "predicates", "Predicates", 174 new String[] { "predicate", "language", "matches" }, 175 new String[] { "Predicate", "Language", "Matches" }, 176 new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.LONG }); 177 } 178 179 public static TabularType loadbalancerExceptionsTabularType() throws OpenDataException { 180 CompositeType ct = loadbalancerExceptionsCompositeType(); 181 return new TabularType("exception", "Exception statistics", ct, new String[] { "exception" }); 182 } 183 184 public static CompositeType loadbalancerExceptionsCompositeType() throws OpenDataException { 185 return new CompositeType( 186 "exceptions", "Exceptions", 187 new String[] { "exception", "failures" }, 188 new String[] { "Exception", "Failures" }, 189 new OpenType[] { SimpleType.STRING, SimpleType.LONG }); 190 } 191 192 public static TabularType endpointsUtilizationTabularType() throws OpenDataException { 193 CompositeType ct = endpointsUtilizationCompositeType(); 194 return new TabularType("endpointsUtilization", "Endpoint utilization statistics", ct, new String[] { "url" }); 195 } 196 197 public static CompositeType endpointsUtilizationCompositeType() throws OpenDataException { 198 return new CompositeType( 199 "endpoints", "Endpoints", 200 new String[] { "url", "hits" }, 201 new String[] { "Url", "Hits" }, 202 new OpenType[] { SimpleType.STRING, SimpleType.LONG }); 203 } 204 205 public static TabularType listTransformersTabularType() throws OpenDataException { 206 CompositeType ct = listTransformersCompositeType(); 207 return new TabularType( 208 "listTransformers", "Lists all the transformers in the registry", ct, new String[] { "scheme", "from", "to" }); 209 } 210 211 public static CompositeType listTransformersCompositeType() throws OpenDataException { 212 return new CompositeType( 213 "transformers", "Transformers", 214 new String[] { "scheme", "from", "to", "static", "dynamic", "description" }, 215 new String[] { "Scheme", "From", "To", "Static", "Dynamic", "Description" }, 216 new OpenType[] { 217 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 218 SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.STRING }); 219 } 220 221 public static TabularType listValidatorsTabularType() throws OpenDataException { 222 CompositeType ct = listValidatorsCompositeType(); 223 return new TabularType("listValidators", "Lists all the validators in the registry", ct, new String[] { "type" }); 224 } 225 226 public static CompositeType listValidatorsCompositeType() throws OpenDataException { 227 return new CompositeType( 228 "validators", "Validators", 229 new String[] { "type", "static", "dynamic", "description" }, 230 new String[] { "Type", "Static", "Dynamic", "Description" }, 231 new OpenType[] { SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.STRING }); 232 } 233 234 public static CompositeType camelHealthDetailsCompositeType() throws OpenDataException { 235 return new CompositeType( 236 "healthDetails", "Health Details", 237 new String[] { "id", "group", "state", "enabled", "readiness", "liveness", "interval", "failureThreshold" }, 238 new String[] { "ID", "Group", "State", "Enabled", "Readiness", "Liveness", "Interval", "Failure Threshold" }, 239 new OpenType[] { 240 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN, 241 SimpleType.BOOLEAN, SimpleType.LONG, SimpleType.INTEGER }); 242 } 243 244 public static TabularType camelHealthDetailsTabularType() throws OpenDataException { 245 CompositeType ct = camelHealthDetailsCompositeType(); 246 return new TabularType("healthDetails", "Health Details", ct, new String[] { "id" }); 247 } 248 249 public static CompositeType camelRoutePropertiesCompositeType() throws OpenDataException { 250 return new CompositeType( 251 "routeProperties", "Route Properties", 252 new String[] { "key", "value" }, 253 new String[] { "Key", "Value" }, 254 new OpenType[] { SimpleType.STRING, SimpleType.STRING }); 255 } 256 257 public static TabularType camelRoutePropertiesTabularType() throws OpenDataException { 258 CompositeType ct = camelRoutePropertiesCompositeType(); 259 return new TabularType("routeProperties", "Route Properties", ct, new String[] { "key" }); 260 } 261 262 public static TabularType supervisingRouteControllerRouteStatusTabularType() throws OpenDataException { 263 CompositeType ct = supervisingRouteControllerRouteStatusCompositeType(); 264 return new TabularType( 265 "routeStatus", "Lists detailed status about all the routes (incl failure details for routes failed to start)", 266 ct, new String[] { "index" }); 267 } 268 269 public static CompositeType supervisingRouteControllerRouteStatusCompositeType() throws OpenDataException { 270 return new CompositeType( 271 "routes", "Routes", 272 new String[] { 273 "index", "routeId", "status", "supervising", "attempts", "elapsed", "last", "error", "stacktrace" }, 274 new String[] { 275 "Index", "Route Id", "Status", "Supervising", "Attempts", "Elapsed", "Since Last Attempt", "Error", 276 "Stacktrace" }, 277 new OpenType[] { 278 SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, 279 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING }); 280 } 281 282}