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