You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/05/14 15:51:41 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/transformation I18nTransformer.java TraxTransformer.java

cziegeler    01/05/14 06:51:39

  Modified:    src/org/apache/cocoon/generation FileGenerator.java
                        HTMLGenerator.java ScriptGenerator.java
               src/org/apache/cocoon/transformation I18nTransformer.java
                        TraxTransformer.java
  Log:
  Fixed file name handling for caching
  
  Revision  Changes    Path
  1.3       +5 -3      xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java
  
  Index: FileGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileGenerator.java	2001/05/10 21:16:50	1.2
  +++ FileGenerator.java	2001/05/14 13:51:18	1.3
  @@ -38,11 +38,13 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/10 21:16:50 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/05/14 13:51:18 $
    */
   public class FileGenerator extends ComposerGenerator
   implements Cacheable, Recyclable {
   
  +    private static final String FILE = "file:";
  +
       /** The input source */
       private InputSource inputSource;
       /** The system ID of the input source */
  @@ -77,8 +79,8 @@
           super.setup(resolver, objectModel, src, par);
           this.inputSource = super.resolver.resolveEntity(null, super.source);
           this.systemID = this.inputSource.getSystemId();
  -        if (this.systemID.startsWith("file:") == true) {
  -            File xmlFile = new File(this.systemID.substring("file:".length()));
  +        if (this.systemID.startsWith(FILE) == true) {
  +            File xmlFile = new File(this.systemID.substring(FILE.length()));
               this.lastModificationDate = xmlFile.lastModified();
           } else {
               try {
  
  
  
  1.3       +5 -3      xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HTMLGenerator.java	2001/05/10 21:16:51	1.2
  +++ HTMLGenerator.java	2001/05/14 13:51:21	1.3
  @@ -37,10 +37,12 @@
   /**
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/10 21:16:51 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/05/14 13:51:21 $
    */
   public class HTMLGenerator extends ComposerGenerator implements Cacheable, Recyclable {
   
  +    private static final String FILE = "file:";
  +
       /** The system ID of the input source */
       private String      systemID;
       /** Last modification date of the source */
  @@ -64,8 +66,8 @@
           super.setup(resolver, objectModel, src, par);
           InputSource inputSource = super.resolver.resolveEntity(null, super.source);
           this.systemID = inputSource.getSystemId();
  -        if (this.systemID.startsWith("file:") == true) {
  -            File xmlFile = new File(this.systemID.substring("file:".length()));
  +        if (this.systemID.startsWith(FILE) == true) {
  +            File xmlFile = new File(this.systemID.substring(FILE.length()));
               this.lastModificationDate = xmlFile.lastModified();
           } else {
               try {
  
  
  
  1.3       +4 -2      xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java
  
  Index: ScriptGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ScriptGenerator.java	2001/05/10 21:16:53	1.2
  +++ ScriptGenerator.java	2001/05/14 13:51:23	1.3
  @@ -31,10 +31,12 @@
    * and additional interpreter (Rhino, Jython, etc.) as a Cocoon Generator
    *
    * @author <a href="mailto:jafoster@engmail.uwaterloo.ca">Jason Foster</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/10 21:16:53 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/05/14 13:51:23 $
    */
   public class ScriptGenerator extends ComposerGenerator implements Recyclable {
   
  +    private static final String FILE = "file:";
  +
       public void configure(Configuration conf) throws ConfigurationException {
           // TODO: figure out what configure might be good for
           // void configure
  @@ -49,7 +51,7 @@
   
               InputSource src = this.resolver.resolveEntity(null, this.source);
               String systemID = src.getSystemId();
  -            String fileName = systemID.substring("file:".length());
  +            String fileName = systemID.substring(FILE.length());
   
               getLogger().debug("file resolved to [" + systemID + "]");
               getLogger().debug("file name extracted as [" + fileName + "]");
  
  
  
  1.2       +5 -3      xml-cocoon2/src/org/apache/cocoon/transformation/I18nTransformer.java
  
  Index: I18nTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/I18nTransformer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- I18nTransformer.java	2001/05/09 20:49:34	1.1
  +++ I18nTransformer.java	2001/05/14 13:51:33	1.2
  @@ -106,6 +106,8 @@
    */
   public class I18nTransformer extends AbstractTransformer implements Composable, Recyclable, Cacheable {
   
  +    private static final String FILE = "file:";
  +
       protected ComponentManager manager;
   
       public Map dictionary;
  @@ -175,7 +177,7 @@
        * @return The generated key hashes the src
        */
       public long generateKey() {
  -        if (this.systemID.startsWith("file:") == true) {
  +        if (this.systemID.startsWith(FILE) == true) {
               return HashUtil.hash(this.source);
           }
           return 0;
  @@ -188,8 +190,8 @@
        *         component is currently not cacheable.
        */
       public CacheValidity generateValidity() {
  -        if (this.systemID.startsWith("file:") == true) {
  -            File xmlFile = new File(this.systemID.substring("file:".length()));
  +        if (this.systemID.startsWith(FILE) == true) {
  +            File xmlFile = new File(this.systemID.substring(FILE.length()));
               return new TimeStampCacheValidity(xmlFile.lastModified());
           }
           return null;
  
  
  
  1.2       +5 -4      xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TraxTransformer.java	2001/05/09 20:49:35	1.1
  +++ TraxTransformer.java	2001/05/14 13:51:34	1.2
  @@ -98,12 +98,13 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version CVS $Id: TraxTransformer.java,v 1.1 2001/05/09 20:49:35 giacomo Exp $
  + * @version CVS $Id: TraxTransformer.java,v 1.2 2001/05/14 13:51:34 cziegeler Exp $
    */
   public class TraxTransformer extends ContentHandlerWrapper
   implements Transformer, Composable, Recyclable, Configurable, Cacheable, Disposable {
  -    private static String FILE = "file:/";
   
  +    private static final String FILE = "file:";
  +
       /** The store service instance */
       private Store store = null;
   
  @@ -141,11 +142,11 @@
       throws SAXException, ProcessingException, IOException, TransformerConfigurationException {
           Templates templates = getTemplates();
           if(templates == null) {
  -            getLogger().debug("Creating new Templates in " + this + " for" + systemID + ":" + xsluri);
  +            getLogger().debug("Creating new Templates in " + this + " for " + systemID + ":" + xsluri);
               templates = getTransformerFactory().newTemplates(new SAXSource(this.inputSource));
               putTemplates (templates);
           } else {
  -            getLogger().debug("Reusing Templates in " + this + " for" + systemID + ":" + xsluri);
  +            getLogger().debug("Reusing Templates in " + this + " for " + systemID + ":" + xsluri);
           }
   
           TransformerHandler handler = getTransformerFactory().newTransformerHandler(templates);
  
  
  

----------------------------------------------------------------------
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