[logback-dev] svn commit: r1935 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic logback-classic/src/main/java/ch/qos/logback/classic/turbo logback-classic/src/main/java/org/slf4j/impl logback-classic/src/test/java/ch/qos/logback/classic logback-classic/src/test/java/ch/qos/logback/classic/joran logback-core/src/main/java/ch/qos/logback/core/joran/action logback-core/src/test/java/ch/qos/logback/core/appender

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Nov 3 20:56:00 CET 2008


Author: ceki
Date: Mon Nov  3 20:56:00 2008
New Revision: 1935

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
   logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java
   logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/NOPAppender.java

Log:

Related to LBCLASSIC-54

Mopping up refactoring of turbo filters




Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java	Mon Nov  3 20:56:00 2008
@@ -59,14 +59,10 @@
   private Hashtable<String, Logger> loggerCache;
 
   private LoggerContextRemoteView loggerContextRemoteView;
-  private final TurboFilterList turboFilterAI = new TurboFilterList();
+  private final TurboFilterList turboFilterList = new TurboFilterList();
 
   boolean started = false;
 
-  public TurboFilterList getTurboFilterAI() {
-    return turboFilterAI;
-  }
-  
   public LoggerContext() {
     super();
     this.loggerCache = new Hashtable<String, Logger>();
@@ -208,41 +204,45 @@
     }
   }
 
+  public TurboFilterList getTurboFilterList() {
+    return turboFilterList;
+  }
+  
   public void addTurboFilter(TurboFilter newFilter) {
-    turboFilterAI.add(newFilter);
+    turboFilterList.add(newFilter);
   }
 
   public void clearAllTurboFilters() {
-    turboFilterAI.clear();
+    turboFilterList.clear();
   }
 
-  final public FilterReply getTurboFilterChainDecision_0_3OrMore(final Marker marker,
+  final FilterReply getTurboFilterChainDecision_0_3OrMore(final Marker marker,
       final Logger logger, final Level level, final String format,
       final Object[] params, final Throwable t) {
-    if (turboFilterAI.size() == 0) {
+    if (turboFilterList.size() == 0) {
       return FilterReply.NEUTRAL;
     }
-    return turboFilterAI.getTurboFilterChainDecision(marker, logger, level,
+    return turboFilterList.getTurboFilterChainDecision(marker, logger, level,
         format, params, t);
   }
 
-  final public FilterReply getTurboFilterChainDecision_1(final Marker marker,
+  final FilterReply getTurboFilterChainDecision_1(final Marker marker,
       final Logger logger, final Level level, final String format,
       final Object param, final Throwable t) {
-    if (turboFilterAI.size() == 0) {
+    if (turboFilterList.size() == 0) {
       return FilterReply.NEUTRAL;
     }
-    return turboFilterAI.getTurboFilterChainDecision(marker, logger, level,
+    return turboFilterList.getTurboFilterChainDecision(marker, logger, level,
         format, new Object[] { param }, t);
   }
 
-  final public FilterReply getTurboFilterChainDecision_2(final Marker marker,
+  final FilterReply getTurboFilterChainDecision_2(final Marker marker,
       final Logger logger, final Level level, final String format,
       final Object param1, final Object param2, final Throwable t) {
-    if (turboFilterAI.size() == 0) {
+    if (turboFilterList.size() == 0) {
       return FilterReply.NEUTRAL;
     }
-    return turboFilterAI.getTurboFilterChainDecision(marker, logger, level,
+    return turboFilterList.getTurboFilterChainDecision(marker, logger, level,
         format, new Object[] { param1, param2 }, t);
   }
 

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java	Mon Nov  3 20:56:00 2008
@@ -32,12 +32,7 @@
   private String name;
   boolean start = false;  
  
-  
-  /**
-   * Points to the next filter in the filter chain.
-   */
-  private TurboFilter turboNext;
-
+ 
   /**
    * Make a decision based on the multiple parameters passed as arguments.
    * The returned value should be one of <code>{@link FilterReply#DENY}</code>, 
@@ -65,20 +60,8 @@
   public void stop() {
     this.start = false;
   }
-  /**
-   * Set the next filter pointer.
-   */
-  public void setNext(TurboFilter next) {
-    this.turboNext = next;
-  }
 
-  /**
-   * Return the pointer to the next filter;
-   */
-  public TurboFilter getNext() {
-    return turboNext;
-  }
-  
+
   public String getName() {
     return name;
   }

Modified: logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java	(original)
+++ logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java	Mon Nov  3 20:56:00 2008
@@ -99,7 +99,7 @@
       throws ClassNotFoundException, SecurityException, NoSuchMethodException,
       IllegalArgumentException, InstantiationException, IllegalAccessException,
       InvocationTargetException {
-    Class contextSelectorClass = Loader.loadClass(contextSelectorStr);
+    Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
     Constructor cons = contextSelectorClass
         .getConstructor(new Class[] { LoggerContext.class });
     return (ContextSelector) cons.newInstance(defaultLoggerContext);

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/TurboFilteringInLoggerTest.java	Mon Nov  3 20:56:00 2008
@@ -133,9 +133,9 @@
 
   public void testLoggingContextShutdownAndReset() {
     addYesFilter();
-    assertNotNull(context.getTurboFilterAI().get(0));
+    assertNotNull(context.getTurboFilterList().get(0));
     context.shutdownAndReset();
-    assertEquals(0, context.getTurboFilterAI().size());
+    assertEquals(0, context.getTurboFilterList().size());
   }
   
 }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java	Mon Nov  3 20:56:00 2008
@@ -99,7 +99,7 @@
     // and place the relevant object correctly.
     configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/turbo.xml");
 
-    TurboFilter filter = loggerContext.getTurboFilterAI().get(0);
+    TurboFilter filter = loggerContext.getTurboFilterList().get(0);
     assertTrue(filter instanceof NOPTurboFilter);
   }
 
@@ -113,7 +113,7 @@
 
     // StatusPrinter.print(loggerContext.getStatusManager());
 
-    TurboFilter filter = loggerContext.getTurboFilterAI().get(0);
+    TurboFilter filter = loggerContext.getTurboFilterList().get(0);
     assertTrue(filter instanceof DebugUsersTurboFilter);
     DebugUsersTurboFilter dutf = (DebugUsersTurboFilter) filter;
     assertEquals(2, dutf.getUsers().size());

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java	Mon Nov  3 20:56:00 2008
@@ -37,7 +37,7 @@
 
   static final String RESOURCE_ATTRIBUTE = "resource";
 
-  static String INVALID_ATTRIBUTES = "In <substitutionProperty> element, either the \"file\" attribute alone, or "
+  static String INVALID_ATTRIBUTES = "In <property> element, either the \"file\" attribute alone, or "
       + "the \"resource\" element alone, or both the \"name\" and \"value\" attributes must be set.";
 
   /**

Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/NOPAppender.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/NOPAppender.java	(original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/NOPAppender.java	Mon Nov  3 20:56:00 2008
@@ -2,10 +2,10 @@
 
 import ch.qos.logback.core.AppenderBase;
 
-public class NOPAppender<E> extends AppenderBase<E> {
+final public class NOPAppender<E> extends AppenderBase<E> {
 
   @Override
-  protected void append(E eventObject) {
+  final protected void append(E eventObject) {
   }
 }
  
\ No newline at end of file


More information about the logback-dev mailing list