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    @ManagedOperation(description = "Adds or updates existing routes from XML")
195    void addOrUpdateRoutesFromXml(String xml) throws Exception;
196
197    @ManagedOperation(description = "Adds or updates existing routes from XML")
198    void addOrUpdateRoutesFromXml(String xml, boolean urlDecode) throws Exception;
199
200    @ManagedOperation(description = "Dumps the CamelContext and routes stats as XML")
201    String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception;
202
203    @ManagedOperation(description = "Dumps the CamelContext and routes and steps stats as XML")
204    String dumpStepStatsAsXml(boolean fullStats) throws Exception;
205
206    @ManagedOperation(description = "Dumps the routes coverage as XML")
207    String dumpRoutesCoverageAsXml() throws Exception;
208
209    @ManagedOperation(description = "Dumps the route templates as XML")
210    String dumpRouteTemplatesAsXml() throws Exception;
211
212    /**
213     * Creates the endpoint by the given uri
214     *
215     * @param  uri       uri of endpoint to create
216     * @return           <tt>true</tt> if a new endpoint was created, <tt>false</tt> if the endpoint already existed
217     * @throws Exception is thrown if error occurred
218     */
219    @ManagedOperation(description = "Creates the endpoint by the given URI")
220    boolean createEndpoint(String uri) throws Exception;
221
222    /**
223     * Removes the endpoint by the given pattern
224     *
225     * @param  pattern   the pattern
226     * @return           number of endpoints removed
227     * @throws Exception is thrown if error occurred
228     * @see              org.apache.camel.CamelContext#removeEndpoints(String)
229     */
230    @ManagedOperation(description = "Removes endpoints by the given pattern")
231    int removeEndpoints(String pattern) throws Exception;
232
233    /**
234     * Returns the JSON schema representation with information about the component and the endpoint parameters it
235     * supports
236     *
237     * @param  componentName the name of the component to lookup
238     * @throws Exception     is thrown if error occurred
239     */
240    @ManagedOperation(description = "Returns the JSON schema representation of the endpoint parameters for the given component name")
241    @Deprecated
242    String componentParameterJsonSchema(String componentName) throws Exception;
243
244    /**
245     * Returns the JSON schema representation with information about the data format and the parameters it supports
246     *
247     * @param  dataFormatName the name of the data format to lookup
248     * @throws Exception      is thrown if error occurred
249     */
250    @ManagedOperation(description = "Returns the JSON schema representation of the data format parameters for the given data format name")
251    @Deprecated
252    String dataFormatParameterJsonSchema(String dataFormatName) throws Exception;
253
254    /**
255     * Returns the JSON schema representation with information about the language and the parameters it supports
256     *
257     * @param  languageName the name of the language to lookup
258     * @throws Exception    is thrown if error occurred
259     */
260    @ManagedOperation(description = "Returns the JSON schema representation of the language parameters for the given language name")
261    @Deprecated
262    String languageParameterJsonSchema(String languageName) throws Exception;
263
264    /**
265     * Returns the JSON schema representation with information about the EIP and the parameters it supports
266     *
267     * @param  eipName   the name of the EIP to lookup
268     * @throws Exception is thrown if error occurred
269     */
270    @ManagedOperation(description = "Returns the JSON schema representation of the EIP parameters for the given EIP name")
271    @Deprecated
272    String eipParameterJsonSchema(String eipName) throws Exception;
273
274    /**
275     * Resets all the performance counters.
276     *
277     * @param  includeRoutes whether to reset all routes as well.
278     * @throws Exception     is thrown if error occurred
279     */
280    @ManagedOperation(description = "Reset counters")
281    void reset(boolean includeRoutes) throws Exception;
282
283}