You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by oz...@apache.org on 2004/10/19 14:55:06 UTC

cvs commit: jakarta-slide/proposals/wck/conf Domain.xml

ozeigermann    2004/10/19 05:55:06

  Modified:    proposals/wck/src/org/apache/slide/simple/store
                        WebdavStoreAdapter.java
               proposals/wck build.properties build.xml
                        build.properties.sample
               proposals/wck/src/org/apache/slide/simple/reference
                        WebdavFileStore.java
               proposals/wck/conf Domain.xml
  Added:       proposals/wck/src/org/apache/slide/simple/store
                        WebdavStoreMacroDeleteExtension.java
                        WebdavStoreMacroAdapter.java
                        WebdavStoreMacroCopyExtension.java
                        WebdavStoreMacroMoveExtension.java
  Log:
  Augmented WCK reference implementation to support macro store
  
  Revision  Changes    Path
  1.6       +32 -19    jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreAdapter.java
  
  Index: WebdavStoreAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreAdapter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebdavStoreAdapter.java	18 Oct 2004 10:17:03 -0000	1.5
  +++ WebdavStoreAdapter.java	19 Oct 2004 12:55:06 -0000	1.6
  @@ -69,6 +69,10 @@
       protected Hashtable parameters;
   
       protected String callBackClassName;
  +    
  +    protected Class storeClass;
  +    
  +    protected boolean isCopySupported, isMoveSupported, isDeleteSupported;
   
       // ==== Service Methods ================================
   
  @@ -77,8 +81,15 @@
           log("setParameters(" + parameters + ")");
           this.parameters = parameters;
           callBackClassName = (String) parameters.get(CALLBACK_PARAMETER);
  -        if (callBackClassName == null)
  +        if (callBackClassName == null) {
               throw new ServiceParameterMissingException(this, CALLBACK_PARAMETER);
  +        }
  +        try {
  +            storeClass = Class.forName(callBackClassName);
  +        } catch (Exception e) {
  +            getLogger().log("Initialize call back store " + callBackClassName, e, LOG_CHANNEL, Logger.CRITICAL);
  +            throw new ServiceParameterErrorException(this, CALLBACK_PARAMETER);
  +        }
       }
   
       public void connect(CredentialsToken crdtoken) throws ServiceConnectionFailedException {
  @@ -120,8 +131,7 @@
           // needed for DirectoryIndexGenerator
           TransactionId id = ((TransactionId) getCurrentlyActiveTransactionalResource());
           if (id == null) {
  -            id = new TransactionId(null, this, uri.getToken().getCredentialsToken().getPrincipal(), callBackClassName,
  -                    parameters);
  +            id = createTransactionResource(uri);
               try {
                   return id.retrieveRevisionContent(uri, revisionDescriptor);
               } finally {
  @@ -177,8 +187,7 @@
           // directory here
           TransactionId id = ((TransactionId) getCurrentlyActiveTransactionalResource());
           if (id == null) {
  -            id = new TransactionId(null, this, uri.getToken().getCredentialsToken().getPrincipal(), callBackClassName,
  -                    parameters);
  +            id = createTransactionResource(uri);
               try {
                   return id.retrieveObject(uri);
               } finally {
  @@ -200,8 +209,7 @@
           // needed for DirectoryIndexGenerator
           TransactionId id = ((TransactionId) getCurrentlyActiveTransactionalResource());
           if (id == null) {
  -            id = new TransactionId(null, this, uri.getToken().getCredentialsToken().getPrincipal(), callBackClassName,
  -                    parameters);
  +            id = createTransactionResource(uri);
               try {
                   return id.retrieveRevisionDescriptors(uri);
               } finally {
  @@ -257,8 +265,7 @@
           // needed for DirectoryIndexGenerator
           TransactionId id = ((TransactionId) getCurrentlyActiveTransactionalResource());
           if (id == null) {
  -            id = new TransactionId(null, this, uri.getToken().getCredentialsToken().getPrincipal(), callBackClassName,
  -                    parameters);
  +            id = createTransactionResource(uri);
               try {
                   return id.retrieveRevisionDescriptor(uri, revisionNumber);
               } finally {
  @@ -272,6 +279,8 @@
           return id.retrieveRevisionDescriptor(uri, revisionNumber);
       }
   
  +    // ==== LockStore Methods ================================
  +
       public void putLock(Uri uri, NodeLock lock) throws ServiceAccessException {
           log("putLock(" + uri + ")");
           ((TransactionId) getCurrentlyActiveTransactionalResource()).putLock(uri, lock);
  @@ -296,8 +305,7 @@
           log("enumerateLocks(" + uri + ")");
           TransactionId id = ((TransactionId) getCurrentlyActiveTransactionalResource());
           if (id == null) {
  -            id = new TransactionId(null, this, uri.getToken().getCredentialsToken().getPrincipal(), callBackClassName,
  -                    parameters);
  +            id = createTransactionResource(uri);
               try {
                   return id.enumerateLocks(uri);
               } finally {
  @@ -328,10 +336,15 @@
           Principal principal = null;
           if (token != null)
               principal = token.getPrincipal();
  -        return new TransactionId(xid, this, principal, callBackClassName, parameters);
  +        return new TransactionId(xid, this, principal, storeClass, parameters);
  +    }
  +
  +    protected TransactionId createTransactionResource(Uri uri) throws ServiceAccessException {
  +        return new TransactionId(null, this, uri.getToken().getCredentialsToken().getPrincipal(), storeClass,
  +                parameters);
       }
   
  -    private static class TransactionId extends AbstractTransactionalResource {
  +    protected static class TransactionId extends AbstractTransactionalResource {
           protected boolean readOnly;
   
           protected BasicWebdavStore store;
  @@ -354,14 +367,14 @@
   
           protected Object connection;
   
  -        TransactionId(Xid xid, Service service, Principal principal, String callBackClassName, Hashtable parameters)
  +        TransactionId(Xid xid, Service service, Principal principal, Class storeClass, Hashtable parameters)
                   throws ServiceAccessException {
               super(xid);
               this.service = service;
               this.principal = principal;
               readOnly = false;
               try {
  -                store = (BasicWebdavStore) Class.forName(callBackClassName).newInstance();
  +                store = (BasicWebdavStore) storeClass.newInstance();
                   if (store instanceof WebdavStoreLockExtension) {
                       lockStore = (WebdavStoreLockExtension) store;
                   }
  
  
  
  1.1                  jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroDeleteExtension.java
  
  Index: WebdavStoreMacroDeleteExtension.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroDeleteExtension.java,v 1.1 2004/10/19 12:55:06 ozeigermann Exp $
   * $Revision: 1.1 $
   * $Date: 2004/10/19 12:55:06 $
   *
   * ====================================================================
   *
   * Copyright 2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   */
  
  package org.apache.slide.simple.store;
  
  import org.apache.slide.common.ServiceAccessException;
  import org.apache.slide.security.AccessDeniedException;
  import org.apache.slide.simple.reference.WebdavFileStore;
  import org.apache.slide.structure.ObjectNotFoundException;
  
  /**
   * Optional extension to the
   * {@link org.apache.slide.simple.store.BasicWebdavStore basic store} with macro
   * call backs.
   * 
   * <p>
   * Be sure to read the Javadocs of the
   * {@link org.apache.slide.simple.store.BasicWebdavStore basic one} first!
   * </p>
   * 
   * <p>
   * <em>Caution: It is most important to understand that this is no general purpose store. 
   * It has been designed to solely work with access to Slide via WebDAV with general methods.
   * It relies on certain sequences of calls that are done when the Slide core is being accessed through
   * the WebDAV layer. Other sequences are likely to make this store fail.</em>
   * </p>
   * 
   * @see BasicWebdavStore
   * @see WebdavFileStore
   * @see WebdavStoreAdapter
   * @version $Revision: 1.1 $
   */
  public interface WebdavStoreMacroDeleteExtension {
  
      /**
       * Deletes an object recursively.
       * 
       * @param targetUri
       *            Uri of the object to delete
       * @throws ObjectNotFoundException if the object to delete was not found
       * @throws ServiceAccessException
       *             if anything else goes wrong while deleting the object
       * @throws AccessDeniedException
       *             if the store denies deleting this object or any descendants
       */
      public void macroDelete(String targetUri) throws ServiceAccessException, AccessDeniedException, ObjectNotFoundException;
  
  }
  
  
  1.1                  jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroAdapter.java
  
  Index: WebdavStoreMacroAdapter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroAdapter.java,v 1.1 2004/10/19 12:55:06 ozeigermann Exp $
   * $Revision: 1.1 $
   * $Date: 2004/10/19 12:55:06 $
   *
   * ====================================================================
   *
   * Copyright 2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   */
  
  package org.apache.slide.simple.store;
  
  import java.security.Principal;
  import java.util.Hashtable;
  
  import javax.transaction.xa.Xid;
  
  import org.apache.commons.transaction.util.xa.TransactionalResource;
  import org.apache.slide.authenticate.CredentialsToken;
  import org.apache.slide.common.Service;
  import org.apache.slide.common.ServiceAccessException;
  import org.apache.slide.common.ServiceParameterErrorException;
  import org.apache.slide.common.ServiceParameterMissingException;
  import org.apache.slide.common.Uri;
  import org.apache.slide.security.AccessDeniedException;
  import org.apache.slide.simple.reference.WebdavFileStore;
  import org.apache.slide.store.MacroStore;
  import org.apache.slide.structure.ObjectAlreadyExistsException;
  import org.apache.slide.structure.ObjectNotFoundException;
  import org.apache.slide.util.logger.Logger;
  
  /**
   * Driving adapter for call back interfaces {@link BasicWebdavStore},
   * extensions and macro call backs.
   * 
   * @see BasicWebdavStore
   * @see WebdavStoreLockExtension
   * @see WebdavStoreBulkPropertyExtension
   * @see WebdavStoreSinglePropertyExtension
   * @see WebdavFileStore
   * @see WebdavStoreAdapter
   * @version $Revision: 1.1 $
   */
  public class WebdavStoreMacroAdapter extends WebdavStoreAdapter implements MacroStore {
  
      protected boolean isCopySupported, isMoveSupported, isDeleteSupported;
  
      public void setParameters(Hashtable parameters) throws ServiceParameterErrorException,
              ServiceParameterMissingException {
          super.setParameters(parameters);
          try {
              Object quickCheckObject = storeClass.newInstance();
              isCopySupported = quickCheckObject instanceof WebdavStoreMacroCopyExtension;
              isMoveSupported = quickCheckObject instanceof WebdavStoreMacroMoveExtension;
              isDeleteSupported = quickCheckObject instanceof WebdavStoreMacroDeleteExtension;
          } catch (Exception e) {
              getLogger().log("Initialize call back store " + callBackClassName, e, LOG_CHANNEL, Logger.CRITICAL);
              throw new ServiceParameterErrorException(this, CALLBACK_PARAMETER);
          }
      }
  
      public boolean isMacroDeleteSupported() {
          return isDeleteSupported;
      }
  
      public void macroDelete(Uri targetUri) throws ServiceAccessException, ObjectNotFoundException {
          log("macroDelete(" + targetUri + ")");
          ((MacroTransactionId) getCurrentlyActiveTransactionalResource()).macroDelete(targetUri);
      }
  
      public boolean isMacroCopySupported() {
          return isCopySupported;
      }
  
      public void macroCopy(Uri sourceUri, Uri targetUri) throws ServiceAccessException, ObjectNotFoundException,
              ObjectAlreadyExistsException {
          log("macroCopy(" + sourceUri + " -> " + targetUri + ")");
          ((MacroTransactionId) getCurrentlyActiveTransactionalResource()).macroCopy(sourceUri, targetUri);
      }
  
      public boolean isMacroMoveSupported() {
          return isMoveSupported;
      }
  
      public void macroMove(Uri sourceUri, Uri targetUri) throws ServiceAccessException, ObjectNotFoundException,
              ObjectAlreadyExistsException {
          log("macroMove(" + sourceUri + " -> " + targetUri + ")");
          ((MacroTransactionId) getCurrentlyActiveTransactionalResource()).macroMove(sourceUri, targetUri);
      }
  
      protected TransactionalResource createTransactionResource(Xid xid) throws ServiceAccessException {
          CredentialsToken token = (CredentialsToken) WebdavStoreAdapter.credentials.get();
          Principal principal = null;
          if (token != null)
              principal = token.getPrincipal();
          return new MacroTransactionId(xid, this, principal, storeClass, parameters);
      }
  
      protected TransactionId createTransactionResource(Uri uri) throws ServiceAccessException {
          return new MacroTransactionId(null, this, uri.getToken().getCredentialsToken().getPrincipal(), storeClass,
                  parameters);
      }
  
  
      protected static class MacroTransactionId extends WebdavStoreAdapter.TransactionId {
          protected WebdavStoreMacroCopyExtension copyStore;
  
          protected WebdavStoreMacroDeleteExtension deleteStore;
  
          protected WebdavStoreMacroMoveExtension moveStore;
  
          MacroTransactionId(Xid xid, Service service, Principal principal, Class storeClass, Hashtable parameters)
                  throws ServiceAccessException {
              super(xid, service, principal, storeClass, parameters);
              try {
                  if (store instanceof WebdavStoreMacroCopyExtension) {
                      copyStore = (WebdavStoreMacroCopyExtension) store;
                  }
                  if (store instanceof WebdavStoreMacroMoveExtension) {
                      moveStore = (WebdavStoreMacroMoveExtension) store;
                  }
                  if (store instanceof WebdavStoreMacroDeleteExtension) {
                      deleteStore = (WebdavStoreMacroDeleteExtension) store;
                  }
              } catch (Exception e) {
                  throw new ServiceAccessException(service, e);
              }
          }
  
          public void macroDelete(Uri targetUri) throws ServiceAccessException, ObjectNotFoundException {
              if (deleteStore != null) {
                  try {
                      deleteStore.macroDelete(targetUri.toString());
                  } catch (AccessDeniedException e) {
                      throw new ServiceAccessException(service, e);
                  }
              }
          }
  
          public void macroCopy(Uri sourceUri, Uri targetUri) throws ServiceAccessException, ObjectNotFoundException,
                  ObjectAlreadyExistsException {
              if (copyStore != null) {
                  try {
                      copyStore.macroCopy(sourceUri.toString(), targetUri.toString());
                  } catch (AccessDeniedException e) {
                      throw new ServiceAccessException(service, e);
                  }
              }
          }
  
          public void macroMove(Uri sourceUri, Uri targetUri) throws ServiceAccessException, ObjectNotFoundException,
                  ObjectAlreadyExistsException {
              if (moveStore != null) {
                  try {
                      moveStore.macroMove(sourceUri.toString(), targetUri.toString());
                  } catch (AccessDeniedException e) {
                      throw new ServiceAccessException(service, e);
                  }
              }
          }
      }
  }
  
  
  1.1                  jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroCopyExtension.java
  
  Index: WebdavStoreMacroCopyExtension.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroCopyExtension.java,v 1.1 2004/10/19 12:55:06 ozeigermann Exp $
   * $Revision: 1.1 $
   * $Date: 2004/10/19 12:55:06 $
   *
   * ====================================================================
   *
   * Copyright 2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   */
  
  package org.apache.slide.simple.store;
  
  import org.apache.slide.common.ServiceAccessException;
  import org.apache.slide.security.AccessDeniedException;
  import org.apache.slide.simple.reference.WebdavFileStore;
  import org.apache.slide.structure.ObjectAlreadyExistsException;
  import org.apache.slide.structure.ObjectNotFoundException;
  
  /**
   * Optional extension to the
   * {@link org.apache.slide.simple.store.BasicWebdavStore basic store} with macro
   * call backs.
   * 
   * <p>
   * Be sure to read the Javadocs of the
   * {@link org.apache.slide.simple.store.BasicWebdavStore basic one} first!
   * </p>
   * 
   * <p>
   * <em>Caution: It is most important to understand that this is no general purpose store. 
   * It has been designed to solely work with access to Slide via WebDAV with general methods.
   * It relies on certain sequences of calls that are done when the Slide core is being accessed through
   * the WebDAV layer. Other sequences are likely to make this store fail.</em>
   * </p>
   * 
   * @see BasicWebdavStore
   * @see WebdavFileStore
   * @see WebdavStoreAdapter
   * @version $Revision: 1.1 $
   */
  public interface WebdavStoreMacroCopyExtension {
  
      /**
       * Recursively copies an object.
       * 
       * @param sourceUri the source URI of the copy
       * @param targetUri the destination URI of the copy
       * @throws ObjectNotFoundException if the object to copy from was not found
       * @throws ObjectAlreadyExistsException if the object to copy to to was already there
       * @throws ServiceAccessException
       *             if anything else goes wrong while copying the object
       * @throws AccessDeniedException
       *             if the store denies copying this object or any descendants
       */
      public void macroCopy(String sourceUri, String targetUri) throws ServiceAccessException, AccessDeniedException, ObjectNotFoundException,
              ObjectAlreadyExistsException;
  
  }
  
  
  1.1                  jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroMoveExtension.java
  
  Index: WebdavStoreMacroMoveExtension.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreMacroMoveExtension.java,v 1.1 2004/10/19 12:55:06 ozeigermann Exp $
   * $Revision: 1.1 $
   * $Date: 2004/10/19 12:55:06 $
   *
   * ====================================================================
   *
   * Copyright 2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   */
  
  package org.apache.slide.simple.store;
  
  import org.apache.slide.common.ServiceAccessException;
  import org.apache.slide.security.AccessDeniedException;
  import org.apache.slide.simple.reference.WebdavFileStore;
  import org.apache.slide.structure.ObjectAlreadyExistsException;
  import org.apache.slide.structure.ObjectNotFoundException;
  
  /**
   * Optional extension to the
   * {@link org.apache.slide.simple.store.BasicWebdavStore basic store} with macro
   * call backs.
   * 
   * <p>
   * Be sure to read the Javadocs of the
   * {@link org.apache.slide.simple.store.BasicWebdavStore basic one} first!
   * </p>
   * 
   * <p>
   * <em>Caution: It is most important to understand that this is no general purpose store. 
   * It has been designed to solely work with access to Slide via WebDAV with general methods.
   * It relies on certain sequences of calls that are done when the Slide core is being accessed through
   * the WebDAV layer. Other sequences are likely to make this store fail.</em>
   * </p>
   * 
   * @see BasicWebdavStore
   * @see WebdavFileStore
   * @see WebdavStoreAdapter
   * @version $Revision: 1.1 $
   */
  public interface WebdavStoreMacroMoveExtension {
  
      /**
       * Recursively moves an object.
       * 
       * @param sourceUri the source URI of the move
       * @param targetUri the destination URI of the move
       * @throws ObjectNotFoundException if the object to move from was not found
       * @throws ObjectAlreadyExistsException if the object to move to to was already there
       * @throws ServiceAccessException
       *             if anything else goes wrong while moving the object
       * @throws AccessDeniedException
       *             if the store denies moving this object or any descendants
       */
      public void macroMove(String sourceUri, String targetUri) throws ServiceAccessException, AccessDeniedException, ObjectNotFoundException,
              ObjectAlreadyExistsException;
  }
  
  
  1.2       +3 -2      jakarta-slide/proposals/wck/build.properties
  
  Index: build.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/build.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.properties	12 Oct 2004 20:19:02 -0000	1.1
  +++ build.properties	19 Oct 2004 12:55:06 -0000	1.2
  @@ -5,7 +5,7 @@
   compile.target=1.4
   build.compiler=modern
   
  -#skip.javadoc
  +skip.javadoc
   skip.slide
   
   # ----- Slide -----
  @@ -15,9 +15,10 @@
   #slide.lib.dir=${slide.base.dir}/dist/slide/lib
   #slide.version=2.1b2
   slide.version=2.2pre1
  +supports.macro.store
   
   # ----- Catalina distribution directory -----
  -catalina.dist=C:/tmp/jakarta-tomcat-5.0.28
  +catalina.dist=C:/temp/jakarta-tomcat-5.0.28
   catalina.server.lib=${catalina.dist}/server/lib
   catalina.common.lib=${catalina.dist}/common/lib
   catalina.jar=${catalina.server.lib}/catalina.jar
  
  
  
  1.2       +10 -2     jakarta-slide/proposals/wck/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/build.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.xml	12 Oct 2004 20:19:02 -0000	1.1
  +++ build.xml	19 Oct 2004 12:55:06 -0000	1.2
  @@ -63,9 +63,10 @@
       <!-- =================================================================== -->
       <!-- Build WCK                                                           -->
       <!-- =================================================================== -->
  -    <target name="build" depends="prepare,build-slide" description="Builds WCK">
  +    <target name="build" depends="prepare,build-slide,build-macro-store" description="Builds WCK">
           <echo message="Building WCK"/>
  -        <javac srcdir="src" destdir="build/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" >
  +        <javac srcdir="src" destdir="build/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}"
  +               excludes="**/WebdavStoreMacroAdapter.java" >
               <classpath refid="classpath"/>
           </javac>
           <copy todir="build/classes">
  @@ -76,6 +77,13 @@
       </target>
       <target name="build-slide" unless="skip.slide">
           <ant antfile="build.xml" dir="${slide.base.dir}" target="dist" inheritAll="false"/>
  +    </target>
  +    <target name="build-macro-store" if="supports.macro.store">
  +        <echo message="Building macro store extension"/>
  +        <javac srcdir="src" destdir="build/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}"
  +               includes="**/WebdavStoreMacroAdapter.java" >
  +            <classpath refid="classpath"/>
  +        </javac>
       </target>
       <!-- =================================================================== -->
       <!-- Clean build and distribution directories                            -->
  
  
  
  1.2       +1 -0      jakarta-slide/proposals/wck/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/build.properties.sample,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.properties.sample	12 Oct 2004 20:19:02 -0000	1.1
  +++ build.properties.sample	19 Oct 2004 12:55:06 -0000	1.2
  @@ -13,6 +13,7 @@
   #lib.dir=${slide.base.dir}/lib
   #slide.lib.dir=${slide.base.dir}/dist/slide/lib
   #slide.version=2.2
  +supports.macro.store
   
   # ----- Catalina distribution directory -----
   #catalina.dist=
  
  
  
  1.4       +62 -5     jakarta-slide/proposals/wck/src/org/apache/slide/simple/reference/WebdavFileStore.java
  
  Index: WebdavFileStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/reference/WebdavFileStore.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WebdavFileStore.java	13 Oct 2004 20:42:46 -0000	1.3
  +++ WebdavFileStore.java	19 Oct 2004 12:55:06 -0000	1.4
  @@ -52,6 +52,9 @@
   import org.apache.slide.simple.store.WebdavStoreAdapter;
   import org.apache.slide.simple.store.WebdavStoreBulkPropertyExtension;
   import org.apache.slide.simple.store.WebdavStoreLockExtension;
  +import org.apache.slide.simple.store.WebdavStoreMacroCopyExtension;
  +import org.apache.slide.simple.store.WebdavStoreMacroDeleteExtension;
  +import org.apache.slide.simple.store.WebdavStoreMacroMoveExtension;
   import org.apache.slide.store.util.FileHelper;
   import org.apache.slide.structure.ObjectAlreadyExistsException;
   import org.apache.slide.structure.ObjectNotFoundException;
  @@ -157,7 +160,8 @@
    * @see WebdavStoreAdapter
    * @version $Revision$
    */
  -public class WebdavFileStore implements BasicWebdavStore, WebdavStoreLockExtension, WebdavStoreBulkPropertyExtension {
  +public class WebdavFileStore implements BasicWebdavStore, WebdavStoreLockExtension, WebdavStoreBulkPropertyExtension,
  +        WebdavStoreMacroCopyExtension, WebdavStoreMacroMoveExtension, WebdavStoreMacroDeleteExtension {
   
       private static final String ROOTPATH_PARAMETER = "rootpath";
   
  @@ -211,6 +215,59 @@
       }
   
       public void rollback() throws ServiceAccessException {
  +    }
  +
  +    public void macroCopy(String sourceUri, String targetUri) throws ServiceAccessException, AccessDeniedException,
  +            ObjectNotFoundException, ObjectAlreadyExistsException {
  +        try {
  +            File fromFile = getFile(sourceUri);
  +            File toFile = getFile(targetUri);
  +            FileHelper.copyRec(fromFile, toFile);
  +            File propertyFile = getPropertyFile(sourceUri);
  +            File destPropertyFile = getPropertyFile(targetUri);
  +            if (propertyFile.exists()) FileHelper.copy(propertyFile, destPropertyFile);
  +            File lockFile = getLockFile(sourceUri);
  +            File destLockFile = getLockFile(targetUri);
  +            if (lockFile.exists()) FileHelper.copy(propertyFile, destPropertyFile);
  +        } catch (IOException e) {
  +            throw new ServiceAccessException(service, e);
  +        } catch (SecurityException e) {
  +            throw new AccessDeniedException(targetUri, e.getMessage(), "/actions/write");
  +        }
  +    }
  +
  +    public void macroMove(String sourceUri, String targetUri) throws ServiceAccessException, AccessDeniedException,
  +            ObjectNotFoundException, ObjectAlreadyExistsException {
  +        try {
  +            File fromFile = getFile(sourceUri);
  +            File toFile = getFile(targetUri);
  +            fromFile.renameTo(toFile);
  +            // FileHelper.moveRec(fromFile, toFile);
  +            File propertyFile = getPropertyFile(sourceUri);
  +            File destPropertyFile = getPropertyFile(targetUri);
  +            if (propertyFile.exists()) propertyFile.renameTo(destPropertyFile);
  +            File lockFile = getLockFile(sourceUri);
  +            File destLockFile = getLockFile(targetUri);
  +            if (lockFile.exists()) lockFile.renameTo(destLockFile);
  +//        } catch (IOException e) {
  +//            throw new ServiceAccessException(service, e);
  +        } catch (SecurityException e) {
  +            throw new AccessDeniedException(targetUri, e.getMessage(), "/actions/write");
  +        }
  +    }
  +
  +    public void macroDelete(String targetUri) throws ServiceAccessException, AccessDeniedException,
  +            ObjectNotFoundException {
  +        try {
  +            File file = getFile(targetUri);
  +            FileHelper.removeRec(file);
  +            File propertyFile = getPropertyFile(targetUri);
  +            if (propertyFile.exists()) propertyFile.delete();    
  +            File lockFile = getLockFile(targetUri);
  +            if (lockFile.exists()) lockFile.delete();    
  +        } catch (SecurityException e) {
  +            throw new AccessDeniedException(targetUri, e.getMessage(), "/actions/write");
  +        }
       }
   
       public boolean objectExists(String uri) throws ServiceAccessException, AccessDeniedException {
  
  
  
  1.2       +6 -0      jakarta-slide/proposals/wck/conf/Domain.xml
  
  Index: Domain.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/conf/Domain.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Domain.xml	12 Oct 2004 20:19:02 -0000	1.1
  +++ Domain.xml	19 Oct 2004 12:55:06 -0000	1.2
  @@ -5,6 +5,8 @@
               <store name="simple">
                   <parameter name="cache-mode">cluster</parameter>
                   <nodestore classname="org.apache.slide.simple.store.WebdavStoreAdapter">
  +                <!-- replace the above line with this one if your Slide version and your store supports macro operations on the store level -->  
  +                <!--nodestore classname="org.apache.slide.simple.store.WebdavStoreMacroAdapter"-->
                       <parameter name="callback-store">org.apache.slide.simple.reference.WebdavFileStore</parameter>
                       <!-- this is where all the resources in the /files collection go to -->
                       <!-- adapt to your needs -->
  @@ -22,6 +24,10 @@
                   <lockstore>
                       <reference store="nodestore"/>
                   </lockstore>
  +                <!-- uncomment this if your Slide version and your store supports macro operations on the store level -->  
  +    <!--macrostore>
  +      <reference store="nodestore"/>
  +    </macrostore-->
                   <!--lockstore classname="org.apache.slide.store.mem.TransientLockStore"/-->
                   <securitystore classname="org.apache.slide.store.mem.TransientSecurityStore"/>
               </store>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org