[slf4j-dev] svn commit: r222 - in slf4j/trunk: . src/filtered-java/org/slf4j src/filtered-java/org/slf4j/impl src/java/org/slf4j src/java/org/slf4j/spi
ceki at slf4j.org
ceki at slf4j.org
Sun Aug 28 16:32:02 CEST 2005
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 ="org.slf4j.impl. at IMPL@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 = "org.slf4j.impl. at MARKER_FACTORY_IMPL_PREFIX@MarkerFactory";
+
try {
- markerFactory = new org.slf4j.impl. at MARKER_FACTORY_IMPL_PREFIX@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 {@link org.slf4j.MarkerFactory}
+ * class bind with the appropriate {@link IMarkerFactory} instance.
+ *
+ * @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a>
+ */
+public interface MarkerFactoryBinder {
+
+ /**
+ * Return the instance of {@link IMarkerFactory} that
+ * {@link org.slf4j.MarkerFactory} class should bind to.
+ *
+ * @return the instance of {@link ILoggerFactory} that
+ * {@link org.slf4j.LoggerFactory} class should bind to.
+ */
+ public IMarkerFactory getMarkerFactory();
+
+ /**
+ * The String form of the {@link 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 {@link IMarkerFactory} instance it is able to
+ * return. Such a discrepency should only occur in case of errors.
+ *
+ * @return the class name of the intended {@link IMarkerFactory} instance
+ */
+ public String getMarkerFactoryClassStr();
+}
More information about the slf4j-dev
mailing list