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