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