You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2001/02/12 14:50:25 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/components/url URLFactoryImpl.java ResourceURLFactory.java ContextURLFactory.java

bloritsch    01/02/12 05:50:24

  Modified:    src/org/apache/cocoon/components/url Tag: xml-cocoon2
                        URLFactoryImpl.java ResourceURLFactory.java
                        ContextURLFactory.java
  Log:
  Change to use AbstractLoggable
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +9 -23     xml-cocoon/src/org/apache/cocoon/components/url/Attic/URLFactoryImpl.java
  
  Index: URLFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/url/Attic/URLFactoryImpl.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- URLFactoryImpl.java	2001/02/12 13:33:16	1.1.2.1
  +++ URLFactoryImpl.java	2001/02/12 13:50:23	1.1.2.2
  @@ -20,24 +20,18 @@
   import org.apache.avalon.ConfigurationException;
   import org.apache.avalon.Context;
   import org.apache.avalon.Contextualizable;
  +import org.apache.avalon.AbstractLoggable;
   import org.apache.avalon.Loggable;
   
  -import org.apache.log.Logger;
  -
   //import org.apache.cocoon.util.NetUtils;
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.util.ClassUtils;
   
   /**
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version $Id: URLFactoryImpl.java,v 1.1.2.1 2001/02/12 13:33:16 giacomo Exp $
  + * @version $Id: URLFactoryImpl.java,v 1.1.2.2 2001/02/12 13:50:23 bloritsch Exp $
    */
  -public class URLFactoryImpl implements URLFactory, Component, Loggable, Configurable, Contextualizable {
  -
  -    /**
  -     * The logger
  -     */
  -    protected Logger log;
  +public class URLFactoryImpl extends AbstractLoggable implements URLFactory, Component, Configurable, Contextualizable {
   
       /**
        * The context
  @@ -69,7 +63,7 @@
           try {
               return new URL(location);
           } catch (MalformedURLException mue) {
  -            log.debug("Making URL a File relative to context root", mue);
  +            getLogger().debug("Making URL a File relative to context root", mue);
   
               String root = (String)context.get(Constants.CONTEXT_ROOT_PATH);
               if (root != null) {
  @@ -92,21 +86,13 @@
               this.context = context;
           }
       }
  -    /**
  -     * Get the logger
  -     */
  -    public void setLogger(Logger logger) {
  -        if (this.log == null) {
  -            this.log = logger;
  -        }
  -    }
   
       /**
        * Configure the URLFactories
        */
       public void configure(final Configuration conf) throws ConfigurationException {
           try {
  -            log.debug("Getting the URLFactories");
  +            getLogger().debug("Getting the URLFactories");
               factories = new HashMap();
               Iterator iter = conf.getChildren("protocol");
               Configuration config = null;
  @@ -115,10 +101,10 @@
               while (iter.hasNext()) {
                   config = (Configuration)iter.next();
                   protocol = config.getAttribute("name");
  -                log.debug("\tfor protocol: " + protocol + " " + config.getAttribute("class"));
  +                getLogger().debug("\tfor protocol: " + protocol + " " + config.getAttribute("class"));
                   urlFactory = (URLFactory) ClassUtils.newInstance(config.getAttribute("class"));
                   if (urlFactory instanceof Loggable) {
  -                    ((Loggable) urlFactory).setLogger (this.log);
  +                    ((Loggable) urlFactory).setLogger(getLogger());
                   }
                   if (urlFactory instanceof Contextualizable) {
                       ((Contextualizable) urlFactory).contextualize (this.context);
  @@ -126,9 +112,9 @@
                   factories.put(protocol, urlFactory);
               }
           } catch (Exception e) {
  -            log.error("Could not get URLFactories", e);
  +            getLogger().error("Could not get URLFactories", e);
               throw new ConfigurationException("Could not get parameters because: " +
                                              e.getMessage());
           }
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.1.2.2   +5 -20     xml-cocoon/src/org/apache/cocoon/components/url/Attic/ResourceURLFactory.java
  
  Index: ResourceURLFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/url/Attic/ResourceURLFactory.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ResourceURLFactory.java	2001/02/12 13:33:15	1.1.2.1
  +++ ResourceURLFactory.java	2001/02/12 13:50:23	1.1.2.2
  @@ -12,22 +12,15 @@
   
   import org.apache.avalon.Context;
   import org.apache.avalon.Contextualizable;
  -import org.apache.avalon.Loggable;
  +import org.apache.avalon.AbstractLoggable;
   
  -import org.apache.log.Logger;
  -
   import org.apache.cocoon.util.ClassUtils;
   
   /**
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version $Id: ResourceURLFactory.java,v 1.1.2.1 2001/02/12 13:33:15 giacomo Exp $
  + * @version $Id: ResourceURLFactory.java,v 1.1.2.2 2001/02/12 13:50:23 bloritsch Exp $
    */
  -public class ResourceURLFactory implements URLFactory, Loggable, Contextualizable {
  -
  -    /**
  -     * The logger
  -     */
  -    protected Logger log;
  +public class ResourceURLFactory extends AbstractLoggable implements URLFactory, Contextualizable {
   
       /**
        * The context
  @@ -48,7 +41,7 @@
           if (u != null)
               return u;
           else {
  -            log.error(location + " could not be found. (possible classloader problem)");
  +            getLogger().error(location + " could not be found. (possible classloader problem)");
               throw new RuntimeException(location + " could not be found. (possible classloader problem)");
           }
       }
  @@ -64,13 +57,5 @@
           if (this.context == null) {
               this.context = context;
           }
  -    }
  -    /**
  -     * Get the logger
  -     */
  -    public void setLogger(Logger logger) {
  -        if (this.log == null) {
  -            this.log = logger;
  -        }
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.1.2.2   +6 -22     xml-cocoon/src/org/apache/cocoon/components/url/Attic/ContextURLFactory.java
  
  Index: ContextURLFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/url/Attic/ContextURLFactory.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ContextURLFactory.java	2001/02/12 13:33:15	1.1.2.1
  +++ ContextURLFactory.java	2001/02/12 13:50:23	1.1.2.2
  @@ -14,22 +14,15 @@
   
   import org.apache.avalon.Context;
   import org.apache.avalon.Contextualizable;
  -import org.apache.avalon.Loggable;
  +import org.apache.avalon.AbstractLoggable;
   
  -import org.apache.log.Logger;
  -
   /**
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version $Id: ContextURLFactory.java,v 1.1.2.1 2001/02/12 13:33:15 giacomo Exp $
  + * @version $Id: ContextURLFactory.java,v 1.1.2.2 2001/02/12 13:50:23 bloritsch Exp $
    */
  -public class ContextURLFactory implements URLFactory, Loggable, Contextualizable {
  +public class ContextURLFactory extends AbstractLoggable implements URLFactory, Contextualizable {
   
       /**
  -     * The logger
  -     */
  -    protected Logger log;
  -
  -    /**
        * The context
        */
       protected Context context;
  @@ -46,14 +39,14 @@
       public URL getURL(String location) throws MalformedURLException {
           ServletContext servletContext = (ServletContext)context.get("servlet-context");
           if (servletContext == null) {
  -            log.warn("no servlet-context in application context (making an absolute URL)");
  +            getLogger().warn("no servlet-context in application context (making an absolute URL)");
               return new URL(location);
           }
           URL u = ((ServletContext)context.get("servlet-context")).getResource(location);
           if (u != null)
               return u;
           else {
  -            log.error(location + " could not be found. (possible context problem)");
  +            getLogger().error(location + " could not be found. (possible context problem)");
               throw new RuntimeException(location + " could not be found. (possible context problem)");
           }
       }
  @@ -69,14 +62,5 @@
           if (this.context == null) {
               this.context = context;
           }
  -    }
  -
  -    /**
  -     * Get the logger
  -     */
  -    public void setLogger(Logger logger) {
  -        if (this.log == null) {
  -            this.log = logger;
  -        }
       }
  -}
  \ No newline at end of file
  +}
  
  
  

Re: cvs commit: xml-cocoon/src/org/apache/cocoon/components/url URLFactoryImpl.java ResourceURLFactory.java ContextURLFactory.java

Posted by Giacomo Pati <gi...@apache.org>.
bloritsch@apache.org wrote:
> bloritsch    01/02/12 05:50:24
>
>   Modified:    src/org/apache/cocoon/components/url Tag: xml-cocoon2
>                         URLFactoryImpl.java ResourceURLFactory.java
>                         ContextURLFactory.java
>   Log:
>   Change to use AbstractLoggable
>
>   Revision  Changes    Path
>   No                   revision
>
>
>   No                   revision
>
>

This is way cool :)

As soon as someone commit somthing someone else get its hand dirty with it.

Thanks, Berin

Giacomo