jakarta-slide-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From luetzkend...@apache.org
Subject cvs commit: jakarta-slide/src/share/org/apache/slide/macro MacroImpl.java MacroPropertyUpdater.java
Date Fri, 11 Mar 2005 16:30:29 GMT
luetzkendorf    2005/03/11 08:30:29

  Modified:    src/share/org/apache/slide/macro MacroImpl.java
                        MacroPropertyUpdater.java
  Added:       src/share/org/apache/slide/common HelperProvider.java
  Log:
  trial: way to provide more infos to event listeners
  
  Revision  Changes    Path
  1.1                  jakarta-slide/src/share/org/apache/slide/common/HelperProvider.java
  
  Index: HelperProvider.java
  ===================================================================
  package org.apache.slide.common;
  
  import org.apache.slide.content.Content;
  import org.apache.slide.lock.Lock;
  import org.apache.slide.macro.Macro;
  import org.apache.slide.search.Search;
  import org.apache.slide.security.Security;
  import org.apache.slide.structure.Structure;
  
  /**
   * Interface for classes that provide access to Slide helper classes.
   */
  public interface HelperProvider {
      /**
       * Get the data helper.
       *
       * @return Data Data helper
       */
      Structure getStructureHelper();
      
      
      /**
       * Get the version helper.
       *
       * @return Version Version helper
       */
      Content getContentHelper();
      
      
      /**
       * Get the lock helper.
       *
       * @return Lock Lock helper
       */
      Lock getLockHelper();
      
      
      /**
       * Get the lock helper.
       *
       * @return Lock Lock helper
       */
      Search getSearchHelper();
      
      
      /**
       * Get the security helper.
       *
       * @return Security Security helper
       */
      Security getSecurityHelper();
      
      
      /**
       * Get the macro helper.
       *
       * @return Macro Macro helper
       */
      Macro getMacroHelper();
  }
  
  
  
  1.56      +25 -5     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.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- MacroImpl.java	6 Jan 2005 18:08:56 -0000	1.55
  +++ MacroImpl.java	11 Mar 2005 16:30:29 -0000	1.56
  @@ -31,6 +31,7 @@
   import java.util.StringTokenizer;
   
   import org.apache.slide.common.Domain;
  +import org.apache.slide.common.HelperProvider;
   import org.apache.slide.common.Namespace;
   import org.apache.slide.common.NamespaceConfig;
   import org.apache.slide.common.PropertyName;
  @@ -52,6 +53,7 @@
   import org.apache.slide.lock.NodeLock;
   import org.apache.slide.lock.ObjectLockedException;
   import org.apache.slide.macro.CopyRouteRedirector.CopyRoute;
  +import org.apache.slide.search.Search;
   import org.apache.slide.security.AccessDeniedException;
   import org.apache.slide.security.NodePermission;
   import org.apache.slide.security.Security;
  @@ -70,7 +72,7 @@
    *
    * @version $Revision$
    */
  -public class MacroImpl implements Macro {
  +public class MacroImpl implements Macro, HelperProvider {
       
       private Namespace namespace;
       private NamespaceConfig namespaceConfig;
  @@ -900,11 +902,9 @@
       
       private boolean destinationExists(SlideToken token, String destinationUri) throws ServiceAccessException,
LinkedObjectNotFoundException, RevisionDescriptorNotFoundException, ObjectLockedException,
AccessDeniedException, VetoException {
           boolean destinationExists = true;
  -        NodeRevisionDescriptor destinationNrd = null;
           try {
  -            destinationNrd =
  -                contentHelper.retrieve(token,
  -                                       contentHelper.retrieve(token, destinationUri));
  +            contentHelper.retrieve(token, contentHelper.retrieve(token,
  +                    destinationUri));
           }
           catch (ObjectNotFoundException x) {
               destinationExists = false;
  @@ -1172,6 +1172,26 @@
       private boolean isLockNull( NodeRevisionDescriptor nrd ) {
           return nrd.propertyValueContains("resourcetype", "lock-null");
       }
  +    
  +    
  +    public Content getContentHelper() {
  +        return this.contentHelper;
  +    }
  +    public Lock getLockHelper() {
  +        return this.lockHelper;
  +    }
  +    public Macro getMacroHelper() {
  +        return this;
  +    }
  +    public Search getSearchHelper() {
  +        return null;
  +    }
  +    public Security getSecurityHelper() {
  +        return securityHelper;
  +    }
  +    public Structure getStructureHelper() {
  +        return structureHelper;
  +    }
   }
   
   
  
  
  
  1.9       +25 -32    jakarta-slide/src/share/org/apache/slide/macro/MacroPropertyUpdater.java
  
  Index: MacroPropertyUpdater.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroPropertyUpdater.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MacroPropertyUpdater.java	15 Dec 2004 16:26:51 -0000	1.8
  +++ MacroPropertyUpdater.java	11 Mar 2005 16:30:29 -0000	1.9
  @@ -23,18 +23,14 @@
   package org.apache.slide.macro;
   
   import org.apache.slide.common.Domain;
  -import org.apache.slide.common.Uri;
  +import org.apache.slide.common.HelperProvider;
   import org.apache.slide.content.Content;
   import org.apache.slide.content.NodeRevisionDescriptor;
   import org.apache.slide.content.NodeRevisionDescriptors;
   import org.apache.slide.event.MacroEvent;
   import org.apache.slide.event.MacroListener;
   import org.apache.slide.event.VetoException;
  -import org.apache.slide.lock.Lock;
  -import org.apache.slide.security.Security;
  -import org.apache.slide.structure.Structure;
   import org.apache.slide.structure.SubjectNode;
  -import org.apache.slide.util.NamespaceConfigUtil;
   import org.apache.slide.util.conf.Configurable;
   import org.apache.slide.util.conf.Configuration;
   import org.apache.slide.util.conf.ConfigurationException;
  @@ -88,7 +84,7 @@
      public void copy(MacroEvent event) throws VetoException
      {
         try {
  -         Content helper = getContentHelper(event);
  +         Content helper = ((HelperProvider)event.getSource()).getContentHelper();
            
            NodeRevisionDescriptors destNrds = helper.retrieve(event.getToken(), 
                                                               event.getTargetURI());
  @@ -119,9 +115,7 @@
            }
   
            if (anyThingUpdated) {
  -            Uri target = event.getNamespace().getUri(event.getToken(), 
  -                  event.getTargetURI());
  -            target.getStore().storeRevisionDescriptor(target, destNrd);
  +            helper.store(event.getToken(), event.getTargetURI(), destNrd, null);
            }
            
         } 
  @@ -137,7 +131,7 @@
      public void move(MacroEvent event) throws VetoException
      {
         try {
  -         Content helper = getContentHelper(event);
  +         Content helper = ((HelperProvider)event.getSource()).getContentHelper();
            
            NodeRevisionDescriptors destNrds = helper.retrieve(event.getToken(), 
                                                               event.getTargetURI());
  @@ -168,8 +162,7 @@
            }
   
            if (anyThingUpdated) {
  -            Uri target = event.getNamespace().getUri(event.getToken(), event.getTargetURI());
  -            target.getStore().storeRevisionDescriptor(target, destNrd);
  +             helper.store(event.getToken(), event.getTargetURI(), destNrd, null);
            }
         } 
         catch (Exception e) {
  @@ -208,21 +201,21 @@
         }
     }
   
  -  private Content getContentHelper(MacroEvent event) {
  -     Security security = NamespaceConfigUtil.getSecurityImplementation(
  -             event.getNamespace());
  -     Lock lock = NamespaceConfigUtil.getLockImplementation(
  -             event.getNamespace(),
  -             security);
  -     Structure structure = NamespaceConfigUtil.getStructureImplementation(
  -             event.getNamespace(),
  -             security,
  -             lock);     
  -     Content helper = NamespaceConfigUtil.getContentImplementation(
  -             event.getNamespace(),
  -             security,
  -             structure,
  -             lock);
  -     return helper;
  -  }
  +//  private Content getContentHelper(MacroEvent event) {
  +//     Security security = NamespaceConfigUtil.getSecurityImplementation(
  +//             event.getNamespace());
  +//     Lock lock = NamespaceConfigUtil.getLockImplementation(
  +//             event.getNamespace(),
  +//             security);
  +//     Structure structure = NamespaceConfigUtil.getStructureImplementation(
  +//             event.getNamespace(),
  +//             security,
  +//             lock);     
  +//     Content helper = NamespaceConfigUtil.getContentImplementation(
  +//             event.getNamespace(),
  +//             security,
  +//             structure,
  +//             lock);
  +//     return helper;
  +//  }
   }
  
  
  

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


Mime
View raw message