pnever      2003/08/18 00:02:46

  Modified:    src/webdav/server/org/apache/slide/webdav/util
                        PropertyRetrieverImpl.java
  Log:
  Init-parameter extendedAllprop and prepared for binding
  
  Revision  Changes    Path
  1.28      +53 -37    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java
  
  Index: PropertyRetrieverImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- PropertyRetrieverImpl.java        13 May 2003 12:48:03 -0000      1.27
  +++ PropertyRetrieverImpl.java        18 Aug 2003 07:02:46 -0000      1.28
  @@ -86,7 +86,9 @@
   import org.apache.slide.security.AccessDeniedException;
   import org.apache.slide.security.Security;
   import org.apache.slide.structure.Structure;
  +import org.apache.slide.util.Configuration;
   import org.apache.slide.webdav.WebdavServletConfig;
  +import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind;
   import org.apache.util.WebdavStatus;
   import org.jdom.CDATA;
   import org.jdom.Comment;
  @@ -187,7 +189,7 @@
        *                                  
<code>serverURL</code>/<code>contextPath</code>
        *                                  /<code>uri</code> gives the absolute URL of 
the resource.
        * @param      serverURL            the URL of the server (e.g. 
<code>http://www.abc.com</code>).
  -     * @param      allpropSupportsDeltaV  indicates if the <code>DeltaV</code> 
specific
  +     * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
        *
  @@ -197,7 +199,7 @@
        * @throws     SlideException
        * @throws     JDOMException  if creating the JDOM Element fails.
        */
  -    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
String uri, String contextPath, String serverURL, boolean allpropSupportsDeltaV) 
throws SlideException, JDOMException  {
  +    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
String uri, String contextPath, String serverURL, boolean extendedAllprop) throws 
SlideException, JDOMException  {
           
           NodeRevisionDescriptors revisionDescriptors = null;
           NodeRevisionDescriptor revisionDescriptor = null;
  @@ -222,11 +224,13 @@
                   isCollection = true;
                   revisionDescriptor = new NodeRevisionDescriptor(0);
                   
  -                String resourceName = uri;
  -                int lastSlash = resourceName.lastIndexOf('/');
  -                if (lastSlash != -1)
  -                    resourceName = resourceName.substring(lastSlash + 1);
  -                revisionDescriptor.setName(resourceName);
  +                if (!Configuration.useBinding(nsaToken.getUri(sToken, 
uri).getStore())) {
  +                    String resourceName = uri;
  +                    int lastSlash = resourceName.lastIndexOf('/');
  +                    if (lastSlash != -1)
  +                        resourceName = resourceName.substring(lastSlash + 1);
  +                    revisionDescriptor.setName(resourceName);
  +                }
               }
               
           } catch (AccessDeniedException e) {
  @@ -239,7 +243,7 @@
           //          throw new WebdavException(getErrorCode(e)); // abort the TA
           //      }
           
  -        return getPropertiesOfObject(requestedProperties, revisionDescriptors, 
revisionDescriptor, contextPath, serverURL, allpropSupportsDeltaV);
  +        return getPropertiesOfObject(requestedProperties, revisionDescriptors, 
revisionDescriptor, contextPath, serverURL, extendedAllprop);
       }
       
       /**
  @@ -254,7 +258,7 @@
        *                                  
<code>serverURL</code>/<code>contextPath</code>
        *                                  /<code>uri</code> gives the absolute URL of 
the resource.
        * @param      serverURL            the URL of the server (e.g. 
<code>http://www.abc.com</code>).
  -     * @param      allpropSupportsDeltaV  indicates if the <code>DeltaV</code> 
specific
  +     * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
        *
  @@ -264,13 +268,13 @@
        * @throws     SlideException
        * @throws     JDOMException  if creating the JDOM Element fails.
        */
  -    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
