this.declaredType = declaredType; short convertType = convertType(declaredType); if (DefaultExpression.isFunctionExpression(convertType)) { expFactory = new ExpressionSAXParser(schema); String name = getFunctionName(atts); Function function = functionFinder.findFunction(name); if (function != null && function instanceof FunctionExpression) { expFactory = new ExpressionSAXParser(schema); switch (convertType) { case ExpressionType.MATH_ADD: LOGGER.finer("is attribute expression"); currentState = setInitialState(curExprssn); readyFlag = false; } else { expFactory.start(declaredType, atts);
expFactory.end(message); if (expFactory.isReady()) { if (currentState.equals("leftValue")) { ((MathExpressionImpl) curExprssn).setExpression1(expFactory.create()); currentState = "rightValue"; expFactory = new ExpressionSAXParser(schema); LOGGER.finer("just added left value: " + currentState); } else if (currentState.equals("rightValue")) { ((MathExpressionImpl) curExprssn).setExpression2(expFactory.create()); currentState = "complete"; expFactory = null; LOGGER.finer("just added right value: " + currentState); } else if (currentState.equals("accumulate")) { accumalationOfExpressions.add(expFactory.create()); expFactory = null; } else { expFactory = new ExpressionSAXParser(schema); // we're gonna get more expressions
/** * 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); } }
expressionFactory = new ExpressionSAXParser(schema); } else if (insideFilter) { short filterType = convertType(localName); expressionFactory.start(localName, atts); } else if (localName.equals("Distance")) { // DJB: this looks like hack LOGGER.finest("inside distance");
/** * 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(); }
/** * 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); } }
expressionFactory=new ExpressionSAXParser(schema); } else if (insideFilter) { short filterType = convertType(localName); expressionFactory.start(localName,atts); } else if (localName.equals("Distance")) { //DJB: this looks like hack LOGGER.finest("inside distance");
private void addFilterToParent() throws IllegalFilterException { parent.filter(filterFactory.create()); expressionFactory = new ExpressionSAXParser(schema); }
if (DefaultExpression.isFunctionExpression(convertType(declaredType))) expFactory = new ExpressionSAXParser(schema); curExprssn = ff.createFunctionExpression( getFunctionName(atts) ); LOGGER.finer("is <function> expression"); if (DefaultExpression.isMathExpression(convertType(declaredType))) { expFactory = new ExpressionSAXParser(schema); curExprssn = ff.createMathExpression(convertType( declaredType)); LOGGER.finer("is math expression"); } else if (DefaultExpression.isLiteralExpression(convertType( declaredType))) { curExprssn = ff.createLiteralExpression(); readChars = true; LOGGER.finer("is literal expression"); } else if (DefaultExpression.isAttributeExpression(convertType( declaredType))) { curExprssn = ff.createAttributeExpression(schema); currentState = setInitialState(curExprssn); readyFlag = false; } else { expFactory.start(declaredType,atts);
expFactory.end(message); if (expFactory.isReady()) { if (currentState.equals("leftValue")) { ((MathExpression) curExprssn).addLeftValue(expFactory .create()); currentState = "rightValue"; expFactory = new ExpressionSAXParser(schema); LOGGER.finer("just added left value: " + currentState); } else if (currentState.equals("rightValue")) { ((MathExpression) curExprssn).addRightValue(expFactory .create()); currentState = "complete"; expFactory = null; LOGGER.finer("just added right value: " + currentState); } else if (currentState.equals("accumulate")) { accumalationOfExpressions.add(expFactory.create()); expFactory = null; expFactory = new ExpressionSAXParser(schema); // we're gonna get more expressions
/** * 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); } }
expressionFactory=new ExpressionSAXParser(schema); } else if (insideFilter) { short filterType = convertType(localName); expressionFactory.start(localName,atts); } else if (localName.equals("Distance")) { //DJB: this looks like hack LOGGER.finest("inside distance");
private void addFilterToLogicFactory() throws IllegalFilterException { logicFactory.add(filterFactory.create()); expressionFactory = new ExpressionSAXParser(schema); }
} else { LOGGER.finest("sending to expression factory: " + message); expressionFactory.message(message,this.convertLiteralToNumber);
if (DefaultExpression.isFunctionExpression(convertType(declaredType))) expFactory = new ExpressionSAXParser(schema); curExprssn = ff.createFunctionExpression( getFunctionName(atts) ); LOGGER.finer("is <function> expression"); if (DefaultExpression.isMathExpression(convertType(declaredType))) { expFactory = new ExpressionSAXParser(schema); curExprssn = ff.createMathExpression(convertType( declaredType)); LOGGER.finer("is math expression"); } else if (DefaultExpression.isLiteralExpression(convertType( declaredType))) { curExprssn = ff.createLiteralExpression(); readChars = true; LOGGER.finer("is literal expression"); } else if (DefaultExpression.isAttributeExpression(convertType( declaredType))) { curExprssn = ff.createAttributeExpression(schema); currentState = setInitialState(curExprssn); readyFlag = false; } else { expFactory.start(declaredType,atts);
expFactory.end(message); if (expFactory.isReady()) { if (currentState.equals("leftValue")) { ((MathExpression) curExprssn).addLeftValue(expFactory .create()); currentState = "rightValue"; expFactory = new ExpressionSAXParser(schema); LOGGER.finer("just added left value: " + currentState); } else if (currentState.equals("rightValue")) { ((MathExpression) curExprssn).addRightValue(expFactory .create()); currentState = "complete"; expFactory = null; LOGGER.finer("just added right value: " + currentState); } else if (currentState.equals("accumulate")) { accumalationOfExpressions.add(expFactory.create()); expFactory = null; expFactory = new ExpressionSAXParser(schema); // we're gonna get more expressions