Author: ceki
Date: Sun Aug 28 16:32:01 2005
New Revision: 222

Added:
   slf4j/trunk/src/filtered-java/org/slf4j/impl/
   slf4j/trunk/src/filtered-java/org/slf4j/impl/StaticBinder.java
      - copied, changed from r220, 
slf4j/trunk/src/filtered-java/org/slf4j/StaticBinder.java
   slf4j/trunk/src/java/org/slf4j/MarkerFactory.java
      - copied, changed from r220, 
slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java
   slf4j/trunk/src/java/org/slf4j/spi/MarkerFactoryBinder.java
Removed:
   slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java
   slf4j/trunk/src/filtered-java/org/slf4j/StaticBinder.java
Modified:
   slf4j/trunk/build.xml
   slf4j/trunk/src/java/org/slf4j/LoggerFactory.java
Log:
refactoring of bindings for Marker

Modified: slf4j/trunk/build.xml
==============================================================================
--- slf4j/trunk/build.xml       (original)
+++ slf4j/trunk/build.xml       Sun Aug 28 16:32:01 2005
@@ -91,8 +91,10 @@
            destdir="${tmp.javac.dest}"
            deprecation="on"
            includes="${SLF4J_STEM}/*.java,
-                    ${SLF4J_STEM}/impl/MessageFormatter.java, 
-                     ${SLF4J_STEM}/impl/${impl}*.java"
+                    ${SLF4J_STEM}/impl/MessageFormatter.java,
+                    ${SLF4J_STEM}/impl/Util.java
+                     ${SLF4J_STEM}/impl/${impl}*.java
+                    ${SLF4J_STEM}/spi/*.java"
               debug="${debug}">
     </javac>
        
@@ -110,7 +112,10 @@
        
     <jar jarfile="${jar-name}" basedir="${tmp.javac.dest}"
         includes="${SLF4J_STEM}/*.class, 
-                  ${SLF4J_STEM}/impl/MessageFormatter.class, 
+                 ${SLF4J_STEM}/spi/*.class,
+                  ${SLF4J_STEM}/impl/MessageFormatter.class,
+                 ${SLF4J_STEM}/impl/Util.class,
+                 ${SLF4J_STEM}/impl/*Binder.class,
                   ${SLF4J_STEM}/impl/${IMPL}*.class"
                 >
       <manifest>

Copied: slf4j/trunk/src/filtered-java/org/slf4j/impl/StaticBinder.java (from 
r220, slf4j/trunk/src/filtered-java/org/slf4j/StaticBinder.java)
==============================================================================
--- slf4j/trunk/src/filtered-java/org/slf4j/StaticBinder.java   (original)
+++ slf4j/trunk/src/filtered-java/org/slf4j/impl/StaticBinder.java      Sun Aug 
28 16:32:01 2005
@@ -31,16 +31,19 @@
  *
  */
 
-package org.slf4j;
+package org.slf4j.impl;
 
+import org.slf4j.ILoggerFactory;
+import org.slf4j.IMarkerFactory;
 import org.slf4j.spi.LoggerFactoryBinder;
+import org.slf4j.spi.MarkerFactoryBinder;
 
 //WARNING
 //WARNING Modifications MUST be made to the original file found at
 //WARNING $SLF4J_HOME/src/filtered-java/org/slf4j/StaticBinder.java
 //WARNING
 
-public class StaticBinder implements LoggerFactoryBinder {
+public class StaticBinder implements LoggerFactoryBinder, MarkerFactoryBinder {
 
   
   // 
@@ -51,9 +54,6 @@
   // Note: @IMPL@ gets substituted at build time by an appropriate Ant task
   String loggerFactoryClassStr ="[EMAIL PROTECTED]@LoggerFactory";
   
-  StaticBinder() {
-  }
-  
   // package private
   public ILoggerFactory getLoggerFactory() {
     // Note: @IMPL@ gets substituted at build time by an appropriate Ant task
@@ -64,4 +64,13 @@
     return loggerFactoryClassStr;
   }   
   
+  public IMarkerFactory getMarkerFactory() {
+    return new BasicMarkerFactory();
+  }
+  
+  public String getMarkerFactoryClassStr() {
+    return BasicMarkerFactory.class.getName();
+  }
+  
+  
 }

Modified: slf4j/trunk/src/java/org/slf4j/LoggerFactory.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/LoggerFactory.java   (original)
+++ slf4j/trunk/src/java/org/slf4j/LoggerFactory.java   Sun Aug 28 16:32:01 2005
@@ -32,6 +32,8 @@
  */
 package org.slf4j;
 
+
+import org.slf4j.impl.StaticBinder;
 import org.slf4j.impl.SystemPropBinder;
 import org.slf4j.impl.Util;
 
@@ -123,9 +125,4 @@
   public static ILoggerFactory getILoggerFactory() {
     return loggerFactory;
   }
-  
-  public static StaticBinder getStaticBinder() {
-    return staticBinder;
-  }
-  
 }

