org.geotools.filter
Class FilterSAXParser

java.lang.Object
  extended byorg.geotools.filter.FilterSAXParser

public class FilterSAXParser
extends java.lang.Object

Creates filters from FilterFilter, which reads in a SAX stream and passes the appropriate messages here.

Version:
$Id: FilterSAXParser.java 18021 2006-02-14 20:36:18Z jdeolive $
Author:
Rob Hranac, Vision for New York
, Chris Holmes, TOPP

Constructor Summary
FilterSAXParser()
          Constructor which flags the operator as between.
FilterSAXParser(FilterFactory factory)
          Constructor injdection
 
Method Summary
 Filter create()
          Creates the filter held in the parser.
 void expression(Expression expression)
          Adds the passed in expression to the current filter.
 void setAttributes(org.xml.sax.Attributes atts)
          Sets the filter attributes.
 void setDistance(java.lang.String distance, java.lang.String units)
          This sets the distance for a GeometryDistanceFilter.
 void setFilterFactory(FilterFactory factory)
          Setter injection
 void start(short filterType)
          Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.
 void value(java.lang.String message)
          Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterSAXParser

public FilterSAXParser()
Constructor which flags the operator as between.


FilterSAXParser

public FilterSAXParser(FilterFactory factory)
Constructor injdection

Method Detail

setFilterFactory

public void setFilterFactory(FilterFactory factory)
Setter injection


start

public void start(short filterType)
           throws IllegalFilterException
Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.

Parameters:
filterType - The string from the SAX filter.
Throws:
IllegalFilterException - Filter is illegal.

value

public void value(java.lang.String message)
           throws IllegalFilterException
Handles all incoming generic string 'messages,' including a message to create the filter, based on the XML tag that represents the start of the filter.

Parameters:
message - The string from the SAX filter.
Throws:
IllegalFilterException - Filter is illegal.

expression

public void expression(Expression expression)
                throws IllegalFilterException
Adds the passed in expression to the current filter. Generally created by the ExpressionSAXParser.

Parameters:
expression - The value of the attribute for comparison.
Throws:
IllegalFilterException - if the expression does not match what the current filter is expecting.
Task:
REVISIT: split this method up.

create

public Filter create()
              throws IllegalFilterException
Creates the filter held in the parser.

Returns:
The current filter to be created by this parser.
Throws:
IllegalFilterException - If called before the filter is in a complete state.

setDistance

public void setDistance(java.lang.String distance,
                        java.lang.String units)
                 throws IllegalFilterException
This sets the distance for a GeometryDistanceFilter. It currently ignores the units, and attempts to convert the distance to a double.

Parameters:
distance - the distance - should be a string of a double.
units - a reference to a units dictionary.
Throws:
IllegalFilterException - if the distance string can not be converted to a double.
Task:
TODO: Implement units, probably with org.geotools.units package and a special distance class in the filter package. It would be nice if the distance class could get any type of units, like it would handle the conversion.

setAttributes

public void setAttributes(org.xml.sax.Attributes atts)
Sets the filter attributes. Called when attributes are encountered by the filter filter. Puts them in a hash map by thier name and value.

Parameters:
atts - the attributes to set.


Copyright © GeoTools. All Rights Reserved.