cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pruss...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/sitemap Manager.java XSLTFactoryLoader.java
Date Tue, 20 Feb 2001 12:47:52 GMT
prussell    01/02/20 04:47:51

  Modified:    src/org/apache/cocoon/sitemap Tag: xml-cocoon2 Manager.java
                        XSLTFactoryLoader.java
  Log:
  Fixing XSLTFactoryLoader's logging. This is not an ideal workaround as I
  am setting the log statically. Since as far as I know we can't get hold
  of the actual class instance to perform lifecycle management, I can't really
  see an alternative.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.9   +9 -1      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- Manager.java	2001/02/19 21:57:50	1.1.2.8
  +++ Manager.java	2001/02/20 12:47:43	1.1.2.9
  @@ -27,6 +27,7 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.sitemap.Handler;
  +import org.apache.cocoon.sitemap.XSLTFactoryLoader;
   
   import org.xml.sax.SAXException;
   
  @@ -36,7 +37,7 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/19 21:57:50 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/20 12:47:43 $
    */
   public class Manager extends AbstractLoggable implements Configurable, Composer, Contextualizable
{
   
  @@ -74,6 +75,13 @@
               prefix = uri_prefix;
           Handler sitemapHandler = (Handler) sitemaps.get(source);
   
  +        /* FIXME: Workaround -- set the logger XSLTFactoryLoader used to generate source
  +         * within the sitemap generation phase.
  +         * Needed because we never have the opportunity to handle the lifecycle of the
  +         * XSLTFactoryLoader, since it is created by the Xalan engine.
  +         */
  +        XSLTFactoryLoader.setLogger(getLogger());
  +        
           if (sitemapHandler != null) {
               if (sitemapHandler.available()) {
                   if (check_reload
  
  
  
  1.1.2.9   +20 -17    xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTFactoryLoader.java
  
  Index: XSLTFactoryLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTFactoryLoader.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- XSLTFactoryLoader.java	2001/01/22 21:56:49	1.1.2.8
  +++ XSLTFactoryLoader.java	2001/02/20 12:47:46	1.1.2.9
  @@ -23,13 +23,16 @@
    * generation stylesheet to load <code>MatcherFactory</code>s or
    * <code>SelectorFactory</code>s to get the generated source code.
    *
  + * <strong>Note:</strong> This class uses a static log instance to
  + * set up the instances it creates. This is suboptimal.
  + *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/01/22 21:56:49 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/20 12:47:46 $
    */
   
  -public class XSLTFactoryLoader implements Loggable {
  -    protected Logger log;
  +public class XSLTFactoryLoader {
  +    protected static Logger log;
   
       private HashMap obj = new HashMap();
   
  @@ -50,27 +53,27 @@
                               + "\". Should implement the CodeFactory interface");
       }
   
  -    public void setLogger(Logger logger) {
  -        if (this.log == null) {
  -            this.log = logger;
  +    public static void setLogger(Logger logger) {
  +        if (log == null) {
  +            log = logger;
           }
       }
   
       public String getParameterSource(String className, NodeIterator conf)
       throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception
{
           Object factory = obj.get(className);
  -    if (factory == null) factory = ClassUtils.newInstance(className);
  -    obj.put (className, factory);
  -
  -    if (factory instanceof Loggable) {
  -        ((Loggable)factory).setLogger(this.log);
  -    }
  -    if (factory instanceof CodeFactory) {
  -        return ((CodeFactory) factory).generateParameterSource(conf);
  -    }
  +        if (factory == null) factory = ClassUtils.newInstance(className);
  +        obj.put (className, factory);
   
  -    throw new Exception ("Wrong class \"" + factory.getClass().getName()
  -                         + "\". Should implement the CodeFactory interface");
  +        if (factory instanceof Loggable) {
  +            ((Loggable)factory).setLogger(this.log);
  +        }
  +        if (factory instanceof CodeFactory) {
  +            return ((CodeFactory) factory).generateParameterSource(conf);
  +        }
  +    
  +        throw new Exception ("Wrong class \"" + factory.getClass().getName()
  +                             + "\". Should implement the CodeFactory interface");
       }
   
       public String getMethodSource(String className, NodeIterator conf)
  
  
  

Mime
View raw message