commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r628082 - in /commons/proper/configuration/branches/configuration2_experimental: ./ src/main/java/org/apache/commons/configuration2/ src/main/java/org/apache/commons/configuration2/beanutils/ src/main/java/org/apache/commons/configuration2/...
Date Fri, 15 Feb 2008 15:12:38 GMT
Author: ebourg
Date: Fri Feb 15 07:12:37 2008
New Revision: 628082

URL: http://svn.apache.org/viewvc?rev=628082&view=rev
Log:
Removed the direct dependency on Commons Logging, the java.util.logging API is used instead

Modified:
    commons/proper/configuration/branches/configuration2_experimental/build.xml
    commons/proper/configuration/branches/configuration2_experimental/gump.xml
    commons/proper/configuration/branches/configuration2_experimental/pom.xml
    commons/proper/configuration/branches/configuration2_experimental/project.xml
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DatabaseConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaClass.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/interpol/ConstantLookup.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/ManagedReloadingStrategy.java
    commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
    commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
    commons/proper/configuration/branches/configuration2_experimental/xdocs/dependencies.xml

Modified: commons/proper/configuration/branches/configuration2_experimental/build.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/build.xml?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/build.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/build.xml Fri Feb 15
07:12:37 2008
@@ -229,8 +229,6 @@
     </setproxy>
     <get dest="${libdir}/commons-lang-2.3.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.3.jar">
     </get>
-    <get dest="${libdir}/commons-logging-1.1.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.1.jar">
-    </get>
     <get dest="${libdir}/commons-digester-1.8.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-digester/jars/commons-digester-1.8.jar">
     </get>
     <get dest="${libdir}/commons-beanutils-core-1.7.0.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-beanutils/jars/commons-beanutils-core-1.7.0.jar">

Modified: commons/proper/configuration/branches/configuration2_experimental/gump.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/gump.xml?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/gump.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/gump.xml Fri Feb 15
07:12:37 2008
@@ -18,8 +18,6 @@
     </depend>
     <depend project="commons-lang">
     </depend>
-    <depend project="commons-logging">
-    </depend>
     <depend project="commons-codec">
     </depend>
     <depend project="dom4j">

Modified: commons/proper/configuration/branches/configuration2_experimental/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/pom.xml?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/pom.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/pom.xml Fri Feb 15 07:12:37
2008
@@ -197,22 +197,6 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-      <version>1.1</version>
-      <exclusions>
-        <exclusion>
-            <groupId>logkit</groupId>
-            <artifactId>logkit</artifactId>
-        </exclusion>
-        <exclusion>
-            <groupId>avalon-framework</groupId>
-            <artifactId>avalon-framework</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
      <groupId>commons-digester</groupId>
       <artifactId>commons-digester</artifactId>
       <version>1.8</version>

Modified: commons/proper/configuration/branches/configuration2_experimental/project.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/project.xml?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/project.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/project.xml Fri Feb
15 07:12:37 2008
@@ -243,15 +243,6 @@
     </dependency>
 
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-      <version>1.1</version>
-      <properties>
-        <war.bundle>true</war.bundle>
-      </properties>
-    </dependency>
-
-    <dependency>
      <groupId>commons-digester</groupId>
       <artifactId>commons-digester</artifactId>
       <version>1.8</version>

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractConfiguration.java
Fri Feb 15 07:12:37 2008
@@ -26,6 +26,8 @@
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.configuration2.event.ConfigurationErrorEvent;
 import org.apache.commons.configuration2.event.ConfigurationErrorListener;
@@ -34,8 +36,6 @@
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.commons.lang.text.StrLookup;
 import org.apache.commons.lang.text.StrSubstitutor;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.impl.NoOpLog;
 
 /**
  * <p>Abstract configuration class. Provides basic functionality but does not
@@ -143,7 +143,7 @@
     private StrSubstitutor substitutor;
 
     /** Stores the logger.*/
-    private Log log;
+    private Logger log;
 
     /**
      * Creates a new instance of <code>AbstractConfiguration</code>.
@@ -340,7 +340,7 @@
      * @return the logger
      * @since 1.4
      */
