unico       2003/10/28 05:48:12

  Modified:    src/blocks/repository/java/org/apache/cocoon/components/source
                        SourceDescriptor.java
               
src/blocks/repository/java/org/apache/cocoon/components/source/impl
                        SourceDescriptorManager.java
  Log:
  add cacheability to source property handling
  
  Revision  Changes    Path
  1.3       +10 -0     
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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SourceDescriptor.java     27 Oct 2003 09:30:07 -0000      1.2
  +++ SourceDescriptor.java     28 Oct 2003 13:48:12 -0000      1.3
  @@ -52,6 +52,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 descriptor handles modifiable source properties.
  @@ -81,4 +82,13 @@
       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.4       +23 -2     
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SourceDescriptorManager.java      27 Oct 2003 09:30:07 -0000      1.3
  +++ SourceDescriptorManager.java      28 Oct 2003 13:48:12 -0000      1.4
  @@ -73,6 +73,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.AggregatedValidity;
   
   /**
    * This source descriptor acts as container for a set of source inspectors.
  @@ -105,7 +107,7 @@
       public void compose(ComponentManager manager) {
           m_manager = manager;
       }
  -    
  +        
       public void configure(Configuration configuration) throws 
ConfigurationException {
           m_configuration = configuration;
       }
  @@ -221,5 +223,24 @@
           }
       }
       
  +    /**
  +     * Returns an aggregate validity describing the validity of all the 
properties.
  +     */
  +    public SourceValidity getValidity(Source source) {
  +        AggregatedValidity validity = new AggregatedValidity();
  +        SourceInspector inspector;
  +        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);
  +            }
  +        }
  +        return validity;
  +    }
   }
   
  
  
  

Reply via email to