You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by un...@apache.org on 2004/03/27 22:49:36 UTC

cvs commit: cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl RepositorySourceFactory.java RepositorySource.java

unico       2004/03/27 13:49:36

  Modified:    src/blocks/repository/java/org/apache/cocoon/components/source/impl
                        RepositorySourceFactory.java RepositorySource.java
  Log:
  move event caching stuff to caching source
  
  Revision  Changes    Path
  1.7       +3 -16     cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySourceFactory.java
  
  Index: RepositorySourceFactory.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySourceFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RepositorySourceFactory.java	5 Mar 2004 14:29:27 -0000	1.6
  +++ RepositorySourceFactory.java	27 Mar 2004 21:49:36 -0000	1.7
  @@ -36,8 +36,6 @@
   
   /**
    * Creates RepositorySources.
  - * 
  - * @author <a href="unico@apache.org">Unico Hommes</a>
    */
   public class RepositorySourceFactory extends AbstractLogEnabled
   implements SourceFactory, Serviceable, Configurable, ThreadSafe {
  @@ -46,7 +44,6 @@
       private SourceResolver m_resolver;
       private SourceDescriptor m_descriptor;
       private String m_name;
  -    private boolean m_useEventCaching;
       private boolean m_isInitialized;
       
       public RepositorySourceFactory() {
  @@ -85,19 +82,10 @@
       }
       
       /**
  -     * Read the <code>name</code> attribute and the <code>use-event-caching</code>
  -     * configuration element.
  +     * Read the <code>name</code> attribute.
        */
  -    public void configure(final Configuration configuration) 
  -        throws ConfigurationException {
  -        
  +    public void configure(final Configuration configuration) throws ConfigurationException {
           m_name = configuration.getAttribute("name");
  -        m_useEventCaching = configuration.getChild("use-event-caching",true).
  -            getValueAsBoolean(false);
  -        if (getLogger().isDebugEnabled()) {
  -            getLogger().debug("Event caching is turned " + (m_useEventCaching ? "ON" : "OFF")
  -            + " for " + m_name + ": protocol.");
  -        }
       }
       
       /**
  @@ -131,8 +119,7 @@
               m_name,
               (ModifiableTraversableSource) source, 
               m_descriptor,
  -            getLogger(),
  -            m_useEventCaching
  +            getLogger()
           );
       }
       
  
  
  
  1.8       +6 -126    cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySource.java
  
  Index: RepositorySource.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySource.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RepositorySource.java	5 Mar 2004 13:02:21 -0000	1.7
  +++ RepositorySource.java	27 Mar 2004 21:49:36 -0000	1.8
  @@ -26,8 +26,6 @@
   
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.Logger;
  -import org.apache.cocoon.caching.validity.EventValidity;
  -import org.apache.cocoon.caching.validity.NamedEvent;
   import org.apache.cocoon.components.source.InspectableSource;
   import org.apache.cocoon.components.source.SourceDescriptor;
   import org.apache.cocoon.components.source.helpers.SourceProperty;
  @@ -43,15 +41,12 @@
    * 
    * <p>
    * Currently this Source optionally adds inspectability
  - * through the InspectableSource interface and event caching
  - * by handing out EventValidities based on the Source uri.
  + * through the InspectableSource interface.
    * </p>
    * 
    * <p>
    * Wrapped sources must implement ModifiableTraversableSource.
    * </p>
  - * 
  - * @author <a href="mailto:unico@apache.org">Unico Hommes</a>
    */
   public class RepositorySource extends AbstractLogEnabled 
   implements Source, ModifiableTraversableSource, InspectableSource {
  @@ -61,7 +56,6 @@
       // the wrapped source
       final ModifiableTraversableSource m_delegate;
       private final SourceDescriptor m_descriptor;
  -    private final boolean m_useEventCaching;
       
       // ---------------------------------------------------- Lifecycle
       
  @@ -69,14 +63,12 @@
           final String prefix,
           final ModifiableTraversableSource delegate, 
           final SourceDescriptor descriptor,
  -        final Logger logger,
  -        final boolean useEventCaching) throws SourceException {
  +        final Logger logger) throws SourceException {
           
           m_prefix = prefix;
           m_delegate = delegate;
           m_descriptor = descriptor;
           enableLogging(logger);
  -        m_useEventCaching = useEventCaching;
       }
       
       // ---------------------------------------------------- InspectableSource implementation
  @@ -184,19 +176,10 @@
        * the validity describing the source itself _and_ one describing
        * the validity of the SourceProperties managed by the SourceDescriptor.
        * </p>
  -     * When using event caching the SourceValidity describing the Source itself
  -     * is an EventValidity that contains a NamedEvent which name is the wrapped 
  -     * Source URI.
        */
       public SourceValidity getValidity() {
           SourceValidity val1;
  -        if (m_useEventCaching) {
  -            val1 = new EventValidity(new NamedEvent(getURI()));
  -        }
  -        else {
  -            val1 = m_delegate.getValidity();
  -        }
  -        
  +        val1 = m_delegate.getValidity();
           if (val1 != null && m_descriptor != null) {
               SourceValidity val2 = m_descriptor.getValidity(m_delegate);
               if (val2 != null) {
  @@ -225,8 +208,7 @@
               m_prefix,
               child,
               m_descriptor,
  -            getLogger(),
  -            m_useEventCaching
  +            getLogger()
           );
       }
   
  @@ -242,8 +224,7 @@
                       m_prefix,
                       child,
                       m_descriptor,
  -    		        getLogger(),
  -                    m_useEventCaching
  +    		        getLogger()
                   )
               );
       	}
  @@ -259,8 +240,7 @@
               m_prefix,
               (ModifiableTraversableSource) m_delegate.getParent(),
           	m_descriptor, 
  -            getLogger(),
  -            m_useEventCaching
  +            getLogger()
           );
       }
   
  @@ -287,105 +267,5 @@
       public OutputStream getOutputStream() throws IOException {
           return m_delegate.getOutputStream();
       }
  -    
  -        
  -    // ---------------------------------------------------- LockableSource implementation
  -    
  -//    public void addSourceLocks(SourceLock lock) throws SourceException {
  -//        if (m_delegate instanceof LockableSource) {
  -//            ((LockableSource) m_delegate).addSourceLocks(lock);
  -//        }
  -//    }
  -//    
  -//    public Enumeration getSourceLocks() throws SourceException {
  -//        if (m_delegate instanceof LockableSource) {
  -//            return ((LockableSource) m_delegate).getSourceLocks();
  -//        }
  -//        return null;
  -//    }
  -    
  -    // ---------------------------------------------------- VersionableSource implementation
  -    
  -//    public String getLatestSourceRevision() throws SourceException {
  -//        if (m_delegate instanceof VersionableSource) {
  -//            return ((VersionableSource) m_delegate).getLatestSourceRevision();
  -//        }
  -//        return null;
  -//    }
  -//    
  -//    public String getSourceRevision() throws SourceException {
  -//        if (m_delegate instanceof VersionableSource) {
  -//            return ((VersionableSource) m_delegate).getSourceRevision();
  -//        }
  -//        return null;
  -//    }
  -//    
  -//    public String getSourceRevisionBranch() throws SourceException {
  -//        if (m_delegate instanceof VersionableSource) {
  -//            return ((VersionableSource) m_delegate).getSourceRevisionBranch();
  -//        }
  -//        return null;
  -//    }
  -//    
  -//    public boolean isVersioned() throws SourceException {
  -//        if (m_delegate instanceof VersionableSource) {
  -//            return ((VersionableSource) m_delegate).isVersioned();
  -//        }
  -//        return false;
  -//    }
  -//    
  -//    public void setSourceRevision(String revision) throws SourceException {
  -//        if (m_delegate instanceof VersionableSource) {
  -//            ((VersionableSource) m_delegate).setSourceRevision(revision);
  -//        }
  -//    }
  -//    
  -//    public void setSourceRevisionBranch(String branch) throws SourceException {
  -//        if (m_delegate instanceof VersionableSource) {
  -//            ((VersionableSource) m_delegate).setSourceRevisionBranch(branch);
  -//        }
  -//    }
  -    
  -    
  -    // ---------------------------------------------------- RestrictableSource implementation
  -    
  -//    public void addSourcePermission(SourcePermission permission)
  -//        throws SourceException {
  -//        
  -//        if (m_delegate instanceof RestrictableSource) {
  -//            ((RestrictableSource) m_delegate).addSourcePermission(permission);
  -//        }
  -//    }
  -//    
  -//    public SourceCredential getSourceCredential() throws SourceException {
  -//        if (m_delegate instanceof RestrictableSource) {
  -//            return ((RestrictableSource) m_delegate).getSourceCredential();
  -//        }
  -//        return null;
  -//    }
  -//    
  -//    public SourcePermission[] getSourcePermissions() throws SourceException {
  -//        if (m_delegate instanceof RestrictableSource) {
  -//            return ((RestrictableSource) m_delegate).getSourcePermissions();
  -//        }
  -//        return null;
  -//    }
  -//    
  -//    public void removeSourcePermission(SourcePermission permission)
  -//        throws SourceException {
  -//        
  -//        if (m_delegate instanceof RestrictableSource) {
  -//            ((RestrictableSource) m_delegate).removeSourcePermission(permission);
  -//        }
  -//    }
  -//    
  -//    public void setSourceCredential(SourceCredential credential)
  -//        throws SourceException {
  -//        
  -//        if (m_delegate instanceof RestrictableSource) {
  -//            ((RestrictableSource) m_delegate).setSourceCredential(credential);
  -//        }
  -//    }
  -    
   
   }