juergen 2002/06/21 00:23:10
Modified: src/share/org/apache/slide/search/basic BasicQuery.java
Log:
Minor changes for testing purposes.
(ralf)
Revision Changes Path
1.11 +37 -12
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BasicQuery.java 19 Jun 2002 11:00:11 -0000 1.10
+++ BasicQuery.java 21 Jun 2002 07:23:10 -0000 1.11
@@ -101,6 +101,31 @@
*/
public abstract class BasicQuery extends SearchQuery implements IBasicQuery {
+ /**
+ * Message of a BadQueryException that is thrown if the query element
+ * is <code>null</code>.
+ */
+ public static final String NO_QUERY_ELEMENT = "No query element";
+
+ /**
+ * Message of a BadQueryException that is thrown if the query element
+ * does not contain a <select> element.
+ */
+ public static final String SELECT_ELEMENT_MISSING = "Required element <select>
not supplied";
+
+ /**
+ * Message of a BadQueryException that is thrown if the query element
+ * does not contain a <from> element.
+ */
+ public static final String FROM_ELEMENT_MISSING = "Required element <from> not
supplied";
+
+ /**
+ * Message of a BadQueryException that is thrown if the query element
+ * neither contains a <from> nor a <from> element.
+ */
+ public static final String PROP_OR_ALLPROP_ELEMENT_MISSING = "Required element
<prop> or <allprop> not supplied";
+
+
/** the element describing this query */
protected Element queryElement;
@@ -227,7 +252,7 @@
protected void parseQueryWithoutExpression (Element basicSearchElement) throws
BadQueryException {
if (basicSearchElement == null)
- throw new BadQueryException ("No query element");
+ throw new BadQueryException (NO_QUERY_ELEMENT);
namespace = basicSearchElement.getNamespace();
@@ -236,14 +261,14 @@
// SELECT is mandatory
if (selectElement == null)
- throw new BadQueryException ("required element <select> not supplied");
+ throw new BadQueryException (SELECT_ELEMENT_MISSING);
Element fromElement = basicSearchElement.getChild
(Literals.FROM, namespace);
// FROM is mandatory
if (fromElement == null) {
- throw new BadQueryException ("required element <from> not supplied");
+ throw new BadQueryException (FROM_ELEMENT_MISSING);
}
whereElement = basicSearchElement.getChild
@@ -261,8 +286,7 @@
}
if (propElement == null) {
- throw new BadQueryException
- ("required element <prop> or <allprop> not supplied");
+ throw new BadQueryException(PROP_OR_ALLPROP_ELEMENT_MISSING);
}
requestedProperties = new RequestedPropertiesImpl (propElement);
@@ -327,6 +351,7 @@
return limit;
}
+
/**
* For debugging purpose.
*
@@ -352,11 +377,11 @@
* @throws BadQueryException
*
*/
- private static QueryScope getScope(Element basicSearchElementJDOM)
+ public static QueryScope getScope(Element basicSearchElementJDOM)
throws BadQueryException
{
if (basicSearchElementJDOM == null)
- throw new BadQueryException ("No query element");
+ throw new BadQueryException (NO_QUERY_ELEMENT);
Namespace namespace = basicSearchElementJDOM.getNamespace();
Element fromElement = basicSearchElementJDOM.getChild
@@ -364,7 +389,7 @@
// FROM is mandatory
if (fromElement == null)
- throw new BadQueryException ("required element <from> not supplied");
+ throw new BadQueryException (FROM_ELEMENT_MISSING);
return new BasicQueryScope (fromElement);
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>