cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r585353 - in /cocoon/trunk/core/cocoon-core/src: main/java/org/apache/cocoon/components/crawler/ main/java/org/apache/cocoon/components/persistence/ main/java/org/apache/cocoon/components/source/ main/java/org/apache/cocoon/components/sourc...
Date Wed, 17 Oct 2007 03:52:21 GMT
Author: vgritsenko
Date: Tue Oct 16 20:52:17 2007
New Revision: 585353

URL: http://svn.apache.org/viewvc?rev=585353&view=rev
Log:
iuse new abstractlogenabled - commons logging

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/crawler/SimpleCocoonCrawlerImpl.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/persistence/RequestDataStoreImpl.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundle.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/ModifiableSourceIncludeCacheStorageProxy.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/StoreIncludeCacheStorageProxy.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingContentHandler.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingEntityResolver.java
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSource.java
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSourceFactory.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/crawler/SimpleCocoonCrawlerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/crawler/SimpleCocoonCrawlerImpl.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/crawler/SimpleCocoonCrawlerImpl.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/crawler/SimpleCocoonCrawlerImpl.java Tue Oct 16 20:52:17 2007
@@ -16,17 +16,6 @@
  */
 package org.apache.cocoon.components.crawler;
 
-import org.apache.avalon.excalibur.pool.Recyclable;
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.Constants;
-import org.apache.commons.lang.StringUtils;
-import org.apache.regexp.RE;
-import org.apache.regexp.RESyntaxException;
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -38,13 +27,25 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.avalon.excalibur.pool.Recyclable;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.cocoon.Constants;
+import org.apache.cocoon.util.AbstractLogEnabled;
+import org.apache.commons.lang.StringUtils;
+import org.apache.regexp.RE;
+import org.apache.regexp.RESyntaxException;
+
 /**
  * A simple cocoon crawler.
  *
  * @version $Id$
  */
 public class SimpleCocoonCrawlerImpl extends AbstractLogEnabled
