wam         02/04/22 09:20:56

  Modified:    src/share/org/apache/slide/store AbstractStore.java
               src/share/org/apache/slide/search/basic AndExpression.java
                        BasicExpression.java BasicQuery.java
                        BasicQueryScope.java CompareExpression.java
                        Literals.java MergeExpression.java
                        NotExpression.java OrderBy.java OrExpression.java
                        RequestedResourcesPoolImpl.java
               src/share/org/apache/slide/search QueryScope.java
                        RequestedResource.java RequestedResourceImpl.java
                        Search.java SearchImpl.java SearchToken.java
               src/webdav/server/org/apache/slide/webdav/method
                        ReportMethod.java SearchMethod.java
               src/share/org/apache/slide/common
                        RequestedPropertiesImpl.java
  Added:       src/share/org/apache/slide/search SlideUri.java
  Log:
  enable overwriting of BasicExpression
  
  Revision  Changes    Path
  1.30      +8 -5      
jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java
  
  Index: AbstractStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- AbstractStore.java        28 Mar 2002 06:23:17 -0000      1.29
  +++ AbstractStore.java        22 Apr 2002 16:20:54 -0000      1.30
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v 1.29 
2002/03/28 06:23:17 jericho Exp $
  - * $Revision: 1.29 $
  - * $Date: 2002/03/28 06:23:17 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v 1.30 
