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.util.Map; 020import java.util.concurrent.TimeUnit; 021 022import org.apache.camel.api.management.ManagedAttribute; 023import org.apache.camel.api.management.ManagedOperation; 024 025public interface ManagedCamelContextMBean extends ManagedPerformanceCounterMBean { 026 027 @ManagedAttribute(description = "Camel ID") 028 String getCamelId(); 029 030 @ManagedAttribute(description = "Camel ManagementName") 031 String getManagementName(); 032 033 @ManagedAttribute(description = "Camel Version") 034 String getCamelVersion(); 035 036 @ManagedAttribute(description = "Camel State") 037 String getState(); 038 039 @ManagedAttribute(description = "Uptime [human readable text]") 040 String getUptime(); 041 042 @ManagedAttribute(description = "Uptime [milliseconds]") 043 long getUptimeMillis(); 044 045 @ManagedAttribute(description = "Camel Management StatisticsLevel") 046 String getManagementStatisticsLevel(); 047 048 @ManagedAttribute(description = "Camel Global Options") 049 Map<String, String> getGlobalOptions(); 050 051 @ManagedAttribute(description = "ClassResolver class name") 052 String getClassResolver(); 053 054 @ManagedAttribute(description = "PackageScanClassResolver class name") 055 String getPackageScanClassResolver(); 056 057 @ManagedAttribute(description = "ApplicationContext class name") 058 String getApplicationContextClassName(); 059 060 @ManagedAttribute(description = "HeadersMapFactory class name") 061 String getHeadersMapFactoryClassName(); 062 063 /** 064 * Gets the value of a CamelContext global option 065 * 066 * @param key the global option key 067 * @return the global option value 068 * @throws Exception when an error occurred 069 */ 070 @ManagedOperation(description = "Gets the value of a Camel global option") 071 String getGlobalOption(String key) throws Exception; 072 073 /** 074 * Sets the value of a CamelContext property name 075 * 076 * @param key the global option key 077 * @param value the global option value 078 * @throws Exception when an error occurred 079 */ 080 @ManagedOperation(description = "Sets the value of a Camel global option") 081 void setGlobalOption(String key, String value) throws Exception; 082 083 @ManagedAttribute(description = "Tracing") 084 Boolean getTracing(); 085 086 @ManagedAttribute(description = "Tracing") 087 void setTracing(Boolean tracing); 088 089 @ManagedAttribute(description = "Total number of routes") 090 Integer getTotalRoutes(); 091 092 @ManagedAttribute(description = "Current number of started routes") 093 Integer getStartedRoutes(); 094 095 @ManagedAttribute(description = "Shutdown timeout") 096 void setTimeout(long timeout); 097 098 @ManagedAttribute(description = "Shutdown timeout") 099 long getTimeout(); 100 101 @ManagedAttribute(description = "Shutdown timeout time unit") 102 void setTimeUnit(TimeUnit timeUnit); 103 104 @ManagedAttribute(description = "Shutdown timeout time unit") 105 TimeUnit getTimeUnit(); 106 107 @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred") 108 void setShutdownNowOnTimeout(boolean shutdownNowOnTimeout); 109 110 @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred") 111 boolean isShutdownNowOnTimeout(); 112 113 @ManagedAttribute(description = "Average load over the last minute") 114 String getLoad01(); 115 116 @ManagedAttribute(description = "Average load over the last five minutes") 117 String getLoad05(); 118 119 @ManagedAttribute(description = "Average load over the last fifteen minutes") 120 String getLoad15(); 121 122 @ManagedAttribute(description = "Whether breadcrumbs is in use") 123 boolean isUseBreadcrumb(); 124 125 @ManagedAttribute(description = "Whether allowing access to the original message during routing") 126 boolean isAllowUseOriginalMessage(); 127 128 @ManagedAttribute(description = "Whether message history is enabled") 129 boolean isMessageHistory(); 130 131 @ManagedAttribute(description = "Whether security mask for Logging is enabled") 132 boolean isLogMask(); 133 134 @ManagedAttribute(description = "Whether MDC logging is supported") 135 boolean isUseMDCLogging(); 136 137 @ManagedAttribute(description = "Whether Message DataType is enabled") 138 boolean isUseDataType(); 139 140 @ManagedOperation(description = "Start Camel") 141 void start() throws Exception; 142 143 @ManagedOperation(description = "Stop Camel (shutdown)") 144 void stop() throws Exception; 145 146 @ManagedOperation(description = "Restart Camel (stop and then start)") 147 void restart() throws Exception; 148 149 @ManagedOperation(description = "Suspend Camel") 150 void suspend() throws Exception; 151 152 @ManagedOperation(description = "Resume Camel") 153 void resume() throws Exception; 154 155 @ManagedOperation(description = "Starts all the routes which currently is not started") 156 void startAllRoutes() throws Exception; 157 158 @ManagedOperation(description = "Whether its possible to send to the endpoint (eg the endpoint has a producer)") 159 boolean canSendToEndpoint(String endpointUri); 160 161 @ManagedOperation(description = "Send body (in only)") 162 void sendBody(String endpointUri, Object body) throws Exception; 163 164 @ManagedOperation(description = "Send body (String type) (in only)") 165 void sendStringBody(String endpointUri, String body) throws Exception; 166 167 @ManagedOperation(description = "Send body and headers (in only)") 168 void sendBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception; 169 170 @ManagedOperation(description = "Request body (in out)") 171 Object requestBody(String endpointUri, Object body) throws Exception; 172 173 @ManagedOperation(description = "Request body (String type) (in out)") 174 Object requestStringBody(String endpointUri, String body) throws Exception; 175 176 @ManagedOperation(description = "Request body and headers (in out)") 177 Object requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception; 178 179 @ManagedOperation(description = "Dumps the rests as XML") 180 String dumpRestsAsXml() throws Exception; 181 182 @ManagedOperation(description = "Dumps the rests as XML") 183 String dumpRestsAsXml(boolean resolvePlaceholders) throws Exception; 184 185 @ManagedOperation(description = "Dumps the routes as XML") 186 String dumpRoutesAsXml() throws Exception; 187 188 @ManagedOperation(description = "Dumps the routes as XML") 189 String dumpRoutesAsXml(boolean resolvePlaceholders) throws Exception; 190 191 @ManagedOperation(description = "Dumps the routes as XML") 192 String dumpRoutesAsXml(boolean resolvePlaceholders, boolean resolveDelegateEndpoints) throws Exception; 193 194 @Deprecated 195 @ManagedOperation(description = "Adds or updates existing routes from XML") 196 void addOrUpdateRoutesFromXml(String xml) throws Exception; 197 198 @Deprecated 199 @ManagedOperation(description = "Adds or updates existing routes from XML") 200 void addOrUpdateRoutesFromXml(String xml, boolean urlDecode) throws Exception; 201 202 @ManagedOperation(description = "Dumps the CamelContext and routes stats as XML") 203 String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception; 204 205 @ManagedOperation(description = "Dumps the CamelContext and routes and steps stats as XML") 206 String dumpStepStatsAsXml(boolean fullStats) throws Exception; 207 208 @ManagedOperation(description = "Dumps the routes coverage as XML") 209 String dumpRoutesCoverageAsXml() throws Exception; 210 211 @ManagedOperation(description = "Dumps the route templates as XML") 212 String dumpRouteTemplatesAsXml() throws Exception; 213 214 /** 215 * Creates the endpoint by the given uri 216 * 217 * @param uri uri of endpoint to create 218 * @return <tt>true</tt> if a new endpoint was created, <tt>false</tt> if the endpoint already existed 219 * @throws Exception is thrown if error occurred 220 */ 221 @ManagedOperation(description = "Creates the endpoint by the given URI") 222 boolean createEndpoint(String uri) throws Exception; 223 224 /** 225 * Removes the endpoint by the given pattern 226 * 227 * @param pattern the pattern 228 * @return number of endpoints removed 229 * @throws Exception is thrown if error occurred 230 * @see org.apache.camel.CamelContext#removeEndpoints(String) 231 */ 232 @ManagedOperation(description = "Removes endpoints by the given pattern") 233 int removeEndpoints(String pattern) throws Exception; 234 235 /** 236 * Returns the JSON schema representation with information about the component and the endpoint parameters it 237 * supports 238 * 239 * @param componentName the name of the component to lookup 240 * @throws Exception is thrown if error occurred 241 */ 242 @ManagedOperation(description = "Returns the JSON schema representation of the endpoint parameters for the given component name") 243 @Deprecated 244 String componentParameterJsonSchema(String componentName) throws Exception; 245 246 /** 247 * Returns the JSON schema representation with information about the data format and the parameters it supports 248 * 249 * @param dataFormatName the name of the data format to lookup 250 * @throws Exception is thrown if error occurred 251 */ 252 @ManagedOperation(description = "Returns the JSON schema representation of the data format parameters for the given data format name") 253 @Deprecated 254 String dataFormatParameterJsonSchema(String dataFormatName) throws Exception; 255 256 /** 257 * Returns the JSON schema representation with information about the language and the parameters it supports 258 * 259 * @param languageName the name of the language to lookup 260 * @throws Exception is thrown if error occurred 261 */ 262 @ManagedOperation(description = "Returns the JSON schema representation of the language parameters for the given language name") 263 @Deprecated 264 String languageParameterJsonSchema(String languageName) throws Exception; 265 266 /** 267 * Returns the JSON schema representation with information about the EIP and the parameters it supports 268 * 269 * @param eipName the name of the EIP to lookup 270 * @throws Exception is thrown if error occurred 271 */ 272 @ManagedOperation(description = "Returns the JSON schema representation of the EIP parameters for the given EIP name") 273 @Deprecated 274 String eipParameterJsonSchema(String eipName) throws Exception; 275 276 /** 277 * Resets all the performance counters. 278 * 279 * @param includeRoutes whether to reset all routes as well. 280 * @throws Exception is thrown if error occurred 281 */ 282 @ManagedOperation(description = "Reset counters") 283 void reset(boolean includeRoutes) throws Exception; 284 285}