manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1201509 - in /incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces: FilterRelationship.java SubqueryFilter.java WHAccessorBuilder.java WHFilter.java
Date Sun, 13 Nov 2011 20:51:00 GMT
Author: kwright
Date: Sun Nov 13 20:51:00 2011
New Revision: 1201509

URL: http://svn.apache.org/viewvc?rev=1201509&view=rev
Log:
Create an interface that constructs accessors based on a row in a relationship.

Added:
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessorBuilder.java
  (with props)
Modified:
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/FilterRelationship.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/SubqueryFilter.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHFilter.java

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/FilterRelationship.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/FilterRelationship.java?rev=1201509&r1=1201508&r2=1201509&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/FilterRelationship.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/FilterRelationship.java
Sun Nov 13 20:51:00 2011
@@ -59,10 +59,10 @@ public class FilterRelationship implemen
   
   /** Override this method to control filtering.
   */
-  protected boolean isUnfiltered(int rowNumber)
+  protected boolean include(int rowNumber)
     throws WHException
   {
-    return filterer.isUnfiltered(this,rowNumber);
+    return filterer.include(this,rowNumber);
   }
   
   /** Accessor class that performs generic filtering.
@@ -112,7 +112,7 @@ public class FilterRelationship implemen
       while (baseAccessor.hasNext())
       {
 	int theRow = baseAccessor.getNext();
-	if (isUnfiltered(theRow))
+	if (include(theRow))
 	  return theRow;
       }
       return -1;

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/SubqueryFilter.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/SubqueryFilter.java?rev=1201509&r1=1201508&r2=1201509&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/SubqueryFilter.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/SubqueryFilter.java
Sun Nov 13 20:51:00 2011
@@ -19,25 +19,34 @@
 
 package org.apache.warthog.interfaces;
 
-/** Filter using a secondary relationship "joined" using specified criteria.
+/** Filter using a secondary index, in either an "exists" or "not exists"
+* way.  This filter must build a new accessor for every isUnfiltered() request,
+* and return 'true' if the accessor is non-empty, or the converse (depending on the
+* setting of the isExists flag).
+* Note that there are a number of 'moving parts' needed to make this filter work.
+* The accessor must be constructed on the fly, so there has to be some code that
+* finds the right table or index accessor based on the join criteria.  That's going to
+* be handled by a class implementing WHAccessorBuilder.
 */
 public class SubqueryFilter implements WHFilter
 {
-  protected WHRelationship subqueryRelationship;
+  protected boolean isExists;
+  protected WHAccessorBuilder builder;
   
   /** Constructor */
-  public SubqueryFilter(WHRelationship subqueryRelationship)
+  public SubqueryFilter(boolean isExists, WHAccessorBuilder builder)
   {
-    // MHL
+    this.isExists = isExists;
+    this.builder = builder;
   }
   
   /** Check if a row should be filtered or not.
   */
-  public boolean isUnfiltered(WHRelationship relationship, int rowNumber)
+  public boolean include(WHRelationship relationship, int rowNumber)
     throws WHException
   {
-    // MHL
-    return true;
+    WHAccessor accessor = builder.createAccessor(relationship,rowNumber);
+    return accessor.hasNext() == isExists;
   }
 
 }
\ No newline at end of file

Added: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessorBuilder.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessorBuilder.java?rev=1201509&view=auto
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessorBuilder.java
(added)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessorBuilder.java
Sun Nov 13 20:51:00 2011
@@ -0,0 +1,34 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.warthog.interfaces;
+
+/** Classes that implement this interface construct WHAccessor objects based
+* on criteria they receive from a specific row in a relationship.
+*/
+public interface WHAccessorBuilder
+{
+  /** Construct an accessor based on the specified row of the specified
+  * relationship.
+  */
+  public WHAccessor createAccessor(WHRelationship relationship,
+    int rowNumber)
+    throws WHException;
+  
+}
\ No newline at end of file

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessorBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHAccessorBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHFilter.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHFilter.java?rev=1201509&r1=1201508&r2=1201509&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHFilter.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/interfaces/WHFilter.java
Sun Nov 13 20:51:00 2011
@@ -25,7 +25,7 @@ public interface WHFilter
 {
   /** Check if a row should be filtered or not.
   */
-  public boolean isUnfiltered(WHRelationship relationship, int rowNumber)
+  public boolean include(WHRelationship relationship, int rowNumber)
     throws WHException;
   
 }



Mime
View raw message