View Javadoc
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.boolex.JaninoEventEvaluator;
21  import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
22  import ch.qos.logback.core.AppenderBase;
23  import ch.qos.logback.core.UnsynchronizedAppenderBase;
24  import ch.qos.logback.core.filter.EvaluatorFilter;
25  import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
26  import ch.qos.logback.core.joran.util.ParentTag_Tag_Class_Tuple;
27  import ch.qos.logback.core.net.ssl.SSLNestedComponentRegistryRules;
28  import ch.qos.logback.core.net.ssl.KeyManagerFactoryFactoryBean;
29  import ch.qos.logback.core.net.ssl.KeyStoreFactoryBean;
30  import ch.qos.logback.core.net.ssl.SSLConfiguration;
31  import ch.qos.logback.core.net.ssl.SSLParametersConfiguration;
32  import ch.qos.logback.core.net.ssl.SecureRandomFactoryBean;
33  import ch.qos.logback.core.net.ssl.TrustManagerFactoryFactoryBean;
34  
35  /**
36   * Contains mappings for the default type of nested components in
37   * logback-classic.
38   * 
39   * @author Ceki Gulcu
40   * 
41   */
42  public class LogbackClassicDefaultNestedComponentRules {
43  
44      static public List<ParentTag_Tag_Class_Tuple> TUPLES_LIST = createTuplesList();
45  
46      static public void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegistry registry) {
47          registry.add(AppenderBase.class, "layout", PatternLayout.class);
48          registry.add(UnsynchronizedAppenderBase.class, "layout", PatternLayout.class);
49  
50          registry.add(AppenderBase.class, "encoder", PatternLayoutEncoder.class);
51          registry.add(UnsynchronizedAppenderBase.class, "encoder", PatternLayoutEncoder.class);
52  
53          registry.add(EvaluatorFilter.class, "evaluator", JaninoEventEvaluator.class);
54  
55          SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
56      }
57  
58      public static List<ParentTag_Tag_Class_Tuple> createTuplesList() {
59  
60          List<ParentTag_Tag_Class_Tuple> tupleList = new ArrayList<>();
61  
62          tupleList.add(new ParentTag_Tag_Class_Tuple("appender", "encoder", PatternLayoutEncoder.class.getName()));
63          tupleList.add(new ParentTag_Tag_Class_Tuple("appender", "layout", PatternLayout.class.getName()));
64          tupleList.add(new ParentTag_Tag_Class_Tuple("receiver", "ssl", SSLConfiguration.class.getName()));
65          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "parameters", SSLParametersConfiguration.class.getName()));
66          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "keyStore", KeyStoreFactoryBean.class.getName()));
67          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "trustStore", KeyManagerFactoryFactoryBean.class.getName()));
68          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "keyManagerFactory", SSLParametersConfiguration.class.getName()));
69          tupleList
70                  .add(new ParentTag_Tag_Class_Tuple("ssl", "trustManagerFactory", TrustManagerFactoryFactoryBean.class.getName()));
71          tupleList.add(new ParentTag_Tag_Class_Tuple("ssl", "secureRandom", SecureRandomFactoryBean.class.getName()));
72          return tupleList;
73  
74      }
75  
76  
77  
78  }