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 java.io.IOException; 020import java.util.List; 021import java.util.Map; 022import java.util.Properties; 023import java.util.concurrent.TimeUnit; 024import javax.management.openmbean.TabularData; 025 026import org.apache.camel.api.management.ManagedAttribute; 027import org.apache.camel.api.management.ManagedOperation; 028 029public interface ManagedCamelContextMBean extends ManagedPerformanceCounterMBean { 030 031 @ManagedAttribute(description = "Camel ID") 032 String getCamelId(); 033 034 @ManagedAttribute(description = "Camel ManagementName") 035 String getManagementName(); 036 037 @ManagedAttribute(description = "Camel Version") 038 String getCamelVersion(); 039 040 @ManagedAttribute(description = "Camel State") 041 String getState(); 042 043 @ManagedAttribute(description = "Uptime [human readable text]") 044 String getUptime(); 045 046 @ManagedAttribute(description = "Uptime [milliseconds]") 047 long getUptimeMillis(); 048 049 @ManagedAttribute(description = "Camel Management StatisticsLevel") 050 String getManagementStatisticsLevel(); 051 052 @Deprecated 053 @ManagedAttribute(description = "Camel Properties") 054 Map<String, String> getProperties(); 055 056 @ManagedAttribute(description = "Camel Global Options") 057 Map<String, String> getGlobalOptions(); 058 059 @ManagedAttribute(description = "ClassResolver class name") 060 String getClassResolver(); 061 062 @ManagedAttribute(description = "PackageScanClassResolver class name") 063 String getPackageScanClassResolver(); 064 065 @ManagedAttribute(description = "ApplicationContext class name") 066 String getApplicationContextClassName(); 067 068 @ManagedAttribute(description = "HeadersMapFactory class name") 069 String getHeadersMapFactoryClassName(); 070 071 @Deprecated 072 @ManagedOperation(description = "Gets the value of a Camel global option") 073 String getProperty(String key) throws Exception; 074 075 /** 076 * Gets the value of a CamelContext global option 077 * 078 * @param key the global option key 079 * @return the global option value 080 * @throws Exception when an error occurred 081 */ 082 @ManagedOperation(description = "Gets the value of a Camel global option") 083 String getGlobalOption(String key) throws Exception; 084 085 @Deprecated 086 @ManagedOperation(description = "Sets the value of a Camel global option") 087 void setProperty(String key, String value) throws Exception; 088 089 /** 090 * Sets the value of a CamelContext property name 091 * 092 * @param key the global option key 093 * @param value the global option value 094 * @throws Exception when an error occurred 095 */ 096 @ManagedOperation(description = "Sets the value of a Camel global option") 097 void setGlobalOption(String key, String value) throws Exception; 098 099 @ManagedAttribute(description = "Tracing") 100 Boolean getTracing(); 101 102 @ManagedAttribute(description = "Tracing") 103 void setTracing(Boolean tracing); 104 105 /** 106 * @deprecated use {@link #getExchangesInflight()} 107 */ 108 @ManagedAttribute(description = "Current number of inflight Exchanges") 109 @Deprecated 110 Integer getInflightExchanges(); 111 112 @ManagedAttribute(description = "Total number of routes") 113 Integer getTotalRoutes(); 114 115 @ManagedAttribute(description = "Current number of started routes") 116 Integer getStartedRoutes(); 117 118 @ManagedAttribute(description = "Shutdown timeout") 119 void setTimeout(long timeout); 120 121 @ManagedAttribute(description = "Shutdown timeout") 122 long getTimeout(); 123 124 @ManagedAttribute(description = "Shutdown timeout time unit") 125 void setTimeUnit(TimeUnit timeUnit); 126 127 @ManagedAttribute(description = "Shutdown timeout time unit") 128 TimeUnit getTimeUnit(); 129 130 @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred") 131 void setShutdownNowOnTimeout(boolean shutdownNowOnTimeout); 132 133 @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred") 134 boolean isShutdownNowOnTimeout(); 135 136 @ManagedAttribute(description = "Average load over the last minute") 137 String getLoad01(); 138 139 @ManagedAttribute(description = "Average load over the last five minutes") 140 String getLoad05(); 141 142 @ManagedAttribute(description = "Average load over the last fifteen minutes") 143 String getLoad15(); 144 145 @ManagedAttribute(description = "Whether breadcrumbs is in use") 146 boolean isUseBreadcrumb(); 147 148 @ManagedAttribute(description = "Whether allowing access to the original message during routing") 149 boolean isAllowUseOriginalMessage(); 150 151 @ManagedAttribute(description = "Whether message history is enabled") 152 boolean isMessageHistory(); 153 154 @ManagedAttribute(description = "Whether security mask for Logging is enabled") 155 boolean isLogMask(); 156 157 @ManagedAttribute(description = "Whether MDC logging is supported") 158 boolean isUseMDCLogging(); 159 160 @ManagedAttribute(description = "Whether Message DataType is enabled") 161 boolean isUseDataType(); 162 163 @ManagedOperation(description = "Start Camel") 164 void start() throws Exception; 165 166 @ManagedOperation(description = "Stop Camel (shutdown)") 167 void stop() throws Exception; 168 169 @ManagedOperation(description = "Restart Camel (stop and then start)") 170 void restart() throws Exception; 171 172 @ManagedOperation(description = "Suspend Camel") 173 void suspend() throws Exception; 174 175 @ManagedOperation(description = "Resume Camel") 176 void resume() throws Exception; 177 178 @ManagedOperation(description = "Starts all the routes which currently is not started") 179 void startAllRoutes() throws Exception; 180 181 @ManagedOperation(description = "Whether its possible to send to the endpoint (eg the endpoint has a producer)") 182 boolean canSendToEndpoint(String endpointUri); 183 184 @ManagedOperation(description = "Send body (in only)") 185 void sendBody(String endpointUri, Object body) throws Exception; 186 187 @ManagedOperation(description = "Send body (String type) (in only)") 188 void sendStringBody(String endpointUri, String body) throws Exception; 189 190 @ManagedOperation(description = "Send body and headers (in only)") 191 void sendBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception; 192 193 @ManagedOperation(description = "Request body (in out)") 194 Object requestBody(String endpointUri, Object body) throws Exception; 195 196 @ManagedOperation(description = "Request body (String type) (in out)") 197 Object requestStringBody(String endpointUri, String body) throws Exception; 198 199 @ManagedOperation(description = "Request body and headers (in out)") 200 Object requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception; 201 202 @ManagedOperation(description = "Dumps the rests as XML") 203 String dumpRestsAsXml() throws Exception; 204 205 @ManagedOperation(description = "Dumps the rests as XML") 206 String dumpRestsAsXml(boolean resolvePlaceholders) throws Exception; 207 208 @ManagedOperation(description = "Dumps the routes as XML") 209 String dumpRoutesAsXml() throws Exception; 210 211 @ManagedOperation(description = "Dumps the routes as XML") 212 String dumpRoutesAsXml(boolean resolvePlaceholders) throws Exception; 213 214 @ManagedOperation(description = "Adds or updates existing routes from XML") 215 void addOrUpdateRoutesFromXml(String xml) throws Exception; 216 217 @ManagedOperation(description = "Adds or updates existing routes from XML") 218 void addOrUpdateRoutesFromXml(String xml, boolean urlDecode) throws Exception; 219 220 @ManagedOperation(description = "Dumps the CamelContext and routes stats as XML") 221 String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception; 222 223 @ManagedOperation(description = "Dumps the routes coverage as XML") 224 String dumpRoutesCoverageAsXml() throws Exception; 225 226 /** 227 * Creates the endpoint by the given uri 228 * 229 * @param uri uri of endpoint to create 230 * @return <tt>true</tt> if a new endpoint was created, <tt>false</tt> if the endpoint already existed 231 * @throws Exception is thrown if error occurred 232 */ 233 @ManagedOperation(description = "Creates the endpoint by the given URI") 234 boolean createEndpoint(String uri) throws Exception; 235 236 /** 237 * Removes the endpoint by the given pattern 238 * 239 * @param pattern the pattern 240 * @return number of endpoints removed 241 * @throws Exception is thrown if error occurred 242 * @see org.apache.camel.CamelContext#removeEndpoints(String) 243 */ 244 @ManagedOperation(description = "Removes endpoints by the given pattern") 245 int removeEndpoints(String pattern) throws Exception; 246 247 /** 248 * Find information about all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}. 249 * 250 * @return a map with the component name, and value with component details. 251 * @throws Exception is thrown if error occurred 252 */ 253 @ManagedOperation(description = "Find all Camel components available in the classpath") 254 Map<String, Properties> findComponents() throws Exception; 255 256 /** 257 * Find information about all the EIPs from camel-core. 258 * 259 * @return a map with node id, and value with EIP details. 260 * @throws Exception is thrown if error occurred 261 */ 262 @ManagedOperation(description = "Find all Camel EIPs from camel-core") 263 Map<String, Properties> findEips() throws Exception; 264 265 /** 266 * Find the names of all the EIPs from camel-core. 267 * 268 * @return a list with the names of the camel EIPs 269 * @throws Exception is thrown if error occurred 270 */ 271 @ManagedOperation(description = "Find all Camel EIP names from camel-core") 272 List<String> findEipNames() throws Exception; 273 274 /** 275 * Find the names of all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}. 276 * 277 * @return a list with the names of the camel components 278 * @throws Exception is thrown if error occurred 279 */ 280 @ManagedOperation(description = "Find all Camel components names available in the classpath") 281 List<String> findComponentNames() throws Exception; 282 283 /** 284 * Find information about all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}. 285 * 286 * @return a list with the data 287 * @throws Exception is thrown if error occurred 288 */ 289 @ManagedOperation(description = "List all Camel components available in the classpath") 290 TabularData listComponents() throws Exception; 291 292 /** 293 * Find information about all the EIPs from camel-core. 294 * 295 * @return a list with the data 296 * @throws Exception is thrown if error occurred 297 */ 298 @ManagedOperation(description = "List all Camel EIPs from camel-core") 299 TabularData listEips() throws Exception; 300 301 /** 302 * Returns the JSON schema representation with information about the component and the endpoint parameters it supports 303 * 304 * @param componentName the name of the component to lookup 305 * @throws Exception is thrown if error occurred 306 */ 307 @ManagedOperation(description = "Returns the JSON schema representation of the endpoint parameters for the given component name") 308 @Deprecated 309 String componentParameterJsonSchema(String componentName) throws Exception; 310 311 /** 312 * Returns the JSON schema representation with information about the data format and the parameters it supports 313 * 314 * @param dataFormatName the name of the data format to lookup 315 * @throws Exception is thrown if error occurred 316 */ 317 @ManagedOperation(description = "Returns the JSON schema representation of the data format parameters for the given data format name") 318 String dataFormatParameterJsonSchema(String dataFormatName) throws Exception; 319 320 /** 321 * Returns the JSON schema representation with information about the language and the parameters it supports 322 * 323 * @param languageName the name of the language to lookup 324 * @throws Exception is thrown if error occurred 325 */ 326 @ManagedOperation(description = "Returns the JSON schema representation of the language parameters for the given language name") 327 String languageParameterJsonSchema(String languageName) throws Exception; 328 329 /** 330 * Returns the JSON schema representation with information about the EIP and the parameters it supports 331 * 332 * @param eipName the name of the EIP to lookup 333 * @throws Exception is thrown if error occurred 334 */ 335 @ManagedOperation(description = "Returns the JSON schema representation of the EIP parameters for the given EIP name") 336 String eipParameterJsonSchema(String eipName) throws Exception; 337 338 /** 339 * Returns a JSON schema representation of the EIP parameters for the given EIP by its id. 340 * 341 * @param nameOrId the name of the EIP ({@link org.apache.camel.NamedNode#getShortName()} or a node id to refer to a specific node from the routes. 342 * @param includeAllOptions whether to include non configured options also (eg default options) 343 * @return the json or <tt>null</tt> if the eipName or the id was not found 344 */ 345 @ManagedOperation(description = "Returns a JSON schema representation of the EIP parameters for the given EIP by its id") 346 String explainEipJson(String nameOrId, boolean includeAllOptions); 347 348 /** 349 * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id. 350 * 351 * @param componentName the id of the component 352 * @param includeAllOptions whether to include non configured options also (eg default options) 353 */ 354 @ManagedOperation(description = " Returns a JSON schema representation of the component parameters for the given component by its id") 355 String explainComponentJson(String componentName, boolean includeAllOptions) throws Exception; 356 357 /** 358 * Returns a JSON schema representation of the endpoint parameters for the given endpoint uri 359 * 360 * @param uri the endpoint uri 361 * @param includeAllOptions whether to include non configured options also (eg default options) 362 */ 363 @ManagedOperation(description = " Returns a JSON schema representation of the endpoint parameters for the given endpoint uri") 364 String explainEndpointJson(String uri, boolean includeAllOptions) throws Exception; 365 366 /** 367 * Resets all the performance counters. 368 * 369 * @param includeRoutes whether to reset all routes as well. 370 * @throws Exception is thrown if error occurred 371 */ 372 @ManagedOperation(description = "Reset counters") 373 void reset(boolean includeRoutes) throws Exception; 374 375 /** 376 * Helper method for tooling which returns the completion list of the endpoint path 377 * from the given endpoint name, properties and current path expression. 378 * <p/> 379 * For example if using the file endpoint, this should complete a list of files (rather like bash completion) 380 * or for an ActiveMQ component this should complete the list of queues or topics. 381 * 382 * @param componentName the component name 383 * @param endpointParameters parameters of the endpoint 384 * @param completionText the entered text which we want to have completion suggestions for 385 * @throws Exception is thrown if error occurred 386 */ 387 @ManagedOperation(description = "Returns the list of available endpoint paths for the given component name, endpoint properties and completion text") 388 @Deprecated 389 List<String> completeEndpointPath(String componentName, Map<String, Object> endpointParameters, String completionText) throws Exception; 390 391 /** 392 * Returns the HTML documentation for the given camel component 393 * 394 * @param componentName the component name 395 * @deprecated use camel-catalog instead 396 */ 397 @ManagedOperation(description = "Returns the HTML documentation for the given camel component") 398 @Deprecated 399 String getComponentDocumentation(String componentName) throws IOException; 400 401 @ManagedOperation(description = "Returns the JSON representation of all the static and dynamic endpoints defined in all the routes") 402 String createRouteStaticEndpointJson(); 403 404 @ManagedOperation(description = "Returns the JSON representation of all the static endpoints (and possible dynamic) defined in all the routes") 405 String createRouteStaticEndpointJson(boolean includeDynamic); 406 407}