Copied: slf4j/trunk/src/java/org/slf4j/MarkerFactory.java (from r220, 
slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java)
==============================================================================
--- slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java  (original)
+++ slf4j/trunk/src/java/org/slf4j/MarkerFactory.java   Sun Aug 28 16:32:01 2005
@@ -31,6 +31,7 @@
  */
 package org.slf4j;
 
+import org.slf4j.impl.StaticBinder;
 import org.slf4j.impl.Util;
 
 // WARNING
@@ -52,7 +53,8 @@
  */
 public class MarkerFactory {
   static IMarkerFactory markerFactory;
-
+  static StaticBinder staticBinder = new StaticBinder();
+  
   private MarkerFactory() {      
   }
   
@@ -61,13 +63,13 @@
   //         $SLF4J_HOME/src/filtered-java/org/slf4j/
   //
   static {
-    String markerFactoryClassStr = "[EMAIL PROTECTED]@MarkerFactory";
+   
     try {
-      markerFactory = new [EMAIL PROTECTED]@MarkerFactory();
+      markerFactory = staticBinder.getMarkerFactory();
      } catch (Exception e) {
        // we should never get here
        Util.reportFailure(
-           "Could not instantiate instance of class [" + markerFactoryClassStr 
+ "]",
+           "Could not instantiate instance of class [" + 
staticBinder.getMarkerFactoryClassStr() + "]",
            e);
      }      
   }

Added: slf4j/trunk/src/java/org/slf4j/spi/MarkerFactoryBinder.java
==============================================================================
--- (empty file)
+++ slf4j/trunk/src/java/org/slf4j/spi/MarkerFactoryBinder.java Sun Aug 28 
16:32:01 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2004-2005 SLF4J.ORG
+ * Copyright (c) 2004-2005 QOS.ch
+ *
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to  deal in  the Software without  restriction, including
+ * without limitation  the rights to  use, copy, modify,  merge, publish,
+ * distribute, and/or sell copies of  the Software, and to permit persons
+ * to whom  the Software is furnished  to do so, provided  that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the  Software and  that both  the above  copyright notice(s)  and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
+ * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
+ * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as  contained in  this notice, the  name of a  copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
+ */
+
+package org.slf4j.spi;
+
+import org.slf4j.IMarkerFactory;
+
+
+/**
+ * An internal interface which helps the static [EMAIL PROTECTED] 
org.slf4j.MarkerFactory} 
+ * class bind with the appropriate [EMAIL PROTECTED] IMarkerFactory} instance. 
+ * 
+ * @author <a href="http://www.qos.ch/log4j/";>Ceki G&uuml;lc&uuml;</a>
+ */
+public interface MarkerFactoryBinder {
+
+  /**
+   * Return the instance of [EMAIL PROTECTED] IMarkerFactory} that 
+   * [EMAIL PROTECTED] org.slf4j.MarkerFactory} class should bind to.
+   * 
+   * @return the instance of [EMAIL PROTECTED] ILoggerFactory} that 
+   * [EMAIL PROTECTED] org.slf4j.LoggerFactory} class should bind to.
+   */
+  public IMarkerFactory getMarkerFactory();
+
+  /**
+   * The String form of the [EMAIL PROTECTED] IMarkerFactory} object that this 
+   * <code>MarkerFactoryBinder</code> instance is <em>intended</em> to return. 
+   * 
+   * <p>This method allows the developer to intterogate this binder's 
intention 
+   * which may be different from the [EMAIL PROTECTED] IMarkerFactory} 
instance it is able to 
+   * return. Such a discrepency should only occur in case of errors.
+   * 
+   * @return the class name of the intended [EMAIL PROTECTED] IMarkerFactory} 
instance
+   */
+  public String getMarkerFactoryClassStr();
+}
_______________________________________________
dev mailing list
dev@slf4j.org
http://slf4j.org/mailman/listinfo/dev

Reply via email to