/** * Constructor with parent, which must implement GMLHandlerJTS. * * @param parent The parent of this filter, to recieve the filters created. * @param schema The schema that the filter will be used against. */ public FilterFilter(FilterHandler parent, SimpleFeatureType schema) { super(); this.parent = parent; this.schema = schema; expressionFactory = new ExpressionSAXParser(schema); filterFactory = new FilterSAXParser(); logicFactory = new LogicSAXParser(); characters = new StringBuffer(); }
private void addFilterToParent() throws IllegalFilterException { parent.filter(filterFactory.create()); expressionFactory = new ExpressionSAXParser(schema); }
/** * Recieves a geometry from its child filter. * * @param geometry The geometry from the filter. * @throws RuntimeException if the filterFactory can't handle the geometry * @task REVISIT: can we throw another exception? */ public void geometry(Geometry geometry) throws RuntimeException { // Sends the geometry to the expression try { LOGGER.finer("got geometry: " + geometry); expressionFactory.geometry(geometry); if (expressionFactory.isReady()) { LOGGER.finer("expression factory made expression and sent " + "to filter factory"); filterFactory.expression(expressionFactory.create()); } } catch (IllegalFilterException ife) { LOGGER.finer("Had problems adding geometry: " + geometry.toString()); throw new RuntimeException("problem adding geometry to filter ", ife); } }
if (filterType == AbstractFilter.FID) { LOGGER.finer("sending attributes to existing FID filter"); filterFactory.setAttributes(atts); } else { isFidFilter = false; filterFactory.start(filterType); filterFactory.setAttributes(atts); } else if (filterType == AbstractFilter.FID) { LOGGER.finer("sending attributes to new FID filter"); filterFactory.setAttributes(atts); isFidFilter = true; LOGGER.finer("is fid (3): " + isFidFilter);
/** * Calling this method should be the first thing done by {@link #endElement(String, String, * String)}, to ensure the message passed to the expression factory contains the whole string * accumulated by the potentially many calls to {@link #characters(char[], int, int)} done by * the parser. * * @throws SAXException */ private void processCharacters() throws SAXException { if (insideFilter) { String message = this.characters.toString(); try { if (insideDistance) { LOGGER.finest("calling set distance on " + message + ", " + units); filterFactory.setDistance(message, units); } else { LOGGER.finest("sending to expression factory: " + message); expressionFactory.message(message, this.convertLiteralToNumber); } } catch (IllegalFilterException ife) { throw new SAXException(ife); } } else if (characters.length() > 0) { LOGGER.finer("delegating characters to parent: " + characters.toString()); int len = this.characters.length(); char[] chars = new char[this.characters.length()]; this.characters.getChars(0, len, chars, 0); parent.characters(chars, 0, len); } }
/** * Creates the filter held in the parser. * * @return The current filter to be created by this parser. * @throws IllegalFilterException If called before the filter is in a complete state. */ public Filter create() throws IllegalFilterException { if (isComplete()) { LOGGER.finer("complete called, state = " + curState); curState = "complete"; // added by cholmes fid bug. return curFilter; } else { throw new IllegalFilterException( "Got to the end state of an incomplete filter, current" + " state is " + curState); } }
curState = setInitialState(filterType); this.filterType = filterType;
LOGGER.finer( "sending attributes to existing FID filter"); filterFactory.setAttributes(atts); } else { isFidFilter = false; filterFactory.start(filterType); filterFactory.setAttributes(atts); } else if (filterType == AbstractFilter.FID) { LOGGER.finer("sending attributes to new FID filter"); filterFactory.setAttributes(atts); isFidFilter = true; LOGGER.finer("is fid (3): " + isFidFilter);
LOGGER.finest("calling set distance on " + message + ", " + units); filterFactory.setDistance(message, units); } else { LOGGER.finest("sending to expression factory: " + message);
/** * Creates the filter held in the parser. * * @return The current filter to be created by this parser. * * @throws IllegalFilterException If called before the filter is in a * complete state. */ public Filter create() throws IllegalFilterException { if (isComplete()) { LOGGER.finer("complete called, state = " + curState); curState = "complete"; //added by cholmes fid bug. return curFilter; } else { throw new IllegalFilterException( "Got to the end state of an incomplete filter, current" + " state is " + curState); } }
curState = setInitialState(filterType); this.filterType = filterType;
LOGGER.finer( "sending attributes to existing FID filter"); filterFactory.setAttributes(atts); } else { isFidFilter = false; filterFactory.start(filterType); filterFactory.setAttributes(atts); } else if (filterType == AbstractFilter.FID) { LOGGER.finer("sending attributes to new FID filter"); filterFactory.setAttributes(atts); isFidFilter = true; LOGGER.finer("is fid (3): " + isFidFilter);
private void addFilterToLogicFactory() throws IllegalFilterException { logicFactory.add(filterFactory.create()); expressionFactory = new ExpressionSAXParser(schema); }
filterFactory.expression(expressionFactory.create());
/** * Constructor with parent, which must implement GMLHandlerJTS. * * @param parent The parent of this filter, to recieve the filters created. * @param schema The schema that the filter will be used against. */ public FilterFilter(FilterHandler parent, FeatureType schema) { super(); this.parent = parent; this.schema = schema; expressionFactory = new ExpressionSAXParser(schema); filterFactory = new FilterSAXParser(); logicFactory = new LogicSAXParser(); characters = new StringBuffer(); }
LOGGER.finest("calling set distance on " + message + ", " + units); filterFactory.setDistance(message, units); } else { LOGGER.finest("sending to expression factory: " + message);
/** * Creates the filter held in the parser. * * @return The current filter to be created by this parser. * * @throws IllegalFilterException If called before the filter is in a * complete state. */ public Filter create() throws IllegalFilterException { if (isComplete()) { LOGGER.finer("complete called, state = " + curState); curState = "complete"; //added by cholmes fid bug. return curFilter; } else { throw new IllegalFilterException( "Got to the end state of an incomplete filter, current" + " state is " + curState); } }
curState = setInitialState(filterType); this.filterType = filterType;
private void addFilterToLogicFactory() throws IllegalFilterException { logicFactory.add(filterFactory.create()); expressionFactory = new ExpressionSAXParser(schema); }
/** * Recieves a geometry from its child filter. * * @param geometry The geometry from the filter. * * @throws RuntimeException if the filterFactory can't handle the geometry * * @task REVISIT: can we throw another exception? */ public void geometry(Geometry geometry) throws RuntimeException { // Sends the geometry to the expression try { LOGGER.finer("got geometry: " + geometry); expressionFactory.geometry(geometry); if (expressionFactory.isReady()) { LOGGER.finer("expression factory made expression and sent " + "to filter factory"); filterFactory.expression(expressionFactory.create()); } } catch (IllegalFilterException ife) { LOGGER.finer("Had problems adding geometry: " + geometry.toString()); throw new RuntimeException("problem adding geometry to filter ", ife); } }