shuber      2005/01/31 18:49:18 CET

  Modified files:
    core/src/conf/metadata/jbproject/jahia Jahia Non Distributable 
                                           Libs.library 
    core/src/java/org/jahia/services/webdav/listeners 
                                                      
CMSSlideContentListener.java 
    core/src/webapp/WEB-INF/etc/slide domain.xml 
  Log:
  Second version of Slide content listener that should now properly detect 
rename and move events, although it is a bit hacky.
  
  Revision  Changes    Path
  No                   
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/.diff?r1=.-1&r2=No&f=h
  No                   
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/.diff?r1=.-1&r2=No&f=h
  No                   
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/.diff?r1=.-1&r2=No&f=h
  No                   
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/.diff?r1=.-1&r2=No&f=h
  1.2       +141 -13   
jahia/core/src/java/org/jahia/services/webdav/listeners/CMSSlideContentListener.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/webdav/listeners/CMSSlideContentListener.java.diff?r1=1.1&r2=1.2&f=h
  1.3       +4 -0      jahia/core/src/webapp/WEB-INF/etc/slide/domain.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/WEB-INF/etc/slide/domain.xml.diff?r1=1.2&r2=1.3&f=h
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  Index: CMSSlideContentListener.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/webdav/listeners/CMSSlideContentListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CMSSlideContentListener.java      31 Jan 2005 09:33:16 -0000      1.1
  +++ CMSSlideContentListener.java      31 Jan 2005 17:49:17 -0000      1.2
  @@ -6,10 +6,16 @@
   import java.util.Enumeration;
   import java.util.Locale;
   import java.util.Properties;
  +import java.util.StringTokenizer;
   
   import org.apache.slide.event.ContentEvent;
   import org.apache.slide.event.ContentListener;
  +import org.apache.slide.event.MacroEvent;
  +import org.apache.slide.event.MacroListener;
   import org.apache.slide.event.VetoException;
  +import org.apache.slide.webdav.event.WebdavEvent;
  +import org.apache.slide.webdav.event.WebdavListener;
  +import org.apache.slide.webdav.util.WebdavUtils;
   import org.jahia.bin.Jahia;
   import org.jahia.data.containers.JahiaContainer;
   import org.jahia.data.containers.JahiaContainerDefinition;
  @@ -20,19 +26,15 @@
   import org.jahia.exceptions.JahiaException;
   import org.jahia.params.ParamBean;
   import org.jahia.params.SoapParamBean;
  +import org.jahia.registries.JahiaContainerDefinitionsRegistry;
   import org.jahia.registries.ServicesRegistry;
   import org.jahia.services.containers.JahiaContainersService;
   import org.jahia.services.pages.JahiaPage;
  +import org.jahia.services.pages.JahiaPageService;
   import org.jahia.services.pages.JahiaPageTemplateBaseService;
   import org.jahia.services.sites.JahiaSite;
   import org.jahia.services.usermanager.JahiaUser;
   import org.jahia.services.version.EntryLoadRequest;
  -import org.apache.slide.webdav.util.WebdavUtils;
  -import org.jahia.services.pages.JahiaPageService;
  -import java.util.StringTokenizer;
  -import org.jahia.registries.JahiaContainerDefinitionsRegistry;
  -import org.apache.slide.event.MacroListener;
  -import org.apache.slide.event.MacroEvent;
   
   /**
    * Created by IntelliJ IDEA.
  @@ -41,20 +43,22 @@
    * Time: 15:23:17
    * <p/>
    * $Author: shuber $
  - * $Date: 2005/01/31 09:33:16 $
  - * $Id: CMSSlideContentListener.java,v 1.1 2005/01/31 09:33:16 shuber Exp $
  + * $Date: 2005/01/31 17:49:17 $
  + * $Id: CMSSlideContentListener.java,v 1.2 2005/01/31 17:49:17 shuber Exp $
    * $RCSfile: CMSSlideContentListener.java,v $
  - * $Revision: 1.1 $
  + * $Revision: 1.2 $
    * $Source: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/webdav/listeners/CMSSlideContentListener.java,v
 $
    * $State: Exp $
    */
  -public class CMSSlideContentListener implements ContentListener, 
