[logback-dev] svn commit: r1177 - in logback/trunk: logback-access/src/main/java/ch/qos/logback/access logback-access/src/main/java/ch/qos/logback/access/db logback-access/src/main/java/ch/qos/logback/access/html logback-access/src/main/java/ch/qos/logback/access/jetty logback-access/src/main/java/ch/qos/logback/access/joran/action logback-access/src/main/java/ch/qos/logback/access/net logback-access/src/main/java/ch/qos/logback/access/tomcat logback-access/src/test/java/ch/qos/logback/access/jetty logback-classic logback-classic/src/main/java/ch/qos/logback/classic/db logback-core/src/main/java/ch/qos/logback/core/db

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Jan 8 23:37:21 CET 2007


Author: ceki
Date: Mon Jan  8 23:37:21 2007
New Revision: 1177

Removed:
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/AccessLayout.java
Modified:
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/joran/action/LayoutAction.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyTestSetup.java
   logback/trunk/logback-classic/pom.xml
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java

Log:
Updating logback-access for gererics.
Update DBAppenderBase and derived classes

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java	Mon Jan  8 23:37:21 2007
@@ -51,7 +51,7 @@
  * @author Ceki Gülcü
  * @author Sébastien Pennec
  */
-public class PatternLayout extends PatternLayoutBase implements AccessLayout {
+public class PatternLayout extends PatternLayoutBase<AccessEvent> {
 
   public static final Map<String, String> defaultConverterMap = new HashMap<String, String>();
 
@@ -157,10 +157,6 @@
     return writeLoopOnConverters(event);
   }
 
-  public String doLayout(Object o) {
-    return doLayout((AccessEvent) o);
-  }
-
   @Override
   public void start() {
     if (getPattern().equalsIgnoreCase(CLF_PATTERN_NAME)

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java	Mon Jan  8 23:37:21 2007
@@ -30,7 +30,7 @@
  * @author Ray DeCampo
  * @author S&eacute;bastien Pennec
  */
-public class DBAppender extends DBAppenderBase {
+public class DBAppender extends DBAppenderBase<AccessEvent> {
   protected static final String insertSQL;
   protected final String insertHeaderSQL = "INSERT INTO  access_event_header (event_id, header_key, header_value) VALUES (?, ?, ?)";
   protected static final Method GET_GENERATED_KEYS_METHOD; 

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java	Mon Jan  8 23:37:21 2007
@@ -12,10 +12,8 @@
 
 import java.util.Map;
 
-import ch.qos.logback.access.AccessLayout;
 import ch.qos.logback.access.PatternLayout;
 import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.access.html.DefaultCssBuilder;
 import ch.qos.logback.core.html.HTMLLayoutBase;
 import ch.qos.logback.core.html.NOPThrowableRenderer;
 import ch.qos.logback.core.pattern.Converter;
@@ -35,7 +33,7 @@
  * @author Ceki G&uuml;lc&uuml;
  * @author S&eacute;bastien Pennec
  */
-public class HTMLLayout extends HTMLLayoutBase implements AccessLayout {
+public class HTMLLayout extends HTMLLayoutBase<AccessEvent> {
 
   /**
    * Default pattern string for log output.
@@ -57,10 +55,6 @@
     return PatternLayout.defaultConverterMap;
   }
 
-  public String doLayout(Object event) {
-    return doLayout((AccessEvent) event);
-  }
-
   public String doLayout(AccessEvent event) {
     StringBuffer buf = new StringBuffer();
     handleTableClosing(buf);

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java	Mon Jan  8 23:37:21 2007
@@ -109,12 +109,12 @@
  * @author S&eacute;bastien Pennec
  */
 public class RequestLogImpl extends ContextBase implements RequestLog,
-    AppenderAttachable, FilterAttachable {
+    AppenderAttachable<AccessEvent>, FilterAttachable {
 
   public final static String DEFAULT_CONFIG_FILE = "etc" + File.separatorChar
       + "logback-access.xml";
 
-  AppenderAttachableImpl aai = new AppenderAttachableImpl();
+  AppenderAttachableImpl<AccessEvent> aai = new AppenderAttachableImpl<AccessEvent>();
   FilterAttachableImpl fai = new FilterAttachableImpl();
   String filename;
   boolean started = false;
@@ -207,7 +207,7 @@
     return false;
   }
 
-  public void addAppender(Appender newAppender) {
+  public void addAppender(Appender<AccessEvent> newAppender) {
     aai.addAppender(newAppender);
   }
 
@@ -215,7 +215,7 @@
     return aai.iteratorForAppenders();
   }
 
-  public Appender getAppender(String name) {
+  public Appender<AccessEvent> getAppender(String name) {
     return aai.getAppender(name);
   }
 

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/joran/action/LayoutAction.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/joran/action/LayoutAction.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/joran/action/LayoutAction.java	Mon Jan  8 23:37:21 2007
@@ -1,14 +1,10 @@
 package ch.qos.logback.access.joran.action;
 
-import ch.qos.logback.access.AccessLayout;
-import ch.qos.logback.core.Layout;
-import ch.qos.logback.core.joran.action.AbstractLayoutAction;
 
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.joran.action.AbstractLayoutAction;
 
-public class LayoutAction extends AbstractLayoutAction {
 
-  protected boolean isOfCorrectType(Layout layout) {
-    return (layout instanceof AccessLayout);
-  }
+public class LayoutAction extends AbstractLayoutAction<AccessEvent> {
 
 }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java	Mon Jan  8 23:37:21 2007
@@ -28,12 +28,12 @@
  * @author S&eacute;bastien Pennec
  * 
  */
-public class SMTPAppender extends SMTPAppenderBase {
+public class SMTPAppender extends SMTPAppenderBase<AccessEvent> {
 
   static final String DEFAULT_SUBJECT_PATTERN = "%m";
   
   private int bufferSize = 512;
-  protected CyclicBuffer cb = new CyclicBuffer(bufferSize);
+  protected CyclicBuffer<AccessEvent> cb = new CyclicBuffer<AccessEvent>(bufferSize);
 
   /**
    * The default constructor will instantiate the appender with a
@@ -55,9 +55,7 @@
    * Perform SMTPAppender specific appending actions, mainly adding the event to
    * a cyclic buffer.
    */
-  protected void subAppend(Object eventObject) {
-    AccessEvent event = (AccessEvent) eventObject;
-
+  protected void subAppend(AccessEvent event) {
     cb.add(event);
     // addInfo("Added event to the cyclic buffer: " + event.getMessage());
   }
@@ -67,7 +65,7 @@
     int len = cb.length();
     for (int i = 0; i < len; i++) {
       // sbuf.append(MimeUtility.encodeText(layout.format(cb.get())));
-      Object event = cb.get();
+      AccessEvent event = (AccessEvent) cb.get();
       sbuf.append(layout.doLayout(event));
     }
   }
@@ -92,7 +90,7 @@
   }
 
   @Override
-  protected Layout makeSubjectLayout(String subjectStr) {
+  protected Layout<AccessEvent> makeSubjectLayout(String subjectStr) {
     if(subjectStr == null) {
       subjectStr = DEFAULT_SUBJECT_PATTERN;
     }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java	Mon Jan  8 23:37:21 2007
@@ -28,7 +28,7 @@
  * 
  */
 
-public class SocketAppender extends SocketAppenderBase {
+public class SocketAppender extends SocketAppenderBase<AccessEvent> {
   
   public SocketAppender() {
   }
@@ -52,7 +52,7 @@
   }
   
   @Override
-  protected void postProcessEvent(Object event) {
+  protected void postProcessEvent(AccessEvent event) {
     AccessEvent ae = (AccessEvent)event;
     ae.prepareForDeferredProcessing();
   }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java	Mon Jan  8 23:37:21 2007
@@ -78,7 +78,7 @@
  * @author S&eacute;bastien Pennec
  */
 public class LogbackValve extends ValveBase implements Context,
-    AppenderAttachable, FilterAttachable {
+    AppenderAttachable<AccessEvent>, FilterAttachable {
 
   public final static String DEFAULT_CONFIG_FILE = "conf" + File.separatorChar
       + "logback-access.xml";
@@ -93,7 +93,7 @@
   Map<String, Object> objectMap = new HashMap<String, Object>();
   private FilterAttachableImpl fai = new FilterAttachableImpl();
 
-  AppenderAttachableImpl aai = new AppenderAttachableImpl();
+  AppenderAttachableImpl<AccessEvent> aai = new AppenderAttachableImpl<AccessEvent>();
   String filename;
   boolean started;
 
@@ -148,7 +148,7 @@
     started = false;
   }
 
-  public void addAppender(Appender newAppender) {
+  public void addAppender(Appender<AccessEvent> newAppender) {
     aai.addAppender(newAppender);
   }
 
@@ -156,7 +156,7 @@
     return aai.iteratorForAppenders();
   }
 
-  public Appender getAppender(String name) {
+  public Appender<AccessEvent> getAppender(String name) {
     return aai.getAppender(name);
   }
 

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyTestSetup.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyTestSetup.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyTestSetup.java	Mon Jan  8 23:37:21 2007
@@ -22,6 +22,7 @@
 import org.mortbay.util.ByteArrayISO8859Writer;
 
 import ch.qos.logback.access.PatternLayout;
+import ch.qos.logback.access.spi.AccessEvent;
 import ch.qos.logback.core.ConsoleAppender;
 import ch.qos.logback.core.read.ListAppender;
 
@@ -81,12 +82,12 @@
 
   private void buildContext() {
 
-    ListAppender appender = new ListAppender();
+    ListAppender<AccessEvent> appender = new ListAppender<AccessEvent>();
     appender.setContext(requestLogImpl);
     appender.setName("list");
     appender.start();
 
-    ConsoleAppender console = new ConsoleAppender();
+    ConsoleAppender<AccessEvent> console = new ConsoleAppender<AccessEvent>();
     console.setContext(requestLogImpl);
     console.setName("console");
     PatternLayout layout = new PatternLayout();

Modified: logback/trunk/logback-classic/pom.xml
==============================================================================
--- logback/trunk/logback-classic/pom.xml	(original)
+++ logback/trunk/logback-classic/pom.xml	Mon Jan  8 23:37:21 2007
@@ -62,7 +62,7 @@
 		<dependency>
 			<groupId>janino</groupId>
 			<artifactId>janino</artifactId>
-			<scope>provided</scope>
+			<version>2.4.3</version>
 		</dependency>
 		
 		<dependency>

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java	Mon Jan  8 23:37:21 2007
@@ -34,7 +34,7 @@
  * @author Ray DeCampo
  * @author S&eacute;bastien Pennec
  */
-public class DBAppender extends DBAppenderBase {
+public class DBAppender extends DBAppenderBase<LoggingEvent> {
   protected final String insertPropertiesSQL = "INSERT INTO  logging_event_property (event_id, mapped_key, mapped_value) VALUES (?, ?, ?)";
   protected final String insertExceptionSQL = "INSERT INTO  logging_event_exception (event_id, i, trace_line) VALUES (?, ?, ?)";
   protected static final String insertSQL;

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java	Mon Jan  8 23:37:21 2007
@@ -27,7 +27,7 @@
  * @author Ray DeCampo
  * @author S&eacute;bastien Pennec
  */
-public abstract class DBAppenderBase extends AppenderBase {
+public abstract class DBAppenderBase<E> extends AppenderBase<E> {
 
   protected ConnectionSource connectionSource;
   protected boolean cnxSupportsGetGeneratedKeys = false;
@@ -78,7 +78,7 @@
   }
 
   @Override
-  public void append(Object eventObject) {
+  public void append(E eventObject) {
     Connection connection = null;
     try {
       connection = connectionSource.getConnection();



More information about the logback-dev mailing list