-    public Log getLogger()
+    public Logger getLogger()
     {
         return log;
     }
@@ -355,9 +355,16 @@
      * @param log the new logger
      * @since 1.4
      */
-    public void setLogger(Log log)
+    public void setLogger(Logger log)
     {
-        this.log = (log != null) ? log : new NoOpLog();
+        if (log == null)
+        {
+            // create a NoOp logger
+            log = Logger.getLogger(getClass().getName() + "." + hashCode());
+            log.setLevel(Level.OFF);
+        }
+
+        this.log = log;
     }
 
     /**
@@ -376,7 +383,7 @@
         {
             public void configurationError(ConfigurationErrorEvent event)
             {
-                getLogger().warn("Internal error", event.getCause());
+                getLogger().log(Level.WARNING, "Internal error", event.getCause());
             }
         });
     }
@@ -384,9 +391,7 @@
     public void addProperty(String key, Object value)
     {
         fireEvent(EVENT_ADD_PROPERTY, key, value, true);
-        addPropertyValues(key, value,
-                isDelimiterParsingDisabled() ? DISABLED_DELIMITER
-                        : getListDelimiter());
+        addPropertyValues(key, value, isDelimiterParsingDisabled() ? DISABLED_DELIMITER :
getListDelimiter());
         fireEvent(EVENT_ADD_PROPERTY, key, value, false);
     }
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java
Fri Feb 15 07:12:37 2008
@@ -32,11 +32,12 @@
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.configuration2.reloading.InvariantReloadingStrategy;
 import org.apache.commons.configuration2.reloading.ReloadingStrategy;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * <p>Partial implementation of the <code>FileConfiguration</code> interface.
@@ -116,7 +117,7 @@
     public AbstractFileConfiguration()
     {
         initReloadingStrategy();
-        setLogger(LogFactory.getLog(getClass()));
+        setLogger(Logger.getLogger(getClass().getName()));
         addErrorLogListener();
     }
 
@@ -304,7 +305,7 @@
             }
             catch (IOException e)
             {
-                getLogger().warn("Could not close input stream", e);
+                getLogger().log(Level.WARNING, "Could not close input stream", e);
             }
         }
     }
@@ -821,9 +822,9 @@
 
                     if (strategy.reloadingRequired())
                     {
-                        if (getLogger().isInfoEnabled())
+                        if (getLogger().isLoggable(Level.FINE))
                         {
-                            getLogger().info("Reloading configuration. URL is " + getURL());
+                            getLogger().fine("Reloading configuration. URL is " + getURL());
                         }
                         fireEvent(EVENT_RELOAD, null, getURL(), true);
                         setDetailEvents(false);
@@ -1017,7 +1018,7 @@
         }
         catch (IOException e)
         {
-            getLogger().warn("Could not close output stream", e);
+            getLogger().log(Level.WARNING, "Could not close output stream", e);
         }
     }
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java
Fri Feb 15 07:12:37 2008
@@ -25,6 +25,8 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.configuration2.plist.PropertyListConfiguration;
 import org.apache.commons.configuration2.plist.XMLPropertyListConfiguration;
@@ -37,8 +39,7 @@
 import org.apache.commons.digester.substitution.VariableSubstitutor;
 import org.apache.commons.digester.xmlrules.DigesterLoader;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
@@ -87,7 +88,7 @@
     private static final String DEF_BASE_PATH = ".";
 
     /** static logger */
-    private static Log log = LogFactory.getLog(ConfigurationFactory.class);
+    private static Logger log = Logger.getLogger(ConfigurationFactory.class.getName());
 
     /** The XML file with the details about the configuration to load */
     private String configurationFileName;
@@ -154,7 +155,6 @@
         }
         catch (Exception e)
         {
-            log.error("Exception caught opening stream to URL", e);
             throw new ConfigurationException("Exception caught opening stream to URL", e);
         }
 
