juergen     02/04/11 05:56:13

  Modified:    src/share/org/apache/slide/macro Macro.java MacroImpl.java
  Log:
  Besides a CopyListener the copy() method now also takes a DeleteListener which will 
be notified before overwriting an existing destination.
  Also fixed notification of CopyListener.
  (ralf)
  
  Revision  Changes    Path
  1.9       +14 -6     jakarta-slide/src/share/org/apache/slide/macro/Macro.java
  
  Index: Macro.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/Macro.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Macro.java        4 Apr 2002 06:25:45 -0000       1.8
  +++ Macro.java        11 Apr 2002 12:56:13 -0000      1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/Macro.java,v 
1.8 2002/04/04 06:25:45 juergen Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/04/04 06:25:45 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/Macro.java,v 
1.9 2002/04/11 12:56:13 juergen Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/04/11 12:56:13 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * Macro helper class.
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public interface Macro {
       
  @@ -122,10 +122,14 @@
        * @param copyListener    the CopyListener that will be notified
        *                        before and after copying a resource.
        *                        (May be <code>null</code>)
  +     * @param deleteListener  the DeleteListener that will be notified
  +     *                        before and after deleting a destination
  +     *                        that will be overwritten by the copy.
  +     *                        (May be <code>null</code>)
        * @exception CopyMacroException Generic Slide exception
        */
       void copy(SlideToken token, String sourceUri,
  -              String destinationUri, CopyListener copyListener)
  +              String destinationUri, CopyListener copyListener, DeleteListener 
deleteListener)
           throws CopyMacroException, DeleteMacroException;
       
       
  @@ -152,11 +156,15 @@
        * @param copyListener    the CopyListener that will be notified
        *                        before and after copying a resource.
        *                        (May be <code>null</code>)
  +     * @param deleteListener  the DeleteListener that will be notified
  +     *                        before and after deleting a destination
  +     *                        that will be overwritten by the copy.
  +     *                        (May be <code>null</code>)
        * @exception CopyMacroException Generic Slide exception
        */
       void copy(SlideToken token, String sourceUri,
                 String destinationUri, MacroParameters parameters,
  -              CopyListener copyListener)
  +              CopyListener copyListener, DeleteListener deleteListener)
           throws CopyMacroException, DeleteMacroException;
       
       
  
  
  
  1.25      +23 -14    jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java
  
  Index: MacroImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- MacroImpl.java    4 Apr 2002 06:25:45 -0000       1.24
  +++ MacroImpl.java    11 Apr 2002 12:56:13 -0000      1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v 1.24 
2002/04/04 06:25:45 juergen Exp $
  - * $Revision: 1.24 $
  - * $Date: 2002/04/04 06:25:45 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v 1.25 
2002/04/11 12:56:13 juergen Exp $
  + * $Revision: 1.25 $
  + * $Date: 2002/04/11 12:56:13 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * Macro helper class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.24 $
  + * @version $Revision: 1.25 $
    */
   public final class MacroImpl implements Macro {
       
  @@ -159,7 +159,7 @@
       public void copy(SlideToken token, String sourceUri,
                        String destinationUri)
           throws CopyMacroException, DeleteMacroException {
  -        copy(token, sourceUri, destinationUri, (CopyListener)null);
  +        copy(token, sourceUri, destinationUri, (CopyListener)null, 
(DeleteListener)null);
       }
       
       /**
  @@ -171,14 +171,19 @@
        * @param copyListener    the CopyListener that will be notified
        *                        before and after copying a resource.
        *                        (May be <code>null</code>)
  +     * @param deleteListener  the DeleteListener that will be notified
  +     *                        before and after deleting a destination
  +     *                        that will be overwritten by the copy.
  +     *                        (May be <code>null</code>)
        * @exception CopyMacroException Generic Slide exception
        */
       public void copy(SlideToken token, String sourceUri,
  -                     String destinationUri, CopyListener copyListener)
  +                     String destinationUri,
  +                     CopyListener copyListener, DeleteListener deleteListener)
           throws CopyMacroException, DeleteMacroException {
           
           this.copy(token, sourceUri, destinationUri,
  -                  RECURSIVE_OVERWRITE_PARAMETERS, copyListener);
  +                  RECURSIVE_OVERWRITE_PARAMETERS, copyListener, deleteListener);
       }
       
       
  @@ -194,7 +199,7 @@
       public void copy(SlideToken token, String sourceUri,
                        String destinationUri, MacroParameters parameters)
           throws CopyMacroException, DeleteMacroException {
  -        copy(token, sourceUri, destinationUri, parameters, null);
  +        copy(token, sourceUri, destinationUri, parameters, null, null);
       }
       
       /**
  @@ -207,11 +212,15 @@
        * @param copyListener    the CopyListener that will be notified
        *                        before and after copying a resource.
        *                        (May be <code>null</code>)
  +     * @param deleteListener  the DeleteListener that will be notified
  +     *                        before and after deleting a destination
  +     *                        that will be overwritten by the copy.
  +     *                        (May be <code>null</code>)
        * @exception CopyMacroException Generic Slide exception
        */
       public void copy(SlideToken token, String sourceUri,
                        String destinationUri, MacroParameters parameters,
  -                     CopyListener copyListener)
  +                     CopyListener copyListener, DeleteListener deleteListener)
           throws CopyMacroException, DeleteMacroException {
           
           Domain.debug("Copy " + sourceUri + " to " + destinationUri);
  @@ -228,7 +237,7 @@
               try {
                   // We make sure the object we want to overwrite exists
                   structureHelper.retrieve(token, destinationUri);
  -                delete(token, destinationUri);
  +                delete(token, destinationUri, deleteListener);
               } catch(ObjectNotFoundException e) {
                   // Silent catch, the target doesn't exist
               } catch(DeleteMacroException s) {
  @@ -329,7 +338,7 @@
                        CopyListener copyListener, DeleteListener deleteListener)
           throws CopyMacroException, DeleteMacroException {
           
  -        copy(token, sourceUri, destinationUri, parameters, copyListener);
  +        copy(token, sourceUri, destinationUri, parameters, copyListener, 
deleteListener);
           delete(token, sourceUri, parameters, deleteListener);
       }
       
  @@ -506,12 +515,12 @@
                                        currentRevisionDescriptor,
                                        currentRevisionContent);
                   
  +                
  +            }
  +            
                   // notify CopyListener
                   if (copyListener != null) {
                       copyListener.afterCopy(sourceUri, destinationUri);
  -                }
  -                
  -                
               }
               
               // TODO : Parse stack
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to