String uri, NodeRevisionNumber revisionNumber, String contextPath, String serverURL, 
boolean allpropSupportsDeltaV) throws SlideException, JDOMException {
  +    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
String uri, NodeRevisionNumber revisionNumber, String contextPath, String serverURL, 
boolean extendedAllprop) throws SlideException, JDOMException {
           
           NodeRevisionDescriptors revisionDescriptors = content.retrieve(sToken, uri);
           NodeRevisionDescriptor revisionDescriptor = content.retrieve(sToken,
                                                                        
revisionDescriptors,
                                                                        
revisionNumber);
  -        return getPropertiesOfObject(requestedProperties, revisionDescriptors, 
revisionDescriptor, contextPath, serverURL, allpropSupportsDeltaV);
  +        return getPropertiesOfObject(requestedProperties, revisionDescriptors, 
revisionDescriptor, contextPath, serverURL, extendedAllprop);
       }
       
       /**
  @@ -285,7 +289,7 @@
        *                                  
<code>serverURL</code>/<code>contextPath</code>
        *                                  /<code>uri</code> gives the absolute URL of 
the resource.
        * @param      serverURL            the URL of the server (e.g. 
<code>http://www.abc.com</code>).
  -     * @param      allpropSupportsDeltaV  indicates if the <code>DeltaV</code> 
specific
  +     * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
        *
  @@ -295,7 +299,7 @@
        * @throws     SlideException
        * @throws     JDOMException  if creating the JDOM Element fails.
        */
  -    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor 
revisionDescriptor, String contextPath, String serverURL, boolean 
allpropSupportsDeltaV) throws SlideException, JDOMException {
  +    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor 
revisionDescriptor, String contextPath, String serverURL, boolean extendedAllprop) 
throws SlideException, JDOMException {
           
           ComputedPropertyProvider propertyProvider = new 
ComputedPropertyProvider(nsaToken,
                                                                                    
sToken,
  @@ -308,7 +312,7 @@
                                                                           
propertyProvider),
                                        contextPath,
                                        serverURL,
  -                                     allpropSupportsDeltaV);
  +                                     extendedAllprop);
           
       }
       
  @@ -322,7 +326,7 @@
        *                                  
<code>serverURL</code>/<code>contextPath</code>
        *                                  /<code>uri</code> gives the absolute URL of 
