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