cziegeler    2004/05/24 06:31:31

  Modified:    src/java/org/apache/cocoon/sitemap LinkTranslator.java
  Log:
  Make LinkTranslator cacheable (from 2.2 repo)
  
  Revision  Changes    Path
  1.7       +25 -2     
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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LinkTranslator.java       5 Mar 2004 13:02:58 -0000       1.6
  +++ LinkTranslator.java       24 May 2004 13:31:30 -0000      1.7
  @@ -18,9 +18,12 @@
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.caching.CacheableProcessingComponent;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.transformation.Transformer;
   import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe;
  +import org.apache.excalibur.source.SourceValidity;
  +import org.apache.excalibur.source.impl.validity.NOPValidity;
   
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
  @@ -32,7 +35,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
    * @version CVS $Id$
    */
  -public class LinkTranslator extends ExtendedXLinkPipe implements Transformer 
{
  +public class LinkTranslator extends ExtendedXLinkPipe implements 
Transformer, CacheableProcessingComponent {
       
       private Map links;
   
  @@ -43,6 +46,26 @@
       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, 
  
  
  

Reply via email to