jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: rev 47489 - in incubator/jackrabbit/trunk: . src/java/org/apache/jackrabbit/core src/java/org/apache/jackrabbit/core/observation src/java/org/apache/jackrabbit/core/search src/java/org/apache/jackrabbit/core/search/jcrql src/java/org/apache/jackrabbit/core/search/lucene
Date Wed, 29 Sep 2004 15:42:17 GMT
Author: mreutegg
Date: Wed Sep 29 08:42:14 2004
New Revision: 47489

Added:
   incubator/jackrabbit/trunk/checkstyle-suppressions.xml   (contents, props changed)
Modified:
   incubator/jackrabbit/trunk/checkstyle.xml
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/DispatchAction.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/AndQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/ExactQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NAryQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NamespaceMappings.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NodeTypeQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NotQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/OrQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/PathQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryRootNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/RangeQueryNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTOrderClause.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTSelectClause.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/JCRQLQueryBuilder.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ParseException.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/SimpleNode.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/AbstractIndex.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/DateField.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FieldNames.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredPropertyIterator.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredScorer.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/LuceneQueryBuilder.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllQuery.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllScorer.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllWeight.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIndexer.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIteratorImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathFilterQuery.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathQuery.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PersistentIndex.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PropertyIteratorImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/VolatileIndex.java
Log:
- Cleaned up code according to coding style checked by checkstyle.
- Added checkstyle-suppressions.xml to exclude generated classes

Added: incubator/jackrabbit/trunk/checkstyle-suppressions.xml
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/checkstyle-suppressions.xml	Wed Sep 29 08:42:14 2004
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE suppressions PUBLIC
+    "-//Puppy Crawl//DTD Suppressions 1.0//EN"
+    "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
+
+<suppressions>
+    <!-- 
+      Suppressions for generated JCRQL parser
+    -->
+    <suppress checks=".*"
+              files=".*JCRQLParser.*|Token.java|SimpleCharStream.java|TokenMgrError.java|ParseException.java|SimpleNode.java" />
+</suppressions>
\ No newline at end of file

Modified: incubator/jackrabbit/trunk/checkstyle.xml
==============================================================================
--- incubator/jackrabbit/trunk/checkstyle.xml	(original)
+++ incubator/jackrabbit/trunk/checkstyle.xml	Wed Sep 29 08:42:14 2004
@@ -159,5 +159,9 @@
         <module name="UpperEll"/>
 
     </module>
+    
+    <module name="SuppressionFilter">
+        <property name="file" value="checkstyle-suppressions.xml"/>
+    </module>    
 
 </module>

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SearchManager.java	Wed Sep 29 08:42:14 2004
@@ -15,10 +15,14 @@
  */
 package org.apache.jackrabbit.core;
 
-import org.apache.jackrabbit.core.search.lucene.*;
 import org.apache.jackrabbit.core.search.NamespaceMappings;
 import org.apache.jackrabbit.core.search.QueryRootNode;
 import org.apache.jackrabbit.core.search.OrderQueryNode;
+import org.apache.jackrabbit.core.search.lucene.SearchIndex;
+import org.apache.jackrabbit.core.search.lucene.NodeIndexer;
+import org.apache.jackrabbit.core.search.lucene.FieldNames;
+import org.apache.jackrabbit.core.search.lucene.QueryResultImpl;
+import org.apache.jackrabbit.core.search.lucene.LuceneQueryBuilder;
 import org.apache.jackrabbit.core.observation.SynchronousEventListener;
 import org.apache.jackrabbit.core.observation.EventImpl;
 import org.apache.jackrabbit.core.state.ItemStateProvider;
@@ -37,10 +41,16 @@
 import javax.jcr.access.Permission;
 import java.io.IOException;
 import java.io.File;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
 
 /**
- * 
+ * Acts as a global entry point to execute queries and index nodes.
+ *
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
  */
@@ -55,7 +65,7 @@
     private final HierarchyManager hmgr;
 
     private final SessionImpl session;
-    
+
     private final NamespaceMappings nsMappings;
 
     public SearchManager(ItemStateProvider stateProvider,
@@ -134,7 +144,7 @@
 
 	// return QueryResult
 	return new QueryResultImpl(itemMgr,
-		(String[])uuids.toArray(new String[uuids.size()]),
+		(String[]) uuids.toArray(new String[uuids.size()]),
 		root.getSelectProperties());
     }
 