the resource.
        * @param      serverURL            the URL of the server (e.g. 
<code>http://www.abc.com</code>).
  -     * @param      allpropSupportsDeltaV  indicates if the <code>DeltaV</code> 
specific
  +     * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
        *
  @@ -332,7 +336,7 @@
        * @throws     SlideException
        * @throws     JDOMException  if creating the JDOM Element fails.
        */
  -    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
RequestedResource requestedResource, String contextPath, String serverURL, boolean 
allpropSupportsDeltaV) throws SlideException, JDOMException {
  +    public List getPropertiesOfObject(RequestedProperties requestedProperties, 
RequestedResource requestedResource, String contextPath, String serverURL, boolean 
extendedAllprop) throws SlideException, JDOMException {
           
           List elementList = new ArrayList();
           
  @@ -341,7 +345,7 @@
                                          (WebdavStatus.SC_OK));
           
           if (requestedProperties.isAllProp()) {
  -            elementList = getAllPropertiesOfObject(requestedResource, contextPath, 
serverURL, allpropSupportsDeltaV);
  +            elementList = getAllPropertiesOfObject(requestedResource, contextPath, 
serverURL, extendedAllprop);
           }
           else {
               elementList = getRequestedPropertiesOfObject(requestedProperties, 
requestedResource, contextPath, serverURL);
  @@ -439,7 +443,7 @@
        *                                  
<code>serverURL</code>/<code>contextPath</code>
        *                                  /<code>uri</code> gives the absolute URL of 
the resource.
        * @param      serverURL            the URL of the server (e.g. 
<code>http://www.abc.com</code>).
  -     * @param      allpropSupportsDeltaV  indicates if the <code>DeltaV</code> 
specific
  +     * @param      extendedAllprop  indicates if the <code>DeltaV</code> specific
        *                                    properties should be included in case
        *                                    all properties are requested.
        *
  @@ -448,7 +452,7 @@
        *
        * @throws     SlideException
        */
  -    protected List getAllPropertiesOfObject(RequestedResource requestedResource, 
String contextPath, String serverURL, boolean allpropSupportsDeltaV) throws 
SlideException {
  +    protected List getAllPropertiesOfObject(RequestedResource requestedResource, 
String contextPath, String serverURL, boolean extendedAllprop) throws SlideException {
           
           List elementList = new ArrayList();
           Element propstat = new Element(E_PROPSTAT, 
NamespaceCache.DEFAULT_NAMESPACE);
  @@ -472,14 +476,13 @@
               PropertyName currentPropertyName = (PropertyName) 
propertyNameIterator.next();
               if (currentPropertyName != null) {
                   
  -                if ( !allpropSupportsDeltaV &&
  -                    
DeltavConstants.DELTAV_PROPERTY_LIST.contains(currentPropertyName.getName()) ) {
  -                    // skip DeltaV properties
  -                    continue;
  -                }
  -                if( !org.apache.slide.util.Configuration.useIntegratedSecurity() &&
  -                       
(AclConstants.ACL_PROPERTY_LIST.contains(currentPropertyName.getName())) ) {
  -                    // skip ACL properties
  +                if ( !extendedAllprop && (
  +                        
DeltavConstants.DELTAV_PROPERTY_LIST.contains(currentPropertyName.getName()) ||
  +                            
BindConstants.BIND_PROPERTY_LIST.contains(currentPropertyName.getName()) ||
  +                            
AclConstants.ACL_PROPERTY_LIST.contains(currentPropertyName.getName())
  +                    )
  +                   ) {
  +                    // skip properties from specification extensions
                       continue;
                   }
                   
  @@ -630,7 +633,9 @@
               if( propertyValue.toString().indexOf('<') >= 0 ) {
                   try {
                       XMLValue xmlValue = new XMLValue(propertyValue.toString(), 
valueDefaultNamespace);
  -                    convertHrefValueToAbsoluteURL(xmlValue, contextPath, serverURL);
  +                    if (AbstractResourceKind.isLiveProperty(propertyName)) {
  +                        convertHrefValueToAbsoluteURL(xmlValue, contextPath, 
serverURL);
  +                    }
                       Iterator iterator = xmlValue.iterator();
                       while (iterator.hasNext()) {
                           Object o = iterator.next();
  @@ -682,12 +687,23 @@
                   Object o = iterator.next();
                   if( o instanceof Element ) {
                       element = (Element)o;
  -                    if ( E_HREF.equals(element.getName()) && (element.getText() != 
null) ) {
  -                        if ( !PropertyHelper.isAbsoluteURL(serverURL, contextPath, 
element.getText()) ) {
  -                            
element.setText(PropertyHelper.getAbsoluteURL(serverURL, contextPath, 
element.getText()));
  -                        }
  -                    }
  +                    convertHrefValueToAbsoluteURL(element, serverURL, contextPath);
                   }
  +            }
  +        }
  +    }
  +    
  +    private static void convertHrefValueToAbsoluteURL(Element element, String 
serverURL, String contextPath) {
  +        if (!element.getChildren().isEmpty()) {
  +            Iterator i = element.getChildren().iterator();
  +            while (i.hasNext()) {
  +                Element child = (Element)i.next();
  +                convertHrefValueToAbsoluteURL(child, serverURL, contextPath);
  +            }
  +        }
  +        if ( E_HREF.equals(element.getName()) && (element.getText() != null) ) {
  +            if ( !PropertyHelper.isAbsoluteURL(serverURL, contextPath, 
element.getText()) ) {
  +                element.setText(PropertyHelper.getAbsoluteURL(serverURL, 
contextPath, element.getText()));
               }
           }
       }
  
  
  

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

Reply via email to