unico       2004/03/27 14:25:10

  Modified:    src/blocks/slide/java/org/apache/cocoon/components/source/impl
                        SlideSourceFactory.java SlideSource.java
  Log:
  remove dependency on eventcaching, caching is handled by CachingSource
  
  Revision  Changes    Path
  1.15      +3 -14     
cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSourceFactory.java
  
  Index: SlideSourceFactory.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSourceFactory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SlideSourceFactory.java   5 Mar 2004 13:02:23 -0000       1.14
  +++ SlideSourceFactory.java   27 Mar 2004 22:25:10 -0000      1.15
  @@ -39,14 +39,7 @@
   /**
    * A factory for sources from a Jakarta Slide repository.
    *
  - * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
  - * @author <a href="mailto:[EMAIL PROTECTED]">Unico Hommes</a>
  - * @version CVS $Id$
  - * 
  - * @avalon.component
  - * @avalon.service type=SourceFactory
  - * @x-avalon.lifestyle type=singleton
  - * @x-avalon.info name=slide
  + * @version CVS $Id$ 
    */
   public class SlideSourceFactory extends AbstractLogEnabled 
   implements SourceFactory, Contextualizable, Serviceable, ThreadSafe {
  @@ -71,8 +64,6 @@
        * Lookup the SlideRepository.
        * 
        * @param manager ServiceManager.
  -     * 
  -     * @avalon.dependency type=SlideRepository optional=false
        */
       public void service(ServiceManager manager) throws ServiceException {
           m_repository = (SlideRepository) 
manager.lookup(SlideRepository.ROLE);
  @@ -92,7 +83,7 @@
       throws MalformedURLException, IOException, SourceException {
   
           if (getLogger().isDebugEnabled()) {
  -            getLogger().debug("resolve uri: " + location);
  +            getLogger().debug("Creating source object for " + location);
           }
           
           final String[] parts = SourceUtil.parseUrl(location);
  @@ -135,7 +126,6 @@
           String version = queryParameters.getParameter("version",null);
           String scope   = queryParameters.getParameter("scope",
               nat.getNamespaceConfig().getFilesPath());
  -        boolean eventCaching = 
queryParameters.getParameterAsBoolean("event-caching",false);
           
           if (getLogger().isDebugEnabled()) {
               getLogger().debug("scheme: " + scheme);
  @@ -144,10 +134,9 @@
               getLogger().debug("path: " + path);
               getLogger().debug("version: " + version);
               getLogger().debug("scope: " + scope);
  -            getLogger().debug("event-caching: " + eventCaching);
           }
   
  -        SlideSource source = new 
SlideSource(nat,scheme,scope,path,principal,version,eventCaching);
  +        SlideSource source = new 
SlideSource(nat,scheme,scope,path,principal,version);
   
           source.enableLogging(getLogger());
           source.contextualize(m_context);
  
  
  
  1.20      +10 -26    
cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSource.java
  
  Index: SlideSource.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSource.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SlideSource.java  5 Mar 2004 13:02:23 -0000       1.19
  +++ SlideSource.java  27 Mar 2004 22:25:10 -0000      1.20
  @@ -39,8 +39,6 @@
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.cocoon.CascadingIOException;
   import org.apache.cocoon.Constants;
  -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.LockableSource;
   import org.apache.cocoon.components.source.VersionableSource;
  @@ -104,7 +102,7 @@
       private Macro m_macro;
   
       /* Source specifics */
  -    private String m_scheme = "slide";
  +    private String m_scheme;
       private String m_path;
       private String m_scope;
       private String m_uri;
  @@ -116,7 +114,6 @@
       
       private String m_principal;
       private SourceValidity m_validity;
  -    private boolean m_useEventCaching;
   
       private SlideSourceOutputStream m_outputStream;
   
  @@ -132,8 +129,7 @@
                          String scope,
                          String path,
                          String principal, 
  -                       String version,
  -                       boolean useEventCaching) {
  +                       String version) {
   
           m_nat = nat;
           m_scheme = scheme;
  @@ -152,7 +148,6 @@
           if (version != null) {
               m_version = new NodeRevisionNumber(version);
           }
  -        m_useEventCaching = useEventCaching;
       }
       
       /**
  @@ -268,20 +263,11 @@
        * @return Validity for the source.
        */
       public SourceValidity getValidity() {
  -        try {
  -            if (m_validity == null) {
  -                if (m_useEventCaching) {
  -                    m_validity = new EventValidity(
  -                        new NamedEvent(m_nat.getName() + m_uri));
  -                }
  -                else if (m_descriptor != null) {
  -                    m_validity = new TimeStampValidity(
  -                        m_descriptor.getLastModifiedAsDate().getTime());
  -                }
  +        if (m_validity == null && m_descriptor != null) {
  +            final long lastModified = getLastModified();
  +            if (lastModified > 0) {
  +                m_validity = new TimeStampValidity(lastModified);            
    
               }
  -        } catch (Exception e) {
  -            getLogger().debug("Could not create SourceValidity", e);
  -            return null;
           }
           return m_validity;
       }
  @@ -291,9 +277,7 @@
        * content has changed.
        */
       public void refresh() {
  -        if (!m_useEventCaching) {
  -            m_validity = null;
  -        }
  +        m_validity = null;
       }
   
       /**
  @@ -446,7 +430,7 @@
       }
       
       private Source getChildByPath(String path) throws SourceException {
  -        SlideSource child = new 
SlideSource(m_nat,m_scheme,m_scope,path,m_principal,null,m_useEventCaching);
  +        SlideSource child = new 
SlideSource(m_nat,m_scheme,m_scope,path,m_principal,null);
           child.enableLogging(getLogger());
           child.contextualize(m_context);
           child.service(m_manager);
  @@ -496,7 +480,7 @@
           else {
               parentPath = m_path.substring(0,index);
           }
  -        SlideSource parent = new 
SlideSource(m_nat,m_scheme,m_scope,parentPath,m_principal,null,m_useEventCaching);
  +        SlideSource parent = new 
SlideSource(m_nat,m_scheme,m_scope,parentPath,m_principal,null);
           parent.enableLogging(getLogger());
           parent.contextualize(m_context);
           parent.service(m_manager);
  
  
  

Reply via email to