MacroListener {
  +public class CMSSlideContentListener implements ContentListener, 
MacroListener, WebdavListener {
   
       private static org.apache.log4j.Logger logger =
           org.apache.log4j.Logger.getLogger(CMSSlideContentListener.class);
   
       private Properties props;
   
  +    ThreadLocal inMoveThreadLocal = new ThreadLocal();
  +
       public CMSSlideContentListener () {
           try {
               props = new Properties();
  @@ -71,6 +75,11 @@
           if (!Jahia.isInitiated()) {
               return;
           }
  +        Boolean inMove = (Boolean) inMoveThreadLocal.get();
  +        if (inMove != null && inMove.booleanValue() == true) {
  +            logger.debug("In move detected, we don't process create");
  +            return;
  +        }
           String filename = event.getRevisionDescriptors().getUri();
           Principal p = event.getToken().getCredentialsToken().getPrincipal();
           if (!filename.startsWith(props.getProperty("filecreation.filter"))) {
  @@ -150,6 +159,7 @@
           }
   
           Jahia.setThreadParamBean(null);
  +        inMoveThreadLocal.set(null);
   
       }
   
  @@ -249,6 +259,13 @@
   
       public void remove (ContentEvent event)
           throws VetoException {
  +        logger.debug("Remove event received " + event);
  +        Boolean inMove = (Boolean) inMoveThreadLocal.get();
  +        if (inMove != null && inMove.booleanValue() == true) {
  +            logger.debug("In move detected, we don't process create");
  +            return;
  +        }
  +        inMoveThreadLocal.set(null);
       }
   
       public void retrieve (ContentEvent event)
  @@ -269,9 +286,120 @@
   
       public void move(MacroEvent macroEvent) throws VetoException {
           logger.debug("Move event called " + macroEvent);
  +        inMoveThreadLocal.set(null);
       }
   
       public void delete(MacroEvent macroEvent) throws VetoException {
           logger.debug("Delete event called " + macroEvent);
       }
  +
  +    // WebDav listener methods :
  +    public void get(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void put(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void propFind(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void propPatch(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void bind(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void rebind(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void unbind(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void mkcol(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void copy(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void move(WebdavEvent event) throws VetoException {
  +        logger.debug("WebDav move event" + event);
  +        inMoveThreadLocal.set(new Boolean(true));
  +    }
  +
  +    public void delete(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void lock(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void unlock(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void acl(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void report(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void search(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void versionControl(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void options(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void update(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void checkin(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void checkout(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void uncheckout(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void label(WebdavEvent event) throws VetoException {
  +        logger.debug("WebDAV Label event " + event);
  +    }
  +
  +    public void mkworkspace(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void subscribe(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void unsubscribe(WebdavEvent event) throws VetoException {
  +
  +    }
  +
  +    public void poll(WebdavEvent event) throws VetoException {
  +
  +    }
   }
  
  
  
  Index: domain.xml
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/webapp/WEB-INF/etc/slide/domain.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- domain.xml        31 Jan 2005 09:33:16 -0000      1.2
  +++ domain.xml        31 Jan 2005 17:49:18 -0000      1.3
  @@ -12,6 +12,10 @@
       <events>
           <event classname="org.apache.slide.event.MacroEvent" method="move" 
enable="true"></event>
           <event classname="org.apache.slide.event.ContentEvent" 
method="create" enable="true"></event>
  +        <event classname="org.apache.slide.event.ContentEvent" 
method="remove" enable="true"></event>
  +        <event classname="org.apache.slide.webdav.event.WebdavEvent" 
method="move" enable="true"></event>
  +        <event classname="org.apache.slide.webdav.event.WebdavEvent" 
method="label" enable="true"></event>
  +        <event classname="org.apache.slide.webdav.event.WebdavEvent" 
method="copy" enable="true"></event>
           <listener classname="org.jahia.services.webdav.JahiaMacroListener"/>
           <!--listener 
classname="org.jahia.services.webdav.listeners.CMSSlideContentListener"/-->
       </events>
  

Reply via email to