You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ha...@apache.org on 2001/11/26 10:49:38 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/sitemap AbstractSitemap.java

haul        01/11/26 01:49:38

  Modified:    src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
                        AbstractSitemap.java
  Log:
  Added <map:dump-parameters/> to print all currently known sitemap
  parameters tog. Great to debug sitemap + educational.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.22  +27 -1     xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
  retrieving revision 1.4.2.21
  retrieving revision 1.4.2.22
  diff -u -r1.4.2.21 -r1.4.2.22
  --- AbstractSitemap.java	2001/10/11 08:56:15	1.4.2.21
  +++ AbstractSitemap.java	2001/11/26 09:49:38	1.4.2.22
  @@ -42,12 +42,13 @@
   import java.util.ArrayList;
   import java.util.List;
   import java.util.Map;
  +import java.util.Iterator;
   
   /**
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.4.2.21 $ $Date: 2001/10/11 08:56:15 $
  + * @version CVS $Revision: 1.4.2.22 $ $Date: 2001/11/26 09:49:38 $
    */
   public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap, Disposable, ThreadSafe {
       private Context context;
  @@ -319,6 +320,31 @@
               getLogger().error("AbstractSitemap:substitute()", e);
               throw new PatternException("error occurred during evaluation of expression \"" + expr + "\" at position " +
                   (i + 1) + "\n" + e.getMessage());
  +        }
  +    }
  +
  +    /** 
  +     * Dumps all sitemap parameters to log
  +     */
  +    protected void dumpParameters(List list) {
  +        if (getLogger().isDebugEnabled()) {
  +            StringBuffer sb=new StringBuffer();
  +            if (!list.isEmpty()) {
  +                sb.append("\nCurrent Sitemap Parameters:\n");
  +                String path="";
  +                for (int i=list.size()-1; i>=0; i--) {
  +                    Map map=(Map)list.get(i);
  +                    Iterator keys = map.keySet().iterator();
  +                    while (keys.hasNext()) {
  +                        String key = (String)keys.next();
  +                        sb.append(path)
  +                            .append("PARAM: '").append(key)
  +                            .append("' VALUE: '").append(map.get(key)).append("'\n");
  +                    }
  +                    path="../"+path;
  +                }
  +            }
  +            getLogger().debug(sb.toString());
           }
       }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org