1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.classic.model.processor;
15  
16  import java.util.ArrayList;
17  import java.util.List;
18  
19  import ch.qos.logback.classic.PatternLayout;
20  import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
21  import ch.qos.logback.core.AppenderBase;
22  import ch.qos.logback.core.UnsynchronizedAppenderBase;
23  import ch.qos.logback.core.filter.EvaluatorFilter;
24  import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
25  import ch.qos.logback.core.joran.util.ParentTag_Tag_Class_Tuple;
26  import ch.qos.logback.core.net.ssl.SSLNestedComponentRegistryRules;
27  import ch.qos.logback.core.net.ssl.KeyManagerFactoryFactoryBean;
28  import ch.qos.logback.core.net.ssl.KeyStoreFactoryBean;
29  import ch.qos.logback.core.net.ssl.SSLConfiguration;
30  import ch.qos.logback.core.net.ssl.SSLParametersConfiguration;
31  import ch.qos.logback.core.net.ssl.SecureRandomFactoryBean;
32  import ch.qos.logback.core.net.ssl.TrustManagerFactoryFactoryBean;
33  
34  /**
35   * Contains mappings for the default type of nested components in
36   * logback-classic.
37   * 
38   * @author Ceki Gulcu
39   * 
40   */
41  public class LogbackClassicDefaultNestedComponentRules {
42  
43      static public List<ParentTag_Tag_Class_Tuple> TUPLES_LIST = createTuplesList();
44  
45      static public void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegistry registry) {
46          registry.add(AppenderBase.class, "layout", PatternLayout.class);
47          registry.add(UnsynchronizedAppenderBase.class, "layout", PatternLayout.class);
48  
49          registry.add(AppenderBase.class, "encoder", PatternLayoutEncoder.class);
50          registry.add(UnsynchronizedAppenderBase.class, "encoder", PatternLayoutEncoder.class);
51  
52          SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
53      }
54  
55      public static List<ParentTag_Tag_Class_Tuple> createTuplesList() {
56  
57          List<ParentTag_Tag_Class_Tuple> tupleList = new ArrayList<>();
58  
59          tupleList.add(new ParentTag_Tag_Class_Tuple("appender", "encoder", PatternLayoutEncoder.class.getName()));
60          tupleList.add(new ParentTag_Tag_Class_Tuple("appender", "layout", PatternLayout.class.getName()));
61          tupleList.add(new ParentTag_Tag_Class_Tuple("receiver", "ssl", SSLConfiguration.class.getName()));
62          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "parameters", SSLParametersConfiguration.class.getName()));
63          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "keyStore", KeyStoreFactoryBean.class.getName()));
64          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "trustStore", KeyManagerFactoryFactoryBean.class.getName()));
65          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "keyManagerFactory", SSLParametersConfiguration.class.getName()));
66          tupleList
67                  .add(new ParentTag_Tag_Class_Tuple("ssl", "trustManagerFactory", TrustManagerFactoryFactoryBean.class.getName()));
68          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "secureRandom", SecureRandomFactoryBean.class.getName()));
69          return tupleList;
70  
71      }
72  
73  
74  
75  }