2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.30 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -90,7 +90,7 @@
    * Abstract implementation of a store. Handles all caching operations.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.29 $
  + * @version $Revision: 1.30 $
    */
   public abstract class AbstractStore extends AbstractSimpleService
       implements Store {
  @@ -208,7 +208,7 @@
       }
       
    
  -        private Hashtable parameters = null;
  +    protected Hashtable parameters = null;
           
       /**
        * Remeber the store parameters to initialise the default child stores on 
request
  @@ -224,6 +224,9 @@
           this.parameters = parameters;
       }
       
  +    public Object getParameter (Object key) {
  +        return parameters.get (key);
  +    }
       
       /**
        * Connects to descriptors store.
  
  
  
  1.4       +6 -6      
jakarta-slide/src/share/org/apache/slide/search/basic/AndExpression.java
  
  Index: AndExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/AndExpression.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AndExpression.java        28 Mar 2002 06:23:16 -0000      1.3
  +++ AndExpression.java        22 Apr 2002 16:20:54 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/AndExpression.java,v 
1.3 2002/03/28 06:23:16 jericho Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/28 06:23:16 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/AndExpression.java,v 
1.4 2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -73,7 +73,7 @@
    * Represents an AND expression.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class AndExpression extends MergeExpression {
       
  @@ -84,8 +84,8 @@
        * @param e jdom element, that describes the expression
        *
        */
  -    protected AndExpression (Element e) throws InvalidQueryException {
  -        super (e);
  +    protected AndExpression (Element e, BasicExpressionFactory factory) throws 
InvalidQueryException {
  +        super (e, factory);
       }
       
       protected void merge (java.util.Set theOtherResultSet) {
  
  
  
  1.6       +6 -65     
jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java
  
  Index: BasicExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BasicExpression.java      28 Mar 2002 09:55:04 -0000      1.5
  +++ BasicExpression.java      22 Apr 2002 16:20:54 -0000      1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v 
1.5 2002/03/28 09:55:04 wam Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/03/28 09:55:04 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v 
1.6 2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -81,10 +81,12 @@
    *
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public abstract class BasicExpression {
       
  +    protected BasicExpressionFactory expressionFactory;
  +    
       /** the JDOM element representing this expression. */
       protected Element   expressionElement;
       
  @@ -108,66 +110,6 @@
           this.expressionElement = e;
       }
      
  -    /**
  -     * Factory method to create the concrete expression.
  -     *
  -     * @param    e the jdom element representing the expression
  -     *
  -     * @return   a BasicSearchExpression
  -     *
  -     * @throws   InvalidQueryException
  -     */
  -    static public BasicExpression createExpression
  -        (Element e) throws InvalidQueryException
  -    {
  -        
  -        BasicExpression result = null;
  -        
  -        if (e == null) {
  -            result = new EmptyExpression ();
  -        }
  -        else {
  -            String name = e.getName();
  -            
  -            if (name.equals (Literals.AND))
  -                result = new AndExpression (e);
  -                
  -            else if (name.equals (Literals.OR))
  -                result = new OrExpression (e);
  -                
  -            else if (name.equals (Literals.GT))
  -                result = new GTExpression (e);
  -                
  -            else if (name.equals (Literals.LT))
  -                result = new LTExpression (e);
  -                
  -            else if (name.equals (Literals.EQ))
  -                result = new EQExpression (e);
  -                
  -            else if (name.equals (Literals.CONTAINS))
  -                result = new ContainsExpression (e);
  -                
  -            else if (name.equals (Literals.ISCOLLECTION))
  -                result = new IsCollectionExpression (e);
  -                
  -            else if (name.equals (Literals.ISPRINCIPAL))
  -                result = new IsPrincipalExpression (e);
  -                
  -            else if (name.equals (Literals.ISDEFINED))
  -                result = new IsDefinedExpression (e);
  -                
  -            else if (name.equals (Literals.NOT))
  -                result = new NotExpression (e);
  -                
  -            else
  -                throw new InvalidQueryException
  -                    ("operator " + name + " is an unprocessable entity");
  -        }
  -
  -        return result;
  -        
  -    }
  -    
       
       /**
        * retrieves the result set.
  @@ -198,6 +140,5 @@
        *           is created
        */
       protected abstract void resolve (Set pool);
  -    
   }
   
  
  
  
  1.7       +44 -11    
jakarta-slide/src/share/org/apache/slide/search/basic/BasicQuery.java
  
  Index: BasicQuery.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQuery.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BasicQuery.java   28 Mar 2002 06:23:16 -0000      1.6
  +++ BasicQuery.java   22 Apr 2002 16:20:54 -0000      1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQuery.java,v 1.6 
2002/03/28 06:23:16 jericho Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/03/28 06:23:16 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQuery.java,v 1.7 
2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -29,7 +29,7 @@
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
  - * 4. the names "The Jakarta Project", "Slide", and "Apache Software
  + * 4. The names "The Jakarta Project", "Slide", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
    *    from this software without prior written permission. For written
    *    permission, please contact [EMAIL PROTECTED]
  @@ -67,10 +67,13 @@
   import org.apache.slide.search.SearchQuery;
   import org.apache.slide.search.SearchException;
   import org.apache.slide.search.BadQueryException;
  +import org.apache.slide.search.SearchQueryResult;
   import org.apache.slide.common.ServiceAccessException;
  +import org.apache.slide.common.SlideRuntimeException;
   import org.apache.slide.common.RequestedProperties;
   import org.apache.slide.common.RequestedPropertiesImpl;
  -import org.apache.slide.search.SearchQueryResult;
  +import org.apache.slide.common.Uri;
  +import org.apache.slide.store.AbstractStore;
   import org.jdom.input.DOMBuilder;
   import org.jdom.input.SAXBuilder;
   import org.jdom.Namespace;
  @@ -92,7 +95,7 @@
    * BasicSearchExpressions.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class BasicQuery extends SearchQuery {
       
  @@ -123,6 +126,7 @@
       /** the top level expression in the <WHERE> clause */
       private BasicExpression rootExpression;
       
  +    private BasicExpressionFactory expressionFactory;
      
       /**
        * Constructs a query from the queryString. queryString is an XML
  @@ -141,7 +145,7 @@
               Element root = doc.getRootElement();
               parseQueryElement (root);
           }
  -        catch (org.jdom.JDOMException e) {
  +        catch (Exception e) {
               e.printStackTrace();
               throw new BadQueryException (e.getMessage());
           }
  @@ -156,8 +160,9 @@
        *
        * @throws BadQueryException
        */
  -    BasicQuery (org.w3c.dom.Element basicSearchElementDOM, SearchToken token) 
throws BadQueryException {
  -        
  +    BasicQuery (org.w3c.dom.Element basicSearchElementDOM, SearchToken token)
  +        throws BadQueryException
  +    {
           this.searchToken = token;
           
           org.jdom.Element basicSearchElementJDom =
  @@ -328,15 +333,18 @@
           if (orderByElement != null)
               orderBy = new OrderBy (orderByElement);
           
  +        BasicExpressionFactory expressionFactory
  +            = getExpressionFactory (scope);
  +        
           // <where> is not mandatory
           if (whereElement != null) {
               List expressionList = whereElement.getChildren();
               
  -            rootExpression = BasicExpression.createExpression
  +            rootExpression = expressionFactory.createExpression
                   ((Element) expressionList.get (0));
           }
           else
  -            rootExpression = BasicExpression.createExpression (null);
  +            rootExpression = expressionFactory.createExpression (null);
           
           if (limitElement != null) {
               limit = new Integer (limitElement.getTextTrim()).intValue();
  @@ -356,6 +364,31 @@
           String result =
               "SELECT [" + requestedProperties + "] FROM [" + scope + "] "
               + "WHERE [" + rootExpression + "]";
  +        
  +        return result;
  +    }
  +    
  +    private BasicExpressionFactory getExpressionFactory (QueryScope scope) {
  +        BasicExpressionFactory result = null;
  +        
  +        String queryClass = "org.apache.slide.search.basic.BasicExpressionFactory";
  +
  +        // might be null in testsuite
  +        if (searchToken.getNamespace() != null) {
  +            Uri uri = new Uri (searchToken.getNamespace(), scope.getHref());
  +            AbstractStore store = (AbstractStore)uri.getStore();
  +            String s = (String) 
store.getParameter(BasicExpressionFactory.EXPRESSION_FACTORY);
  +            if (s != null)
  +                queryClass = s;
  +        }
  +        
  +        try {
  +            Class factoryClass = Class.forName (queryClass);
  +            result = (BasicExpressionFactory)factoryClass.newInstance();
  +        }
  +        catch (Exception e) {
  +            throw new SlideRuntimeException (e.getMessage());
  +        }
           
           return result;
       }
  
  
  
  1.3       +9 -4      
jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java
  
  Index: BasicQueryScope.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicQueryScope.java      28 Mar 2002 06:23:16 -0000      1.2
  +++ BasicQueryScope.java      22 Apr 2002 16:20:54 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v 
1.2 2002/03/28 06:23:16 jericho Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/28 06:23:16 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v 
1.3 2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * Holds the scope information supplied with the <FROM> element.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class BasicQueryScope implements QueryScope {
       
  @@ -161,6 +161,11 @@
       public int getDepth() {
           return depth;
       }
  +    
  +    public String getSlideScope() {
  +        return null;
  +    }
  +    
       
       
       /**
  
  
  
  1.6       +5 -5      
jakarta-slide/src/share/org/apache/slide/search/basic/CompareExpression.java
  
  Index: CompareExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/CompareExpression.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CompareExpression.java    28 Mar 2002 09:55:04 -0000      1.5
  +++ CompareExpression.java    22 Apr 2002 16:20:54 -0000      1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/CompareExpression.java,v
 1.5 2002/03/28 09:55:04 wam Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/03/28 09:55:04 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/CompareExpression.java,v
 1.6 2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -74,10 +74,10 @@
   import org.apache.slide.search.InvalidQueryException;
   
   /**
  - * Abstract base class for compare expressions (GT, EQ, is-collection ...).
  + * Abstract base class for compare expressions (property compares, contains).
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public abstract class CompareExpression extends BasicExpression {
       
  
  
  
  1.6       +7 -4      
jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java
  
  Index: Literals.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Literals.java     28 Mar 2002 09:55:04 -0000      1.5
  +++ Literals.java     22 Apr 2002 16:20:54 -0000      1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java,v 1.5 
2002/03/28 09:55:04 wam Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/03/28 09:55:04 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java,v 1.6 
2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -67,7 +67,7 @@
    * static container for some literals.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class Literals {
   
  @@ -102,6 +102,9 @@
       public static final String SELECT        = "select";
       public static final String WHERE         = "where";
   
  +    public static final String DAV_NAMESPACE = "DAV:";
  +    public static final String SLIDE_EXTENSIONS  = 
"http://jakarta.apache.org/slide:";;
  +    
       // this one must be slidewide known, move it to appropriate class somewhen
       // (is that true after the new DASL?)
       //static final String DT_NAMESPACE
  
  
  
  1.5       +9 -6      
jakarta-slide/src/share/org/apache/slide/search/basic/MergeExpression.java
  
  Index: MergeExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/MergeExpression.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MergeExpression.java      28 Mar 2002 06:23:16 -0000      1.4
  +++ MergeExpression.java      22 Apr 2002 16:20:54 -0000      1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/MergeExpression.java,v 
1.4 2002/03/28 06:23:16 jericho Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/03/28 06:23:16 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/MergeExpression.java,v 
1.5 2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -76,26 +76,29 @@
    * Abstract base class for merge expressions (AND, OR).
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public abstract class MergeExpression extends BasicExpression {
       
       /** all nested expressions */
       protected List nestedExpressions = new ArrayList ();
       
  +    protected BasicExpressionFactory expressionFactory;
  +    
       /**
        * Creates a merge expression according to Element e
        *
        * @param e jdom element, that describes the expression
        *
        */
  -    MergeExpression (Element e) throws InvalidQueryException {
  +    MergeExpression (Element e, BasicExpressionFactory factory) throws 
InvalidQueryException {
           super (e);
           Iterator it = e.getChildren().iterator();
  +        expressionFactory = factory;
           
           while (it.hasNext()) {
               Element el = (Element) it.next();
  -            nestedExpressions.add (BasicExpression.createExpression (el));
  +            nestedExpressions.add (expressionFactory.createExpression (el));
           }
           
       }
  
  
  
  1.3       +6 -6      
jakarta-slide/src/share/org/apache/slide/search/basic/NotExpression.java
  
  Index: NotExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotExpression.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NotExpression.java        28 Mar 2002 06:23:16 -0000      1.2
  +++ NotExpression.java        22 Apr 2002 16:20:54 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotExpression.java,v 
1.2 2002/03/28 06:23:16 jericho Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/28 06:23:16 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotExpression.java,v 
1.3 2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -65,7 +65,7 @@
    * Represents a NOT expression.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   
   package org.apache.slide.search.basic;
  @@ -86,13 +86,13 @@
        * @param e jdom element, that describes the expression
        *
        */
  -    protected NotExpression (Element e) throws InvalidQueryException {
  +    protected NotExpression (Element e, BasicExpressionFactory factory) throws 
InvalidQueryException {
           super (e);
           Iterator it = e.getChildren().iterator();
           
           if (it.hasNext()) {
               nestedExpression =
  -                BasicExpression.createExpression ((Element) it.next());
  +                factory.createExpression ((Element) it.next());
           }
           if (nestedExpression == null || it.hasNext()) {
               throw new InvalidQueryException
  
  
  
  1.3       +66 -3     
jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java
  
  Index: OrderBy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OrderBy.java      28 Mar 2002 06:23:16 -0000      1.2
  +++ OrderBy.java      22 Apr 2002 16:20:54 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java,v 1.2 
2002/03/28 06:23:16 jericho Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/28 06:23:16 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java,v 1.3 
2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -76,11 +76,28 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   
  +
  +/**
  + * Encapsulate an OrderBy expression. Also supplies a Comparator according
  + * to the specified parameters in the OrderBy expression,
  + *
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  + * @version $Revision: 1.3 $
  + */
   public class OrderBy {
       
  +    /** the comparator according to this expression */
       Comparator theComparator = new _Comparator ();
  +    
  +    /** all orderby elements of this expression */
       List orderByElements = new ArrayList ();
       
  +    /**
  +     * Constructs an OrderBy.
  +     *
  +     * @param orderByElements  the JDOM element containing the
  +     *        orderBy expression
  +     */
       OrderBy (Element orderByElement) throws InvalidQueryException {
           Namespace nameSpace = orderByElement.getNamespace ();
           Iterator it =
  @@ -97,11 +114,25 @@
           }
       }
       
  +    /**
  +     * Method getComparator
  +     *
  +     * @return   the comparator according to the OrderBy expression
  +     *
  +     */
       public Comparator getComparator () {
           return theComparator;
       }
       
       
  +    /**
  +     * Method isCaseSensitive
  +     *
  +     * @param    order               an order Element
  +     *
  +     * @return   true if this order element shall regard case
  +     *
  +     */
       private boolean isCaseSensitive (Element order) {
           boolean result = true;
           Attribute caseSens =
  @@ -120,6 +151,16 @@
       
       
       
  +    /**
  +     * Method isAscending
  +     *
  +     * @param    order               an Element
  +     *
  +     * @return   a boolean
  +     *
  +     * @throws   InvalidQueryException if ascending and descending is supplied
  +     *
  +     */
       private boolean isAscending (Element order) throws InvalidQueryException {
           Element asc = order.getChild (Literals.ASCENDING, order.getNamespace());
           Element desc = order.getChild (Literals.DESCENDING, order.getNamespace());
  @@ -134,6 +175,16 @@
           return result;
       }
       
  +    /**
  +     * Method getPropName
  +     *
  +     * @param    order               an Element
  +     *
  +     * @return   a String
  +     *
  +     * @throws   InvalidQueryException
  +     *
  +     */
       private String getPropName (Element order) throws InvalidQueryException {
           
           Element prop = order.getChild (Literals.PROP, order.getNamespace ());
  @@ -149,8 +200,20 @@
       }
       
       
  +    /**
  +     * a comparator that sorts according to the OrderBy element
  +     */
       class _Comparator implements Comparator  {
           
  +        /**
  +         * Method compare
  +         *
  +         * @param    o1                  an Object
  +         * @param    o2                  an Object
  +         *
  +         * @return   an int
  +         *
  +         */
           public int compare(Object o1, Object o2) {
               RequestedResource r1 = (RequestedResource)o1;
               RequestedResource r2 = (RequestedResource)o2;
  
  
  
  1.3       +6 -6      
jakarta-slide/src/share/org/apache/slide/search/basic/OrExpression.java
  
  Index: OrExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrExpression.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OrExpression.java 28 Mar 2002 06:23:16 -0000      1.2
  +++ OrExpression.java 22 Apr 2002 16:20:54 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrExpression.java,v 
1.2 2002/03/28 06:23:16 jericho Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/28 06:23:16 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrExpression.java,v 
1.3 2002/04/22 16:20:54 wam Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/22 16:20:54 $
    *
    * ====================================================================
    *
  @@ -73,7 +73,7 @@
    * Represents an OR expression.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class OrExpression extends MergeExpression {
       
  @@ -84,8 +84,8 @@
        * @param e jdom element, that describes the expression
        *
        */
  -    protected OrExpression (Element e) throws InvalidQueryException {
  -        super (e);
  +    protected OrExpression (Element e, BasicExpressionFactory factory) throws 
InvalidQueryException {
  +        super (e, factory);
       }
       
       protected void merge (java.util.Set theOtherResultSet) {
  
  
  
  1.3       +7 -3      
jakarta-slide/src/share/org/apache/slide/search/basic/RequestedResourcesPoolImpl.java
  
  Index: RequestedResourcesPoolImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/RequestedResourcesPoolImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RequestedResourcesPoolImpl.java   19 Mar 2002 17:28:15 -0000      1.2
  +++ RequestedResourcesPoolImpl.java   22 Apr 2002 16:20:54 -0000      1.3
  @@ -32,7 +32,7 @@
    * computed.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class RequestedResourcesPoolImpl implements RequestedResourcesPool {
       
  @@ -41,11 +41,13 @@
       private Content contentHelper;
       private SlideToken slideToken;
       private QueryScope scope;
  +    private SearchToken searchToken;
       
       private int scopeDepth;
       private int maxSlideDepth;
       private boolean partialResult = false;
       private Set pool;
  +    private SlideUri slideContext;
       
       /**
        * Constructs a RequestedResourcesPool
  @@ -63,6 +65,8 @@
           this.slideToken = searchToken.getSlideToken();
           this.scope      = scope;
           this.contentHelper = searchToken.getContentHelper();
  +        this.slideContext = searchToken.getSlideContext();
  +        this.searchToken = searchToken;
           
           scopeDepth = scope.getDepth ();
           maxSlideDepth = searchToken.getMaxDepth();
  @@ -101,7 +105,7 @@
       private void createPool () throws BadQueryException {
           pool = new HashSet ();
           
  -        String resourceUri = scope.getHref();
  +        String resourceUri = searchToken.getSlideContext().getSlidePath 
(scope.getHref());
           
           // Get the object from Data.
           ObjectNode resource = null;
  @@ -149,7 +153,7 @@
           }
           
           RequestedResource item =
  -            new RequestedResourceImpl (object, slideToken, contentHelper);
  +            new RequestedResourceImpl (object, searchToken);
           
           pool.add (item);
       }
  
  
  
  1.3       +7 -5      jakarta-slide/src/share/org/apache/slide/search/QueryScope.java
  
  Index: QueryScope.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/QueryScope.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueryScope.java   28 Mar 2002 06:23:15 -0000      1.2
  +++ QueryScope.java   22 Apr 2002 16:20:55 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/QueryScope.java,v 1.2 
2002/03/28 06:23:15 jericho Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/28 06:23:15 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/QueryScope.java,v 1.3 
2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
    * Holds the scope information supplied with the <FROM> element.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public interface QueryScope {
        
  @@ -83,7 +83,7 @@
        public static final int DEPTH_INFINITY = Integer.MAX_VALUE;
       
       /**
  -      * href accessor
  +     * href accessor.
         *
         * @return   a String
         *
  @@ -99,4 +99,6 @@
         */
       public int getDepth();
        
  +    
  +    public String getSlideScope ();
   }
  
  
  
  1.5       +17 -6     
jakarta-slide/src/share/org/apache/slide/search/RequestedResource.java
  
  Index: RequestedResource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RequestedResource.java    28 Mar 2002 09:55:03 -0000      1.4
  +++ RequestedResource.java    22 Apr 2002 16:20:55 -0000      1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResource.java,v 1.4 
2002/03/28 09:55:03 wam Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/03/28 09:55:03 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResource.java,v 1.5 
2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -85,17 +85,28 @@
    * TODO: Namespace awareness!!
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public interface RequestedResource {
       
       
       /**
  -     * href accessor
  +     * returns the internal href. / means: the root of this slide
  +     * for example http://localhost/slide
        *
        * @return   the href of this item
        */
  -    public String getHref ();
  +    public String getInternalHref ();
  +    
  +    
  +    /**
  +     * returns the external href. / means: the root of this server
  +     * for example http://localhost/
  +     *
  +     * @return   the href of this item
  +     */
  +    public String getExternalHref ();
  +    
       
       /**
        * Checks, if a property, represented by its name and value (as String),
  
  
  
  1.5       +20 -5     
jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java
  
  Index: RequestedResourceImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RequestedResourceImpl.java        28 Mar 2002 09:55:03 -0000      1.4
  +++ RequestedResourceImpl.java        22 Apr 2002 16:20:55 -0000      1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v 
1.4 2002/03/28 09:55:03 wam Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/03/28 09:55:03 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v 
1.5 2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -87,7 +87,7 @@
    * equals, ...
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class RequestedResourceImpl implements RequestedResource {
       
  @@ -103,12 +103,14 @@
       private Content contentHelper;
       private NodeRevisionDescriptors revisionDescriptors;
       private SlideToken slideToken;
  +    private SearchToken searchToken;
       
       /** coantains allowed on */
       static final private Set containsAllowedOn = new HashSet();
       static {
           containsAllowedOn.add ("text/xml");
           containsAllowedOn.add ("application/text");
  +        containsAllowedOn.add ("text/plain");
       };
       
       private static final int EQ =  1;
  @@ -119,6 +121,14 @@
       
       
       
  +    public RequestedResourceImpl (ObjectNode objectNode, SearchToken searchToken)
  +        throws SlideException
  +    {
  +        this (objectNode, searchToken.getSlideToken(), 
searchToken.getContentHelper());
  +        this.searchToken = searchToken;
  +    }
  +        
  +    
       // private boolean isCollection;
       
       /**
  @@ -216,8 +226,13 @@
        *
        * @return   the href of this item
        */
  -    public String getHref() {
  +    public String getInternalHref() {
           return objectNode.getUri();
  +    }
  +    
  +    public String getExternalHref () {
  +        SlideUri slideContext = searchToken.getSlideContext();
  +        return  slideContext.getContextPath (objectNode.getUri());
       }
       
       
  
  
  
  1.8       +11 -4     jakarta-slide/src/share/org/apache/slide/search/Search.java
  
  Index: Search.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/Search.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Search.java       28 Mar 2002 06:23:15 -0000      1.7
  +++ Search.java       22 Apr 2002 16:20:55 -0000      1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/Search.java,v 
1.7 2002/03/28 06:23:15 jericho Exp $
  - * $Revision: 1.7 $
  - * $Date: 2002/03/28 06:23:15 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/Search.java,v 
1.8 2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.8 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
    * Search helper.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public interface Search {
       
  @@ -121,5 +121,12 @@
                                   Element searchRequestElement,
                                   SlideToken token,
                                   int maxDepth)
  +        throws BadQueryException;
  +    
  +    SearchQuery createSearchQuery (String grammarUri,
  +                                   Element searchRequestElement,
  +                                   SlideToken token,
  +                                   int maxDepth,
  +                                   String requestUri)
           throws BadQueryException;
   }
  
  
  
  1.9       +30 -5     jakarta-slide/src/share/org/apache/slide/search/SearchImpl.java
  
  Index: SearchImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SearchImpl.java   28 Mar 2002 06:23:15 -0000      1.8
  +++ SearchImpl.java   22 Apr 2002 16:20:55 -0000      1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchImpl.java,v 1.8 
2002/03/28 06:23:15 jericho Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/03/28 06:23:15 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchImpl.java,v 1.9 
2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -87,7 +87,7 @@
    * Search helper.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public final class SearchImpl implements Search {
       
  @@ -220,10 +220,35 @@
                                          int maxDepth)
           throws BadQueryException
       {
  +        return createSearchQuery (grammarUri, queryElement, token, maxDepth, null);
  +    }
  +    
  +    /**
  +     * Creates a SearchQuery.
  +     *
  +     * @param    grammarUri          identifier for the SearchLanguage
  +     * @param    queryElement        the element containing the query
  +     * @param    token               the SlideToken
  +     * @param    maxDepth            may be 0, 1 or INFINIT
  +     *
  +     * @return   the SearchQuery
  +     *
  +     * @throws   BadQueryException
  +     *
  +     */
  +    public SearchQuery createSearchQuery (String grammarUri,
  +                                          Element queryElement,
  +                                          SlideToken token,
  +                                          int maxDepth,
  +                                          String requestUri)
  +        throws BadQueryException
  +    {
           SearchQuery result = null;
           // create search token
           SearchToken searchToken =
  -            SearchToken.createSearchToken (token, contentHelper, structureHelper, 
maxDepth);
  +            SearchToken.createSearchToken (token, contentHelper,
  +                                           structureHelper, maxDepth,
  +                                           requestUri, namespace);
           
           SearchLanguage language = getLanguage (grammarUri);
           result = language.parseQuery (queryElement, searchToken);
  
  
  
  1.3       +37 -9     jakarta-slide/src/share/org/apache/slide/search/SearchToken.java
  
  Index: SearchToken.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchToken.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SearchToken.java  28 Mar 2002 06:23:15 -0000      1.2
  +++ SearchToken.java  22 Apr 2002 16:20:55 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchToken.java,v 1.2 
2002/03/28 06:23:15 jericho Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/28 06:23:15 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchToken.java,v 1.3 
2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -64,6 +64,7 @@
   package org.apache.slide.search;
   
   import org.apache.slide.common.SlideToken;
  +import org.apache.slide.common.Namespace;
   import org.apache.slide.content.Content;
   import org.apache.slide.structure.Structure;
   
  @@ -71,7 +72,7 @@
    * Represents the context of a search requerst.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class SearchToken {
        
  @@ -79,9 +80,12 @@
        private Content contentHelper;
        private Structure structureHelper;
        
  +    private SlideUri slideContext;
        
        private int maxDepth = Integer.MAX_VALUE;
        
  +    private Namespace namespace;
  +    
        /**
         * SearchToken factory.
         *
  @@ -94,9 +98,10 @@
         */
        public static SearchToken createSearchToken
                (SlideToken token, Content content,
  -              Structure structure, int maxDepth)
  +         Structure structure, int maxDepth,
  +         String requestUri, Namespace namespace)
        {
  -             return new SearchToken (token, content, structure, maxDepth);
  +        return new SearchToken (token, content, structure, maxDepth, requestUri, 
namespace);
        }
        
        /**
  @@ -107,8 +112,8 @@
         * @return   a SearchToken
         *
         */
  -     public static SearchToken createSearchTokenForTestOnly (int maxDepth) {
  -             return new SearchToken (null, null, null, maxDepth);
  +    public static SearchToken createSearchTokenForTestOnly (int maxDepth, String 
requestUri) {
  +        return new SearchToken (null, null, null, maxDepth, requestUri, null);
        }
        
        
  @@ -122,12 +127,25 @@
         *
         */
        private SearchToken (SlideToken token, Content content,
  -                                              Structure structure, int maxDepth) {
  +                         Structure structure, int maxDepth,
  +                         String requestUri, Namespace namespace) {
                
                this.slideToken = token;
                this.contentHelper = content;
                this.structureHelper = structure;
                this.maxDepth = maxDepth;
  +        this.slideContext = new SlideUri (requestUri);
  +        this.namespace = namespace;
  +    }
  +    
  +    /**
  +     * Method getNamespace
  +     *
  +     * @return   the namespace
  +     *
  +     */
  +    public Namespace getNamespace () {
  +        return namespace;
        }
        
        /**
  @@ -169,5 +187,15 @@
        public int getMaxDepth() {
                return maxDepth;
        }
  +    
  +    /**
  +     * Method getSlideContext
  +     *
  +     * @return   a SlideUri
  +     *
  +     */
  +    public SlideUri getSlideContext () {
  +        return slideContext;
  +    }
   }
   
  
  
  
  1.1                  jakarta-slide/src/share/org/apache/slide/search/SlideUri.java
  
  Index: SlideUri.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/SlideUri.java,v 1.1 
2002/04/22 16:20:55 wam Exp $
   * $Revision: 1.1 $
   * $Date: 2002/04/22 16:20:55 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.search;
  
  import java.net.URL;
  import java.net.MalformedURLException;
  
  /**
   * The root of an href in slide is the slide servlet. For an external href the
   * root is the server. Example: the host is localhost, the context is slide.
   * http://localhost/slide/mycoll/myfile.xml
   *
   */
  public class SlideUri {
      
      private String context;
      private String path;
      
      public SlideUri (String requestUri) {
          this.context = getContextOfRelPath(requestUri);
          this.path = getPathOfRelPath(requestUri);
      }
      
      /**
       * Method getSlideUri
       *
       * @param    relPath             a  String
       *
       * @return   a String
       *
       * @throws   MalformedURLException
       *
       */
      public String getSlidePath (String relPath) throws InvalidScopeException {
          
          StringBuffer sb = new StringBuffer ();
          if (relPath.startsWith("/")) {
              String relContext = getContextOfRelPath (relPath);
              if (!relContext.equals (context))
                  throw new InvalidScopeException ("Uri does not refer to " + context
                                                  + ". If an absolute scope is used, 
it must start with /"
                                                  + context);
              
              relPath = getPathOfRelPath (relPath);
          }
              
          else {
              sb.append (path);
              if (!path.endsWith("/"))
                  sb.append ("/");
          }
      
          sb.append (relPath);
          
          return sb.toString();
      }
      
      /**
       * Method getContextPath
       *
       * @param    internalHref        a  String
       *
       * @return   a String
       *
       */
      public String getContextPath (String slidePath) {
          return context + slidePath;
      }
      
      
      /**
       * Method getContextOfRelPath
       *
       * @param    relPath             a  String
       *
       * @return   a String
       *
       */
      private String getContextOfRelPath (String relPath) {
          String result = null;
          int posSlash = relPath.indexOf ('/', 1);
          if (posSlash == -1)
              result = relPath.substring (0);
          else
              result = relPath.substring (0, posSlash);
          
          return result;
      }
      
      /**
       * Method getPathOfRelPath
       *
       * @param    relPath             a  String
       *
       * @return   a String
       *
       */
      private String getPathOfRelPath (String relPath) {
          String result = null;
          int posSlash = relPath.indexOf ('/', 1);
          if (posSlash == -1)
              result = "";
          else
              result = relPath.substring (posSlash);
          
          return result;
      }
     
      
      
      
      
  }
  
  
  
  
  1.18      +18 -13    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java
  
  Index: ReportMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ReportMethod.java 16 Apr 2002 09:24:41 -0000      1.17
  +++ ReportMethod.java 22 Apr 2002 16:20:55 -0000      1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
 1.17 2002/04/16 09:24:41 juergen Exp $
  - * $Revision: 1.17 $
  - * $Date: 2002/04/16 09:24:41 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
 1.18 2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.18 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -164,7 +164,7 @@
   /**
    * An implementation of the DeltaV <code>REPORT</code> method.
    *
  - * @version $Revision: 1.17 $
  + * @version $Revision: 1.18 $
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
    */
  @@ -543,7 +543,7 @@
                   executeAclPrincipalReport(requestUri, multistatusElement, 
getDepth());
               }
               else if (R_PRINCIPAL_MATCH.equals(requestedReport)) {
  -                executeAclMatchReport(requestUri, multistatusElement, getDepth());
  +                executeAclMatchReport (multistatusElement, getDepth());
               }
               else if (R_LOCATE_BY_HISTORY.equals(requestedReport)) {
                   executeLocateByHistoryReport(requestUri, multistatusElement, 
getDepth());
  @@ -927,7 +927,7 @@
        * @throws     ObjectNotFoundException
        * @throws     JDOMException
        */
  -    protected void executeAclMatchReport(String requestUri, Element parentElement, 
int depth) throws WebdavException, ObjectLockedException, 
RevisionDescriptorNotFoundException, ServiceAccessException, 
LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, 
JDOMException {
  +    protected void executeAclMatchReport(Element parentElement, int depth) throws 
WebdavException, ObjectLockedException, RevisionDescriptorNotFoundException, 
ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, 
ObjectNotFoundException, JDOMException {
           
           List propstatList = null;
           String currentUri = null;
  @@ -962,9 +962,10 @@
           String currentUser = new String (userpath + userID);
           
           // get matched user
  -        currentUri = requestUri;
           
           
  +        currentUri = req.getRequestURI();
  +        
           if (self) {
               // build query for self
               searchDocument = C_MATCH_REPORT_SEARCH1 + C_MATCH_REPORT_ALLPROP +
  @@ -1008,7 +1009,7 @@
           searchHelper = token.getSearchHelper();
           try {
               searchQuery = searchHelper.createSearchQuery
  -                (grammarNamespace, queryElement, slideToken, maxDepth);
  +                (grammarNamespace, queryElement, slideToken, maxDepth, 
req.getRequestURI());
           } catch (BadQueryException e) {
               resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
               throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
  @@ -1026,8 +1027,9 @@
           while (it.hasNext()) {
               String uri = null;
               RequestedResource resource = (RequestedResource)it.next();
  -            String currentUrl = resource.getHref();
  -            uri = resource.getHref();
  +            String currentExtUrl = resource.getExternalHref();
  +            String currentIntUrl = resource.getInternalHref();
  +            uri = resource.getInternalHref();
               if (!self) {
                   try {
                       uri = (String) resource.getThisValue("owner");
  @@ -1051,14 +1053,14 @@
                           new org.jdom.Element (WebdavConstants.E_HREF, namespace);
                       
                       
  -                    hrefElement.addContent(currentUrl);
  +                    hrefElement.addContent(currentExtUrl);
                       responseElement.addContent (hrefElement);
                       
                       // get properties, if any defined
                       if (requestedProperties != null) {
                           try {
                               propList = retriever.getPropertiesOfObject 
(requestedProperties,
  -                                                                        currentUrl,
  +                                                                        
currentIntUrl,
                                                                           
req.getContextPath(),
                                                                           serverURL,
                                                                           true);
  @@ -1530,8 +1532,11 @@
           return saxBuilder;
       }
       
  -    
   }
  +
  +
  +
  +    
   
   
   
  
  
  
  1.13      +10 -7     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java
  
  Index: SearchMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SearchMethod.java 17 Apr 2002 07:46:46 -0000      1.12
  +++ SearchMethod.java 22 Apr 2002 16:20:55 -0000      1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v
 1.12 2002/04/17 07:46:46 wam Exp $
  - * $Revision: 1.12 $
  - * $Date: 2002/04/17 07:46:46 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v
 1.13 2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.13 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -71,6 +71,7 @@
   import org.apache.slide.common.ServiceAccessException;
   import org.apache.slide.common.SlideException;
   import org.apache.slide.util.Configuration;
  +import org.apache.slide.common.Uri;
   
   import org.apache.slide.search.SearchQuery;
   import org.apache.slide.search.RequestedResource;
  @@ -156,8 +157,10 @@
                   // SearchLanguage language = searchHelper.getLanguage 
(grammarNamespace);
                   int maxDepth = getConfig().getDepthLimit();
                   
  +                
                   searchQuery = searchHelper.createSearchQuery
  -                    (grammarNamespace, queryElement, slideToken, maxDepth);
  +                    (grammarNamespace, queryElement, slideToken, maxDepth,
  +                     req.getRequestURI());
                   
                   requestedProperties = searchQuery.requestedProperties ();
               }
  @@ -383,11 +386,11 @@
                       new org.jdom.Element (WebdavConstants.E_HREF, namespace);
                   
                   RequestedResource resource = (RequestedResource)it.next();
  -                String uri = resource.getHref();
  -                hrefElement.addContent(uri);
  +                String internalUri = resource.getInternalHref();
  +                hrefElement.addContent(resource.getExternalHref());
                   responseElement.addContent (hrefElement);
                   List propstatList= retriever.getPropertiesOfObject 
(requestedProperties,
  -                                                                    uri,
  +                                                                    internalUri,
                                                                       
req.getContextPath(),
                                                                       serverURL,
                                                                       true);
  
  
  
  1.4       +8 -4      
jakarta-slide/src/share/org/apache/slide/common/RequestedPropertiesImpl.java
  
  Index: RequestedPropertiesImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/RequestedPropertiesImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RequestedPropertiesImpl.java      2 Apr 2002 04:51:21 -0000       1.3
  +++ RequestedPropertiesImpl.java      22 Apr 2002 16:20:55 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/RequestedPropertiesImpl.java,v
 1.3 2002/04/02 04:51:21 msmith Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/04/02 04:51:21 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/common/RequestedPropertiesImpl.java,v
 1.4 2002/04/22 16:20:55 wam Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/04/22 16:20:55 $
    *
    * ====================================================================
    *
  @@ -78,7 +78,7 @@
    * Holds one property as part of the SELECT element.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Wallmer</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class RequestedPropertiesImpl implements RequestedProperties {
       
  @@ -111,6 +111,10 @@
                                Element prop = (Element)it.next();
                                uri  = prop.getNamespace().getURI();
                                name = prop.getName ();
  +                             if (uri.equals ("DAV:") && name.equals ("property")) {
  +                                     name = prop.getAttributeValue ("name");
  +                             }
  +
                                addProperty (new RequestedPropertyImpl (name, uri));
                        }
                }
  
  
  

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

Reply via email to