cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upayav...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/sitemap LinkTranslator.java
Date Tue, 21 Oct 2003 21:48:32 GMT
upayavira    2003/10/21 14:48:32

  Modified:    src/java/org/apache/cocoon/bean CocoonBean.java
               src/java/org/apache/cocoon/bean/helpers Crawler.java
               src/java/org/apache/cocoon/sitemap LinkTranslator.java
  Log:
  Fixing broken link translation - LinkTranslator was set to be cachable, which meant that
links were translated with getType(), translations worked out, and then getPage() got the
cached version back which was created before the translation had been done.
  
  Also fixed a problem with the allTranslatedLinks map where already translated links weren't
accessed correctly.
  
  Revision  Changes    Path
  1.38      +5 -1      cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java
  
  Index: CocoonBean.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- CocoonBean.java	17 Oct 2003 14:08:29 -0000	1.37
  +++ CocoonBean.java	21 Oct 2003 21:48:32 -0000	1.38
  @@ -497,6 +497,10 @@
                              }
                           }
                       }
  +                } else {
  +                    String originalURI = linkTarget.getOriginalSourceURI();
  +                    linkTarget = crawler.getTranslatedLink(linkTarget);
  +                    linkTarget.setOriginalURI(originalURI);
                   }
   
                   translatedLinks.put(linkTarget.getOriginalSourceURI(), linkTarget.getTranslatedURI(target.getPath()));
  
  
  
  1.3       +7 -2      cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/Crawler.java
  
  Index: Crawler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/Crawler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Crawler.java	9 Oct 2003 17:37:32 -0000	1.2
  +++ Crawler.java	21 Oct 2003 21:48:32 -0000	1.3
  @@ -107,12 +107,17 @@
       }
       
       public void addTranslatedLink(Target target) throws ProcessingException {
  -        allTranslatedLinks.put(target.getSourceURI(), target.getDestinationURI());
  +        allTranslatedLinks.put(target.getSourceURI(), target);
       }
       
       public boolean hasTranslatedLink(Target link) {
           return allTranslatedLinks.get(link.getSourceURI())!=null;
       }
  +    
  +    public Target getTranslatedLink(Target link) {
  +        return (Target) allTranslatedLinks.get(link.getSourceURI());
  +    }
  +    
       /**
        * Returns an iterator for reading targets
        */
  
  
  
  1.4       +2 -22     cocoon-2.1/src/java/org/apache/cocoon/sitemap/LinkTranslator.java
  
  Index: LinkTranslator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/sitemap/LinkTranslator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LinkTranslator.java	5 Sep 2003 11:40:41 -0000	1.3
  +++ LinkTranslator.java	21 Oct 2003 21:48:32 -0000	1.4
  @@ -70,7 +70,7 @@
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @version CVS $Id$
    */
  -public class LinkTranslator extends ExtendedXLinkPipe implements Transformer, CacheableProcessingComponent
{
  +public class LinkTranslator extends ExtendedXLinkPipe implements Transformer {
       
       private Map links;
   
  @@ -81,26 +81,6 @@
       public void setup(SourceResolver resolver, Map objectModel, String src, Parameters
par) 
       throws ProcessingException, SAXException, IOException {
           this.links = (Map)objectModel.get(Constants.LINK_OBJECT);
  -    }
  -
  -    /**
  -     * Generate the unique key.
  -     * This key must be unique inside the space of this component.
  -     *
  -     * @return The generated key hashes the src
  -     */
  -    public java.io.Serializable getKey() {
  -        return "1";
  -    }
  -
  -    /**
  -     * Generate the validity object.
  -     *
  -     * @return The generated validity object or <code>null</code> if the
  -     *         component is currently not cacheable.
  -     */
  -    public SourceValidity getValidity() {
  -        return NOPValidity.SHARED_INSTANCE;
       }
   
       public void simpleLink(String href, String role, String arcrole, 
  
  
  

Mime
View raw message