cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source SourceDescriptor.java SourceInspector.java
Date Fri, 21 Nov 2003 16:09:29 GMT
unico       2003/11/21 08:09:29

  Modified:    src/blocks/repository/java/org/apache/cocoon/components/source/impl
                        XPathSourceInspector.java
                        SourceDescriptorManager.java
                        AbstractImageSourceInspector.java
               src/blocks/repository/java/org/apache/cocoon/components/source
                        SourceDescriptor.java SourceInspector.java
  Log:
  getValidity needs to be defined on inspector instead of descriptor because computed properties
  can also become invalid
  
  Revision  Changes    Path
  1.6       +12 -1     cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/XPathSourceInspector.java
  
  Index: XPathSourceInspector.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/XPathSourceInspector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XPathSourceInspector.java	21 Nov 2003 11:37:48 -0000	1.5
  +++ XPathSourceInspector.java	21 Nov 2003 16:09:28 -0000	1.6
  @@ -62,6 +62,8 @@
   import org.apache.cocoon.components.source.helpers.SourceProperty;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
  +import org.apache.excalibur.source.SourceValidity;
  +import org.apache.excalibur.source.impl.validity.NOPValidity;
   import org.apache.excalibur.xml.dom.DOMParser;
   import org.apache.excalibur.xml.xpath.XPathProcessor;
   import org.w3c.dom.Document;
  @@ -95,6 +97,8 @@
        */
       public static final String DEFAULT_PROPERTY_NAME = "result";
       
  +    private static final SourceValidity VALIDITY = new NOPValidity();
  +    
       private String propertynamespace;
       private String propertyname;
       private String extension;
  @@ -174,5 +178,12 @@
           return this.propertynamespace.equals(namespace) && this.propertyname.equals(name);
       }
   
  +    /**
  +     * Returns NOPValidity
  +     */
  +    public SourceValidity getValidity(Source source) {
  +        return VALIDITY;
  +    }
  +    
   }
   
  
  
  
  1.7       +5 -7      cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/SourceDescriptorManager.java
  
  Index: SourceDescriptorManager.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/SourceDescriptorManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SourceDescriptorManager.java	21 Nov 2003 11:37:48 -0000	1.6
  +++ SourceDescriptorManager.java	21 Nov 2003 16:09:28 -0000	1.7
  @@ -248,13 +248,11 @@
           final Iterator inspectors = m_inspectors.iterator();
           while (inspectors.hasNext()) {
               inspector = (SourceInspector) inspectors.next();
  -            if (inspector instanceof SourceDescriptor) {
  -                SourceValidity sv = ((SourceDescriptor) inspector).getValidity(source);
  -                if (sv == null) {
  -                    return null;
  -                }
  -                validity.add(sv);
  +            SourceValidity sv = inspector.getValidity(source);
  +            if (sv == null) {
  +                return null;
               }
  +            validity.add(sv);
           }
           return validity;
       }
  
  
  
  1.3       +11 -0     cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/AbstractImageSourceInspector.java
  
  Index: AbstractImageSourceInspector.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/AbstractImageSourceInspector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractImageSourceInspector.java	21 Nov 2003 11:37:48 -0000	1.2
  +++ AbstractImageSourceInspector.java	21 Nov 2003 16:09:28 -0000	1.3
  @@ -54,6 +54,8 @@
   import org.apache.cocoon.components.source.helpers.SourceProperty;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
  +import org.apache.excalibur.source.SourceValidity;
  +import org.apache.excalibur.source.impl.validity.NOPValidity;
   
   /**
    * Abstract base class for inspectors that can calculate 
  @@ -83,6 +85,8 @@
        */
       public static final String IMAGE_HEIGHT_PROPERTY_NAME = "height";
       
  +    private static final SourceValidity VALIDITY = new NOPValidity();
  +    
       private static final String[] HANDLED_PROPERTIES = new String[] {
           PROPERTY_NS + "#" + IMAGE_HEIGHT_PROPERTY_NAME,
           PROPERTY_NS + "#" + IMAGE_WIDTH_PROPERTY_NAME
  @@ -128,6 +132,13 @@
           return namespace.equals(PROPERTY_NS) && 
                      (name.equals(IMAGE_WIDTH_PROPERTY_NAME) || 
                      name.equals(IMAGE_HEIGHT_PROPERTY_NAME));
  +    }
  +    
  +    /**
  +     * Returns NOPValidity
  +     */
  +    public SourceValidity getValidity(Source source) {
  +        return VALIDITY;
       }
       
       /**
  
  
  
  1.4       +0 -10     cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/SourceDescriptor.java
  
  Index: SourceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/SourceDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SourceDescriptor.java	28 Oct 2003 13:48:12 -0000	1.3
  +++ SourceDescriptor.java	21 Nov 2003 16:09:28 -0000	1.4
  @@ -52,7 +52,6 @@
   import org.apache.cocoon.components.source.helpers.SourceProperty;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
  -import org.apache.excalibur.source.SourceValidity;
   
   /**
    * A source descriptor handles modifiable source properties.
  @@ -82,13 +81,4 @@
       public void removeSourceProperty(Source source, String namespace, String name) 
           throws SourceException;
   
  -    /**
  -     * Get the validity object that describes the validity state
  -     * of the properties belonging to the given source.
  -     * 
  -     * @param source  the Source for which to calculate the validity
  -     * its properties, <code>null</code> if the source properties
  -     * are not cacheable.
  -     */
  -    public SourceValidity getValidity(Source source);
   }
  
  
  
  1.5       +12 -1     cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/SourceInspector.java
  
  Index: SourceInspector.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/SourceInspector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SourceInspector.java	21 Nov 2003 11:37:48 -0000	1.4
  +++ SourceInspector.java	21 Nov 2003 16:09:28 -0000	1.5
  @@ -53,6 +53,7 @@
   import org.apache.cocoon.components.source.helpers.SourceProperty;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
  +import org.apache.excalibur.source.SourceValidity;
   
   /**
    * A source inspector exposes source properties.
  @@ -98,5 +99,15 @@
        * else <code>false</code>.
        */
       public boolean handlesProperty(String namespace, String name);
  +    
  +    /**
  +     * Get the validity object that describes the validity state
  +     * of the properties belonging to the given source.
  +     * 
  +     * @param source  the Source for which to calculate the validity
  +     * its properties, <code>null</code> if the source properties
  +     * are not cacheable.
  +     */
  +    public SourceValidity getValidity(Source source);
   }
   
  
  
  

Mime
View raw message