-implements CocoonCrawler, Configurable, Disposable, Recyclable {
+                                     implements CocoonCrawler, Configurable, Disposable,
+                                                Recyclable {
 
     /**
      * Config element name specifying expected link content-typ.
@@ -383,9 +384,7 @@
      * @since
      */
     private List getLinks(URL url) {
-        ArrayList url_links = null;
         String sURL = url.toString();
-
         if (!isIncludedURL(sURL) || isExcludedURL(sURL)) {
             return null;
         }
@@ -402,6 +401,8 @@
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("Getting links of URL " + sURL);
         }
+
+        ArrayList url_links = null;
         BufferedReader br = null;
         try {
             sURL = url.getFile();
@@ -478,7 +479,6 @@
             if (br != null) {
                 try {
                     br.close();
-                    br = null;
                 } catch (IOException ignored) {
                 }
             }
@@ -498,11 +498,10 @@
             return false;
         }
 
-        final String s = url.toString();
         Iterator i = excludeCrawlingURL.iterator();
         while (i.hasNext()) {
             RE pattern = (RE) i.next();
-            if (pattern.match(s)) {
+            if (pattern.match(url)) {
                 if (getLogger().isDebugEnabled()) {
                     getLogger().debug("Excluded URL " + url);
                 }
@@ -527,11 +526,10 @@
             return true;
         }
 
-        final String s = url.toString();
         Iterator i = includeCrawlingURL.iterator();
         while (i.hasNext()) {
             RE pattern = (RE) i.next();
-            if (pattern.match(s)) {
+            if (pattern.match(url)) {
                 if (getLogger().isDebugEnabled()) {
                     getLogger().debug("Included URL " + url);
                 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/persistence/RequestDataStoreImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/persistence/RequestDataStoreImpl.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/persistence/RequestDataStoreImpl.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/persistence/RequestDataStoreImpl.java Tue Oct 16 20:52:17 2007
@@ -22,10 +22,10 @@
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.util.AbstractLogEnabled;
 
 /**
  * The default implementation
@@ -35,16 +35,14 @@
  * @deprecated Use the scoped attributes on the Request object instead.
  *             This component will be removed with Cocoon 2.3.
  */
-public class RequestDataStoreImpl
-    extends AbstractLogEnabled
-    implements ThreadSafe, RequestDataStore, Contextualizable {
+public class RequestDataStoreImpl extends AbstractLogEnabled
+                                  implements ThreadSafe, RequestDataStore, Contextualizable {
         
+    protected final String requestDataKey = getClass().getName() + "/RD";
+    protected final String globalRequestDataKey = getClass().getName() + "/GRD";
+
     protected Context context;
 
-    protected final String requestDataKey = this.getClass().getName() + "/RD";
-    
-    protected final String globalRequestDataKey = this.getClass().getName() + "/GRD";
-    
     /* (non-Javadoc)
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
      */

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java Tue Oct 16 20:52:17 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.cocoon.components.source;
 
-
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -27,7 +26,6 @@
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -36,6 +34,7 @@
 import org.apache.cocoon.Processor;
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceFactory;
@@ -45,13 +44,13 @@
  * This is the default implementation of the {@link SourceResolver} for
  * Cocoon. The implementation is based on the original source resolver implementation
  * from the Excalibur project.
+ *
  * @since 2.2
- * 
  * @version $Id$
  */
-public class CocoonSourceResolver 
-extends AbstractLogEnabled
-implements SourceResolver, Contextualizable, Serviceable, Disposable, ThreadSafe {
+public class CocoonSourceResolver extends AbstractLogEnabled
+                                  implements SourceResolver, Contextualizable, Serviceable, Disposable,
+                                             ThreadSafe {
 
     /** A (optional) custom source resolver */
     protected org.apache.excalibur.source.SourceResolver customResolver;
@@ -63,76 +62,78 @@
     protected URL baseURL;
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     * @see Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
      */
-    public void contextualize( Context context )
+    public void contextualize(Context context)
     throws ContextException {
         try {
-            if ( context.get( "context-root" ) instanceof URL ) {
-                this.baseURL = (URL)context.get( "context-root" );
+            if (context.get("context-root") instanceof URL) {
+                this.baseURL = (URL) context.get("context-root");
             } else {
-                this.baseURL = ( (File)context.get( "context-root" ) ).toURL();
+                this.baseURL = ((File) context.get("context-root")).toURL();
             }
         } catch( ContextException ce ) {
             // set the base URL to the current directory
             try {
                 this.baseURL = new File( System.getProperty( "user.dir" ) ).toURL();
-                if( this.getLogger().isDebugEnabled() ) {
-                    this.getLogger().debug( "SourceResolver: Using base URL: " + this.baseURL );
+                if (this.getLogger().isDebugEnabled()) {
+                    this.getLogger().debug("SourceResolver: Using base URL: " + this.baseURL);
                 }
-            } catch( MalformedURLException mue ) {
-                throw new ContextException( "Malformed URL for user.dir, and no container.rootDir exists", mue );
+            } catch (MalformedURLException mue) {
+                throw new ContextException("Malformed URL for user.dir, and no container.rootDir exists", mue);
             }
-        } catch( MalformedURLException mue ) {
-            throw new ContextException( "Malformed URL for container.rootDir", mue );
+        } catch (MalformedURLException mue) {
+            throw new ContextException("Malformed URL for container.rootDir", mue);
         }
     }
 
     /**
-     * @see org.apache.excalibur.source.SourceResolver#resolveURI(java.lang.String, java.lang.String, java.util.Map)
+     * @see SourceResolver#resolveURI(java.lang.String, java.lang.String, java.util.Map)
+     * @throws MalformedURLException if unable to parse location URI
      */
     public Source resolveURI(String location, String baseURI, Map parameters)
-    throws MalformedURLException, IOException, SourceException {
-        if ( baseURI == null ) {
+    throws IOException {
+        if (baseURI == null) {
             final Processor processor = EnvironmentHelper.getCurrentProcessor();
-            if ( processor != null ) {
+            if (processor != null) {
                 baseURI = processor.getContext();
             }
         }
-        if ( this.customResolver != null ) {
+        if (this.customResolver != null) {
             return this.customResolver.resolveURI(location, baseURI, parameters);
         }
-        if( this.getLogger().isDebugEnabled() ) {
-            this.getLogger().debug( "Resolving '" + location + "' with base '" + baseURI + "' in context '" + this.baseURL + "'" );
+
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Resolving '" + location + "' with base '" + baseURI + "' in context '" + this.baseURL + "'");
         }
-        if( location == null ) {
-            throw new MalformedURLException( "Invalid System ID" );
+        if (location == null) {
+            throw new MalformedURLException("Invalid System ID");
         }
-        if( null != baseURI && org.apache.excalibur.source.SourceUtil.indexOfSchemeColon(baseURI) == -1 ) {
-            throw new MalformedURLException( "BaseURI is not valid, it must contain a protocol: " + baseURI );
+        if (baseURI != null && org.apache.excalibur.source.SourceUtil.indexOfSchemeColon(baseURI) == -1) {
+            throw new MalformedURLException("BaseURI is not valid, it must contain a protocol: " + baseURI);
         }
 
-        if( baseURI == null ) {
+        if (baseURI == null) {
             baseURI = this.baseURL.toExternalForm();
         }
 
         String systemID = location;
         // special handling for windows file paths
-        if( location.length() > 1 && location.charAt( 1 ) == ':' ) {
+        if (location.length() > 1 && location.charAt(1) == ':') {
             systemID = "file:/" + location;
-        } else if( location.length() > 2 && location.charAt(0) == '/' && location.charAt(2) == ':' ) {
+        } else if (location.length() > 2 && location.charAt(0) == '/' && location.charAt(2) == ':') {
             systemID = "file:" + location;
         }
 
         // determine protocol (scheme): first try to get the one of the systemID, if that fails, take the one of the baseURI
         String protocol;
         int protocolPos = org.apache.excalibur.source.SourceUtil.indexOfSchemeColon(systemID);
-        if( protocolPos != -1 ) {
-            protocol = systemID.substring( 0, protocolPos );
+        if (protocolPos != -1) {
+            protocol = systemID.substring(0, protocolPos);
         } else {
             protocolPos = org.apache.excalibur.source.SourceUtil.indexOfSchemeColon(baseURI);
-            if( protocolPos != -1 ) {
-                protocol = baseURI.substring( 0, protocolPos );
+            if (protocolPos != -1) {
+                protocol = baseURI.substring(0, protocolPos);
             } else {
                 protocol = "*";
             }
@@ -144,28 +145,28 @@
         // search for a SourceFactory implementing the protocol
         SourceFactory factory = null;
         try {
-            factory = this.getSourceFactory( m, protocol );
-            systemID = this.absolutize( factory, baseURI, systemID );
-            if( getLogger().isDebugEnabled() ) {
-                getLogger().debug( "Resolved to systemID : " + systemID );
+            factory = this.getSourceFactory(m, protocol);
+            systemID = this.absolutize(factory, baseURI, systemID);
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Resolved to systemID : " + systemID);
             }
-            source = factory.getSource( systemID, parameters );
-        } catch( final ProcessingException ce ) {
+            source = factory.getSource(systemID, parameters);
+        } catch (final ProcessingException ce) {
             // no selector available, use fallback
         } finally {
-            m.release( factory );
+            m.release(factory);
         }
 
-        if( null == source ) {
+        if (null == source) {
             try {
-                factory = this.getSourceFactory( m, "*");
-                systemID = this.absolutize( factory, baseURI, systemID );
-                if( getLogger().isDebugEnabled() ) {
-                    getLogger().debug( "Resolved to systemID : " + systemID );
+                factory = this.getSourceFactory(m, "*");
+                systemID = this.absolutize(factory, baseURI, systemID);
+                if (getLogger().isDebugEnabled()) {
+                    getLogger().debug("Resolved to systemID : " + systemID);
                 }
-                source = factory.getSource( systemID, parameters );
-            } catch (ProcessingException se ) {
-                throw new SourceException( "Unable to select source factory for " + systemID, se );
+                source = factory.getSource(systemID, parameters);
+            } catch (ProcessingException se) {
+                throw new SourceException("Unable to select source factory for " + systemID, se);
             } finally {
                 m.release(factory);
             }
@@ -175,11 +176,11 @@
     }
 
     /**
-     * @see org.apache.excalibur.source.SourceResolver#resolveURI(java.lang.String)
+     * @see SourceResolver#resolveURI(java.lang.String)
+     * @throws MalformedURLException if unable to parse location URI
      */
-    public Source resolveURI(String location)
-    throws MalformedURLException, IOException, SourceException {
-        return this.resolveURI(location, null, null);
+    public Source resolveURI(String location) throws IOException {
+        return resolveURI(location, null, null);
     }
 
     /** 
@@ -189,9 +190,9 @@
      */
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
-        if ( this.manager.hasService(org.apache.excalibur.source.SourceResolver.ROLE+"/Cocoon")) {
+        if (this.manager.hasService(org.apache.excalibur.source.SourceResolver.ROLE + "/Cocoon")) {
             this.customResolver = (org.apache.excalibur.source.SourceResolver)
-                     this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE+"/Cocoon");
+                    this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE + "/Cocoon");
         }
     }
 
@@ -199,8 +200,8 @@
      * @see org.apache.avalon.framework.activity.Disposable#dispose()
      */
     public void dispose() {
-        if ( this.manager != null ) {
-            this.manager.release( this.customResolver );
+        if (this.manager != null) {
+            this.manager.release(this.customResolver);
             this.customResolver = null;
             this.manager = null;
         }
@@ -211,7 +212,7 @@
      */
     protected ServiceManager getComponentLocator() {
         ServiceManager l = EnvironmentHelper.getSitemapServiceManager();
-        if ( l == null ) {
+        if (l == null) {
             l = this.manager;
         }
         return l;
@@ -223,7 +224,7 @@
     protected SourceFactory getSourceFactory(ServiceManager m, String scheme) 
     throws ProcessingException {
         try {
-            return (SourceFactory)m.lookup(SourceFactory.ROLE + '/' + scheme);
+            return (SourceFactory) m.lookup(SourceFactory.ROLE + '/' + scheme);
         } catch (ServiceException se) {
             throw new ProcessingException("Unable to lookup source factory for scheme: " + scheme, se);
         }
@@ -233,13 +234,15 @@
      * @see org.apache.excalibur.source.SourceResolver#release(org.apache.excalibur.source.Source)
      */
     public void release(Source source) {
-        if( source == null ) return;
+        if (source == null) {
+            return;
+        }
 
-        if ( this.customResolver != null ) {
-            this.customResolver.release( source );
+        if (this.customResolver != null) {
+            this.customResolver.release(source);
         } else {
             final ServiceManager m = this.getComponentLocator();
-            
+
             // search for a SourceFactory implementing the protocol
             final String scheme = source.getScheme();
             SourceFactory factory = null;
@@ -247,15 +250,15 @@
             try {
                 factory = this.getSourceFactory(m, scheme);
                 factory.release(source);
-            } catch (ProcessingException se ) {
+            } catch (ProcessingException se) {
                 try {
                     factory = this.getSourceFactory(m, "*");
                     factory.release(source);
-                } catch (ProcessingException sse ) {
-                    throw new SourceFactoryNotFoundException( "Unable to select source factory for " + source.getURI(), se );
+                } catch (ProcessingException sse) {
+                    throw new SourceFactoryNotFoundException("Unable to select source factory for " + source.getURI(), se);
                 }
             } finally {
-                m.release( factory );
+                m.release(factory);
             }
         }
     }
@@ -263,13 +266,13 @@
     /**
      * Makes an absolute URI based on a baseURI and a relative URI.
      */
-    protected String absolutize( SourceFactory factory, String baseURI, String systemID )  {
-        if( factory instanceof URIAbsolutizer ) {
-            systemID = ((URIAbsolutizer)factory).absolutize(baseURI, systemID);
+    protected String absolutize(SourceFactory factory, String baseURI, String systemID) {
+        if (factory instanceof URIAbsolutizer) {
+            systemID = ((URIAbsolutizer) factory).absolutize(baseURI, systemID);
         } else {
             systemID = org.apache.excalibur.source.SourceUtil.absolutize(baseURI, systemID);
         }
+
         return systemID;
     }
-
 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java Tue Oct 16 20:52:17 2007
@@ -35,7 +35,6 @@
 import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
@@ -47,10 +46,9 @@
 import org.apache.cocoon.environment.background.BackgroundEnvironment;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.cocoon.thread.RunnableManager;
+import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.cocoon.util.NetUtils;
 import org.apache.cocoon.util.avalon.CLLoggerWrapper;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceResolver;
@@ -61,10 +59,9 @@
  * @since 2.1.1
  * @version $Id$
  */
-public class DelaySourceRefresher implements SourceRefresher {
+public class DelaySourceRefresher extends AbstractLogEnabled
+                                  implements SourceRefresher {
 
-    private Log logger = LogFactory.getLog(getClass());    
-    
     private static final long DEFAULT_INTERVAL = 0;
     
 	private static final String DEFAULT_WRITE_FILE        = "refresher-targets.xml";
@@ -105,15 +102,15 @@
                 throw new ConfigurationException("Can not create parent directory for: " +
                                                  this.configFile);
             }
-            if (logger.isDebugEnabled()) {
-                logger.debug("Write source location: " + this.configFile);
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Write source location: " + this.configFile);
             }
 
             setupRefreshJobs(readRefreshJobConfiguration());
             startConfigurationTask(writeInterval);
         } else {
-        	if (logger.isInfoEnabled()) {
-				logger.info("Not writing update targets to file.");
+        	if (getLogger().isInfoEnabled()) {
+				getLogger().info("Not writing update targets to file.");
         	}
         }
    
@@ -146,7 +143,6 @@
         if (task == null) {
             // New source added.
             task = new RefresherTask(key, uri, interval);
-            task.enableLogging(new CLLoggerWrapper(logger));
             this.entries.put(key, task);
             this.runnable.execute(task, interval, interval);
             this.changed = true;
@@ -184,7 +180,7 @@
                 SourceUtil.toSAX(this.manager, source, source.getMimeType(), b);
             }
         } catch (Exception ignore) {
-            logger.warn("Unable to read configuration from " + this.configFile);
+            getLogger().warn("Unable to read configuration from " + this.configFile);
         } finally {
             if (source != null) {
                 this.resolver.release(source);
@@ -205,8 +201,8 @@
                     try {
                         setupSingleRefreshJob(children[i]);
                     } catch (CascadingException ignore) {
-                        if (logger.isDebugEnabled()) {
-                            logger.debug("Setting up refresh job, ignoring exception:", ignore);
+                        if (getLogger().isDebugEnabled()) {
+                            getLogger().debug("Setting up refresh job, ignoring exception:", ignore);
                         }
                     }
                 }
@@ -234,7 +230,6 @@
      */
     protected void startConfigurationTask(long interval) {
         configurationTask = new ConfigurationTask();
-        configurationTask.enableLogging(new CLLoggerWrapper(logger));
         runnable.execute(configurationTask, interval, interval);
     }
 
@@ -279,8 +274,8 @@
                     // Got I/O exception while writing the list.
                     // Will re-try writing the list next time.
                     success = false;
-                    if (logger.isDebugEnabled()) {
-                        logger.debug("Error writing targets to file.", e);
+                    if (getLogger().isDebugEnabled()) {
+                        getLogger().debug("Error writing targets to file.", e);
                     }
                 } finally {
                     if (writer != null) {
@@ -313,8 +308,8 @@
 
         public void run() {
             if (this.uri != null) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Refreshing " + this.uri);
+                if (getLogger().isDebugEnabled()) {
+                    getLogger().debug("Refreshing " + this.uri);
                 }
 
                 // Setup Environment
@@ -322,7 +317,7 @@
                 try {
                     org.apache.cocoon.environment.Context ctx =
                             (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
-                    env = new BackgroundEnvironment(new CLLoggerWrapper(logger), ctx);
+                    env = new BackgroundEnvironment(new CLLoggerWrapper(getLogger()), ctx);
                 } catch (ContextException e) {
                     throw new CascadingRuntimeException("No context found", e);
                 }
@@ -346,7 +341,7 @@
                         source = resolver.resolveURI(uri);
                         source.refresh();
                     } catch (IOException e) {
-                        logger.error("Error refreshing source", e);
+                        getLogger().error("Error refreshing source", e);
                     } finally {
                         if (source != null) {
                             resolver.release(source);

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java Tue Oct 16 20:52:17 2007
@@ -20,12 +20,12 @@
 import java.net.MalformedURLException;
 import java.util.Map;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.spring.configurator.BlockResourcesHolder;
+import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceFactory;
@@ -37,32 +37,31 @@
  * 
  * @version $Id$
  */
-public class BlockContextSourceFactory extends AbstractLogEnabled implements
-        SourceFactory, Serviceable, ThreadSafe {
+public class BlockContextSourceFactory extends AbstractLogEnabled
+                                       implements SourceFactory, Serviceable, ThreadSafe {
     
     private ServiceManager serviceManager;
 
     private BlockResourcesHolder blockResourcesHolder;
 
     /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     * @see Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager aServiceManager) throws ServiceException {
         this.serviceManager = aServiceManager;
         this.blockResourcesHolder = (BlockResourcesHolder) this.serviceManager.lookup(BlockResourcesHolder.class.getName());
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
+    /**
+     * @see SourceFactory#getSource(java.lang.String, java.util.Map)
      */
-    public Source getSource(String location, Map parameters) throws IOException,
-            MalformedURLException {
-
+    public Source getSource(String location, Map parameters) throws IOException {
         Map blockContexts = this.blockResourcesHolder.getBlockContexts();
 
         // the root "directory" of the blocks
-        if (location.endsWith(":/"))
+        if (location.endsWith(":/")) {
             return new BlockContextSource(location, blockContexts, this.serviceManager);
+        }
         
         // Remove the protocol and the first '/'
         int pos = location.indexOf(":/");
@@ -74,15 +73,16 @@
             String blockName = path.substring(0, pos);
             path = path.substring(pos);
             String blockContext = (String) blockContexts.get(blockName);
-            if (blockContext == null)
+            if (blockContext == null) {
                 throw new MalformedURLException("Unknown block name " + blockName +
-                        " in block context uri " + location);
+                                                " in block context uri " + location);
+            }
 
             // construct the path relative the block context
             String resolvedPath = blockContext + path;
-            if (this.getLogger().isDebugEnabled())
-                this.getLogger().debug("block context source " + location +
-                        " is resolved to " + resolvedPath);
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("block context source " + location + " is resolved to " + resolvedPath);
+            }
 
             SourceResolver resolver = null;
             try {
@@ -94,15 +94,14 @@
                 this.serviceManager.release(resolver);
             }
         } else {
-            throw new MalformedURLException("The block name part of a block context uri must end with a '/':" + location);
+            throw new MalformedURLException("The block name part of a block context uri must end with a '/' in " + location);
         }
     }
 
     /**
-     * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
+     * @see SourceFactory#release(org.apache.excalibur.source.Source)
      */
     public void release(Source source) {
         // nothing to do
     }
-
 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundle.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundle.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundle.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundle.java Tue Oct 16 20:52:17 2007
@@ -16,7 +16,12 @@
  */
 package org.apache.cocoon.i18n;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import java.net.MalformedURLException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceNotFoundException;
 import org.apache.excalibur.source.SourceResolver;
@@ -27,18 +32,13 @@
 import org.apache.cocoon.ResourceNotFoundException;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.components.source.impl.validity.DelayedValidity;
+import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.cocoon.xml.ParamSaxBuffer;
 
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
-
-import java.net.MalformedURLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
 
 /**
  * Implementation of <code>Bundle</code> interface for XML resources. Represents a

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java Tue Oct 16 20:52:17 2007
@@ -16,11 +16,16 @@
  */
 package org.apache.cocoon.i18n;
 
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -31,14 +36,9 @@
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.excalibur.store.Store;
 
+import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.cocoon.util.NetUtils;
 
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
 /**
  * This is the XMLResourceBundleFactory, the method for getting and creating
  * XMLResourceBundles.
@@ -281,7 +281,6 @@
         }
 
         XMLResourceBundle bundle = new XMLResourceBundle(sourceURI, locale, parent);
-        bundle.enableLogging(getLogger());
         bundle.reload(this.resolver, this.interval);
         return bundle;
     }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java Tue Oct 16 20:52:17 2007
@@ -20,7 +20,6 @@
 import java.net.URL;
 
 import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
@@ -28,23 +27,25 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.SourceValidity;
+import org.apache.excalibur.store.Store;
+
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.caching.CachedResponse;
-
 import org.apache.cocoon.components.sax.XMLByteStreamCompiler;
 import org.apache.cocoon.components.sax.XMLByteStreamInterpreter;
 import org.apache.cocoon.components.sax.XMLTeePipe;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.environment.CocoonRunnable;
 import org.apache.cocoon.thread.RunnableManager;
+import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.cocoon.xml.XMLConsumer;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceValidity;
-import org.apache.excalibur.store.Store;
-import org.xml.sax.SAXException;
+
 import EDU.oswego.cs.dl.util.concurrent.CountDown;
+import org.xml.sax.SAXException;
 
 /**
  * Default implementation of a {@link IncludeCacheManager}.
@@ -61,23 +62,19 @@
  *  @version $Id$
  *  @since   2.1
  */
-public final class DefaultIncludeCacheManager
-    extends AbstractLogEnabled
-    implements IncludeCacheManager, 
-                ThreadSafe, 
-                Serviceable, 
-                Disposable,
-                Parameterizable {
+public final class DefaultIncludeCacheManager extends AbstractLogEnabled
+                                              implements IncludeCacheManager, ThreadSafe, Serviceable,
+                                                         Disposable, Parameterizable {
 
     private ServiceManager manager;
     
-    private SourceResolver   resolver;
+    private SourceResolver resolver;
     
-    private Store            store;
+    private Store          store;
     
     private IncludeCacheStorageProxy defaultCacheStorage;
     
-    private String            preemptiveLoaderURI;
+    private String         preemptiveLoaderURI;
     
     /**
      * @see IncludeCacheManager#getSession(org.apache.avalon.framework.parameters.Parameters)
@@ -91,7 +88,7 @@
             Source source = null;
             try {
                 source = this.resolver.resolveURI(sourceURI);
-                IncludeCacheStorageProxy proxy = new ModifiableSourceIncludeCacheStorageProxy(this.resolver, source.getURI(), this.getLogger());
+                IncludeCacheStorageProxy proxy = new ModifiableSourceIncludeCacheStorageProxy(this.resolver, source.getURI());
                 session = new IncludeCacheManagerSession(pars, proxy);
             } catch (Exception local) {
                 session = new IncludeCacheManagerSession(pars, this.defaultCacheStorage);
@@ -133,9 +130,7 @@
     /**
      * @see IncludeCacheManager#load(java.lang.String, IncludeCacheManagerSession)
      */
-    public String load(String uri,
-                        IncludeCacheManagerSession session) 
-    throws IOException, SourceException {
+    public String load(String uri, IncludeCacheManagerSession session) throws IOException {
         if (this.getLogger().isDebugEnabled()) {
             this.getLogger().debug("Load " + uri + " for session " + session);
         }
@@ -205,19 +200,18 @@
     public void stream(String uri,
                         IncludeCacheManagerSession session,
                         XMLConsumer handler) 
-    throws IOException, SourceException, SAXException {
+    throws IOException, SAXException {
 
-        if (this.getLogger().isDebugEnabled()) {
-            this.getLogger().debug("Stream " + uri + " for session " + session);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Stream " + uri + " for session " + session);
         }
 
         // if we are processing in parallel (and not preemptive) then....
-        if ( session.isParallel() && !session.isPreemptive()) {
-            
+        if (session.isParallel() && !session.isPreemptive()) {
+
             // get either the cached content or the pooled thread
             Object object = session.get(uri);
-            
-            if ( null == object ) {
+            if (object == null) {
                 // this should never happen!
                 throw new SAXException("No pooled thread found for " + uri);
             }
@@ -321,7 +315,7 @@
         }
 
         // we are not processing in parallel and have no (valid) cached response
-        XMLByteStreamCompiler serializer = null;
+        XMLByteStreamCompiler serializer;
         try {
             final Source source = session.resolveURI(uri, this.resolver);
             
@@ -398,7 +392,7 @@
         } catch (ServiceException e) {
             throw new ParameterException("Unable to lookup store with role " + storeRole, e);
         }
-        this.defaultCacheStorage = new StoreIncludeCacheStorageProxy(this.store, this.getLogger());
+        this.defaultCacheStorage = new StoreIncludeCacheStorageProxy(this.store);
     }
     
     final private static class LoaderThread implements Runnable {
@@ -439,12 +433,11 @@
     final private static class PreemptiveBooter implements Runnable {
     
         private final String uri;
-    
-        public PreemptiveBooter( final String uri )
-        {
+
+        public PreemptiveBooter(final String uri) {
             this.uri = uri;
         }
-        
+
         public void run() {
             try {
                 URL url = new URL(this.uri);

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/ModifiableSourceIncludeCacheStorageProxy.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/ModifiableSourceIncludeCacheStorageProxy.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/ModifiableSourceIncludeCacheStorageProxy.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/ModifiableSourceIncludeCacheStorageProxy.java Tue Oct 16 20:52:17 2007
@@ -23,40 +23,38 @@
 import java.io.OutputStream;
 import java.io.Serializable;
 
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.cocoon.CascadingIOException;
-import org.apache.cocoon.util.HashUtil;
 import org.apache.excalibur.source.ModifiableSource;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 
+import org.apache.cocoon.CascadingIOException;
+import org.apache.cocoon.util.AbstractLogEnabled;
+import org.apache.cocoon.util.HashUtil;
+
 /**
  * This is the interface between the {@link IncludeCacheManager} and a
  * {@link Source} object that stores the cached content in a directory
  * manner.
  * 
- *  @version $Id$
- *  @since   2.1
+ * @since   2.1
+ * @version $Id$
  */
-public final class ModifiableSourceIncludeCacheStorageProxy
-    implements IncludeCacheStorageProxy {
+public final class ModifiableSourceIncludeCacheStorageProxy extends AbstractLogEnabled
+                                                            implements IncludeCacheStorageProxy {
 
     private SourceResolver resolver;
     private String         parentURI;
-    private Logger         logger;
-    
+
     /**
-     * Constructor
+     * Constructor.
+     *
      * @param resolver   For source resolving
      * @param parentURI  The "directory"
-     * @param logger     A logger for debugging
      */
     public ModifiableSourceIncludeCacheStorageProxy(SourceResolver resolver,
-                                             String         parentURI,
-                                             Logger         logger) {
+                                             String         parentURI) {
         this.resolver = resolver;
         this.parentURI= parentURI;
-        this.logger = logger;
     }
     
     /**
@@ -81,17 +79,16 @@
      * @see IncludeCacheStorageProxy#get(java.lang.String)
      */
     public Serializable get(String uri) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("WSCProxy: Getting content for " + uri);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("WSCProxy: Getting content for " + uri);
         }
 
         Source child = null;
         Serializable result = null;
         try {
             child = this.resolver.resolveURI(this.getURI(uri));
-
-            if (logger.isDebugEnabled()) {
-                logger.debug("WSCProxy: Resolved to " + child.getURI());
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("WSCProxy: Resolved to " + child.getURI());
             }
 
             if (child.exists()) {
@@ -105,8 +102,8 @@
             this.resolver.release( child );
         }
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("WSCProxy: Result for " + uri + " : " + (result == null ? "Not in cache" : "Found"));
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("WSCProxy: Result for " + uri + " : " + (result == null ? "Not in cache" : "Found"));
         }
         return result;
     }
@@ -116,15 +113,15 @@
      */
     public void put(String uri, Serializable object) 
     throws IOException {
-        if (logger.isDebugEnabled()) {
-            logger.debug("WSCProxy: Storing content for " + uri);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("WSCProxy: Storing content for " + uri);
         }
+
         Source child = null;
         try {
             child = this.resolver.resolveURI(this.getURI(uri));
-
-            if (logger.isDebugEnabled()) {
-                logger.debug("WSCProxy: Resolved to " + child.getURI());
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("WSCProxy: Resolved to " + child.getURI());
             }
 
             OutputStream os;
@@ -150,19 +147,19 @@
      * @see IncludeCacheStorageProxy#remove(java.lang.String)
      */
     public void remove(String uri) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("WSCProxy: Removing content for " + uri);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("WSCProxy: Removing content for " + uri);
         }
+
         Source child = null;
         try {
             child = this.resolver.resolveURI(this.getURI(uri));
-
-            if (logger.isDebugEnabled()) {
-                logger.debug("WSCProxy: Resolved to " + child.getURI());
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("WSCProxy: Resolved to " + child.getURI());
             }
 
             if (child instanceof ModifiableSource) {
-                ((ModifiableSource)child).delete();
+                ((ModifiableSource) child).delete();
             } else {
                 throw new IOException("Source " + uri + " is not writeable.");
             }
@@ -177,7 +174,7 @@
      */
     public boolean equals(Object object) {
         if (object instanceof ModifiableSourceIncludeCacheStorageProxy) {
-            return this.parentURI.equals(((ModifiableSourceIncludeCacheStorageProxy)object).parentURI);
+            return this.parentURI.equals(((ModifiableSourceIncludeCacheStorageProxy) object).parentURI);
         }
         return false;
     }
@@ -188,5 +185,4 @@
     public int hashCode() {
         return this.parentURI.hashCode();
     }
-
 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/StoreIncludeCacheStorageProxy.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/StoreIncludeCacheStorageProxy.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/StoreIncludeCacheStorageProxy.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/helpers/StoreIncludeCacheStorageProxy.java Tue Oct 16 20:52:17 2007
@@ -19,31 +19,28 @@
 import java.io.IOException;
 import java.io.Serializable;
 
-import org.apache.avalon.framework.logger.Logger;
 import org.apache.excalibur.store.Store;
 
+import org.apache.cocoon.util.AbstractLogEnabled;
+
 /**
  * This is the interface between the {@link IncludeCacheManager} and the usual
  * store.
  * 
- *  @version $Id$
- *  @since   2.1
+ * @since   2.1
+ * @version $Id$
  */
-public final class StoreIncludeCacheStorageProxy
-    implements IncludeCacheStorageProxy {
+public final class StoreIncludeCacheStorageProxy extends AbstractLogEnabled
+                                                 implements IncludeCacheStorageProxy {
+
+    private Store store;
 
-    private Store  store;
-    
-    private Logger logger;
-    
     /**
      * Constructor
      * @param store  The store for the cached content
-     * @param logger A logger for debugging
      */
-    public StoreIncludeCacheStorageProxy(Store store, Logger logger) {
+    public StoreIncludeCacheStorageProxy(Store store) {
         this.store = store;
-        this.logger = logger;
     }
     
     /** A string representation for a key */
@@ -55,14 +52,14 @@
      * @see IncludeCacheStorageProxy#get(java.lang.String)
      */
     public Serializable get(String uri) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("StoreProxy: Getting content for " + uri);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("StoreProxy: Getting content for " + uri);
         }
 
-        Serializable result = (Serializable)this.store.get(this.getKey(uri));
+        Serializable result = (Serializable) this.store.get(getKey(uri));
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("StoreProxy: Result for " + uri + " : " + (result == null ? "Not in cache" : "Found"));
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("StoreProxy: Result for " + uri + " : " + (result == null ? "Not in cache" : "Found"));
         }
         return result;
     }
@@ -72,19 +69,19 @@
      */
     public void put(String uri, Serializable object) 
     throws IOException {
-        if (logger.isDebugEnabled()) {
-            logger.debug("StoreProxy: Storing content for " + uri);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("StoreProxy: Storing content for " + uri);
         }
-        this.store.store(this.getKey(uri), object);
+        this.store.store(getKey(uri), object);
     }
 
     /**
      * @see IncludeCacheStorageProxy#remove(java.lang.String)
      */
     public void remove(String uri) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("StoreProxy: Removing content for " + uri);
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("StoreProxy: Removing content for " + uri);
         }
-        this.store.remove(this.getKey(uri));
+        this.store.remove(getKey(uri));
     }
 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingContentHandler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingContentHandler.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingContentHandler.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingContentHandler.java Tue Oct 16 20:52:17 2007
@@ -16,18 +16,20 @@
  */
 package org.apache.cocoon.xml;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.cocoon.util.AbstractLogEnabled;
+
 import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
-import org.xml.sax.ContentHandler;
 
 /**
  * Logging content handler logs all events going through to the logger.
  *
  * @version $Id$
  */
-public class LoggingContentHandler extends AbstractLogEnabled implements ContentHandler {
+public class LoggingContentHandler extends AbstractLogEnabled
+                                   implements ContentHandler {
 
     /**
      * All debug messages from this handler are prefixed with this id.
@@ -57,69 +59,60 @@
     }
 
     public void endDocument() throws SAXException {
-        log ("endDocument", "");
+        log("endDocument", "");
         this.contentHandler.endDocument();
     }
 
     public void startPrefixMapping(String prefix, String uri) throws SAXException {
-        log ("startPrefixMapping", "prefix="+prefix+",uri="+uri);
-        this.contentHandler.startPrefixMapping(prefix,uri);
+        log("startPrefixMapping", "prefix=" + prefix + ",uri=" + uri);
+        this.contentHandler.startPrefixMapping(prefix, uri);
     }
 
     public void endPrefixMapping(String prefix) throws SAXException {
-        log ("endPrefixMapping", "prefix="+prefix);
+        log("endPrefixMapping", "prefix=" + prefix);
         this.contentHandler.endPrefixMapping(prefix);
     }
 
     public void startElement(String uri, String loc, String raw, Attributes a)
     throws SAXException {
-        log ("startElement", "uri="+uri+",local="+loc+",raw="+raw);
+        log("startElement", "uri=" + uri + ",local=" + loc + ",raw=" + raw);
         for (int i = 0; i < a.getLength(); i++) {
-            log ("            ", Integer.toString(i + 1)
-                 + ". uri=" + a.getURI(i)
-                 + ",local=" + a.getLocalName(i)
-                 + ",qname=" + a.getQName(i)
-                 + ",type=" + a.getType(i)
-                 + ",value=" + a.getValue(i));
+            log("            ", Integer.toString(i + 1)
+                                + ". uri=" + a.getURI(i)
+                                + ",local=" + a.getLocalName(i)
+                                + ",qname=" + a.getQName(i)
+                                + ",type=" + a.getType(i)
+                                + ",value=" + a.getValue(i));
         }
-        this.contentHandler.startElement(uri,loc,raw,a);
+        this.contentHandler.startElement(uri, loc, raw, a);
     }
 
-
     public void endElement(String uri, String loc, String qname) throws SAXException {
-        log ("endElement", "uri="+uri+",local="+loc+",qname="+qname);
-        this.contentHandler.endElement(uri,loc,qname);
+        log("endElement", "uri=" + uri + ",local=" + loc + ",qname=" + qname);
+        this.contentHandler.endElement(uri, loc, qname);
     }
 
     public void characters(char ch[], int start, int len) throws SAXException {
-        log ("characters", new String(ch,start,len));
-        this.contentHandler.characters(ch,start,len);
+        log("characters", new String(ch, start, len));
+        this.contentHandler.characters(ch, start, len);
     }
 
     public void ignorableWhitespace(char ch[], int start, int len) throws SAXException {
-        log ("ignorableWhitespace", new String(ch,start,len));
-        this.contentHandler.ignorableWhitespace(ch,start,len);
+        log("ignorableWhitespace", new String(ch, start, len));
+        this.contentHandler.ignorableWhitespace(ch, start, len);
     }
 
     public void processingInstruction(String target, String data) throws SAXException {
-        log ("processingInstruction", "target="+target+",data="+data);
-        this.contentHandler.processingInstruction(target,data);
+        log("processingInstruction", "target=" + target + ",data=" + data);
+        this.contentHandler.processingInstruction(target, data);
     }
 
     public void skippedEntity(String name) throws SAXException {
-        log ("skippedEntity", "name="+name);
+        log("skippedEntity", "name=" + name);
         this.contentHandler.skippedEntity(name);
     }
 
     private void log(String location, String description) {
-        StringBuffer logEntry = new StringBuffer();
-        logEntry.append(id);
-        logEntry.append("[");
-        logEntry.append(location);
-        logEntry.append("] ");
-        logEntry.append(description);
-        logEntry.append("\n");
-        getLogger().debug(logEntry.toString());
-        // System.out.print(logEntry.toString());
+        getLogger().debug(id + "[" + location + "] " + description + "\n");
     }
 }

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingEntityResolver.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingEntityResolver.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingEntityResolver.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/xml/LoggingEntityResolver.java Tue Oct 16 20:52:17 2007
@@ -16,40 +16,41 @@
  */
 package org.apache.cocoon.xml;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
 import java.io.IOException;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.cocoon.util.AbstractLogEnabled;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
 /**
  * Logging entity resolver to assist in caching.
  *
  * @version $Id$
  */
-public class LoggingEntityResolver extends AbstractLogEnabled implements EntityResolver {
-
-  protected EntityResolver resolver;
-  protected Set dependencies;
+public class LoggingEntityResolver extends AbstractLogEnabled
+                                   implements EntityResolver {
 
-  public LoggingEntityResolver(EntityResolver resolver) {
-    this.resolver = resolver;
-    dependencies = new HashSet();
-  }
-
-  public InputSource resolveEntity(String public_id, String system_id) throws SAXException,IOException {
-    InputSource input_source = resolver.resolveEntity(public_id,system_id);
-    dependencies.add(input_source);
-    getLogger().debug("Dependency: "+input_source.getSystemId());
-    return input_source;
-  }
-
-  public Set getDependencies() {
-    return Collections.unmodifiableSet(dependencies);
-  }
+    protected EntityResolver resolver;
+    protected Set dependencies;
 
+    public LoggingEntityResolver(EntityResolver resolver) {
+        this.resolver = resolver;
+        dependencies = new HashSet();
+    }
+
+    public InputSource resolveEntity(String public_id, String system_id) throws SAXException, IOException {
+        InputSource input_source = resolver.resolveEntity(public_id, system_id);
+        dependencies.add(input_source);
+        getLogger().debug("Dependency: " + input_source.getSystemId());
+        return input_source;
+    }
+
+    public Set getDependencies() {
+        return Collections.unmodifiableSet(dependencies);
+    }
 }

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSource.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSource.java (original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSource.java Tue Oct 16 20:52:17 2007
@@ -30,6 +30,8 @@
 
 /**
  * Proxy like source adding XMLizable.
+ *
+ * @version $Id$
  */
 public class XMLizableSource implements XMLizable, Source {
 
@@ -56,8 +58,7 @@
         return m_source.exists();
     }
 
-    public InputStream getInputStream()
-        throws IOException, SourceNotFoundException {
+    public InputStream getInputStream() throws IOException {
         return m_source.getInputStream();
     }
 
@@ -91,11 +92,9 @@
 
     public void toSAX(ContentHandler handler) throws SAXException {
         try {
-            SourceUtil.toSAX(m_manager,m_source,"text/xml",handler);
-        }
-        catch (Exception e) {
+            SourceUtil.toSAX(m_manager, m_source, "text/xml", handler);
+        } catch (Exception e) {
             throw new SAXException("Failure during toSAX",e);
         }
     }
-
 }

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSourceFactory.java?rev=585353&r1=585352&r2=585353&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/XMLizableSourceFactory.java Tue Oct 16 20:52:17 2007
@@ -17,10 +17,8 @@
 package org.apache.cocoon.components.source.impl;
 
 import java.io.IOException;
-import java.net.MalformedURLException;
 import java.util.Map;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -30,43 +28,48 @@
 import org.apache.excalibur.source.SourceFactory;
 import org.apache.excalibur.source.SourceResolver;
 
+import org.apache.cocoon.util.AbstractLogEnabled;
 
-public class XMLizableSourceFactory extends AbstractLogEnabled 
-implements SourceFactory, Serviceable, ThreadSafe {
+/**
+ * @version $Id$
+ */
+public class XMLizableSourceFactory extends AbstractLogEnabled
+                                    implements SourceFactory, Serviceable, ThreadSafe {
     
     private ServiceManager m_manager;
     private SourceResolver m_resolver;
     
-    private boolean m_initialized;
+    private volatile boolean m_initialized;
+
     
     public void service(ServiceManager manager) throws ServiceException {
         m_manager = manager;
     }
     
     private synchronized void lazyInitialize() throws SourceException {
-        if (m_initialized) {
-            return;
-        }
-        try {
-            m_resolver = (SourceResolver) m_manager.lookup(SourceResolver.ROLE);
-        }
-        catch (ServiceException e) {
-            throw new SourceException("Missing service dependency: SourceResolver",e);
+        if (!m_initialized) {
+            try {
+                m_resolver = (SourceResolver) m_manager.lookup(SourceResolver.ROLE);
+            } catch (ServiceException e) {
+                throw new SourceException("Missing service dependency: SourceResolver",e);
+            }
+            m_initialized = true;
         }
-        m_initialized = true;
     }
     
     public Source getSource(String location, Map parameters)
-        throws IOException, MalformedURLException {
-        if (this.getLogger().isDebugEnabled()) {
-            this.getLogger().debug("Creating source object for " + location);
+    throws IOException {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Creating source object for " + location);
         }
         if (!m_initialized) {
             lazyInitialize();
         }
-        final String uri = location.substring(XMLizableSource.SCHEME.length()+1);
-        final Source delegate = m_resolver.resolveURI(uri,null,parameters);
-        return new XMLizableSource(delegate,m_manager);
+
+        final String uri = location.substring(XMLizableSource.SCHEME.length() + 1);
+        final Source delegate = m_resolver.resolveURI(uri, null, parameters);
+
+        return new XMLizableSource(delegate, m_manager);
     }
 
     public void release(Source source) {
@@ -74,5 +77,4 @@
             m_resolver.release(((XMLizableSource) source).getSource());
         }
     }
-
 }



Mime
View raw message