@@ -186,12 +186,10 @@
         }
         catch (SAXException saxe)
         {
-            log.error("SAX Exception caught", saxe);
             throw new ConfigurationException("SAX Exception caught", saxe);
         }
         catch (IOException ioe)
         {
-            log.error("IO Exception caught", ioe);
             throw new ConfigurationException("IO Exception caught", ioe);
         }
         return builder.getConfiguration();
@@ -859,8 +857,7 @@
         public void begin(Attributes attrs) throws Exception
         {
             optional = attrs.getValue(ATTR_OPTIONAL) != null
-                    && PropertyConverter.toBoolean(
-                            attrs.getValue(ATTR_OPTIONAL)).booleanValue();
+                    && PropertyConverter.toBoolean(attrs.getValue(ATTR_OPTIONAL)).booleanValue();
             super.begin(attrs);
         }
 
@@ -880,7 +877,7 @@
             {
                 if (optional)
                 {
-                    log.warn("Could not create optional configuration!", ex);
+                    log.log(Level.WARNING, "Could not create optional configuration!", ex);
                 }
                 else
                 {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
Fri Feb 15 07:12:37 2008
@@ -29,13 +29,13 @@
 import java.net.URL;
 import java.net.URLDecoder;
 import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.configuration2.event.ConfigurationErrorEvent;
 import org.apache.commons.configuration2.event.ConfigurationErrorListener;
 import org.apache.commons.configuration2.event.EventSource;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * Miscellaneous utility methods for configurations.
@@ -59,7 +59,7 @@
     private static final String METHOD_CLONE = "clone";
 
     /** The logger.*/
-    private static Log log = LogFactory.getLog(ConfigurationUtils.class);
+    private static Logger log = Logger.getLogger(ConfigurationUtils.class.getName());
 
     /**
      * Private constructor. Prevents instances from being created.
@@ -391,12 +391,12 @@
      */
     public static URL locate(String base, String name)
     {
-        if (log.isDebugEnabled())
+        if (log.isLoggable(Level.FINE))
         {
             StringBuilder buf = new StringBuilder();
             buf.append("ConfigurationUtils.locate(): base is ").append(base);
             buf.append(", name is ").append(name);
-            log.debug(buf.toString());
+            log.fine(buf.toString());
         }
 
         if (name == null)
@@ -434,7 +434,7 @@
                 }
             }
 
-            log.debug("Loading configuration from the URL " + url);
+            log.fine("Loading configuration from the URL " + url);
         }
         catch (IOException e)
         {
@@ -450,11 +450,11 @@
                 try
                 {
                     url = file.toURL();
-                    log.debug("Loading configuration from the absolute path " + name);
+                    log.fine("Loading configuration from the absolute path " + name);
                 }
                 catch (MalformedURLException e)
                 {
-                    log.warn("Could not obtain URL from file", e);
+                    log.log(Level.WARNING, "Could not obtain URL from file", e);
                 }
             }
         }
@@ -472,12 +472,12 @@
 
                 if (url != null)
                 {
-                    log.debug("Loading configuration from the path " + file);
+                    log.fine("Loading configuration from the path " + file);
                 }
             }
             catch (MalformedURLException e)
             {
-                log.warn("Could not obtain URL from file", e);
+                log.log(Level.WARNING, "Could not obtain URL from file", e);
             }
         }
 
@@ -494,13 +494,13 @@
 
                 if (url != null)
                 {
-                    log.debug("Loading configuration from the home path " + file);
+                    log.fine("Loading configuration from the home path " + file);
                 }
 
             }
             catch (MalformedURLException e)
             {
-                log.warn("Could not obtain URL from file", e);
+                log.log(Level.WARNING, "Could not obtain URL from file", e);
             }
         }
 
@@ -529,7 +529,7 @@
 
             if (url != null)
             {
-                log.debug("Loading configuration from the context classpath (" + resourceName
+ ")");
+                log.fine("Loading configuration from the context classpath (" + resourceName
+ ")");
             }
         }
 
