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