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