@@ -540,7 +540,7 @@
 
             if (url != null)
             {
-                log.debug("Loading configuration from the system classpath (" + resourceName
+ ")");
+                log.fine("Loading configuration from the system classpath (" + resourceName
+ ")");
             }
         }
         return url;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DatabaseConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DatabaseConfiguration.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DatabaseConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DatabaseConfiguration.java
Fri Feb 15 07:12:37 2008
@@ -26,11 +26,10 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import javax.sql.DataSource;
 
-import org.apache.commons.logging.LogFactory;
-
 /**
  * Configuration stored in a database. The properties are retrieved from a
  * table containing at least one column for the keys, and one column for the
@@ -119,7 +118,7 @@
         this.keyColumn = keyColumn;
         this.valueColumn = valueColumn;
         this.name = name;
-        setLogger(LogFactory.getLog(getClass()));
+        setLogger(Logger.getLogger(getClass().getName()));
         addErrorLogListener();  // log errors per default
     }
 
@@ -586,7 +585,7 @@
         }
         catch (SQLException e)
         {
-            getLogger().error("An error occured on closing the statement", e);
+            getLogger().log(Level.SEVERE, "An error occured on closing the statement", e);
         }
 
         try
@@ -598,7 +597,7 @@
         }
         catch (SQLException e)
         {
-            getLogger().error("An error occured on closing the connection", e);
+            getLogger().log(Level.SEVERE, "An error occured on closing the connection", e);
         }
     }
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
Fri Feb 15 07:12:37 2008
@@ -25,6 +25,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Logger;
 
 import org.apache.commons.configuration2.beanutils.BeanDeclaration;
 import org.apache.commons.configuration2.beanutils.BeanFactory;
@@ -35,7 +36,6 @@
 import org.apache.commons.configuration2.tree.DefaultExpressionEngine;
 import org.apache.commons.configuration2.tree.OverrideCombiner;
 import org.apache.commons.configuration2.tree.UnionCombiner;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * <p>
@@ -342,7 +342,7 @@
         providers = new HashMap<String, ConfigurationProvider>();
         registerDefaultProviders();
         registerBeanFactory();
-        setLogger(LogFactory.getLog(getClass()));
+        setLogger(Logger.getLogger(getClass().getName()));
         addErrorLogListener();  // log errors per default
     }
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
Fri Feb 15 07:12:37 2008
@@ -18,12 +18,12 @@
 package org.apache.commons.configuration2;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-import java.util.Arrays;
-
+import java.util.logging.Logger;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NameClassPair;
@@ -33,7 +33,6 @@
 import javax.naming.NotContextException;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * This Configuration class allows you to interface with a JNDI datasource.
@@ -104,7 +103,7 @@
     {
         this.context = context;
         this.prefix = prefix;
-        setLogger(LogFactory.getLog(getClass()));
+        setLogger(Logger.getLogger(getClass().getName()));
         addErrorLogListener();
     }
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
Fri Feb 15 07:12:37 2008
@@ -143,8 +143,7 @@
  * @author Oliver Heger
  * @version $Revision$, $Date$
  */
