001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.classic.model.processor;
015
016import java.util.ArrayList;
017import java.util.List;
018
019import ch.qos.logback.classic.PatternLayout;
020import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
021import ch.qos.logback.core.AppenderBase;
022import ch.qos.logback.core.UnsynchronizedAppenderBase;
023import ch.qos.logback.core.filter.EvaluatorFilter;
024import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
025import ch.qos.logback.core.joran.util.ParentTag_Tag_Class_Tuple;
026import ch.qos.logback.core.net.ssl.SSLNestedComponentRegistryRules;
027import ch.qos.logback.core.net.ssl.KeyManagerFactoryFactoryBean;
028import ch.qos.logback.core.net.ssl.KeyStoreFactoryBean;
029import ch.qos.logback.core.net.ssl.SSLConfiguration;
030import ch.qos.logback.core.net.ssl.SSLParametersConfiguration;
031import ch.qos.logback.core.net.ssl.SecureRandomFactoryBean;
032import ch.qos.logback.core.net.ssl.TrustManagerFactoryFactoryBean;
033
034/**
035 * Contains mappings for the default type of nested components in
036 * logback-classic.
037 * 
038 * @author Ceki Gulcu
039 * 
040 */
041public class LogbackClassicDefaultNestedComponentRules {
042
043    static public List<ParentTag_Tag_Class_Tuple> TUPLES_LIST = createTuplesList();
044
045    static public void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegistry registry) {
046        registry.add(AppenderBase.class, "layout", PatternLayout.class);
047        registry.add(UnsynchronizedAppenderBase.class, "layout", PatternLayout.class);
048
049        registry.add(AppenderBase.class, "encoder", PatternLayoutEncoder.class);
050        registry.add(UnsynchronizedAppenderBase.class, "encoder", PatternLayoutEncoder.class);
051
052        SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
053    }
054
055    public static List<ParentTag_Tag_Class_Tuple> createTuplesList() {
056
057        List<ParentTag_Tag_Class_Tuple> tupleList = new ArrayList<>();
058
059        tupleList.add(new ParentTag_Tag_Class_Tuple("appender", "encoder", PatternLayoutEncoder.class.getName()));
060        tupleList.add(new ParentTag_Tag_Class_Tuple("appender", "layout", PatternLayout.class.getName()));
061        tupleList.add(new ParentTag_Tag_Class_Tuple("receiver", "ssl", SSLConfiguration.class.getName()));
062        tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "parameters", SSLParametersConfiguration.class.getName()));
063        tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "keyStore", KeyStoreFactoryBean.class.getName()));
064        tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "trustStore", KeyManagerFactoryFactoryBean.class.getName()));
065        tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "keyManagerFactory", SSLParametersConfiguration.class.getName()));
066        tupleList
067                .add(new ParentTag_Tag_Class_Tuple("ssl", "trustManagerFactory", TrustManagerFactoryFactoryBean.class.getName()));
068        tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "secureRandom", SecureRandomFactoryBean.class.getName()));
069        return tupleList;
070
071    }
072
073
074
075}