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