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     */
017    package org.apache.camel.api.management.mbean;
018    
019    import java.util.Map;
020    import java.util.Properties;
021    import java.util.concurrent.TimeUnit;
022    
023    import org.apache.camel.api.management.ManagedAttribute;
024    import org.apache.camel.api.management.ManagedOperation;
025    
026    public interface ManagedCamelContextMBean extends ManagedPerformanceCounterMBean {
027    
028        @ManagedAttribute(description = "Camel ID")
029        String getCamelId();
030    
031        @ManagedAttribute(description = "Camel Management Name")
032        String getManagementName();
033    
034        @ManagedAttribute(description = "Camel Version")
035        String getCamelVersion();
036    
037        @ManagedAttribute(description = "Camel State")
038        String getState();
039    
040        @ManagedAttribute(description = "Uptime")
041        String getUptime();
042    
043        @ManagedAttribute(description = "Camel Properties")
044        Map<String, String> getProperties();
045    
046        @ManagedAttribute(description = "Tracing")
047        Boolean getTracing();
048    
049        @ManagedAttribute(description = "Tracing")
050        void setTracing(Boolean tracing);
051    
052        @ManagedAttribute(description = "Current number of inflight Exchanges")
053        Integer getInflightExchanges();
054    
055        @ManagedAttribute(description = "Shutdown timeout")
056        void setTimeout(long timeout);
057    
058        @ManagedAttribute(description = "Shutdown timeout")
059        long getTimeout();
060    
061        @ManagedAttribute(description = "Shutdown timeout time unit")
062        void setTimeUnit(TimeUnit timeUnit);
063    
064        @ManagedAttribute(description = "Shutdown timeout time unit")
065        TimeUnit getTimeUnit();
066    
067        @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred")
068        void setShutdownNowOnTimeout(boolean shutdownNowOnTimeout);
069    
070        @ManagedAttribute(description = "Whether to force shutdown now when a timeout occurred")
071        boolean isShutdownNowOnTimeout();
072    
073        @ManagedAttribute(description = "Average load over the last minute")
074        String getLoad01();
075    
076        @ManagedAttribute(description = "Average load over the last five minutes")
077        String getLoad05();
078    
079        @ManagedAttribute(description = "Average load over the last fifteen minutes")
080        String getLoad15();
081    
082        @ManagedOperation(description = "Start Camel")
083        void start() throws Exception;
084    
085        @ManagedOperation(description = "Stop Camel (shutdown)")
086        void stop() throws Exception;
087    
088        @ManagedOperation(description = "Suspend Camel")
089        void suspend() throws Exception;
090    
091        @ManagedOperation(description = "Resume Camel")
092        void resume() throws Exception;
093    
094        @ManagedOperation(description = "Send body (in only)")
095        void sendBody(String endpointUri, Object body) throws Exception;
096    
097        @ManagedOperation(description = "Send body (String type) (in only)")
098        void sendStringBody(String endpointUri, String body) throws Exception;
099    
100        @ManagedOperation(description = "Send body and headers (in only)")
101        void sendBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception;
102    
103        @ManagedOperation(description = "Request body (in out)")
104        Object requestBody(String endpointUri, Object body) throws Exception;
105    
106        @ManagedOperation(description = "Request body (String type) (in out)")
107        Object requestStringBody(String endpointUri, String body) throws Exception;
108    
109        @ManagedOperation(description = "Request body and headers (in out)")
110        Object requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws Exception;
111    
112        @ManagedOperation(description = "Dumps the routes as XML")
113        String dumpRoutesAsXml() throws Exception;
114    
115        @ManagedOperation(description = "Adds or updates existing routes from XML")
116        void addOrUpdateRoutesFromXml(String xml) throws Exception;
117    
118        @ManagedOperation(description = "Dumps the routes stats as XML")
119        String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception;
120    
121        /**
122         * Creates the endpoint by the given uri
123         *
124         * @param uri uri of endpoint to create
125         * @return <tt>true</tt> if a new endpoint was created, <tt>false</tt> if the endpoint already existed
126         * @throws Exception is thrown if error occurred
127         */
128        @ManagedOperation(description = "Creates the endpoint by the given URI")
129        boolean createEndpoint(String uri) throws Exception;
130    
131        /**
132         * Removes the endpoint by the given pattern
133         *
134         * @param pattern the pattern
135         * @return number of endpoints removed
136         * @throws Exception is thrown if error occurred
137         * @see org.apache.camel.CamelContext#removeEndpoints(String)
138         */
139        @ManagedOperation(description = "Removes endpoints by the given pattern")
140        int removeEndpoints(String pattern) throws Exception;
141    
142        /**
143         * Find information about all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}.
144         *
145         * @return a map with the component name, and value with component details.
146         * @throws Exception is thrown if error occurred
147         */
148        @ManagedOperation(description = "Find all Camel components available in the classpath")
149        Map<String, Properties> findComponents() throws Exception;
150    
151    }