@@ -148,7 +158,7 @@
 
 	while (events.hasNext()) {
 	    try {
-		EventImpl e = (EventImpl)events.nextEvent();
+		EventImpl e = (EventImpl) events.nextEvent();
 		long type = e.getType();
 		if (type == EventType.CHILD_NODE_ADDED) {
 
@@ -160,7 +170,7 @@
 		    path = getIndexlessPath(path);
 
 		    ItemId id = new NodeId(e.getChildUUID());
-		    addNode((NodeState)stateProvider.getItemState(id),
+		    addNode((NodeState) stateProvider.getItemState(id),
 			    path.toJCRPath(nsMappings));
 
 		} else if (type == EventType.CHILD_NODE_REMOVED) {
@@ -193,12 +203,12 @@
 	    }
 	}
 
-	for (Iterator it = modified.iterator(); it.hasNext(); ) {
+	for (Iterator it = modified.iterator(); it.hasNext();) {
 	    try {
-		Path path = (Path)it.next();
+		Path path = (Path) it.next();
 		ItemId id = hmgr.resolvePath(path);
 		path = getIndexlessPath(path);
-		updateNode((NodeState)stateProvider.getItemState(id),
+		updateNode((NodeState) stateProvider.getItemState(id),
 			path.toJCRPath(nsMappings));
 	    } catch (NoPrefixDeclaredException e) {
 		log.error("error indexing node.", e);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/DispatchAction.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/DispatchAction.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/DispatchAction.java	Wed Sep 29 08:42:14 2004
@@ -30,13 +30,13 @@
     /**
      * The collection of <code>EventState</code>s
      */
-    final EventStateCollection eventStates;
+    private final EventStateCollection eventStates;
 
     /**
      * <code>EventStates</code> are dispatched to these
      * <code>EventConsumer</code>s.
      */
-    final Collection eventConsumers;
+    private final Collection eventConsumers;
 
     /**
      * Creates a new <code>DispatchAction</code> struct with
@@ -45,5 +45,22 @@
     DispatchAction(EventStateCollection eventStates, Collection eventConsumers) {
 	this.eventStates = eventStates;
 	this.eventConsumers = eventConsumers;
+    }
+
+    /**
+     * Returns a collection of {@link EventState}s to dispatch.
+     * @return a collection of {@link EventState}s to dispatch.
+     */
+    EventStateCollection getEventStates() {
+	return eventStates;
+    }
+
+    /**
+     * Returns a <code>Collection</code> of {@link EventConsumer}s where
+     * the events should be dispatched to.
+     * @return a <code>Collection</code> of {@link EventConsumer}s.
+     */
+    Collection getEventConsumers() {
+	return eventConsumers;
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventConsumer.java	Wed Sep 29 08:42:14 2004
@@ -27,7 +27,12 @@
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
 import javax.jcr.observation.EventType;
-import java.util.*;
+import java.util.Map;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * The <code>EventConsumer</code> class combines the {@link
@@ -134,7 +139,7 @@
 	Iterator it = events.iterator();
 	Set denied = null;
 	while (it.hasNext()) {
-	    EventState state = (EventState)it.next();
+	    EventState state = (EventState) it.next();
 	    if (state.getType() == EventType.CHILD_NODE_REMOVED
 		    || state.getType() == EventType.PROPERTY_REMOVED) {
 
@@ -177,10 +182,10 @@
      *               to dispatch.
      */
     void consumeEvents(EventStateCollection events) throws RepositoryException {
-	Set denied = (Set)accessDenied.remove(events);
+	Set denied = (Set) accessDenied.remove(events);
 	// check permissions
-	for (Iterator it = events.iterator(); it.hasNext(); ) {
-	    EventState state = (EventState)it.next();
+	for (Iterator it = events.iterator(); it.hasNext();) {
+	    EventState state = (EventState) it.next();
 	    if (state.getType() == EventType.CHILD_NODE_ADDED
 		    || state.getType() == EventType.PROPERTY_ADDED
 		    || state.getType() == EventType.PROPERTY_CHANGED) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventFilter.java	Wed Sep 29 08:42:14 2004
@@ -15,9 +15,11 @@
  */
 package org.apache.jackrabbit.core.observation;
 
-import org.apache.jackrabbit.core.*;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
-import org.apache.log4j.Logger;
+import org.apache.jackrabbit.core.ItemManager;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.Path;
+import org.apache.jackrabbit.core.MalformedPathException;
 
 import javax.jcr.RepositoryException;
 
@@ -29,8 +31,6 @@
  * @version $Revision: 1.5 $, $Date: 2004/08/25 16:44:50 $
  */
 class EventFilter {
-
-    private static final Logger log = Logger.getLogger(EventFilter.class);
 
     static final EventFilter BLOCK_ALL = new BlockAllFilter();
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventImpl.java	Wed Sep 29 08:42:14 2004
@@ -62,13 +62,10 @@
      *
      * @param session    the session of the registerd <code>EventListener</code>
      *                   where this <code>Event</code> will be delivered to.
-     * @param itemMgr    the <code>ItemManager</code> of the above
-     *                   <code>Session</code>.
      * @param eventState the underlying <code>EventState</code>.
      */
-    EventImpl(SessionImpl session, /*ItemManager itemMgr, */ EventState eventState) {
+    EventImpl(SessionImpl session, EventState eventState) {
 	this.session = session;
-	//this.itemMgr = itemMgr;
 	this.eventState = eventState;
     }
 
@@ -84,7 +81,7 @@
      */
     public String getNodePath() throws RepositoryException {
 	try {
-	    return eventState.getParentPath().toJCRPath(session.getNamespaceResolver()); //itemMgr.getItem(new NodeId(eventState.getParentUUID())).getPath();
+	    return eventState.getParentPath().toJCRPath(session.getNamespaceResolver());
 	} catch (NoPrefixDeclaredException e) {
 	    String msg = "internal error: encountered unregistered namespace in path";
 	    log.error(msg, e);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/EventStateCollection.java	Wed Sep 29 08:42:14 2004
@@ -16,9 +16,17 @@
 package org.apache.jackrabbit.core.observation;
 
 import org.apache.log4j.Logger;
-import org.apache.jackrabbit.core.state.*;
-import org.apache.jackrabbit.core.*;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.HierarchyManager;
+import org.apache.jackrabbit.core.QName;
+import org.apache.jackrabbit.core.Path;
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.state.ItemStateProvider;
+import org.apache.jackrabbit.core.state.ItemState;
+import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.ItemStateException;
 
 import javax.jcr.RepositoryException;
 import java.util.ArrayList;
@@ -33,7 +41,7 @@
  * @author Marcel Reutegger
  * @version $Revision: 1.5 $
  */
-final public class EventStateCollection {
+public final class EventStateCollection {
 
     /**
      * Logger instance for this class
@@ -91,8 +99,8 @@
 	    throws RepositoryException {
 	int status = state.getStatus();
 
-	if (status == ItemState.STATUS_EXISTING_MODIFIED ||
-		status == ItemState.STATUS_NEW) {
+	if (status == ItemState.STATUS_EXISTING_MODIFIED
+		|| status == ItemState.STATUS_NEW) {
 
 	    if (state.isNode()) {
 		NodeState currentNode = (NodeState) state;
@@ -150,7 +158,7 @@
 		if (state.getStatus() == ItemState.STATUS_EXISTING_MODIFIED) {
 		    NodeId parentId = new NodeId(state.getParentUUID());
 		    try {
-			NodeState parentState = (NodeState)provider.getItemState(parentId);
+			NodeState parentState = (NodeState) provider.getItemState(parentId);
 			Path parentPath = hmgr.getPath(parentId);
 			events.add(EventState.propertyChanged(state.getParentUUID(),
 				parentPath,

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerFactory.java	Wed Sep 29 08:42:14 2004
@@ -18,10 +18,14 @@
 import org.apache.commons.collections.Buffer;
 import org.apache.commons.collections.BufferUtils;
 import org.apache.commons.collections.UnboundedFifoBuffer;
-import org.apache.jackrabbit.core.*;
 import org.apache.jackrabbit.core.state.ItemStateProvider;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.ItemManager;
+import org.apache.jackrabbit.core.HierarchyManager;
+import org.apache.jackrabbit.core.Path;
+import org.apache.jackrabbit.core.MalformedPathException;
 import org.apache.log4j.Logger;
 
 import javax.jcr.RepositoryException;
@@ -42,7 +46,7 @@
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
  */
-final public class ObservationManagerFactory implements Runnable {
+public final class ObservationManagerFactory implements Runnable {
 
     /**
      * Logger instance for this class
@@ -168,11 +172,11 @@
 	while ((action = (DispatchAction) eventQueue.remove()) != DISPOSE_MARKER) {
 
 	    log.debug("got EventStateCollection");
-	    log.debug("event delivery to " + action.eventConsumers.size() + " consumers started...");
-	    for (Iterator it = action.eventConsumers.iterator(); it.hasNext();) {
+	    log.debug("event delivery to " + action.getEventConsumers().size() + " consumers started...");
+	    for (Iterator it = action.getEventConsumers().iterator(); it.hasNext();) {
 		EventConsumer c = (EventConsumer) it.next();
 		try {
-		    c.consumeEvents(action.eventStates);
+		    c.consumeEvents(action.getEventStates());
 		} catch (Throwable t) {
 		    log.warn("EventConsumer threw exception.", t);
 		    // move on to the next consumer
@@ -194,8 +198,8 @@
 	Set consumers = new HashSet();
 	consumers.addAll(getSynchronousConsumers());
 	consumers.addAll(getAsynchronousConsumers());
-	for (Iterator it = consumers.iterator(); it.hasNext(); ) {
-	    EventConsumer c = (EventConsumer)it.next();
+	for (Iterator it = consumers.iterator(); it.hasNext();) {
+	    EventConsumer c = (EventConsumer) it.next();
 	    c.prepareEvents(events);
 	}
     }
@@ -212,7 +216,7 @@
 	if (log.isDebugEnabled()) {
 	    log.debug("notifying " + synchronous.size() + " synchronous listeners.");
 	}
-	for (Iterator it = synchronous.iterator(); it.hasNext(); ) {
+	for (Iterator it = synchronous.iterator(); it.hasNext();) {
 	    EventConsumer c = (EventConsumer) it.next();
 	    try {
 		c.consumeEvents(events);
@@ -287,7 +291,7 @@
 		NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
 		nodeTypes = new NodeTypeImpl[nodeTypeName.length];
 		for (int i = 0; i < nodeTypes.length; i++) {
-		    nodeTypes[i] = (NodeTypeImpl)ntMgr.getNodeType(nodeTypeName[i]);
+		    nodeTypes[i] = (NodeTypeImpl) ntMgr.getNodeType(nodeTypeName[i]);
 		}
 	    }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/AndQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/AndQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/AndQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -67,14 +67,18 @@
 	if (getParent() instanceof NotQueryNode) {
 	    bracket = true;
 	}
-	if (bracket) sb.append("(");
+	if (bracket) {
+	    sb.append("(");
+	}
 	String and = "";
-	for (Iterator it = operands.iterator(); it.hasNext(); ) {
+	for (Iterator it = operands.iterator(); it.hasNext();) {
 	    sb.append(and);
-	    sb.append(((QueryNode)it.next()).toJCRQLString());
+	    sb.append(((QueryNode) it.next()).toJCRQLString());
 	    and = " AND ";
 	}
-	if (bracket) sb.append(")");
+	if (bracket) {
+	    sb.append(")");
+	}
 	return sb.toString();
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/ExactQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/ExactQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/ExactQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -39,7 +39,9 @@
      */
     public ExactQueryNode(QueryNode parent, String property, String value) {
 	super(parent);
-	if (parent == null) throw new NullPointerException("parent");
+	if (parent == null) {
+	    throw new NullPointerException("parent");
+	}
 	this.property = property;
 	this.value = value;
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NAryQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NAryQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NAryQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -70,7 +70,7 @@
     public Object[] acceptOperands(QueryNodeVisitor visitor, Object data) {
 	Object[] result = new Object[operands.size()];
 	for (int i = 0; i < operands.size(); i++) {
-	    result[i] = ((QueryNode)operands.get(i)).accept(visitor, data);
+	    result[i] = ((QueryNode) operands.get(i)).accept(visitor, data);
 	}
 	return result;
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NamespaceMappings.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NamespaceMappings.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NamespaceMappings.java	Wed Sep 29 08:42:14 2004
@@ -15,15 +15,24 @@
  */
 package org.apache.jackrabbit.core.search;
 
-import org.apache.jackrabbit.core.*;
 import org.apache.log4j.Logger;
+import org.apache.jackrabbit.core.NamespaceResolver;
+import org.apache.jackrabbit.core.MalformedPathException;
+import org.apache.jackrabbit.core.Path;
+import org.apache.jackrabbit.core.NoPrefixDeclaredException;
 
 import javax.jcr.NamespaceException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Iterator;
-import java.io.*;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.io.File;
 
 /**
  * The class <code>NamespaceMappings</code> implements a {@link
@@ -34,7 +43,7 @@
  * Whenever a yet unknown namespace uri to prefix mapping is requested, a new
  * prefix is created on the fly and associated with the namespace. Known
  * namespace mappings are stored in a properties file.
- * 
+ *
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
  */
@@ -96,7 +105,7 @@
      *                            mapping could not be stored.
      */
     public synchronized String getPrefix(String uri) throws NamespaceException {
-	String prefix = (String)uriToPrefix.get(uri);
+	String prefix = (String) uriToPrefix.get(uri);
 	if (prefix == null) {
 	    // make sure prefix is not taken
 	    while (prefixToURI.get(String.valueOf(prefixCount)) != null) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NodeTypeQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NodeTypeQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NodeTypeQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -29,7 +29,7 @@
      * Creates a new <code>NodeTypeQueryNode</code>.
      * @param parent the parent node for this query node.
      * @param nodeType the name of the node type.
-     */ 
+     */
     public NodeTypeQueryNode(QueryNode parent, String nodeType) {
 	// we only use the jcr primary type as a dummy value
 	// the property name is actually replaced in the query builder

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NotQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NotQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/NotQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -37,7 +37,9 @@
      * @param node the child query node to invert.
      */
     public NotQueryNode(QueryNode parent, QueryNode node) {
-	super(parent, new QueryNode[] { node });
+	super(parent, new QueryNode[] {
+	    node
+	});
     }
 
     /**
@@ -53,7 +55,7 @@
      */
     public String toJCRQLString() {
         if (operands.size() > 0) {
-	    return "NOT " + ((QueryNode)operands.get(0)).toJCRQLString();
+	    return "NOT " + ((QueryNode) operands.get(0)).toJCRQLString();
 	}
 	return "";
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/OrQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/OrQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/OrQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -67,14 +67,18 @@
 	if (getParent() instanceof AndQueryNode || getParent() instanceof NotQueryNode) {
 	    bracket = true;
 	}
-	if (bracket) sb.append("(");
+	if (bracket) {
+	    sb.append("(");
+	}
 	String or = "";
-	for (Iterator it = operands.iterator(); it.hasNext(); ) {
+	for (Iterator it = operands.iterator(); it.hasNext();) {
 	    sb.append(or);
-	    sb.append(((QueryNode)it.next()).toJCRQLString());
+	    sb.append(((QueryNode) it.next()).toJCRQLString());
 	    or = " OR ";
 	}
-	if (bracket) sb.append(")");
+	if (bracket) {
+	    sb.append(")");
+	}
 	return sb.toString();
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/PathQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/PathQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/PathQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -54,7 +54,9 @@
      */
     public PathQueryNode(QueryNode parent, String path, int type) {
 	super(parent);
-	if (type < TYPE_EXACT || type > TYPE_DESCENDANT) throw new IllegalArgumentException(String.valueOf(type));
+	if (type < TYPE_EXACT || type > TYPE_DESCENDANT) {
+	    throw new IllegalArgumentException(String.valueOf(type));
+	}
 	this.path = path;
 	this.type = type;
 	this.indexedName = (path.indexOf('[') > -1);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryManagerImpl.java	Wed Sep 29 08:42:14 2004
@@ -99,6 +99,6 @@
      * @see QueryManager#getSupportedQueryLanguages()
      */
     public String[] getSupportedQueryLanguages() {
-	return (String[])SUPPORTED_QUERIES_LIST.toArray(new String[SUPPORTED_QUERIES.length]);
+	return (String[]) SUPPORTED_QUERIES_LIST.toArray(new String[SUPPORTED_QUERIES.length]);
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryRootNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryRootNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/QueryRootNode.java	Wed Sep 29 08:42:14 2004
@@ -84,7 +84,7 @@
      * @return an array of select properties.
      */
     public String[] getSelectProperties() {
-	return (String[])selectProperties.toArray(new String[selectProperties.size()]);
+	return (String[]) selectProperties.toArray(new String[selectProperties.size()]);
     }
 
     /**
@@ -148,8 +148,8 @@
 	if (nodeTypes.size() > 0) {
 	    sb.append(" FROM");
 	}
-	for (Iterator it = nodeTypes.iterator(); it.hasNext(); ) {
-	    NodeTypeQueryNode nodeType = (NodeTypeQueryNode)it.next();
+	for (Iterator it = nodeTypes.iterator(); it.hasNext();) {
+	    NodeTypeQueryNode nodeType = (NodeTypeQueryNode) it.next();
 	    sb.append(comma);
 	    sb.append(" ").append(nodeType.getValue());
 	    comma = ",";

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/RangeQueryNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/RangeQueryNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/RangeQueryNode.java	Wed Sep 29 08:42:14 2004
@@ -55,7 +55,9 @@
      */
     public RangeQueryNode(QueryNode parent, long lower, long upper) {
     	super(parent);
-	rangeLong = new long[] { lower, upper };
+	rangeLong = new long[] {
+	    lower, upper
+	};
 	type = TYPE_LONG;
     }
 
@@ -67,7 +69,7 @@
      */
     public RangeQueryNode(QueryNode parent, double lower, double upper) {
 	super(parent);
-	rangeDouble = new double[] { lower, upper };
+	rangeDouble = new double[]{lower, upper};
 	type = TYPE_DOUBLE;
     }
 
@@ -79,7 +81,7 @@
      */
     public RangeQueryNode(QueryNode parent, String lower, String upper) {
 	super(parent);
-	rangeString = new String[] { lower, upper };
+	rangeString = new String[]{lower, upper};
 	type = TYPE_STRING;
     }
 
@@ -91,7 +93,7 @@
      */
     public RangeQueryNode(QueryNode parent, Date lower, Date upper) {
 	super(parent);
-	rangeDate = new Date[] { lower, upper };
+	rangeDate = new Date[]{lower, upper};
 	type = TYPE_DATE;
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTOrderClause.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTOrderClause.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTOrderClause.java	Wed Sep 29 08:42:14 2004
@@ -37,7 +37,7 @@
     }
 
     public String[] getProperties() {
-	return (String[])properties.toArray(new String[properties.size()]);
+	return (String[]) properties.toArray(new String[properties.size()]);
     }
 
     public boolean isAscending() {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTSelectClause.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTSelectClause.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ASTSelectClause.java	Wed Sep 29 08:42:14 2004
@@ -35,7 +35,7 @@
     }
 
     public String[] getProperties() {
-	return (String[])properties.toArray(new String[properties.size()]);
+	return (String[]) properties.toArray(new String[properties.size()]);
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/JCRQLQueryBuilder.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/JCRQLQueryBuilder.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/JCRQLQueryBuilder.java	Wed Sep 29 08:42:14 2004
@@ -15,14 +15,25 @@
  */
 package org.apache.jackrabbit.core.search.jcrql;
 
-import org.apache.jackrabbit.core.search.*;
+import org.apache.jackrabbit.core.search.QueryRootNode;
+import org.apache.jackrabbit.core.search.NAryQueryNode;
+import org.apache.jackrabbit.core.search.NodeTypeQueryNode;
+import org.apache.jackrabbit.core.search.AndQueryNode;
+import org.apache.jackrabbit.core.search.PathQueryNode;
+import org.apache.jackrabbit.core.search.OrQueryNode;
+import org.apache.jackrabbit.core.search.NotQueryNode;
+import org.apache.jackrabbit.core.search.RelationQueryNode;
+import org.apache.jackrabbit.core.search.Constants;
+import org.apache.jackrabbit.core.search.TextsearchQueryNode;
+import org.apache.jackrabbit.core.search.OrderQueryNode;
 
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.util.ISO8601;
 import java.util.Date;
 
 /**
- * 
+ * Query builder that translates a JCRQL statement into query tree structure.
+ *
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
  */
@@ -30,8 +41,6 @@
 
     private final ASTStatement stmt;
 
-    private QueryNode currentNode;
-
     private QueryRootNode root;
 
     private JCRQLQueryBuilder(ASTStatement stmt) {
@@ -50,7 +59,7 @@
 
     QueryRootNode getRootNode() {
 	if (root == null) {
-	    root = (QueryRootNode)stmt.jjtAccept(this, null);
+	    root = (QueryRootNode) stmt.jjtAccept(this, null);
 	}
 	return root;
     }
@@ -71,7 +80,7 @@
     }
 
     public Object visit(ASTSelectClause node, Object data) {
-	QueryRootNode root = (QueryRootNode)data;
+	QueryRootNode root = (QueryRootNode) data;
 	String[] properties = node.getProperties();
 	for (int i = 0; i < properties.length; i++) {
 	    root.addSelectProperty(properties[i]);
@@ -80,7 +89,7 @@
     }
 
     public Object visit(ASTFromClause node, Object data) {
-	QueryRootNode root = (QueryRootNode)data;
+	QueryRootNode root = (QueryRootNode) data;
 	// add node type query to parent
 	node.childrenAccept(this, root.getConstraintNode());
 
@@ -88,26 +97,26 @@
     }
 
     public Object visit(ASTNodeType node, Object data) {
-        NAryQueryNode parent = (NAryQueryNode)data;
+        NAryQueryNode parent = (NAryQueryNode) data;
 	parent.addOperand(new NodeTypeQueryNode(parent, node.getName()));
 	return parent;
     }
 
     public Object visit(ASTLocationClause node, Object data) {
-	QueryRootNode root = (QueryRootNode)data;
+	QueryRootNode root = (QueryRootNode) data;
 	root.setLocationNode(new PathQueryNode(root, node.getStringLocation(),
 		node.getType()));
 	return root;
     }
 
     public Object visit(ASTWhereClause node, Object data) {
-	QueryRootNode root = (QueryRootNode)data;
+	QueryRootNode root = (QueryRootNode) data;
         // just pass it to the expression
 	return node.childrenAccept(this, root.getConstraintNode());
     }
 
     public Object visit(ASTOrExpr node, Object data) {
-	NAryQueryNode parent = (NAryQueryNode)data;
+	NAryQueryNode parent = (NAryQueryNode) data;
 	OrQueryNode orQuery = new OrQueryNode(parent);
 	// pass to operands
 	node.childrenAccept(this, orQuery);
@@ -117,7 +126,7 @@
     }
 
     public Object visit(ASTAndExpr node, Object data) {
-	NAryQueryNode parent = (NAryQueryNode)data;
+	NAryQueryNode parent = (NAryQueryNode) data;
 	AndQueryNode andQuery = new AndQueryNode(parent);
 	// pass to operands
 	node.childrenAccept(this, andQuery);
@@ -127,7 +136,7 @@
     }
 
     public Object visit(ASTNotExpr node, Object data) {
-	NAryQueryNode parent = (NAryQueryNode)data;
+	NAryQueryNode parent = (NAryQueryNode) data;
 	NotQueryNode notQuery = new NotQueryNode(parent);
 	// pass to operand
 	node.childrenAccept(this, notQuery);
@@ -137,8 +146,8 @@
     }
 
     public Object visit(ASTRelExpr node, Object data) {
-	NAryQueryNode parent = (NAryQueryNode)data;
-	ASTValue value = (ASTValue)node.jjtGetChild(0);
+	NAryQueryNode parent = (NAryQueryNode) data;
+	ASTValue value = (ASTValue) node.jjtGetChild(0);
 	int type = value.getType();
 	RelationQueryNode rel = null;
 
@@ -186,13 +195,13 @@
     }
 
     public Object visit(ASTTextsearchClause node, Object data) {
-	QueryRootNode root = (QueryRootNode)data;
+	QueryRootNode root = (QueryRootNode) data;
 	root.setTextsearchNode(new TextsearchQueryNode(root, node.getQuery()));
 	return root;
     }
 
     public Object visit(ASTOrderClause node, Object data) {
-	QueryRootNode root = (QueryRootNode)data;
+	QueryRootNode root = (QueryRootNode) data;
 	root.setOrderNode(
 		new OrderQueryNode(root, node.getProperties(), node.isAscending()));
 	return root;

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ParseException.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ParseException.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/ParseException.java	Wed Sep 29 08:42:14 2004
@@ -17,191 +17,184 @@
 package org.apache.jackrabbit.core.search.jcrql;
 
 /**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
+ * This exception is thrown when parse errors are encountered. You can
+ * explicitly create objects of this exception type by calling the method
+ * generateParseException in the generated parser.
+ * <p/>
+ * You can modify this class to customize your error reporting mechanisms so
+ * long as you retain the public fields.
  */
 public class ParseException extends Exception {
 
-  /**
-   * This constructor is used by the method "generateParseException"
-   * in the generated parser.  Calling this constructor generates
-   * a new object of this type with the fields "currentToken",
-   * "expectedTokenSequences", and "tokenImage" set.  The boolean
-   * flag "specialConstructor" is also set to true to indicate that
-   * this constructor was used to create this object.
-   * This constructor calls its super class with the empty string
-   * to force the "toString" method of parent class "Throwable" to
-   * print the error message in the form:
-   *     ParseException: <result of getMessage>
-   */
-  public ParseException(Token currentTokenVal,
-                        int[][] expectedTokenSequencesVal,
-                        String[] tokenImageVal
-                       )
-  {
-    super("");
-    specialConstructor = true;
-    currentToken = currentTokenVal;
-    expectedTokenSequences = expectedTokenSequencesVal;
-    tokenImage = tokenImageVal;
-  }
-
-  /**
-   * The following constructors are for use by you for whatever
-   * purpose you can think of.  Constructing the exception in this
-   * manner makes the exception behave in the normal way - i.e., as
-   * documented in the class "Throwable".  The fields "errorToken",
-   * "expectedTokenSequences", and "tokenImage" do not contain
-   * relevant information.  The JavaCC generated code does not use
-   * these constructors.
-   */
-
-  public ParseException() {
-    super();
-    specialConstructor = false;
-  }
-
-  public ParseException(String message) {
-    super(message);
-    specialConstructor = false;
-  }
-
-  /**
-   * This variable determines which constructor was used to create
-   * this object and thereby affects the semantics of the
-   * "getMessage" method (see below).
-   */
-  protected boolean specialConstructor;
-
-  /**
-   * This is the last token that has been consumed successfully.  If
-   * this object has been created due to a parse error, the token
-   * followng this token will (therefore) be the first error token.
-   */
-  public Token currentToken;
-
-  /**
-   * Each entry in this array is an array of integers.  Each array
-   * of integers represents a sequence of tokens (by their ordinal
-   * values) that is expected at this point of the parse.
-   */
-  public int[][] expectedTokenSequences;
-
-  /**
-   * This is a reference to the "tokenImage" array of the generated
-   * parser within which the parse error occurred.  This array is
-   * defined in the generated ...Constants interface.
-   */
-  public String[] tokenImage;
-
-  /**
-   * This method has the standard behavior when this object has been
-   * created using the standard constructors.  Otherwise, it uses
-   * "currentToken" and "expectedTokenSequences" to generate a parse
-   * error message and returns it.  If this object has been created
-   * due to a parse error, and you do not catch it (it gets thrown
-   * from the parser), then this method is called during the printing
-   * of the final stack trace, and hence the correct error message
-   * gets displayed.
-   */
-  public String getMessage() {
-    if (!specialConstructor) {
-      return super.getMessage();
+    /**
+     * This constructor is used by the method "generateParseException" in the
+     * generated parser.  Calling this constructor generates a new object of
+     * this type with the fields "currentToken", "expectedTokenSequences", and
+     * "tokenImage" set.  The boolean flag "specialConstructor" is also set to
+     * true to indicate that this constructor was used to create this object.
+     * This constructor calls its super class with the empty string to force the
+     * "toString" method of parent class "Throwable" to print the error message
+     * in the form: ParseException: <result of getMessage>
+     */
+    public ParseException(Token currentTokenVal,
+			  int[][] expectedTokenSequencesVal,
+			  String[] tokenImageVal) {
+	super("");
+	specialConstructor = true;
+	currentToken = currentTokenVal;
+	expectedTokenSequences = expectedTokenSequencesVal;
+	tokenImage = tokenImageVal;
     }
-    String expected = "";
-    int maxSize = 0;
-    for (int i = 0; i < expectedTokenSequences.length; i++) {
-      if (maxSize < expectedTokenSequences[i].length) {
-        maxSize = expectedTokenSequences[i].length;
-      }
-      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-        expected += tokenImage[expectedTokenSequences[i][j]] + " ";
-      }
-      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
-        expected += "...";
-      }
-      expected += eol + "    ";
+
+    /**
+     * The following constructors are for use by you for whatever purpose you
+     * can think of.  Constructing the exception in this manner makes the
+     * exception behave in the normal way - i.e., as documented in the class
+     * "Throwable".  The fields "errorToken", "expectedTokenSequences", and
+     * "tokenImage" do not contain relevant information.  The JavaCC generated
+     * code does not use these constructors.
+     */
+
+    public ParseException() {
+	super();
+	specialConstructor = false;
     }
-    String retval = "Encountered \"";
-    Token tok = currentToken.next;
-    for (int i = 0; i < maxSize; i++) {
-      if (i != 0) retval += " ";
-      if (tok.kind == 0) {
-        retval += tokenImage[0];
-        break;
-      }
-      retval += add_escapes(tok.image);
-      tok = tok.next; 
+
+    public ParseException(String message) {
+	super(message);
+	specialConstructor = false;
     }
-    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
-    retval += "." + eol;
-    if (expectedTokenSequences.length == 1) {
-      retval += "Was expecting:" + eol + "    ";
-    } else {
-      retval += "Was expecting one of:" + eol + "    ";
+
+    /**
+     * This variable determines which constructor was used to create this object
+     * and thereby affects the semantics of the "getMessage" method (see
+     * below).
+     */
+    protected boolean specialConstructor;
+
+    /**
+     * This is the last token that has been consumed successfully.  If this
+     * object has been created due to a parse error, the token followng this
+     * token will (therefore) be the first error token.
+     */
+    public Token currentToken;
+
+    /**
+     * Each entry in this array is an array of integers.  Each array of integers
+     * represents a sequence of tokens (by their ordinal values) that is
+     * expected at this point of the parse.
+     */
+    public int[][] expectedTokenSequences;
+
+    /**
+     * This is a reference to the "tokenImage" array of the generated parser
+     * within which the parse error occurred.  This array is defined in the
+     * generated ...Constants interface.
+     */
+    public String[] tokenImage;
+
+    /**
+     * This method has the standard behavior when this object has been created
+     * using the standard constructors.  Otherwise, it uses "currentToken" and
+     * "expectedTokenSequences" to generate a parse error message and returns
+     * it.  If this object has been created due to a parse error, and you do not
+     * catch it (it gets thrown from the parser), then this method is called
+     * during the printing of the final stack trace, and hence the correct error
+     * message gets displayed.
+     */
+    public String getMessage() {
+	if (!specialConstructor) {
+	    return super.getMessage();
+	}
+	String expected = "";
+	int maxSize = 0;
+	for (int i = 0; i < expectedTokenSequences.length; i++) {
+	    if (maxSize < expectedTokenSequences[i].length) {
+		maxSize = expectedTokenSequences[i].length;
+	    }
+	    for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+		expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+	    }
+	    if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+		expected += "...";
+	    }
+	    expected += eol + "    ";
+	}
+	String retval = "Encountered \"";
+	Token tok = currentToken.next;
+	for (int i = 0; i < maxSize; i++) {
+	    if (i != 0) {
+		retval += " ";
+	    }
+	    if (tok.kind == 0) {
+		retval += tokenImage[0];
+		break;
+	    }
+	    retval += add_escapes(tok.image);
+	    tok = tok.next;
+	}
+	retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+	retval += "." + eol;
+	if (expectedTokenSequences.length == 1) {
+	    retval += "Was expecting:" + eol + "    ";
+	} else {
+	    retval += "Was expecting one of:" + eol + "    ";
+	}
+	retval += expected;
+	return retval;
+    }
+
+    /**
+     * The end of line string for this machine.
+     */
+    protected String eol = System.getProperty("line.separator", "\n");
+
+    /**
+     * Used to convert raw characters to their escaped version when these raw
+     * version cannot be used as part of an ASCII string literal.
+     */
+    protected String add_escapes(String str) {
+	StringBuffer retval = new StringBuffer();
+	char ch;
+	for (int i = 0; i < str.length(); i++) {
+	    switch (str.charAt(i)) {
+		case 0:
+		    continue;
+		case '\b':
+		    retval.append("\\b");
+		    continue;
+		case '\t':
+		    retval.append("\\t");
+		    continue;
+		case '\n':
+		    retval.append("\\n");
+		    continue;
+		case '\f':
+		    retval.append("\\f");
+		    continue;
+		case '\r':
+		    retval.append("\\r");
+		    continue;
+		case '\"':
+		    retval.append("\\\"");
+		    continue;
+		case '\'':
+		    retval.append("\\\'");
+		    continue;
+		case '\\':
+		    retval.append("\\\\");
+		    continue;
+		default:
+		    if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+			String s = "0000" + Integer.toString(ch, 16);
+			retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+		    } else {
+			retval.append(ch);
+		    }
+		    continue;
+	    }
+	}
+	return retval.toString();
     }
-    retval += expected;
-    return retval;
-  }
-
-  /**
-   * The end of line string for this machine.
-   */
-  protected String eol = System.getProperty("line.separator", "\n");
- 
-  /**
-   * Used to convert raw characters to their escaped version
-   * when these raw version cannot be used as part of an ASCII
-   * string literal.
-   */
-  protected String add_escapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
-        }
-      }
-      return retval.toString();
-   }
 
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/SimpleNode.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/SimpleNode.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/jcrql/SimpleNode.java	Wed Sep 29 08:42:14 2004
@@ -17,85 +17,99 @@
 package org.apache.jackrabbit.core.search.jcrql;
 
 public class SimpleNode implements Node {
-  protected Node parent;
-  protected Node[] children;
-  protected int id;
-  protected JCRQLParser parser;
-
-  public SimpleNode(int i) {
-    id = i;
-  }
-
-  public SimpleNode(JCRQLParser p, int i) {
-    this(i);
-    parser = p;
-  }
-
-  public void jjtOpen() {
-  }
-
-  public void jjtClose() {
-  }
-  
-  public void jjtSetParent(Node n) { parent = n; }
-  public Node jjtGetParent() { return parent; }
-
-  public void jjtAddChild(Node n, int i) {
-    if (children == null) {
-      children = new Node[i + 1];
-    } else if (i >= children.length) {
-      Node c[] = new Node[i + 1];
-      System.arraycopy(children, 0, c, 0, children.length);
-      children = c;
-    }
-    children[i] = n;
-  }
-
-  public Node jjtGetChild(int i) {
-    return children[i];
-  }
-
-  public int jjtGetNumChildren() {
-    return (children == null) ? 0 : children.length;
-  }
-
-  /** Accept the visitor. **/
-  public Object jjtAccept(JCRQLParserVisitor visitor, Object data) {
-    return visitor.visit(this, data);
-  }
-
-  /** Accept the visitor. **/
-  public Object childrenAccept(JCRQLParserVisitor visitor, Object data) {
-    if (children != null) {
-      for (int i = 0; i < children.length; ++i) {
-        children[i].jjtAccept(visitor, data);
-      }
-    }
-    return data;
-  }
-
-  /* You can override these two methods in subclasses of SimpleNode to
-     customize the way the node appears when the tree is dumped.  If
-     your output uses more than one line you should override
-     toString(String), otherwise overriding toString() is probably all
-     you need to do. */
-
-  public String toString() { return JCRQLParserTreeConstants.jjtNodeName[id]; }
-  public String toString(String prefix) { return prefix + toString(); }
-
-  /* Override this method if you want to customize how the node dumps
-     out its children. */
-
-  public void dump(String prefix) {
-    System.out.println(toString(prefix));
-    if (children != null) {
-      for (int i = 0; i < children.length; ++i) {
-	SimpleNode n = (SimpleNode)children[i];
-	if (n != null) {
-	  n.dump(prefix + " ");
+    protected Node parent;
+    protected Node[] children;
+    protected int id;
+    protected JCRQLParser parser;
+
+    public SimpleNode(int i) {
+	id = i;
+    }
+
+    public SimpleNode(JCRQLParser p, int i) {
+	this(i);
+	parser = p;
+    }
+
+    public void jjtOpen() {
+    }
+
+    public void jjtClose() {
+    }
+
+    public void jjtSetParent(Node n) {
+	parent = n;
+    }
+
+    public Node jjtGetParent() {
+	return parent;
+    }
+
+    public void jjtAddChild(Node n, int i) {
+	if (children == null) {
+	    children = new Node[i + 1];
+	} else if (i >= children.length) {
+	    Node[] c = new Node[i + 1];
+	    System.arraycopy(children, 0, c, 0, children.length);
+	    children = c;
+	}
+	children[i] = n;
+    }
+
+    public Node jjtGetChild(int i) {
+	return children[i];
+    }
+
+    public int jjtGetNumChildren() {
+	return (children == null) ? 0 : children.length;
+    }
+
+    /**
+     * Accept the visitor. *
+     */
+    public Object jjtAccept(JCRQLParserVisitor visitor, Object data) {
+	return visitor.visit(this, data);
+    }
+
+    /**
+     * Accept the visitor. *
+     */
+    public Object childrenAccept(JCRQLParserVisitor visitor, Object data) {
+	if (children != null) {
+	    for (int i = 0; i < children.length; ++i) {
+		children[i].jjtAccept(visitor, data);
+	    }
+	}
+	return data;
+    }
+
+    /* You can override these two methods in subclasses of SimpleNode to
+       customize the way the node appears when the tree is dumped.  If
+       your output uses more than one line you should override
+       toString(String), otherwise overriding toString() is probably all
+       you need to do. */
+
+    public String toString() {
+	return JCRQLParserTreeConstants.jjtNodeName[id];
+    }
+
+    public String toString(String prefix) {
+	return prefix + toString();
+    }
+
+    /* Override this method if you want to customize how the node dumps
+       out its children. */
+
+    public void dump(String prefix) {
+	System.out.println(toString(prefix));
+	if (children != null) {
+	    for (int i = 0; i < children.length; ++i) {
+		SimpleNode n = (SimpleNode) children[i];
+		if (n != null) {
+		    n.dump(prefix + " ");
+		}
+	    }
 	}
-      }
     }
-  }
 }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/AbstractIndex.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/AbstractIndex.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/AbstractIndex.java	Wed Sep 29 08:42:14 2004
@@ -82,7 +82,7 @@
 	getIndexReader().delete(idTerm);
     }
 
-    synchronized protected IndexReader getIndexReader() throws IOException {
+    protected synchronized IndexReader getIndexReader() throws IOException {
 	if (indexWriter != null) {
 	    indexWriter.close();
 	    indexWriter = null;
@@ -93,7 +93,7 @@
 	return indexReader;
     }
 
-    synchronized protected IndexWriter getIndexWriter() throws IOException {
+    protected synchronized IndexWriter getIndexWriter() throws IOException {
 	if (indexReader != null) {
 	    indexReader.close();
 	    indexReader = null;

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/DateField.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/DateField.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/DateField.java	Wed Sep 29 08:42:14 2004
@@ -18,7 +18,10 @@
 import java.util.Date;
 
 /**
- * 
+ * Implements <code>Date</code> &lt;-&gt; <code>String</code> conversions in
+ * a way that the resulting <code>String</code> is suitable for indexing and
+ * sorting.
+ *
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
  */
@@ -30,31 +33,35 @@
     /**
      * Date string length for about 3000 years
      */
-    private static int DATE_LEN = Long.toString(1000L * 365 * 24 * 60 * 60 * 3000,
+    private static final int DATE_LEN = Long.toString(1000L * 365 * 24 * 60 * 60 * 3000,
 	    Character.MAX_RADIX).length();
 
     /**
      * Date shift of 2'000 years this allows dates back to 30 BC
      */
-    private static long DATE_SHIFT = 1000L * 365 * 24 * 60 * 60 * 2000;
+    private static final long DATE_SHIFT = 1000L * 365 * 24 * 60 * 60 * 2000;
 
 
     /**
      * Returns '000000000' -> something around 30 BC
      */
-    public static String MIN_DATE_STRING() {
-      return timeToString(-DATE_SHIFT);
-    }
+    public static final String MIN_DATE_STRING = timeToString(-DATE_SHIFT);
 
     /**
      * Returns 'zzzzzzzzz' -> something around 3189
      */
-    public static String MAX_DATE_STRING() {
+    public static final String MAX_DATE_STRING;
+
+    /**
+     * Initializes the constant {@link #MAX_DATE_STRING}.
+     */
+    static {
 	char[] buffer = new char[DATE_LEN];
 	char c = Character.forDigit(Character.MAX_RADIX - 1, Character.MAX_RADIX);
-	for (int i = 0; i < DATE_LEN; i++)
+	for (int i = 0; i < DATE_LEN; i++) {
 	    buffer[i] = c;
-	return new String(buffer);
+	}
+	MAX_DATE_STRING = new String(buffer);
     }
 
     /**
@@ -75,19 +82,22 @@
 	time += DATE_SHIFT;
 
 
-	if (time < 0)
+	if (time < 0) {
 	    throw new RuntimeException("time too early");
+	}
 
 	String s = Long.toString(time, Character.MAX_RADIX);
 
-	if (s.length() > DATE_LEN)
+	if (s.length() > DATE_LEN) {
 	    throw new RuntimeException("time too late");
+	}
 
 	// Pad with leading zeros
 	if (s.length() < DATE_LEN) {
 	    StringBuffer sb = new StringBuffer(s);
-	    while (sb.length() < DATE_LEN)
+	    while (sb.length() < DATE_LEN) {
 		sb.insert(0, 0);
+	    }
 	    s = sb.toString();
 	}
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FieldNames.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FieldNames.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FieldNames.java	Wed Sep 29 08:42:14 2004
@@ -16,7 +16,9 @@
 package org.apache.jackrabbit.core.search.lucene;
 
 /**
- * 
+ * Defines field names that are used internally to store UUID, Path, etc
+ * in the search index.
+ *
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
  */

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredPropertyIterator.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredPropertyIterator.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredPropertyIterator.java	Wed Sep 29 08:42:14 2004
@@ -17,7 +17,10 @@
 
 import org.apache.log4j.Logger;
 
-import javax.jcr.*;
+import javax.jcr.PropertyIterator;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
 import java.util.NoSuchElementException;
 
 /**
@@ -40,19 +43,23 @@
     }
 
     public Property nextProperty() {
-	if (propIndex >= props.length) throw new NoSuchElementException();
+	if (propIndex >= props.length) {
+	    throw new NoSuchElementException();
+	}
 	try {
 	    return node.getProperty(props[propIndex++]);
 	} catch (RepositoryException e) {
 	    // FIXME find better error handling
 	    log.error("Exception retrieving property with name: "
-		    + props[propIndex-1]);
+		    + props[propIndex - 1]);
 	    throw new NoSuchElementException();
 	}
     }
 
     public void skip(long skipNum) {
-	if ((propIndex + skipNum) > props.length) throw new NoSuchElementException();
+	if ((propIndex + skipNum) > props.length) {
+	    throw new NoSuchElementException();
+	}
 	propIndex += skipNum;
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredScorer.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredScorer.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/FilteredScorer.java	Wed Sep 29 08:42:14 2004
@@ -20,7 +20,6 @@
 import org.apache.lucene.search.HitCollector;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.index.IndexReader;
-import org.apache.jackrabbit.core.search.lucene.PackageFilter;
 
 import java.io.IOException;
 import java.util.BitSet;
@@ -31,7 +30,6 @@
  *
  * @version $Revision: 1.1 $, $Date: 2004/01/23 15:55:40 $
  * @author Marcel Reutegger
- * @since gumbear
  */
 class FilteredScorer extends Scorer {
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/LuceneQueryBuilder.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/LuceneQueryBuilder.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/LuceneQueryBuilder.java	Wed Sep 29 08:42:14 2004
@@ -22,9 +22,23 @@
 import org.apache.lucene.index.Term;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.queryParser.ParseException;
-import org.apache.jackrabbit.core.*;
-import org.apache.jackrabbit.core.search.*;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.core.search.QueryNodeVisitor;
+import org.apache.jackrabbit.core.search.QueryRootNode;
+import org.apache.jackrabbit.core.search.NamespaceMappings;
+import org.apache.jackrabbit.core.search.TextsearchQueryNode;
+import org.apache.jackrabbit.core.search.OrQueryNode;
+import org.apache.jackrabbit.core.search.AndQueryNode;
+import org.apache.jackrabbit.core.search.NotQueryNode;
+import org.apache.jackrabbit.core.search.ExactQueryNode;
+import org.apache.jackrabbit.core.search.NodeTypeQueryNode;
+import org.apache.jackrabbit.core.search.RangeQueryNode;
+import org.apache.jackrabbit.core.search.PathQueryNode;
+import org.apache.jackrabbit.core.search.RelationQueryNode;
+import org.apache.jackrabbit.core.search.Constants;
+import org.apache.jackrabbit.core.search.OrderQueryNode;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.MalformedPathException;
 import org.apache.log4j.Logger;
 
 import javax.jcr.RepositoryException;
@@ -46,7 +60,7 @@
     private SessionImpl session;
 
     private NamespaceMappings nsMappings;
-    
+
     private Analyzer analyzer;
 
     private List exceptions = new ArrayList();
@@ -73,7 +87,7 @@
 	Query q = builder.createLuceneQuery();
 	if (builder.exceptions.size() > 0) {
 	    StringBuffer msg = new StringBuffer();
-	    for (Iterator it = builder.exceptions.iterator(); it.hasNext(); ) {
+	    for (Iterator it = builder.exceptions.iterator(); it.hasNext();) {
 		msg.append(it.next().toString()).append('\n');
 	    }
 	    throw new RepositoryException("Exception parsing query: " + msg.toString());
@@ -82,12 +96,12 @@
     }
 
     private Query createLuceneQuery() {
-	return (Query)root.accept(this, null);
+	return (Query) root.accept(this, null);
     }
 
     public Object visit(QueryRootNode node, Object data) {
 	BooleanQuery root = new BooleanQuery();
-	Query constraintQuery = (Query)node.getConstraintNode().accept(this, null);
+	Query constraintQuery = (Query) node.getConstraintNode().accept(this, null);
 	if (constraintQuery != null) {
 	    root.add(constraintQuery, true, false);
 	}
@@ -105,7 +119,7 @@
 
 	TextsearchQueryNode textsearchNode = node.getTextsearchNode();
 	if (textsearchNode != null) {
-	    Query textsearch = (Query)textsearchNode.accept(this, null);
+	    Query textsearch = (Query) textsearchNode.accept(this, null);
 	    if (textsearch != null) {
 		root.add(textsearch, true, false);
 	    }
@@ -113,7 +127,7 @@
 
 	Query wrapped = root;
 	if (node.getLocationNode() != null) {
-	    wrapped = (Query)node.getLocationNode().accept(this, root);
+	    wrapped = (Query) node.getLocationNode().accept(this, root);
 	}
 
 	return wrapped;
@@ -123,7 +137,7 @@
 	BooleanQuery orQuery = new BooleanQuery();
 	Object[] result = node.acceptOperands(this, null);
 	for (int i = 0; i < result.length; i++) {
-	    Query operand = (Query)result[i];
+	    Query operand = (Query) result[i];
 	    orQuery.add(operand, false, false);
 	}
 	return orQuery;
@@ -136,7 +150,7 @@
 	}
 	BooleanQuery andQuery = new BooleanQuery();
 	for (int i = 0; i < result.length; i++) {
-	    Query operand = (Query)result[i];
+	    Query operand = (Query) result[i];
 	    andQuery.add(operand, true, false);
 	}
 	return andQuery;
@@ -146,7 +160,7 @@
 	BooleanQuery notQuery = new BooleanQuery();
 	Object[] result = node.acceptOperands(this, null);
 	for (int i = 0; i < result.length; i++) {
-	    Query operand = (Query)result[i];
+	    Query operand = (Query) result[i];
 	    notQuery.add(operand, false, true);
 	}
 	return notQuery;
@@ -233,7 +247,7 @@
 	    exceptions.add(e);
 	}
 	PathFilter filter = new PathFilter(path, node.getType());
-	return new PathFilterQuery((Query)data, new PackageFilter(filter));
+	return new PathFilterQuery((Query) data, new PackageFilter(filter));
     }
 
     public Object visit(RelationQueryNode node, Object data) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllQuery.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllQuery.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllQuery.java	Wed Sep 29 08:42:14 2004
@@ -38,7 +38,9 @@
      * @throws NullPointerException if <code>field</code> is null.
      */
     MatchAllQuery(String field) {
-        if (field == null) throw new NullPointerException("field");
+        if (field == null) {
+	    throw new NullPointerException("field");
+	}
         this.field = field.intern();
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllScorer.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllScorer.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllScorer.java	Wed Sep 29 08:42:14 2004
@@ -15,18 +15,22 @@
  */
 package org.apache.jackrabbit.core.search.lucene;
 
-import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.TermEnum;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
+import org.apache.lucene.search.Scorer;
+import org.apache.lucene.search.Weight;
+import org.apache.lucene.search.Explanation;
+import org.apache.lucene.search.Similarity;
+import org.apache.lucene.search.HitCollector;
 
 import java.io.IOException;
 import java.util.BitSet;
 
 /**
  * The MatchAllScorer implements a Scorer that scores / collects all
- * documents in the index that match an optional field / atom-filter.
+ * documents in the index that match a field.
  * In case there are no filters, this MatchAllScores simply collects
  * all documents in the index that are not marked as deleted.
  *
@@ -51,7 +55,7 @@
     private BitSet docFilter;
 
     /** Explanation object. the same for all docs */
-    private Explanation MATCH_EXPL;
+    private final Explanation matchExpl;
 
     /**
      * Creates a new MatchAllScorer.
@@ -68,7 +72,7 @@
         this.reader = reader;
         this.weight = weight;
         this.field = field;
-        MATCH_EXPL
+        matchExpl
             = new Explanation(Similarity.getDefault().idf(reader.maxDoc(),
                     reader.maxDoc()),
                     "matchAll");
@@ -99,7 +103,7 @@
      * @see Scorer#explain
      */
     public Explanation explain(int doc) {
-        return MATCH_EXPL;
+        return matchExpl;
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllWeight.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllWeight.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/MatchAllWeight.java	Wed Sep 29 08:42:14 2004
@@ -15,8 +15,13 @@
  */
 package org.apache.jackrabbit.core.search.lucene;
 
-import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Weight;
+import org.apache.lucene.search.Searcher;
+import org.apache.lucene.search.Scorer;
+import org.apache.lucene.search.Explanation;
+import org.apache.lucene.search.Similarity;
 
 import java.io.IOException;
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIndexer.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIndexer.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIndexer.java	Wed Sep 29 08:42:14 2004
@@ -15,10 +15,17 @@
  */
 package org.apache.jackrabbit.core.search.lucene;
 
-import org.apache.jackrabbit.core.state.*;
-import org.apache.jackrabbit.core.*;
 import org.apache.jackrabbit.core.search.NamespaceMappings;
 import org.apache.jackrabbit.core.util.uuid.UUID;
+import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ItemStateProvider;
+import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.NoSuchItemStateException;
+import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.InternalValue;
+import org.apache.jackrabbit.core.QName;
+import org.apache.jackrabbit.core.Path;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 
@@ -71,7 +78,7 @@
 	    NodeState.PropertyEntry prop = (NodeState.PropertyEntry) it.next();
 	    PropertyId id = new PropertyId(node.getUUID(), prop.getName());
 	    try {
-		PropertyState propState = (PropertyState)stateProvider.getItemState(id);
+		PropertyState propState = (PropertyState) stateProvider.getItemState(id);
 		InternalValue[] values = propState.getValues();
 		for (int i = 0; i < values.length; i++) {
 		    addValue(doc, values[i], propState.getName());
@@ -105,7 +112,7 @@
 			false));
 		break;
 	    case PropertyType.DATE:
-                long millis = ((Calendar)internalValue).getTimeInMillis();
+                long millis = ((Calendar) internalValue).getTimeInMillis();
 		doc.add(new Field(fieldName,
 			DateField.timeToString(millis),
 			false,
@@ -113,7 +120,7 @@
 			false));
 		break;
 	    case PropertyType.DOUBLE:
-		double doubleVal = ((Double)internalValue).doubleValue();
+		double doubleVal = ((Double) internalValue).doubleValue();
 		doc.add(new Field(fieldName,
 			DoubleField.doubleToString(doubleVal),
 			false,
@@ -121,7 +128,7 @@
 			false));
 		break;
 	    case PropertyType.LONG:
-		long longVal = ((Long)internalValue).longValue();
+		long longVal = ((Long) internalValue).longValue();
 		doc.add(new Field(fieldName,
 			LongField.longToString(longVal),
 			false,
@@ -129,7 +136,7 @@
 			false));
 		break;
 	    case PropertyType.REFERENCE:
-		String uuid = ((UUID)internalValue).toString();
+		String uuid = ((UUID) internalValue).toString();
 		doc.add(new Field(fieldName,
 			uuid,
 			false,
@@ -137,7 +144,7 @@
 			false));
 		break;
 	    case PropertyType.PATH:
-                String path = ((Path)internalValue).toString();
+                String path = ((Path) internalValue).toString();
 		doc.add(new Field(fieldName,
 			path,
 			false,
@@ -159,7 +166,7 @@
 			true));
 		break;
 	    case PropertyType.NAME:
-		QName qualiName = (QName)internalValue;
+		QName qualiName = (QName) internalValue;
 		String normValue = internalValue.toString();
 		try {
 		    normValue = mappings.getPrefix(qualiName.getNamespaceURI())

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIteratorImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIteratorImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/NodeIteratorImpl.java	Wed Sep 29 08:42:14 2004
@@ -45,9 +45,11 @@
     }
 
     public Node nextNode() {
-	if (pos >= uuids.length) throw new NoSuchElementException();
+	if (pos >= uuids.length) {
+	    throw new NoSuchElementException();
+	}
 	try {
-	    return (Node)itemMgr.getItem(new NodeId(uuids[pos++]));
+	    return (Node) itemMgr.getItem(new NodeId(uuids[pos++]));
 	} catch (RepositoryException e) {
 	    log.error("Exception retrieving Node with UUID: "
 		    + uuids[pos] + ": " + e.toString());
@@ -61,7 +63,9 @@
     }
 
     public void skip(long skipNum) {
-	if ((pos + skipNum) > uuids.length) throw new NoSuchElementException();
+	if ((pos + skipNum) > uuids.length) {
+	    throw new NoSuchElementException();
+	}
 	pos += skipNum;
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathFilterQuery.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathFilterQuery.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathFilterQuery.java	Wed Sep 29 08:42:14 2004
@@ -15,10 +15,12 @@
  */
 package org.apache.jackrabbit.core.search.lucene;
 
-import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
-import org.apache.jackrabbit.core.search.lucene.PackageFilter;
-import org.apache.jackrabbit.core.search.lucene.FilteredScorer;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Weight;
+import org.apache.lucene.search.Searcher;
+import org.apache.lucene.search.Explanation;
+import org.apache.lucene.search.Scorer;
 
 import java.io.IOException;
 
@@ -84,8 +86,8 @@
      * Returns a clone of this query.
      */
     public Object clone() {
-	PathFilterQuery clone = (PathFilterQuery)super.clone();
-	clone.delegatee = (Query)this.delegatee.clone();
+	PathFilterQuery clone = (PathFilterQuery) super.clone();
+	clone.delegatee = (Query) this.delegatee.clone();
 	return clone;
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathQuery.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathQuery.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PathQuery.java	Wed Sep 29 08:42:14 2004
@@ -15,9 +15,15 @@
  */
 package org.apache.jackrabbit.core.search.lucene;
 
-import org.apache.lucene.search.*;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.TermDocs;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Weight;
+import org.apache.lucene.search.Searcher;
+import org.apache.lucene.search.Scorer;
+import org.apache.lucene.search.Explanation;
+import org.apache.lucene.search.Similarity;
+import org.apache.lucene.search.HitCollector;
 import org.apache.jackrabbit.core.search.PathQueryNode;
 
 import java.io.IOException;

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PersistentIndex.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PersistentIndex.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PersistentIndex.java	Wed Sep 29 08:42:14 2004
@@ -19,7 +19,6 @@
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.jackrabbit.core.search.lucene.AbstractIndex;
 
 import java.io.IOException;
 
@@ -43,7 +42,9 @@
 
     void mergeIndex(AbstractIndex index) throws IOException {
 	this.getIndexWriter().addIndexes(
-		new IndexReader[] { index.getIndexReader() });
+		new IndexReader[] {
+		    index.getIndexReader()
+		});
     }
 
     Directory getDirectory() throws IOException {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PropertyIteratorImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PropertyIteratorImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/PropertyIteratorImpl.java	Wed Sep 29 08:42:14 2004
@@ -17,7 +17,10 @@
 
 import org.apache.log4j.Logger;
 
-import javax.jcr.*;
+import javax.jcr.PropertyIterator;
+import javax.jcr.NodeIterator;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
 import java.util.NoSuchElementException;
 
 /**
@@ -53,7 +56,9 @@
     }
 
     public Property nextProperty() {
-	if (next == null) throw new NoSuchElementException();
+	if (next == null) {
+	    throw new NoSuchElementException();
+	}
 	try {
 	    Property tmp = next;
 	    fetchNext();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryImpl.java	Wed Sep 29 08:42:14 2004
@@ -15,25 +15,37 @@
  */
 package org.apache.jackrabbit.core.search.lucene;
 
-import org.apache.jackrabbit.core.*;
 import org.apache.jackrabbit.core.search.QueryRootNode;
 import org.apache.jackrabbit.core.SearchManager;
+import org.apache.jackrabbit.core.QName;
+import org.apache.jackrabbit.core.NamespaceRegistryImpl;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.ItemManager;
+import org.apache.jackrabbit.core.Path;
+import org.apache.jackrabbit.core.NoPrefixDeclaredException;
+import org.apache.jackrabbit.core.MalformedPathException;
+import org.apache.jackrabbit.core.NamespaceResolver;
 import org.apache.jackrabbit.core.search.QueryParser;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 
 import javax.jcr.query.Query;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.InvalidQueryException;
-import javax.jcr.*;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.ItemExistsException;
+import javax.jcr.PathNotFoundException;
 
 /**
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
  */
 public class QueryImpl implements Query {
-    
+
     /** jcr:statement */
     private static final QName PROP_STATEMENT =
 	    new QName(NamespaceRegistryImpl.NS_JCR_URI, "statement");
@@ -69,9 +81,9 @@
 
 	// parse query according to language
 	// build query tree
-	this.root = QueryParser.parse(statement, language/*, session.getNamespaceResolver()*/);
+	this.root = QueryParser.parse(statement, language);
     }
-    
+
     public QueryImpl(SessionImpl session,
 	      ItemManager itemMgr,
 	      SearchManager searchMgr,
@@ -88,8 +100,12 @@
 		query = session.getRootNode().getNode(absPath);
 		// assert query has mix:referenceable
 		query.getUUID();
-		NodeType ntQuery = session.getWorkspace().getNodeTypeManager().getNodeType(NodeTypeRegistry.NT_QUERY.toJCRName(session.getNamespaceResolver()));
-		if (query.getPrimaryNodeType().equals(ntQuery));
+		NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
+		NodeType ntQuery = ntMgr.getNodeType(NodeTypeRegistry.NT_QUERY.toJCRName(
+			session.getNamespaceResolver()));
+		if (!query.getPrimaryNodeType().equals(ntQuery)) {
+		    throw new InvalidQueryException("node is not of type nt:query");
+		}
 	    } else {
 		throw new ItemNotFoundException(absPath);
 	    }
@@ -101,7 +117,7 @@
 
 	    // parse query according to language
 	    // build query tree and pass to QueryImpl
-	    QueryRootNode root = QueryParser.parse(statement, language/*, session.getNamespaceResolver()*/);
+	    QueryRootNode root = QueryParser.parse(statement, language);
 	    this.root = root;
 	} catch (NoPrefixDeclaredException e) {
 	    throw new InvalidQueryException(e.getMessage(), e);
@@ -167,7 +183,7 @@
 	    }
 	    Node queryNode = session.getRootNode().addNode(p.toJCRPath(resolver),
 		    NodeTypeRegistry.NT_QUERY.toJCRName(resolver));
-	    // set 
+	    // set properties
 	    queryNode.setProperty(PROP_LANGUAGE.toJCRName(resolver), language);
 	    queryNode.setProperty(PROP_STATEMENT.toJCRName(resolver), statement);
 	    // add mixin referenceable

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/QueryResultImpl.java	Wed Sep 29 08:42:14 2004
@@ -23,6 +23,7 @@
 import javax.jcr.NodeIterator;
 
 /**
+ * Implements the <code>javax.jcr.query.QueryResult</code> interface.
  *
  * @author Marcel Reutegger
  * @version $Revision:  $, $Date:  $
@@ -36,9 +37,9 @@
     private final String[] uuids;
 
     private final String[] selectProps;
-    
+
     public QueryResultImpl(ItemManager itemMgr,
-			   String[] uuids, 
+			   String[] uuids,
 			   String[] selectProps) {
 	this.uuids = uuids;
 	this.itemMgr = itemMgr;
@@ -47,7 +48,7 @@
 
     public PropertyIterator getProperties() {
 	return new PropertyIteratorImpl(selectProps,
-	    new NodeIteratorImpl(itemMgr, uuids));
+		new NodeIteratorImpl(itemMgr, uuids));
     }
 
     public NodeIterator getNodes() {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/VolatileIndex.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/VolatileIndex.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/search/lucene/VolatileIndex.java	Wed Sep 29 08:42:14 2004
@@ -18,7 +18,6 @@
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.store.Directory;
-import org.apache.jackrabbit.core.search.lucene.AbstractIndex;
 
 import java.io.IOException;
 

Mime
View raw message