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", new String[]{"from", "to"},
040                new String[]{"From type", "To type"},
041                new OpenType[]{SimpleType.STRING, SimpleType.STRING});
042    }
043
044    public static TabularType listRestServicesTabularType() throws OpenDataException {
045        CompositeType ct = listRestServicesCompositeType();
046        return new TabularType("listRestServices", "Lists all the rest services in the registry", ct, new String[]{"url", "method"});
047    }
048
049    public static CompositeType listRestServicesCompositeType() throws OpenDataException {
050        return new CompositeType("rests", "Rest Services", new String[]{"url", "baseUrl", "basePath", "uriTemplate", "method", "consumes",
051            "produces", "inType", "outType", "state", "routeId", "description"},
052                new String[]{"Url", "Base Url", "Base Path", "Uri Template", "Method", "Consumes",
053                    "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", new String[]{"url", "static", "dynamic"},
065                new String[]{"Url", "Static", "Dynamic"},
066                new OpenType[]{SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN});
067    }
068
069    public static TabularType explainComponentTabularType() throws OpenDataException {
070        CompositeType ct = explainComponentCompositeType();
071        return new TabularType("explainComponent", "Explain how this component is configured", ct, new String[]{"option"});
072    }
073
074    public static CompositeType explainComponentCompositeType() throws OpenDataException {
075        return new CompositeType("components", "Components", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
076                new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
077                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
078                               SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
079    }
080
081    public static TabularType explainEndpointTabularType() throws OpenDataException {
082        CompositeType ct = explainEndpointsCompositeType();
083        return new TabularType("explainEndpoint", "Explain how this endpoint is configured", ct, new String[]{"option"});
084    }
085
086    public static CompositeType explainEndpointsCompositeType() throws OpenDataException {
087        return new CompositeType("endpoints", "Endpoints", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
088                new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
089                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
090                               SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
091    }
092
093    public static TabularType explainEipTabularType() throws OpenDataException {
094        CompositeType ct = explainEipsCompositeType();
095        return new TabularType("explainEip", "Explain how this EIP is configured", ct, new String[]{"option"});
096    }
097
098    public static CompositeType explainEipsCompositeType() throws OpenDataException {
099        return new CompositeType("eips", "EIPs", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"},
100                new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"},
101                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
102                               SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
103    }
104
105    public static TabularType listComponentsTabularType() throws OpenDataException {
106        CompositeType ct = listComponentsCompositeType();
107        return new TabularType("listComponents", "Lists all the components", ct, new String[]{"name"});
108    }
109
110    public static CompositeType listComponentsCompositeType() throws OpenDataException {
111        return new CompositeType("components", "Components", new String[]{"name", "title", "description", "label", "status", "type", "groupId", "artifactId", "version"},
112                new String[]{"Name", "Title", "Description", "Label", "Status", "Type", "GroupId", "ArtifactId", "Version"},
113                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
114                               SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
115    }
116
117    public static TabularType listAwaitThreadsTabularType() throws OpenDataException {
118        CompositeType ct = listAwaitThreadsCompositeType();
119        return new TabularType("listAwaitThreads", "Lists blocked threads by the routing engine", ct, new String[]{"id"});
120    }
121
122    public static CompositeType listAwaitThreadsCompositeType() throws OpenDataException {
123        return new CompositeType("threads", "Threads", new String[]{"id", "name", "exchangeId", "routeId", "nodeId", "duration"},
124                new String[]{"Thread Id", "Thread name", "ExchangeId", "RouteId", "NodeId", "Duration"},
125                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
126    }
127
128    public static TabularType listEipsTabularType() throws OpenDataException {
129        CompositeType ct = listEipsCompositeType();
130        return new TabularType("listEips", "Lists all the EIPs", ct, new String[]{"name"});
131    }
132
133    public static CompositeType listEipsCompositeType() throws OpenDataException {
134        return new CompositeType("eips", "EIPs", new String[]{"name", "title", "description", "label", "status", "type"},
135                new String[]{"Name", "Title", "Description", "Label", "Status", "Type"},
136                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
137    }
138
139    public static TabularType listInflightExchangesTabularType() throws OpenDataException {
140        CompositeType ct = listInflightExchangesCompositeType();
141        return new TabularType("listInflightExchanges", "Lists inflight exchanges", ct, new String[]{"exchangeId"});
142    }
143
144    public static CompositeType listInflightExchangesCompositeType() throws OpenDataException {
145        return new CompositeType("exchanges", "Exchanges", new String[]{"exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration"},
146                new String[]{"Exchange Id", "From RouteId", "RouteId", "NodeId", "Elapsed", "Duration"},
147                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
148    }
149
150}