-public class XMLConfiguration extends AbstractHierarchicalFileConfiguration
-    implements EntityResolver
+public class XMLConfiguration extends AbstractHierarchicalFileConfiguration implements EntityResolver
 {
     /**
      * The serial version UID.
@@ -572,8 +571,7 @@
         }
         else
         {
-            DocumentBuilderFactory factory = DocumentBuilderFactory
-                    .newInstance();
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             factory.setValidating(isValidating());
             DocumentBuilder result = factory.newDocumentBuilder();
             result.setEntityResolver(this);

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
Fri Feb 15 07:12:37 2008
@@ -19,8 +19,9 @@
 
 import java.lang.reflect.Array;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.beanutils.DynaBean;
 import org.apache.commons.beanutils.DynaClass;
@@ -28,8 +29,6 @@
 import org.apache.commons.configuration2.ConfigurationMap;
 import org.apache.commons.configuration2.ConversionException;
 import org.apache.commons.configuration2.SubsetConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * The <tt>ConfigurationDynaBean</tt> dynamically reads and writes
@@ -61,7 +60,7 @@
     private static final String PROPERTY_DELIMITER = ".";
 
     /** The logger.*/
-    private static Log log = LogFactory.getLog(ConfigurationDynaBean.class);
+    private static Logger log = Logger.getLogger(ConfigurationDynaBean.class.getName());
 
     /**
      * Creates a new instance of <code>ConfigurationDynaBean</code> and sets
@@ -72,17 +71,17 @@
     public ConfigurationDynaBean(Configuration configuration)
     {
         super(configuration);
-        if (log.isTraceEnabled())
+        if (log.isLoggable(Level.FINEST))
         {
-            log.trace("ConfigurationDynaBean(" + configuration + ")");
+            log.finest("ConfigurationDynaBean(" + configuration + ")");
         }
     }
 
     public void set(String name, Object value)
     {
-        if (log.isTraceEnabled())
+        if (log.isLoggable(Level.FINEST))
         {
-            log.trace("set(" + name + "," + value + ")");
+            log.finest("set(" + name + "," + value + ")");
         }
 
         if (value == null)
@@ -92,11 +91,9 @@
 
         if (value instanceof Collection)
         {
-            Collection collection = (Collection) value;
-            Iterator iterator = collection.iterator();
-            while (iterator.hasNext())
+            for (Object item : (Collection) value)
             {
-                getConfiguration().addProperty(name, iterator.next());
+                getConfiguration().addProperty(name, item);
             }
         }
         else if (value.getClass().isArray())
@@ -115,9 +112,9 @@
 
     public Object get(String name)
     {
-        if (log.isTraceEnabled())
+        if (log.isLoggable(Level.FINEST))
         {
-            log.trace("get(" + name + ")");
+            log.finest("get(" + name + ")");
         }
 
         // get configuration property
@@ -132,9 +129,9 @@
             }
         }
 
-        if (log.isDebugEnabled())
+        if (log.isLoggable(Level.FINE))
         {
-            log.debug(name + "=[" + result + "]");
+            log.fine(name + "=[" + result + "]");
         }
 
         if (result == null)

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaClass.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaClass.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaClass.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaClass.java
Fri Feb 15 07:12:37 2008
@@ -17,16 +17,16 @@
 
 package org.apache.commons.configuration2.beanutils;
 
-import java.util.Iterator;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.beanutils.DynaBean;
 import org.apache.commons.beanutils.DynaClass;
 import org.apache.commons.beanutils.DynaProperty;
 import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * The <tt>ConfigurationDynaClass</tt> dynamically determines properties for
@@ -40,7 +40,7 @@
 public class ConfigurationDynaClass implements DynaClass
 {
     /** The logger.*/
-    private static Log log = LogFactory.getLog(ConfigurationDynaClass.class);
+    private static Logger log = Logger.getLogger(ConfigurationDynaClass.class.getName());
 
     /** Stores the associated configuration.*/
     private Configuration configuration;
@@ -53,18 +53,18 @@
     public ConfigurationDynaClass(Configuration configuration)
     {
         super();
-        if (log.isTraceEnabled())
+        if (log.isLoggable(Level.FINEST))
         {
-            log.trace("ConfigurationDynaClass(" + configuration + ")");
+            log.finest("ConfigurationDynaClass(" + configuration + ")");
         }
         this.configuration = configuration;
     }
 
     public DynaProperty getDynaProperty(String name)
     {
-        if (log.isTraceEnabled())
+        if (log.isLoggable(Level.FINEST))
         {
-            log.trace("getDynaProperty(" + name + ")");
+            log.finest("getDynaProperty(" + name + ")");
         }
 
         if (name == null)
@@ -120,13 +120,13 @@
 
     public DynaProperty[] getDynaProperties()
     {
-        if (log.isTraceEnabled())
+        if (log.isLoggable(Level.FINEST))
         {
-            log.trace("getDynaProperties()");
+            log.finest("getDynaProperties()");
         }
 
         Iterator keys = configuration.getKeys();
-        List properties = new ArrayList();
+        List<DynaProperty> properties = new ArrayList<DynaProperty>();
         while (keys.hasNext())
         {
             String key = (String) keys.next();
@@ -136,9 +136,9 @@
 
         DynaProperty[] propertyArray = new DynaProperty[properties.size()];
         properties.toArray(propertyArray);
-        if (log.isDebugEnabled())
+        if (log.isLoggable(Level.FINEST))
         {
-            log.debug("Found " + properties.size() + " properties.");
+            log.finest("Found " + properties.size() + " properties.");
         }
 
         return propertyArray;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/interpol/ConstantLookup.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/interpol/ConstantLookup.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/interpol/ConstantLookup.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/interpol/ConstantLookup.java
Fri Feb 15 07:12:37 2008
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.interpol;
 
 import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.commons.lang.ClassUtils;
 import org.apache.commons.lang.text.StrLookup;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * <p>
@@ -48,9 +49,7 @@
  *
  * @version $Id$
  * @since 1.4
- * @author <a
- * href="http://commons.apache.org/configuration/team-list.html">Commons
- * Configuration team</a>
+ * @author <a href="http://commons.apache.org/configuration/team-list.html">Commons
Configuration team</a>
  */
 public class ConstantLookup extends StrLookup
 {
@@ -58,10 +57,10 @@
     private static final char FIELD_SEPRATOR = '.';
 
     /** An internally used cache for already retrieved values. */
-    private static Map constantCache = new HashMap();
+    private static Map<String, String> constantCache = new HashMap<String, String>();
 
     /** The logger. */
-    private Log log = LogFactory.getLog(getClass());
+    private Logger log = Logger.getLogger(getClass().getName());
 
     /**
      * Tries to resolve the specified variable. The passed in variable name is
@@ -85,7 +84,7 @@
         String result;
         synchronized (constantCache)
         {
-            result = (String) constantCache.get(var);
+            result = constantCache.get(var);
         }
         if (result != null)
         {
@@ -99,8 +98,7 @@
         }
         try
         {
-            Object value = resolveField(var.substring(0, fieldPos), var
-                    .substring(fieldPos + 1));
+            Object value = resolveField(var.substring(0, fieldPos), var.substring(fieldPos
+ 1));
             if (value != null)
             {
                 synchronized (constantCache)
@@ -115,7 +113,7 @@
         }
         catch (Exception ex)
         {
-            log.warn("Could not obtain value for variable " + var, ex);
+            log.log(Level.WARNING, "Could not obtain value for variable " + var, ex);
         }
 
         return result;
@@ -144,8 +142,7 @@
      * @return the field's value
      * @throws Exception if an error occurs
      */
-    protected Object resolveField(String className, String fieldName)
-            throws Exception
+    protected Object resolveField(String className, String fieldName) throws Exception
     {
         Class clazz = fetchClass(className);
         Field field = clazz.getField(fieldName);

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
Fri Feb 15 07:12:37 2008
@@ -84,6 +84,7 @@
  */
 public class PropertyListConfiguration extends AbstractHierarchicalFileConfiguration
 {
+    /** The default date format, its use must be synchronized */
     static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("<*'D'yyyy-MM-dd
HH:mm:ss Z>");
 
     /** Instance specific format that can be used to format date in differents time zones
*/

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/ManagedReloadingStrategy.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/ManagedReloadingStrategy.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/ManagedReloadingStrategy.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/reloading/ManagedReloadingStrategy.java
Fri Feb 15 07:12:37 2008
@@ -17,9 +17,9 @@
 
 package org.apache.commons.configuration2.reloading;
 
+import java.util.logging.Logger;
+
 import org.apache.commons.configuration2.FileConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * A strategy to reload configuration based on management requests. Designed for
@@ -27,11 +27,10 @@
  *
  * @author Nicolas De loof
  */
-public class ManagedReloadingStrategy implements ReloadingStrategy,
-        ManagedReloadingStrategyMBean
+public class ManagedReloadingStrategy implements ReloadingStrategy, ManagedReloadingStrategyMBean
 {
     /** The logger. */
-    private Log log = LogFactory.getLog(ManagedReloadingStrategy.class);
+    private Logger log = Logger.getLogger(getClass().getName());
 
     /** Stores a reference to the associated configuration. */
     private FileConfiguration configuration;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
Fri Feb 15 07:12:37 2008
@@ -23,13 +23,15 @@
 
 import org.apache.cactus.ServletTestCase;
 import org.apache.commons.collections.IteratorUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.commons.configuration2.CompositeConfiguration;
+import org.apache.commons.configuration2.Configuration;
+import org.apache.commons.configuration2.ConfigurationFactory;
+import org.apache.commons.configuration2.JNDIConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
 
 public class TestConfigurationFactoryWithJNDI extends ServletTestCase
 {
     private File testDigesterFile = new File("conf/testDigesterConfigurationWJNDI.xml");
-    private static Log log = LogFactory.getLog(TestConfigurationFactoryWithJNDI.class);
 
     public void testLoadingWithDigester() throws Exception
     {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestAbstractConfiguration.java
Fri Feb 15 07:12:37 2008
@@ -20,11 +20,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-
-import org.apache.commons.configuration2.AbstractConfiguration;
-import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.logging.Logger;
 
 import junit.framework.TestCase;
 import junitx.framework.ListAssert;
@@ -152,7 +148,7 @@
     {
         AbstractConfiguration config = getEmptyConfiguration();
         assertNotNull("Default logger is null", config.getLogger());
-        Log log = LogFactory.getLog(config.getClass());
+        Logger log = Logger.getLogger(config.getClass().getName());
         config.setLogger(log);
         assertSame("Logger was not set", log, config.getLogger());
     }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/test/HsqlDB.java
Fri Feb 15 07:12:37 2008
@@ -18,15 +18,13 @@
 package org.apache.commons.configuration2.test;
 
 import java.io.FileReader;
-
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.logging.Logger;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * Stolen from Turbine
@@ -38,7 +36,7 @@
 public class HsqlDB
 {
     private Connection connection = null;
-    private static Log log = LogFactory.getLog(HsqlDB.class);
+    private Logger log = Logger.getLogger(getClass().getName());
 
     public HsqlDB(String uri, String databaseDriver, String loadFile)throws Exception
     {
@@ -86,7 +84,7 @@
                 }
                 catch (SQLException sqle)
                 {
-                    log.warn("Statement: " + cmd + ": " + sqle.getMessage());
+                    log.warning("Statement: " + cmd + ": " + sqle.getMessage());
                 }
                 
                 commands = commands.substring(targetPos + 2);

Modified: commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml (original)
+++ commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml Fri
Feb 15 07:12:37 2008
@@ -27,6 +27,12 @@
       <action dev="oheger" type="update">
         The dependency to commons-collections is no longer needed.
       </action>
+      <action dev="ebourg" type="update">
+        The dependency to commons-logging is no longer needed. The java.util.logging API
is used instead.
+        If necessary it's still possible to redirect the log messages to a 3rd party logging
API using a
+        bridging mechanism such as the one available for Log4J
+        (see http://people.apache.org/~psmith/logging.apache.org/sandbox/jul-log4j-bridge/).
+      </action>
       <action dev="oheger" type="update">
         To avoid incompatibilities with older versions the package structure
 	    has been changed. The main package is now

Modified: commons/proper/configuration/branches/configuration2_experimental/xdocs/dependencies.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/xdocs/dependencies.xml?rev=628082&r1=628081&r2=628082&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/xdocs/dependencies.xml
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/xdocs/dependencies.xml
Fri Feb 15 07:12:37 2008
@@ -49,7 +49,6 @@
                         <td>
                             Java 5<br/>
                             commons-lang<br/>
-                            commons-logging
                         </td>
                     </tr>
                     <tr>
@@ -104,10 +103,6 @@
                     <tr>
                       <td>commons-lang</td>
                       <td>2.2, 2.3</td>
-                    </tr>
-                    <tr>
-                      <td>commons-logging</td>
-                      <td>1.0.4, 1.1</td>
                     </tr>
                     <tr>
                       <td>commons-digester</td>



Mime
View raw message