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.spi;
018    
019    import java.util.List;
020    
021    import org.apache.camel.ManagementStatisticsLevel;
022    import org.apache.camel.Service;
023    import org.apache.camel.model.ProcessorDefinition;
024    
025    /**
026     * Strategy for management.
027     * <p/>
028     * This is totally pluggable allowing to use a custom or 3rd party management implementation with Camel.
029     *
030     * @see org.apache.camel.spi.EventNotifier
031     * @see org.apache.camel.spi.EventFactory
032     * @see org.apache.camel.spi.ManagementNamingStrategy
033     * @see org.apache.camel.spi.ManagementAgent
034     * @version $Revision: 898746 $
035     */
036    public interface ManagementStrategy extends org.fusesource.commons.management.ManagementStrategy, Service {
037    
038        /**
039         * Gets the event notifiers.
040         *
041         * @return event notifiers
042         */
043        List<EventNotifier> getEventNotifiers();
044    
045        /**
046         * Sets the list of event notifier to use.
047         *
048         * @param eventNotifier list of event notifiers
049         */
050        void setEventNotifiers(List<EventNotifier> eventNotifier);
051    
052        /**
053         * Adds the event notifier to use.
054         *
055         * @param eventNotifier event notifier
056         */
057        void addEventNotifier(EventNotifier eventNotifier);
058    
059        /**
060         * Gets the event factory
061         *
062         * @return event factory
063         */
064        EventFactory getEventFactory();
065    
066        /**
067         * Sets the event factory to use
068         *
069         * @param eventFactory event factory
070         */
071        void setEventFactory(EventFactory eventFactory);
072    
073        /**
074         * Gets the naming strategy to use
075         *
076         * @return naming strategy
077         */
078        ManagementNamingStrategy getManagementNamingStrategy();
079    
080        /**
081         * Sets the naming strategy to use
082         *
083         * @param strategy naming strategy
084         */
085        void setManagementNamingStrategy(ManagementNamingStrategy strategy);
086    
087        /**
088         * Gets the management agent
089         *
090         * @return management agent
091         */
092        ManagementAgent getManagementAgent();
093    
094        /**
095         * Sets the management agent to use
096         *
097         * @param managementAgent management agent
098         */
099        void setManagementAgent(ManagementAgent managementAgent);
100    
101        /**
102         * Filter whether the processor should be managed or not.
103         * <p/>
104         * Is used to filter out unwanted processors to avoid managing at too fine grained level.
105         *
106         * @param definition definition of the processor
107         * @return <tt>true</tt> to manage it
108         */
109        boolean manageProcessor(ProcessorDefinition<?> definition);
110    
111        /**
112         * Sets the whether only manage processors if they have been configured with a custom id
113         * <p/>
114         * Default is false.
115         *
116         * @param flag <tt>true</tt> will only manage if custom id was set.
117         */
118        void onlyManageProcessorWithCustomId(boolean flag);
119    
120        /**
121         * Checks whether only to manage processors if they have been configured with a custom id
122         *
123         * @return true or false
124         */
125        boolean isOnlyManageProcessorWithCustomId();
126    
127        /**
128         * Sets the statistics level
129         * <p/>
130         * Default is {@link org.apache.camel.ManagementStatisticsLevel#All}
131         *
132         * @param level the new level
133         */
134        void setStatisticsLevel(ManagementStatisticsLevel level);
135    
136        /**
137         * Gets the statistics level
138         *
139         * @return the level
140         */
141        ManagementStatisticsLevel getStatisticsLevel();
142    }