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[] {
112                        "index", "url", "routeId", "direction", "static", "dynamic", "hits",
113                        "minBodySize", "maxBodySize", "meanBodySize",
114                        "minHeadersSize", "maxHeadersSize", "meanHeadersSize" },
115                new String[] {
116                        "Index", "Url", "Route Id", "Direction", "Static", "Dynamic", "Hits",
117                        "Min Body Size", "Max Body Size", "Mean Body Size",
118                        "Min Headers Size", "Max Headers Size", "Mean Headers Size" },
119                new OpenType[] {
120                        SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN,
121                        SimpleType.BOOLEAN, SimpleType.LONG,
122                        SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
123                        SimpleType.LONG, SimpleType.LONG, SimpleType.LONG });
124    }
125
126    public static TabularType listComponentsTabularType() throws OpenDataException {
127        CompositeType ct = listComponentsCompositeType();
128        return new TabularType("listComponents", "Lists all the components", ct, new String[] { "name" });
129    }
130
131    public static CompositeType listComponentsCompositeType() throws OpenDataException {
132        return new CompositeType(
133                "components", "Components",
134                new String[] {
135                        "name", "title", "syntax", "description", "label", "deprecated", "secret", "status", "type", "groupId",
136                        "artifactId", "version" },
137                new String[] {
138                        "Name", "Title", "Syntax", "Description", "Label", "Deprecated", "Secret", "Status", "Type", "GroupId",
139                        "ArtifactId", "Version" },
140                new OpenType[] {
141                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
142                        SimpleType.STRING,
143                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
144                        SimpleType.STRING });
145    }
146
147    public static TabularType listAwaitThreadsTabularType() throws OpenDataException {
148        CompositeType ct = listAwaitThreadsCompositeType();
149        return new TabularType("listAwaitThreads", "Lists blocked threads by the routing engine", ct, new String[] { "id" });
150    }
151
152    public static CompositeType listAwaitThreadsCompositeType() throws OpenDataException {
153        return new CompositeType(
154                "threads", "Threads",
155                new String[] { "id", "name", "exchangeId", "routeId", "nodeId", "duration" },
156                new String[] { "Thread Id", "Thread name", "ExchangeId", "RouteId", "NodeId", "Duration" },
157                new OpenType[] {
158                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
159                        SimpleType.STRING });
160    }
161
162    public static TabularType listEipsTabularType() throws OpenDataException {
163        CompositeType ct = listEipsCompositeType();
164        return new TabularType("listEips", "Lists all the EIPs", ct, new String[] { "name" });
165    }
166
167    public static CompositeType listEipsCompositeType() throws OpenDataException {
168        return new CompositeType(
169                "eips", "EIPs",
170                new String[] { "name", "title", "description", "label", "status", "type" },
171                new String[] { "Name", "Title", "Description", "Label", "Status", "Type" },
172                new OpenType[] {
173                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
174                        SimpleType.STRING });
175    }
176
177    public static TabularType listInflightExchangesTabularType() throws OpenDataException {
178        CompositeType ct = listInflightExchangesCompositeType();
179        return new TabularType("listInflightExchanges", "Lists inflight exchanges", ct, new String[] { "exchangeId" });
180    }
181
182    public static CompositeType listInflightExchangesCompositeType() throws OpenDataException {
183        return new CompositeType(
184                "exchanges", "Exchanges",
185                new String[] { "exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration" },
186                new String[] { "Exchange Id", "From RouteId", "RouteId", "NodeId", "Elapsed", "Duration" },
187                new OpenType[] {
188                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
189                        SimpleType.STRING });
190    }
191
192    public static TabularType choiceTabularType() throws OpenDataException {
193        CompositeType ct = choiceCompositeType();
194        return new TabularType("choice", "Choice statistics", ct, new String[] { "predicate" });
195    }
196
197    public static CompositeType choiceCompositeType() throws OpenDataException {
198        return new CompositeType(
199                "predicates", "Predicates",
200                new String[] { "predicate", "language", "matches" },
201                new String[] { "Predicate", "Language", "Matches" },
202                new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.LONG });
203    }
204
205    public static TabularType doTryTabularType() throws OpenDataException {
206        CompositeType ct = doTryCompositeType();
207        return new TabularType("doTry", "doTry statistics", ct, new String[] { "exception" });
208    }
209
210    public static CompositeType doTryCompositeType() throws OpenDataException {
211        return new CompositeType(
212                "exceptions", "Exception types",
213                new String[] { "exception", "predicate", "language", "matches" },
214                new String[] { "Exception", "Predicate", "Language", "Matches" },
215                new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG });
216    }
217
218    public static TabularType loadbalancerExceptionsTabularType() throws OpenDataException {
219        CompositeType ct = loadbalancerExceptionsCompositeType();
220        return new TabularType("exception", "Exception statistics", ct, new String[] { "exception" });
221    }
222
223    public static CompositeType loadbalancerExceptionsCompositeType() throws OpenDataException {
224        return new CompositeType(
225                "exceptions", "Exceptions",
226                new String[] { "exception", "failures" },
227                new String[] { "Exception", "Failures" },
228                new OpenType[] { SimpleType.STRING, SimpleType.LONG });
229    }
230
231    public static TabularType endpointsUtilizationTabularType() throws OpenDataException {
232        CompositeType ct = endpointsUtilizationCompositeType();
233        return new TabularType("endpointsUtilization", "Endpoint utilization statistics", ct, new String[] { "url" });
234    }
235
236    public static CompositeType endpointsUtilizationCompositeType() throws OpenDataException {
237        return new CompositeType(
238                "endpoints", "Endpoints",
239                new String[] { "url", "hits" },
240                new String[] { "Url", "Hits" },
241                new OpenType[] { SimpleType.STRING, SimpleType.LONG });
242    }
243
244    public static TabularType listTransformersTabularType() throws OpenDataException {
245        CompositeType ct = listTransformersCompositeType();
246        return new TabularType(
247                "listTransformers", "Lists all the transformers in the registry", ct, new String[] { "name", "from", "to" });
248    }
249
250    public static CompositeType listTransformersCompositeType() throws OpenDataException {
251        return new CompositeType(
252                "transformers", "Transformers",
253                new String[] { "name", "from", "to", "static", "dynamic", "description" },
254                new String[] { "Name", "From", "To", "Static", "Dynamic", "Description" },
255                new OpenType[] {
256                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
257                        SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.STRING });
258    }
259
260    public static TabularType listValidatorsTabularType() throws OpenDataException {
261        CompositeType ct = listValidatorsCompositeType();
262        return new TabularType("listValidators", "Lists all the validators in the registry", ct, new String[] { "type" });
263    }
264
265    public static CompositeType listValidatorsCompositeType() throws OpenDataException {
266        return new CompositeType(
267                "validators", "Validators",
268                new String[] { "type", "static", "dynamic", "description" },
269                new String[] { "Type", "Static", "Dynamic", "Description" },
270                new OpenType[] { SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.STRING });
271    }
272
273    public static CompositeType camelHealthDetailsCompositeType() throws OpenDataException {
274        return new CompositeType(
275                "healthDetails", "Health Details",
276                new String[] {
277                        "id", "group", "state", "enabled", "message", "failureUri", "failureCount", "failureStackTrace",
278                        "readiness", "liveness" },
279                new String[] {
280                        "ID", "Group", "State", "Enabled", "Message", "Failure Uri", "Failure Count", "Failure StackTrace",
281                        "Readiness", "Liveness" },
282                new OpenType[] {
283                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.STRING,
284                        SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN });
285    }
286
287    public static TabularType camelHealthDetailsTabularType() throws OpenDataException {
288        CompositeType ct = camelHealthDetailsCompositeType();
289        return new TabularType("healthDetails", "Health Details", ct, new String[] { "id" });
290    }
291
292    public static CompositeType camelRoutePropertiesCompositeType() throws OpenDataException {
293        return new CompositeType(
294                "routeProperties", "Route Properties",
295                new String[] { "key", "value" },
296                new String[] { "Key", "Value" },
297                new OpenType[] { SimpleType.STRING, SimpleType.STRING });
298    }
299
300    public static TabularType camelRoutePropertiesTabularType() throws OpenDataException {
301        CompositeType ct = camelRoutePropertiesCompositeType();
302        return new TabularType("routeProperties", "Route Properties", ct, new String[] { "key" });
303    }
304
305    public static TabularType supervisingRouteControllerRouteStatusTabularType() throws OpenDataException {
306        CompositeType ct = supervisingRouteControllerRouteStatusCompositeType();
307        return new TabularType(
308                "routeStatus", "Lists detailed status about all the routes (incl failure details for routes failed to start)",
309                ct, new String[] { "index" });
310    }
311
312    public static CompositeType supervisingRouteControllerRouteStatusCompositeType() throws OpenDataException {
313        return new CompositeType(
314                "routes", "Routes",
315                new String[] {
316                        "index", "routeId", "status", "supervising", "attempts", "elapsed", "last", "error", "stacktrace" },
317                new String[] {
318                        "Index", "Route Id", "Status", "Supervising", "Attempts", "Elapsed", "Since Last Attempt", "Error",
319                        "Stacktrace" },
320                new OpenType[] {
321                        SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG,
322                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING });
323    }
324
325    public static CompositeType camelVariablesCompositeType() throws OpenDataException {
326        return new CompositeType(
327                "variables", "Variables",
328                new String[] { "id", "key", "className", "value" },
329                new String[] { "Id", "Key", "className", "Value" },
330                new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING });
331    }
332
333    public static TabularType camelVariablesTabularType() throws OpenDataException {
334        CompositeType ct = camelVariablesCompositeType();
335        return new TabularType("variables", "Variables", ct, new String[] { "id", "key" });
336    }
337
338    public static TabularType listBackoffTaskTabularType() throws OpenDataException {
339        CompositeType ct = listBackoffTaskCompositeType();
340        return new TabularType(
341                "listBackoff", "Lists all the backoff tasks", ct,
342                new String[] { "name" });
343    }
344
345    public static CompositeType listBackoffTaskCompositeType() throws OpenDataException {
346        return new CompositeType(
347                "tasks", "Tasks",
348                new String[] {
349                        "name", "kind", "status", "attempts", "delay", "elapsed", "firstTime", "lastTime", "nextTime",
350                        "failure" },
351                new String[] {
352                        "Name", "Kind", "Status", "Attempts", "Delay", "Elapsed", "FirstTime", "LastTime", "NextTime",
353                        "Failure" },
354                new OpenType[] {
355                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG,
356                        SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING });
357    }
358
359    public static TabularType listInternalTaskTabularType() throws OpenDataException {
360        CompositeType ct = listInternalTaskCompositeType();
361        return new TabularType(
362                "listTask", "Lists all the internal tasks", ct,
363                new String[] { "name" });
364    }
365
366    public static CompositeType listInternalTaskCompositeType() throws OpenDataException {
367        return new CompositeType(
368                "tasks", "Tasks",
369                new String[] {
370                        "name", "kind", "status", "attempts", "delay", "elapsed", "firstTime", "lastTime", "nextTime",
371                        "failure" },
372                new String[] {
373                        "Name", "Kind", "Status", "Attempts", "Delay", "Elapsed", "FirstTime", "LastTime", "NextTime",
374                        "Failure" },
375                new OpenType[] {
376                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG,
377                        SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING });
378    }
379
380    public static TabularType listErrorRegistryTabularType() throws OpenDataException {
381        CompositeType ct = listErrorRegistryCompositeType();
382        return new TabularType("listErrors", "Lists captured routing errors", ct, new String[] { "exchangeId" });
383    }
384
385    public static CompositeType listErrorRegistryCompositeType() throws OpenDataException {
386        return new CompositeType(
387                "errors", "Errors",
388                new String[] {
389                        "exchangeId", "routeId", "routeGroup", "nodeId", "stepId",
390                        "endpointUri", "fromEndpointUri", "timestamp",
391                        "routeUptime", "elapsed",
392                        "handled", "exceptionType", "exceptionMessage" },
393                new String[] {
394                        "Exchange Id", "Route Id", "Route Group", "Node Id", "Step Id",
395                        "Endpoint Uri", "From Endpoint Uri", "Timestamp",
396                        "Route Uptime", "Elapsed",
397                        "Handled", "Exception Type", "Exception Message" },
398                new OpenType[] {
399                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
400                        SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
401                        SimpleType.LONG, SimpleType.LONG,
402                        SimpleType.BOOLEAN, SimpleType.STRING, SimpleType.STRING });
403    }
404
405}