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