You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by wa...@apache.org on 2002/04/26 17:19:12 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method ReportMethod.java SearchMethod.java
wam 02/04/26 08:19:12
Modified: src/share/org/apache/slide/search/basic BasicExpression.java
BasicExpressionFactory.java BasicQueryScope.java
BasicSearchLanguage.java
CheckResourceTypeExpression.java
ComparePropertyExpression.java EQExpression.java
GTEExpression.java GTExpression.java
IsDefinedExpression.java Literals.java
LTEExpression.java LTExpression.java OrderBy.java
RequestedResourcesPoolImpl.java
src/share/org/apache/slide/search CompareHint.java
RequestedResource.java RequestedResourceImpl.java
Search.java SearchImpl.java SearchLanguage.java
SearchQueryResult.java SlideUri.java
src/webdav/server/org/apache/slide/webdav/method
ReportMethod.java SearchMethod.java
Added: src/share/org/apache/slide/search/basic
PropContainsExpression.java
Log:
allow create SearchQuery without requestUri
internal operator propcontains
bugfix: namespaceawareness
Revision Changes Path
1.8 +8 -4 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BasicExpression.java 25 Apr 2002 21:12:30 -0000 1.7
+++ BasicExpression.java 26 Apr 2002 15:19:11 -0000 1.8
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v 1.7 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.7 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpression.java,v 1.8 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.8 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -64,6 +64,7 @@
package org.apache.slide.search.basic;
import org.jdom.Element;
+import org.jdom.Namespace;
import org.apache.slide.search.InvalidQueryException;
import org.apache.slide.search.basic.RequestedResourcesPool;
@@ -81,9 +82,12 @@
*
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public abstract class BasicExpression {
+
+ protected static final Namespace davNamespace =
+ Namespace.getNamespace (Literals.DAV_NAMESPACE);
protected BasicExpressionFactory expressionFactory;
1.3 +8 -3 jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpressionFactory.java
Index: BasicExpressionFactory.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpressionFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasicExpressionFactory.java 25 Apr 2002 21:12:30 -0000 1.2
+++ BasicExpressionFactory.java 26 Apr 2002 15:19:11 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpressionFactory.java,v 1.2 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.2 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicExpressionFactory.java,v 1.3 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.3 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -153,6 +153,11 @@
&& name.equals (Literals.ISPRINCIPAL))
result = new IsPrincipalExpression (e);
+
+ if (namespace.equals (Literals.SLIDE_EXTENSIONS)
+ && name.equals (Literals.PROPCONTAINS))
+
+ result = new PropContainsExpression (e);
else
throw new InvalidQueryException
1.5 +6 -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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BasicQueryScope.java 25 Apr 2002 21:12:30 -0000 1.4
+++ BasicQueryScope.java 26 Apr 2002 15:19:11 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v 1.4 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v 1.5 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -76,7 +76,7 @@
* Holds the scope information supplied with the <FROM> element.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class BasicQueryScope implements QueryScope {
@@ -130,6 +130,8 @@
Element scope = fromElement.getChild (Literals.SCOPE, namespace);
href = scope.getChildTextTrim (Literals.HREF, namespace);
+ if (!href.endsWith("/"))
+ href += "/";
Element depth = scope.getChild (Literals.DEPTH, namespace);
if (depth != null) {
1.5 +21 -32 jakarta-slide/src/share/org/apache/slide/search/basic/BasicSearchLanguage.java
Index: BasicSearchLanguage.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicSearchLanguage.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BasicSearchLanguage.java 25 Apr 2002 21:12:30 -0000 1.4
+++ BasicSearchLanguage.java 26 Apr 2002 15:19:11 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicSearchLanguage.java,v 1.4 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicSearchLanguage.java,v 1.5 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@
* Represent the BasicSearchLanguage for Slide
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class BasicSearchLanguage extends SearchLanguage {
@@ -108,21 +108,6 @@
* Creates a SearchQuery out of this queryString
*
* @param queryString an XML String describing this query
- *
- * @return the SearchQuery
- *
- * @throws InvalidQueryException
- */
-// public SearchQuery parseQuery (String queryString)
-// throws BadQueryException
-// {
-// return new BasicQuery (queryString);
-// }
-
- /**
- * Creates a SearchQuery out of this queryString
- *
- * @param queryString an XML String describing this query
* @param maxDepth the maximum depth for this query
*
* @return the SearchQuery
@@ -139,32 +124,36 @@
/**
* Creates a SearchQuery out of this queryElement
*
- * @param queryElement an XML Element describing this query
+ * @param basicSearchElement DOM Element describing this query
+ * @param token SearchToken
*
- * @return the SearchQuery
+ * @return BasicSearchQuery
+ *
+ * @throws BadQueryException
*
- * @throws InvalidQueryException
*/
-// public SearchQuery parseQuery (Element queryElement)
-// throws BadQueryException
-// {
-// return new BasicQuery (queryElement);
-// }
+ public SearchQuery parseQuery (Element basicSearchElement, SearchToken token)
+ throws BadQueryException
+ {
+ BasicQuery query = new BasicQuery (basicSearchElement, token);
+ return query;
+ }
/**
* Creates a SearchQuery out of this queryElement
*
- * @param queryElement an XML Element describing this query
+ * @param basicSearchElement JDOM Element describing this query
+ * @param token SearchToken
*
- * @return the SearchQuery
+ * @return BasicSearchQuery
+ *
+ * @throws BadQueryException
*
- * @throws InvalidQueryException
*/
- public SearchQuery parseQuery (Element basicSearchElement, SearchToken token)
+ public SearchQuery parseQuery (org.jdom.Element basicSearchElement, SearchToken token)
throws BadQueryException
{
BasicQuery query = new BasicQuery (basicSearchElement, token);
- // query.setMaxDepth (maxDepth);
return query;
}
}
1.3 +5 -5 jakarta-slide/src/share/org/apache/slide/search/basic/CheckResourceTypeExpression.java
Index: CheckResourceTypeExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/CheckResourceTypeExpression.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CheckResourceTypeExpression.java 25 Apr 2002 21:12:30 -0000 1.2
+++ CheckResourceTypeExpression.java 26 Apr 2002 15:19:11 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/CheckResourceTypeExpression.java,v 1.2 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.2 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/CheckResourceTypeExpression.java,v 1.3 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.3 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Represents an expression that check for a specific resourcetype.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public abstract class CheckResourceTypeExpression extends ComparePropertyExpression {
@@ -98,7 +98,7 @@
*/
protected boolean compare (RequestedResource item) {
String resourceTypeValue =
- (String) item.getThisValue (property);
+ (String) item.getThisValue (property, propNamespace);
int index = resourceTypeValue.indexOf (literal);
1.3 +14 -10 jakarta-slide/src/share/org/apache/slide/search/basic/ComparePropertyExpression.java
Index: ComparePropertyExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/ComparePropertyExpression.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComparePropertyExpression.java 25 Apr 2002 21:12:30 -0000 1.2
+++ ComparePropertyExpression.java 26 Apr 2002 15:19:11 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/ComparePropertyExpression.java,v 1.2 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.2 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/ComparePropertyExpression.java,v 1.3 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.3 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -77,7 +77,7 @@
* Abstract base class for compare expressions (GT, EQ, is-collection ...).
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public abstract class ComparePropertyExpression extends CompareExpression {
@@ -87,6 +87,9 @@
/** the property name <prop> */
protected String property;
+ /** the property's namespace */
+ protected String propNamespace;
+
/**
* dummy constructor, called by is-collection (as no prop / literal
* is passed).
@@ -101,7 +104,7 @@
*/
ComparePropertyExpression (Element e) throws InvalidQueryException {
super (e);
- property = getPropName(e);
+ setProperty(e);
literal = getLiteral (e);
}
@@ -116,8 +119,8 @@
* property was supplied
*
*/
- protected String getPropName(Element e) throws InvalidQueryException {
- Element propListElement = e.getChild (Literals.PROP, e.getNamespace());
+ protected void setProperty (Element e) throws InvalidQueryException {
+ Element propListElement = e.getChild (Literals.PROP, davNamespace);
if (propListElement == null)
throw new InvalidQueryException
("No property element supplied");
@@ -128,8 +131,9 @@
throw new InvalidQueryException
("Expected exactly 1 prop element, found " + propList.size());
-
- return ((Element)propList.get(0)).getName();
+ Element propElement = ((Element)propList.get(0));
+ property = propElement.getName();
+ propNamespace = propElement.getNamespace().getURI();
}
/**
@@ -162,7 +166,7 @@
*
*/
protected String getLiteral(Element e) throws InvalidQueryException {
- Element lit = e.getChild (Literals.LITERAL, e.getNamespace());
+ Element lit = e.getChild (Literals.LITERAL, davNamespace);
if (lit == null)
throw new InvalidQueryException
("No literal element supplied");
1.6 +5 -5 jakarta-slide/src/share/org/apache/slide/search/basic/EQExpression.java
Index: EQExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/EQExpression.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EQExpression.java 25 Apr 2002 21:12:30 -0000 1.5
+++ EQExpression.java 26 Apr 2002 15:19:11 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/EQExpression.java,v 1.5 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.5 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/EQExpression.java,v 1.6 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Represents an EQUALS expression.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class EQExpression extends ComparePropertyExpression {
@@ -96,7 +96,7 @@
*
*/
protected boolean compare (RequestedResource item) {
- return item.equals (property, literal) == Literals.TRUE;
+ return item.equals (property, propNamespace, literal) == Literals.TRUE;
}
1.5 +5 -5 jakarta-slide/src/share/org/apache/slide/search/basic/GTEExpression.java
Index: GTEExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/GTEExpression.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- GTEExpression.java 25 Apr 2002 21:12:30 -0000 1.4
+++ GTEExpression.java 26 Apr 2002 15:19:11 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/GTEExpression.java,v 1.4 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/GTEExpression.java,v 1.5 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Represents an EQUALS expression.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class GTEExpression extends ComparePropertyExpression {
@@ -96,7 +96,7 @@
*
*/
protected boolean compare (RequestedResource item) {
- return item.greaterThanEquals (property, literal) == Literals.TRUE;
+ return item.greaterThanEquals (property, propNamespace, literal) == Literals.TRUE;
}
1.6 +5 -5 jakarta-slide/src/share/org/apache/slide/search/basic/GTExpression.java
Index: GTExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/GTExpression.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GTExpression.java 25 Apr 2002 21:12:30 -0000 1.5
+++ GTExpression.java 26 Apr 2002 15:19:11 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/GTExpression.java,v 1.5 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.5 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/GTExpression.java,v 1.6 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@
* Represents an GREATER_THAN expression.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class GTExpression extends ComparePropertyExpression {
@@ -98,7 +98,7 @@
*
*/
protected boolean compare (RequestedResource item) {
- return item.greaterThan (property, literal) == Literals.TRUE;
+ return item.greaterThan (property, propNamespace, literal) == Literals.TRUE;
}
/**
1.6 +6 -6 jakarta-slide/src/share/org/apache/slide/search/basic/IsDefinedExpression.java
Index: IsDefinedExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/IsDefinedExpression.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- IsDefinedExpression.java 25 Apr 2002 21:12:30 -0000 1.5
+++ IsDefinedExpression.java 26 Apr 2002 15:19:11 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/IsDefinedExpression.java,v 1.5 2002/04/25 21:12:30 jericho Exp $
- * $Revision: 1.5 $
- * $Date: 2002/04/25 21:12:30 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/IsDefinedExpression.java,v 1.6 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Represents an isdefined expression.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class IsDefinedExpression extends ComparePropertyExpression {
@@ -85,7 +85,7 @@
*/
protected IsDefinedExpression (Element e) throws InvalidQueryException {
this.expressionElement = e;
- property = getPropName (e);
+ setProperty (e);
literal = "";
}
@@ -98,7 +98,7 @@
*
*/
protected boolean compare (RequestedResource item) {
- return item.isDefined (property);
+ return item.isDefined (property, propNamespace);
}
1.8 +6 -5 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Literals.java 25 Apr 2002 21:30:15 -0000 1.7
+++ Literals.java 26 Apr 2002 15:19:11 -0000 1.8
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java,v 1.7 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.7 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java,v 1.8 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.8 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -67,7 +67,7 @@
* static container for some literals.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class Literals {
@@ -96,6 +96,7 @@
public static final String ORDER = "order";
public static final String ORDERBY = "orderby";
public static final String PROP = "prop";
+ public static final String PROPCONTAINS = "propcontains";
public static final String RESOURCETYPE = "resourcetype";
public static final String RESULTSET = "resultset";
public static final String SCOPE = "scope";
@@ -103,7 +104,7 @@
public static final String WHERE = "where";
public static final String DAV_NAMESPACE = "DAV:";
- public static final String SLIDE_EXTENSIONS = "http://jakarta.apache.org/slide:";
+ 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?)
1.5 +5 -5 jakarta-slide/src/share/org/apache/slide/search/basic/LTEExpression.java
Index: LTEExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/LTEExpression.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LTEExpression.java 25 Apr 2002 21:30:15 -0000 1.4
+++ LTEExpression.java 26 Apr 2002 15:19:11 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/LTEExpression.java,v 1.4 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/LTEExpression.java,v 1.5 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Represents an EQUALS expression.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class LTEExpression extends ComparePropertyExpression {
@@ -96,7 +96,7 @@
*
*/
protected boolean compare (RequestedResource item) {
- return item.lowerThanEquals (property, literal) == Literals.TRUE;
+ return item.lowerThanEquals (property, propNamespace, literal) == Literals.TRUE;
}
1.5 +5 -5 jakarta-slide/src/share/org/apache/slide/search/basic/LTExpression.java
Index: LTExpression.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/LTExpression.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LTExpression.java 25 Apr 2002 21:30:15 -0000 1.4
+++ LTExpression.java 26 Apr 2002 15:19:11 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/LTExpression.java,v 1.4 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/LTExpression.java,v 1.5 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Represents an EQUALS expression.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class LTExpression extends ComparePropertyExpression {
@@ -97,7 +97,7 @@
*/
protected boolean compare (RequestedResource item) {
return item.lowerThan
- (property, literal) == Literals.TRUE;
+ (property, propNamespace, literal) == Literals.TRUE;
}
1.5 +22 -8 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- OrderBy.java 25 Apr 2002 21:30:15 -0000 1.4
+++ OrderBy.java 26 Apr 2002 15:19:11 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java,v 1.4 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java,v 1.5 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
@@ -82,7 +82,7 @@
* to the specified parameters in the OrderBy expression,
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class OrderBy {
@@ -105,12 +105,14 @@
while (it.hasNext()) {
Element order = (Element) it.next();
- String propName = getPropName (order);
+ _Property p = getProperty(order);
+ String propName = p.name;
+ String propNamespace = p.namespace;
boolean isAscending = isAscending (order);
boolean isCaseSensitive = isCaseSensitive (order);
orderByElements.add
- (new CompareHint (propName, isAscending, isCaseSensitive));
+ (new CompareHint (propName, propNamespace, isAscending, isCaseSensitive));
}
}
@@ -185,7 +187,7 @@
* @throws InvalidQueryException
*
*/
- private String getPropName (Element order) throws InvalidQueryException {
+ private _Property getProperty (Element order) throws InvalidQueryException {
Element prop = order.getChild (Literals.PROP, order.getNamespace ());
@@ -196,7 +198,10 @@
throw new InvalidQueryException
("Expected exactly 1 prop element, found " + propList.size());
- return ((Element)propList.get(0)).getName();
+ Element propElem = (Element)propList.get(0);
+ String name = propElem.getName();
+ String nameSpace = propElem.getNamespace().getURI();
+ return new _Property (name, nameSpace);
}
@@ -226,6 +231,15 @@
result = r1.compareTo (r2, obe);
}
return result;
+ }
+ }
+
+ class _Property {
+ String name;
+ String namespace;
+ _Property (String name, String namespace) {
+ this.name=name;
+ this.namespace = namespace;
}
}
}
1.4 +61 -4 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RequestedResourcesPoolImpl.java 22 Apr 2002 16:20:54 -0000 1.3
+++ RequestedResourcesPoolImpl.java 26 Apr 2002 15:19:11 -0000 1.4
@@ -1,7 +1,64 @@
-/**
- * RequestedResourcesPoolImpl.java
+/*
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/RequestedResourcesPoolImpl.java,v 1.4 2002/04/26 15:19:11 wam Exp $
+ * $Revision: 1.4 $
+ * $Date: 2002/04/26 15:19:11 $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2002 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 apache@apache.org.
+ *
+ * 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]
*
- * @author Created by Omnicore CodeGuide
*/
package org.apache.slide.search.basic;
@@ -32,7 +89,7 @@
* computed.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class RequestedResourcesPoolImpl implements RequestedResourcesPool {
1.1 jakarta-slide/src/share/org/apache/slide/search/basic/PropContainsExpression.java
Index: PropContainsExpression.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/PropContainsExpression.java,v 1.1 2002/04/26 15:19:11 wam Exp $
* $Revision: 1.1 $
* $Date: 2002/04/26 15:19:11 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 - 2002 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 apache@apache.org.
*
* 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.basic;
import org.apache.slide.search.*;
import org.jdom.Element;
import org.apache.slide.search.InvalidQueryException;
import java.util.Set;
/**
* Represents an EQUALS expression.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
* @version $Revision: 1.1 $
*/
public class PropContainsExpression extends ComparePropertyExpression {
/**
* Creates an EQ expression according to Element e
*
* @param e jdom element, that describes the expression
*
*/
protected PropContainsExpression (Element e) throws InvalidQueryException {
super (e);
}
/**
* Checks item for equality against <prop><literal> of this expression.
*
* @param item a BasicDataItem
*
* @return a boolean
*
*/
protected boolean compare (RequestedResource item) {
return item.propContains (property, propNamespace, literal) == Literals.TRUE;
}
/**
* For debugging purpose.
*
* @return This expression as string
*
*/
public String toString () {
return super.toString (Literals.EQ);
}
}
1.5 +20 -6 jakarta-slide/src/share/org/apache/slide/search/CompareHint.java
Index: CompareHint.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/CompareHint.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CompareHint.java 25 Apr 2002 21:12:31 -0000 1.4
+++ CompareHint.java 26 Apr 2002 15:19:12 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/CompareHint.java,v 1.4 2002/04/25 21:12:31 jericho Exp $
- * $Revision: 1.4 $
- * $Date: 2002/04/25 21:12:31 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/CompareHint.java,v 1.5 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -69,13 +69,16 @@
* property, on which the compare shall take place.
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class CompareHint {
- /** the name of the p�roperty, which shall be compared */
+ /** the name of the property, which shall be compared */
private String property;
+ /** the property's namespace */
+ private String propNamespace;
+
/** if the associated comparator is used for sort, ascending or descending? */
private boolean ascending;
@@ -94,6 +97,16 @@
}
/**
+ * Method getPropNamespace
+ *
+ * @return the property's namespace
+ *
+ */
+ public String getPropNamespace () {
+ return propNamespace;
+ }
+
+ /**
* Method isAscending
*
* @return a boolean
@@ -116,8 +129,9 @@
/**
* constructs a CompareHint
*/
- public CompareHint (String property, boolean ascending, boolean caseSensitive) {
+ public CompareHint (String property, String propNamespace, boolean ascending, boolean caseSensitive) {
this.property = property;
+ this.propNamespace = propNamespace;
this.ascending = ascending;
this.caseSensitive = caseSensitive;
}
1.7 +21 -11 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RequestedResource.java 25 Apr 2002 21:30:15 -0000 1.6
+++ RequestedResource.java 26 Apr 2002 15:19:12 -0000 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResource.java,v 1.6 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.6 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResource.java,v 1.7 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.7 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -85,7 +85,7 @@
* TODO: Namespace awareness!!
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public interface RequestedResource {
@@ -118,7 +118,7 @@
* @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
*
*/
- public int greaterThan (String propName, String literal);
+ public int greaterThan (String propName, String propNamespace, String literal);
/**
* Checks, if a property, represented by its name and value (as String),
@@ -130,7 +130,7 @@
* @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
*
*/
- public int lowerThan (String propName, String literal);
+ public int lowerThan (String propName, String propNamespace, String literal);
/**
* Checks, if a property, represented by its name and value (as String),
@@ -142,7 +142,7 @@
* @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
*
*/
- public int greaterThanEquals (String propName, String literal);
+ public int greaterThanEquals (String propName, String propNamespace, String literal);
/**
* Checks, if a property, represented by its name and value (as String),
@@ -154,7 +154,7 @@
* @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
*
*/
- public int lowerThanEquals (String propName, String literal);
+ public int lowerThanEquals (String propName, String propNamespace, String literal);
/**
* Checks, if a property, represented by its name and value (as String),
@@ -166,7 +166,7 @@
* @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
*
*/
- public int equals (String propName, String literal);
+ public int equals (String propName, String propNamespace, String literal);
/**
* Retrieves the value for the given property of this Resource
@@ -175,7 +175,7 @@
*
* @return the value of the property within this item
*/
- public Object getThisValue (String propName);
+ public Object getThisValue (String propName, String propNamespace);
/**
@@ -201,8 +201,18 @@
* @return true if propName is defined in this resource.
*
*/
- public boolean isDefined (String propName);
+ public boolean isDefined (String propName, String propNamespace);
+ /**
+ * Method propContains
+ *
+ * @param propName a String
+ * @param literal a String
+ *
+ * @return true if literal is contained in this prop's value
+ *
+ */
+ public int propContains (String propName, String propNamespace, String literal);
/**
* Checks, if the content of the resource contains a specific literal.
1.7 +57 -31 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RequestedResourceImpl.java 25 Apr 2002 21:30:15 -0000 1.6
+++ RequestedResourceImpl.java 26 Apr 2002 15:19:12 -0000 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v 1.6 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.6 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v 1.7 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.7 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -87,7 +87,7 @@
* equals, ...
*
* @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public class RequestedResourceImpl implements RequestedResource {
@@ -189,24 +189,22 @@
* @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
*
*/
- public int greaterThan (String propName, String literal) {
- return compare (propName, literal, GT);
+ public int greaterThan (String propName, String propNamespace, String literal) {
+ return compare (propName, propNamespace, literal, GT);
}
- public int greaterThanEquals (String propName, String literal) {
- return compare (propName, literal, GTE);
+ public int greaterThanEquals (String propName, String propNamespace, String literal) {
+ return compare (propName, propNamespace, literal, GTE);
}
- public int lowerThan (String propName, String literal) {
- return compare (propName, literal, LT);
+ public int lowerThan (String propName, String propNamespace, String literal) {
+ return compare (propName, propNamespace, literal, LT);
}
- public int lowerThanEquals (String propName, String literal) {
- return compare (propName, literal, LTE);
+ public int lowerThanEquals (String propName, String propNamespace, String literal) {
+ return compare (propName, propNamespace, literal, LTE);
}
-
-
/**
* Checks, if a property, represented by its name and value (as String),
* is EQUAL the matching property within this item.
@@ -217,8 +215,30 @@
* @return Literals.TRUE, Literals.FALSE or Literals.UNKNOWN
*
*/
- public int equals (String propName, String literal) {
- return compare (propName, literal, EQ);
+ public int equals (String propName, String propNamespace, String literal) {
+ return compare (propName, propNamespace, literal, EQ);
+ }
+
+ /**
+ * checks, if a properties' value contains a literal
+ *
+ * @param propName a String
+ * @param literal a String
+ *
+ * @return Literal.TRUE, if propName's value contains literal
+ *
+ */
+ public int propContains (String propName, String propNamespace, String literal) {
+ Object o = getThisValue (propName, propNamespace);
+
+ if (o instanceof String == false)
+ return Literals.UNKNOWN;
+
+ String thisValue = (String)o;
+ if (thisValue.indexOf(literal) == -1)
+ return Literals.FALSE;
+
+ return Literals.TRUE;
}
/**
@@ -230,6 +250,12 @@
return objectNode.getUri();
}
+ /**
+ * Method getExternalHref
+ *
+ * @return a String
+ * @deprecated
+ */
public String getExternalHref () {
SlideUri slideContext = searchToken.getSlideContext();
return slideContext.getContextPath (objectNode.getUri());
@@ -243,12 +269,12 @@
*
* @return the value of the property within this item
*/
- public Object getThisValue (String propName) {
+ public Object getThisValue (String propName, String propNamespace) {
Object result = null;
// special handling for properties as contenlength, contenttype, ...
// all other properties...
- NodeProperty np = revisionDescriptor.getProperty (propName);
+ NodeProperty np = revisionDescriptor.getProperty (propName, propNamespace);
result = (np == null) ? null : np.getValue();
return result;
@@ -293,8 +319,8 @@
public int compareTo (RequestedResource otherResource, CompareHint hint) {
int result = 0;
- Comparable otherValue = (Comparable) otherResource.getThisValue (hint.getProperty());
- Comparable thisValue = (Comparable) getThisValue (hint.getProperty());
+ Comparable otherValue = (Comparable) otherResource.getThisValue (hint.getProperty(), hint.getPropNamespace());
+ Comparable thisValue = (Comparable) getThisValue (hint.getProperty(), hint.getPropNamespace());
if (thisValue != null && otherValue != null)
result = thisValue.compareTo(otherValue);
@@ -324,8 +350,8 @@
* @return true if propName is defined in this resource.
*
*/
- public boolean isDefined (String propName) {
- return getThisValue (propName) == null ? false : true;
+ public boolean isDefined (String propName, String propNamespace) {
+ return getThisValue (propName, propNamespace) == null ? false : true;
}
/**
@@ -382,12 +408,12 @@
* @throws UnknownException
*
*/
- private int compareTo (String propName, String literal)
+ private int compareTo (String propName, String propNamespace, String literal)
throws NumberFormatException, UnknownException
{
int result = 0;
- Object thisValue = getThisValue (propName);
+ Object thisValue = getThisValue (propName, propNamespace);
if (thisValue == null)
throw new UnknownException ();
@@ -434,10 +460,10 @@
return otherValue;
}
- private int compare (String propName, String literal, int op) {
+ private int compare (String propName, String propNamespace, String literal, int op) {
int result = Literals.FALSE;
- Object thisValue = getThisValue (propName);
+ Object thisValue = getThisValue (propName, propNamespace);
if (thisValue == null)
return Literals.UNKNOWN;
@@ -449,27 +475,27 @@
switch (op)
{
case EQ:
- if (compareTo (propName, literal) == 0)
+ if (compareTo (propName, propNamespace, literal) == 0)
result = Literals.TRUE;
break;
case GT:
- if (compareTo (propName, literal) > 0)
+ if (compareTo (propName, propNamespace, literal) > 0)
result = Literals.TRUE;
break;
case LT:
- if (compareTo (propName, literal) < 0)
+ if (compareTo (propName, propNamespace, literal) < 0)
result = Literals.TRUE;
break;
case GTE:
- if (compareTo (propName, literal) >= 0)
+ if (compareTo (propName, propNamespace, literal) >= 0)
result = Literals.TRUE;
break;
case LTE:
- if (compareTo (propName, literal) <= 0)
+ if (compareTo (propName, propNamespace, literal) <= 0)
result = Literals.TRUE;
break;
default:
1.10 +17 -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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Search.java 25 Apr 2002 21:30:15 -0000 1.9
+++ Search.java 26 Apr 2002 15:19:12 -0000 1.10
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/Search.java,v 1.9 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.9 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/Search.java,v 1.10 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.10 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@
* Search helper.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public interface Search {
@@ -125,6 +125,19 @@
SearchQuery createSearchQuery (String grammarUri,
Element searchRequestElement,
+ SlideToken token,
+ int maxDepth,
+ String requestUri)
+ throws BadQueryException;
+
+ SearchQuery createSearchQuery (String grammarUri,
+ org.jdom.Element searchRequestElement,
+ SlideToken token,
+ int maxDepth)
+ throws BadQueryException;
+
+ SearchQuery createSearchQuery (String grammarUri,
+ org.jdom.Element searchRequestElement,
SlideToken token,
int maxDepth,
String requestUri)
1.11 +60 -6 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SearchImpl.java 25 Apr 2002 21:30:15 -0000 1.10
+++ SearchImpl.java 26 Apr 2002 15:19:12 -0000 1.11
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchImpl.java,v 1.10 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.10 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchImpl.java,v 1.11 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.11 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -87,7 +87,7 @@
* Search helper.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public final class SearchImpl implements Search {
@@ -205,7 +205,7 @@
* Creates a SearchQuery.
*
* @param grammarUri identifier for the SearchLanguage
- * @param queryElement the element containing the query
+ * @param queryElement the DOM element containing the query
* @param token the SlideToken
* @param maxDepth may be 0, 1 or INFINIT
*
@@ -227,7 +227,29 @@
* Creates a SearchQuery.
*
* @param grammarUri identifier for the SearchLanguage
- * @param queryElement the element containing the query
+ * @param queryElement the JDOM 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,
+ org.jdom.Element queryElement,
+ SlideToken token,
+ int maxDepth)
+ throws BadQueryException
+ {
+ return createSearchQuery (grammarUri, queryElement, token, maxDepth, null);
+ }
+
+ /**
+ * Creates a SearchQuery.
+ *
+ * @param grammarUri identifier for the SearchLanguage
+ * @param queryElement the DOM element containing the query
* @param token the SlideToken
* @param maxDepth may be 0, 1 or INFINIT
*
@@ -257,5 +279,37 @@
return result;
}
+ /**
+ * Creates a SearchQuery.
+ *
+ * @param grammarUri identifier for the SearchLanguage
+ * @param queryElement the JDOM 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,
+ org.jdom.Element queryElement,
+ SlideToken token,
+ int maxDepth,
+ String requestUri)
+ throws BadQueryException
+ {
+ SearchQuery result = null;
+ // create search token
+ SearchToken searchToken =
+ SearchToken.createSearchToken (token, contentHelper,
+ structureHelper, maxDepth,
+ requestUri, namespace);
+
+ SearchLanguage language = getLanguage (grammarUri);
+ result = language.parseQuery (queryElement, searchToken);
+ return result;
+ }
}
+
1.7 +24 -15 jakarta-slide/src/share/org/apache/slide/search/SearchLanguage.java
Index: SearchLanguage.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchLanguage.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SearchLanguage.java 25 Apr 2002 21:30:15 -0000 1.6
+++ SearchLanguage.java 26 Apr 2002 15:19:12 -0000 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchLanguage.java,v 1.6 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.6 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchLanguage.java,v 1.7 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.7 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -69,7 +69,7 @@
* Base class for a search language.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public abstract class SearchLanguage {
@@ -92,12 +92,6 @@
public abstract String getGrammarUri ();
/**
- * Generate a query object from a String.
- */
-// public abstract SearchQuery parseQuery(String queryString)
-// throws BadQueryException;
-//
- /**
* Generate a query object from a String, set the maximum depth.
*/
public abstract SearchQuery parseQuery(String queryString, SearchToken token)
@@ -106,15 +100,30 @@
/**
* Generate a query object from a DOM Element.
+ *
+ * @param queryElement DOM element containing the query
+ * @param token the SearchToken
+ *
+ * @return a SearchQuery
+ *
+ * @throws BadQueryException
+ *
*/
-// public abstract SearchQuery parseQuery(Element queryElement)
-// throws BadQueryException;
+ public abstract SearchQuery parseQuery(Element queryElement, SearchToken token)
+ throws BadQueryException;
/**
- * Generate a query object from a DOM Element.
+ * Generate a query object from a JDOM Element.
+ *
+ * @param queryElement JDOM element containing the query
+ * @param token the SearchToken
+ *
+ * @return a SearchQuery
+ *
+ * @throws BadQueryException
+ *
*/
- public abstract SearchQuery parseQuery(Element queryElement, SearchToken token)
+ public abstract SearchQuery parseQuery(org.jdom.Element queryElement, SearchToken token)
throws BadQueryException;
-
}
1.9 +5 -5 jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java
Index: SearchQueryResult.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SearchQueryResult.java 25 Apr 2002 21:30:15 -0000 1.8
+++ SearchQueryResult.java 26 Apr 2002 15:19:12 -0000 1.9
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java,v 1.8 2002/04/25 21:30:15 jericho Exp $
- * $Revision: 1.8 $
- * $Date: 2002/04/25 21:30:15 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SearchQueryResult.java,v 1.9 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.9 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -82,7 +82,7 @@
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
* @author <a href="mailto:martin.wallmer@softweareag.com">Martin Wallmer</a>
*
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
*/
public class SearchQueryResult {
@@ -193,7 +193,7 @@
/**
* Method iterator
*
- * @return iterator for iteraing the result
+ * @return iterator for iterating the result, RequestedResource
*
*/
public Iterator iterator () {
1.3 +27 -6 jakarta-slide/src/share/org/apache/slide/search/SlideUri.java
Index: SlideUri.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SlideUri.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SlideUri.java 25 Apr 2002 21:15:11 -0000 1.2
+++ SlideUri.java 26 Apr 2002 15:19:12 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SlideUri.java,v 1.2 2002/04/25 21:15:11 jericho Exp $
- * $Revision: 1.2 $
- * $Date: 2002/04/25 21:15:11 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/SlideUri.java,v 1.3 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.3 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -68,7 +68,8 @@
/**
* 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.
+ * root is the server. Example: the host is localhost, the context is slide,
+ * the slidePath is /mycoll/myfile.xml
* http://localhost/slide/mycoll/myfile.xml
*
*/
@@ -77,13 +78,24 @@
private String context;
private String path;
+ /**
+ * Constructs a SlideUri. If the requestUri is null, paths are regarded
+ * as being always slidePaths
+ */
public SlideUri (String requestUri) {
+ if (requestUri == null) {
+ this.context = null;
+ this.path = "";
+ }
+ else {
this.context = getContextOfRelPath(requestUri);
this.path = getPathOfRelPath(requestUri);
}
+ }
/**
- * Method getSlideUri
+ * Method getSlideUri. If the requestUri is null, relpath is regarded to be
+ * already a slidePath, it must staqrt with a "/"
*
* @param relPath a String
*
@@ -94,6 +106,12 @@
*/
public String getSlidePath (String relPath) throws InvalidScopeException {
+ if (context == null) {
+ if (!relPath.startsWith("/"))
+ throw new InvalidScopeException ("absolute scope is required");
+ return relPath;
+ }
+
StringBuffer sb = new StringBuffer ();
if (relPath.startsWith("/")) {
String relContext = getContextOfRelPath (relPath);
@@ -122,9 +140,12 @@
* @param internalHref a String
*
* @return a String
- *
+ * @deprecated
*/
public String getContextPath (String slidePath) {
+ if (context == null) {
+ throw new RuntimeException ("getContextPath not allowed in this context");
+ }
return context + slidePath;
}
1.22 +5 -5 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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ReportMethod.java 26 Apr 2002 10:55:39 -0000 1.21
+++ ReportMethod.java 26 Apr 2002 15:19:12 -0000 1.22
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v 1.21 2002/04/26 10:55:39 juergen Exp $
- * $Revision: 1.21 $
- * $Date: 2002/04/26 10:55:39 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v 1.22 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.22 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -164,7 +164,7 @@
/**
* An implementation of the DeltaV <code>REPORT</code> method.
*
- * @version $Revision: 1.21 $
+ * @version $Revision: 1.22 $
*
* @author <a href="mailto:ralf.stuckert@softwareag.com">Ralf Stuckert</a>
*/
@@ -1026,7 +1026,7 @@
uri = resource.getInternalHref();
if (!self) {
try {
- uri = (String) resource.getThisValue("owner");
+ uri = (String) resource.getThisValue("owner", WebdavConstants.DEFAULT_NAMESPACE);
if (uri != null) {
if (!(userpath.endsWith("/"))) userpath = userpath + "/";
uri = new String (userpath + uri);
1.15 +12 -4 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SearchMethod.java 25 Apr 2002 21:27:31 -0000 1.14
+++ SearchMethod.java 26 Apr 2002 15:19:12 -0000 1.15
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v 1.14 2002/04/25 21:27:31 jericho Exp $
- * $Revision: 1.14 $
- * $Date: 2002/04/25 21:27:31 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v 1.15 2002/04/26 15:19:12 wam Exp $
+ * $Revision: 1.15 $
+ * $Date: 2002/04/26 15:19:12 $
*
* ====================================================================
*
@@ -93,6 +93,7 @@
import org.apache.slide.webdav.WebdavServletConfig;
import org.apache.slide.webdav.WebdavException;
import org.apache.slide.webdav.util.PropertyRetriever;
+import org.apache.slide.webdav.util.PropertyHelper;
import org.apache.slide.webdav.util.PropertyRetrieverImpl;
import org.apache.slide.webdav.util.WebdavConstants;
@@ -387,7 +388,14 @@
RequestedResource resource = (RequestedResource)it.next();
String internalUri = resource.getInternalHref();
- hrefElement.addContent(resource.getExternalHref());
+
+
+ //String absUri = resource.getExternalHref();
+ String absUri = PropertyHelper.getAbsoluteURL
+ (serverURL, req.getContextPath(), internalUri);
+
+ hrefElement.addContent(absUri);
+
responseElement.addContent (hrefElement);
List propstatList= retriever.getPropertiesOfObject (requestedProperties,
internalUri,
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>