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 listRuntimeEndpointsTabularType() throws OpenDataException { 070 CompositeType ct = listRuntimeEndpointsCompositeType(); 071 return new TabularType("listRuntimeEndpoints", "Lists all the input and output endpoints gathered during runtime", ct, new String[]{"index"}); 072 } 073 074 public static CompositeType listRuntimeEndpointsCompositeType() throws OpenDataException { 075 return new CompositeType("endpoints", "Endpoints", new String[]{"index", "url", "routeId", "direction", "static", "dynamic", "hits"}, 076 new String[]{"Index", "Url", "Route Id", "Direction", "Static", "Dynamic", "Hits"}, 077 new OpenType[]{SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN, SimpleType.LONG}); 078 } 079 080 public static TabularType explainComponentTabularType() throws OpenDataException { 081 CompositeType ct = explainComponentCompositeType(); 082 return new TabularType("explainComponent", "Explain how this component is configured", ct, new String[]{"option"}); 083 } 084 085 public static CompositeType explainComponentCompositeType() throws OpenDataException { 086 return new CompositeType("components", "Components", new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "value", "default value", "description"}, 087 new String[]{"Option", "Kind", "Group", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"}, 088 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 089 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 090 } 091 092 public static TabularType explainDataFormatTabularType() throws OpenDataException { 093 CompositeType ct = explainDataFormatsCompositeType(); 094 return new TabularType("explainDataFormat", "Explain how this dataformat is configured", ct, new String[]{"option"}); 095 } 096 097 public static CompositeType explainDataFormatsCompositeType() throws OpenDataException { 098 return new CompositeType("dataformats", "DataFormats", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"}, 099 new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"}, 100 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 101 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 102 } 103 104 105 public static TabularType explainEndpointTabularType() throws OpenDataException { 106 CompositeType ct = explainEndpointsCompositeType(); 107 return new TabularType("explainEndpoint", "Explain how this endpoint is configured", ct, new String[]{"option"}); 108 } 109 110 public static CompositeType explainEndpointsCompositeType() throws OpenDataException { 111 return new CompositeType("endpoints", "Endpoints", new String[]{"option", "kind", "group", "label", "type", "java type", "deprecated", "value", "default value", "description"}, 112 new String[]{"Option", "Kind", "Group", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"}, 113 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 114 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 115 } 116 117 public static TabularType explainEipTabularType() throws OpenDataException { 118 CompositeType ct = explainEipsCompositeType(); 119 return new TabularType("explainEip", "Explain how this EIP is configured", ct, new String[]{"option"}); 120 } 121 122 public static CompositeType explainEipsCompositeType() throws OpenDataException { 123 return new CompositeType("eips", "EIPs", new String[]{"option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description"}, 124 new String[]{"Option", "Kind", "Label", "Type", "Java Type", "Deprecated", "Value", "Default Value", "Description"}, 125 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 126 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 127 } 128 129 public static TabularType listComponentsTabularType() throws OpenDataException { 130 CompositeType ct = listComponentsCompositeType(); 131 return new TabularType("listComponents", "Lists all the components", ct, new String[]{"name"}); 132 } 133 134 public static CompositeType listComponentsCompositeType() throws OpenDataException { 135 return new CompositeType("components", "Components", new String[]{"name", "title", "syntax", "description", "label", "deprecated", "status", "type", "groupId", "artifactId", "version"}, 136 new String[]{"Name", "Title", "Syntax", "Description", "Label", "Deprecated", "Status", "Type", "GroupId", "ArtifactId", "Version"}, 137 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, 138 SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 139 } 140 141 public static TabularType listAwaitThreadsTabularType() throws OpenDataException { 142 CompositeType ct = listAwaitThreadsCompositeType(); 143 return new TabularType("listAwaitThreads", "Lists blocked threads by the routing engine", ct, new String[]{"id"}); 144 } 145 146 public static CompositeType listAwaitThreadsCompositeType() throws OpenDataException { 147 return new CompositeType("threads", "Threads", new String[]{"id", "name", "exchangeId", "routeId", "nodeId", "duration"}, 148 new String[]{"Thread Id", "Thread name", "ExchangeId", "RouteId", "NodeId", "Duration"}, 149 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 150 } 151 152 public static TabularType listEipsTabularType() throws OpenDataException { 153 CompositeType ct = listEipsCompositeType(); 154 return new TabularType("listEips", "Lists all the EIPs", ct, new String[]{"name"}); 155 } 156 157 public static CompositeType listEipsCompositeType() throws OpenDataException { 158 return new CompositeType("eips", "EIPs", new String[]{"name", "title", "description", "label", "status", "type"}, 159 new String[]{"Name", "Title", "Description", "Label", "Status", "Type"}, 160 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 161 } 162 163 public static TabularType listInflightExchangesTabularType() throws OpenDataException { 164 CompositeType ct = listInflightExchangesCompositeType(); 165 return new TabularType("listInflightExchanges", "Lists inflight exchanges", ct, new String[]{"exchangeId"}); 166 } 167 168 public static CompositeType listInflightExchangesCompositeType() throws OpenDataException { 169 return new CompositeType("exchanges", "Exchanges", new String[]{"exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration"}, 170 new String[]{"Exchange Id", "From RouteId", "RouteId", "NodeId", "Elapsed", "Duration"}, 171 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); 172 } 173 174 public static TabularType choiceTabularType() throws OpenDataException { 175 CompositeType ct = choiceCompositeType(); 176 return new TabularType("choice", "Choice statistics", ct, new String[]{"predicate"}); 177 } 178 179 public static CompositeType choiceCompositeType() throws OpenDataException { 180 return new CompositeType("predicates", "Predicates", new String[]{"predicate", "language", "matches"}, 181 new String[]{"Predicate", "Language", "Matches"}, 182 new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.LONG}); 183 } 184 185 public static TabularType loadbalancerExceptionsTabularType() throws OpenDataException { 186 CompositeType ct = loadbalancerExceptionsCompositeType(); 187 return new TabularType("exception", "Exception statistics", ct, new String[]{"exception"}); 188 } 189 190 public static CompositeType loadbalancerExceptionsCompositeType() throws OpenDataException { 191 return new CompositeType("exceptions", "Exceptions", new String[]{"exception", "failures"}, 192 new String[]{"Exception", "Failures"}, 193 new OpenType[]{SimpleType.STRING, SimpleType.LONG}); 194 } 195 196 public static TabularType endpointsUtilizationTabularType() throws OpenDataException { 197 CompositeType ct = endpointsUtilizationCompositeType(); 198 return new TabularType("endpointsUtilization", "Endpoint utilization statistics", ct, new String[]{"url"}); 199 } 200 201 public static CompositeType endpointsUtilizationCompositeType() throws OpenDataException { 202 return new CompositeType("endpoints", "Endpoints", new String[]{"url", "hits"}, 203 new String[]{"Url", "Hits"}, 204 new OpenType[]{SimpleType.STRING, SimpleType.LONG}); 205 } 206 207}