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.logging.log4j.core.config;
018    
019    import org.apache.logging.log4j.core.Appender;
020    import org.apache.logging.log4j.core.Filter;
021    import org.apache.logging.log4j.core.LogEvent;
022    import org.apache.logging.log4j.core.Logger;
023    import org.apache.logging.log4j.core.filter.Filterable;
024    import org.apache.logging.log4j.core.lookup.StrSubstitutor;
025    import org.apache.logging.log4j.core.net.Advertiser;
026    
027    import java.util.Map;
028    
029    /**
030     * Interface that must be implemented to create a configuration.
031     */
032    public interface Configuration extends Filterable {
033    
034        /** Key for storing the Context properties. */
035        String CONTEXT_PROPERTIES = "ContextProperties";
036    
037        /**
038         * Returns the configuration name.
039         * @return the name of the configuration.
040         */
041        String getName();
042    
043        /**
044         * Locates the appropriate LoggerConfig for a Logger name. This will remove tokens from the
045         * package name as necessary or return the root LoggerConfig if no other matches were found.
046         * @param name The Logger name.
047         * @return The located LoggerConfig.
048         */
049        LoggerConfig getLoggerConfig(String name);
050    
051        /**
052         * Returns a Map containing all the Appenders and their name.
053         * @return A Map containing each Appender's name and the Appender object.
054         */
055        Map<String, Appender<?>> getAppenders();
056    
057        Map<String, LoggerConfig> getLoggers();
058    
059        void addLoggerAppender(Logger logger, Appender<?> appender);
060    
061        void addLoggerFilter(Logger logger, Filter filter);
062    
063        void setLoggerAdditive(Logger logger, boolean additive);
064    
065        Map<String, String> getProperties();
066    
067        void start();
068    
069        void stop();
070    
071        void addListener(ConfigurationListener listener);
072    
073        void removeListener(ConfigurationListener listener);
074    
075        StrSubstitutor getSubst();
076    
077        void createConfiguration(Node node, LogEvent event);
078    
079        Object getComponent(String name);
080    
081        void addComponent(String name, Object object);
082    
083        void setConfigurationMonitor(ConfigurationMonitor monitor);
084        
085        ConfigurationMonitor getConfigurationMonitor();
086        
087        void setAdvertiser(Advertiser advertiser);
088        
089        Advertiser getAdvertiser();
090    }