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