You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/02/18 17:38:27 UTC
[5/6] qpid-jms git commit: consolidate the selector parsing bits into
the client module
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-client/src/main/javacc/HyphenatedParser.jj
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/javacc/HyphenatedParser.jj b/qpid-jms-client/src/main/javacc/HyphenatedParser.jj
new file mode 100755
index 0000000..5966027
--- /dev/null
+++ b/qpid-jms-client/src/main/javacc/HyphenatedParser.jj
@@ -0,0 +1,563 @@
+/**
+ * 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.
+ */
+
+// ----------------------------------------------------------------------------
+// OPTIONS
+// ----------------------------------------------------------------------------
+options {
+ STATIC = false;
+ UNICODE_INPUT = true;
+ // some performance optimizations
+ ERROR_REPORTING = false;
+}
+
+// ----------------------------------------------------------------------------
+// PARSER
+// ----------------------------------------------------------------------------
+
+PARSER_BEGIN(HyphenatedParser)
+/**
+ * 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.qpid.jms.selector.hyphenated;
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.qpid.jms.selector.filter.*;
+
+/**
+ * JMS Selector Parser generated by JavaCC
+ *
+ * Do not edit this .java file directly - it is autogenerated from HyphenatedParser.jj
+ */
+public class HyphenatedParser {
+ private BooleanExpression asBooleanExpression(Expression value) throws ParseException {
+ if (value instanceof BooleanExpression) {
+ return (BooleanExpression) value;
+ }
+ if (value instanceof PropertyExpression) {
+ return UnaryExpression.createBooleanCast( value );
+ }
+ throw new ParseException("Expression will not result in a boolean value: " + value);
+ }
+}
+
+PARSER_END(HyphenatedParser)
+
+// ----------------------------------------------------------------------------
+// Tokens
+// ----------------------------------------------------------------------------
+
+/* White Space */
+SPECIAL_TOKEN :
+{
+ " " | "\t" | "\n" | "\r" | "\f"
+}
+
+/* Comments */
+SKIP:
+{
+ <LINE_COMMENT: "--" (~["\n","\r"])* ("\n"|"\r"|"\r\n") >
+}
+
+SKIP:
+{
+ <BLOCK_COMMENT: "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
+}
+
+/* Reserved Words */
+TOKEN [IGNORE_CASE] :
+{
+ < NOT : "NOT">
+ | < AND : "AND">
+ | < OR : "OR">
+ | < BETWEEN : "BETWEEN">
+ | < LIKE : "LIKE">
+ | < ESCAPE : "ESCAPE">
+ | < IN : "IN">
+ | < IS : "IS">
+ | < TRUE : "TRUE" >
+ | < FALSE : "FALSE" >
+ | < NULL : "NULL" >
+ | < XPATH : "XPATH" >
+ | < XQUERY : "XQUERY" >
+}
+
+/* Literals */
+TOKEN [IGNORE_CASE] :
+{
+
+ < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* (["l","L"])? >
+ | < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+ | < OCTAL_LITERAL: "0" (["0"-"7"])* >
+ | < FLOATING_POINT_LITERAL:
+ (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? // matches: 5.5 or 5. or 5.5E10 or 5.E10
+ | "." (["0"-"9"])+ (<EXPONENT>)? // matches: .5 or .5E10
+ | (["0"-"9"])+ <EXPONENT> // matches: 5E10
+ >
+ | < #EXPONENT: "E" (["+","-"])? (["0"-"9"])+ >
+ | < STRING_LITERAL: "'" ( ("''") | ~["'"] )* "'" >
+}
+
+TOKEN [IGNORE_CASE] :
+{
+ < ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$", "-"])* >
+}
+
+// ----------------------------------------------------------------------------
+// Grammer
+// ----------------------------------------------------------------------------
+BooleanExpression JmsSelector() :
+{
+ Expression left=null;
+}
+{
+ (
+ left = orExpression()
+ )
+ {
+ return asBooleanExpression(left);
+ }
+
+}
+
+Expression orExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = andExpression()
+ (
+ <OR> right = andExpression()
+ {
+ left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
+ }
+ )*
+ )
+ {
+ return left;
+ }
+
+}
+
+
+Expression andExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = equalityExpression()
+ (
+ <AND> right = equalityExpression()
+ {
+ left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
+ }
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression equalityExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = comparisonExpression()
+ (
+
+ "=" right = comparisonExpression()
+ {
+ left = ComparisonExpression.createEqual(left, right);
+ }
+ |
+ "<>" right = comparisonExpression()
+ {
+ left = ComparisonExpression.createNotEqual(left, right);
+ }
+ |
+ LOOKAHEAD(2)
+ <IS> <NULL>
+ {
+ left = ComparisonExpression.createIsNull(left);
+ }
+ |
+ <IS> <NOT> <NULL>
+ {
+ left = ComparisonExpression.createIsNotNull(left);
+ }
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression comparisonExpression() :
+{
+ Expression left;
+ Expression right;
+ Expression low;
+ Expression high;
+ String t, u;
+ boolean not;
+ ArrayList list;
+}
+{
+ (
+ left = addExpression()
+ (
+
+ ">" right = addExpression()
+ {
+ left = ComparisonExpression.createGreaterThan(left, right);
+ }
+ |
+ ">=" right = addExpression()
+ {
+ left = ComparisonExpression.createGreaterThanEqual(left, right);
+ }
+ |
+ "<" right = addExpression()
+ {
+ left = ComparisonExpression.createLessThan(left, right);
+ }
+ |
+ "<=" right = addExpression()
+ {
+ left = ComparisonExpression.createLessThanEqual(left, right);
+ }
+ |
+ {
+ u=null;
+ }
+ <LIKE> t = stringLitteral()
+ [ <ESCAPE> u = stringLitteral() ]
+ {
+ left = ComparisonExpression.createLike(left, t, u);
+ }
+ |
+ LOOKAHEAD(2)
+ {
+ u=null;
+ }
+ <NOT> <LIKE> t = stringLitteral() [ <ESCAPE> u = stringLitteral() ]
+ {
+ left = ComparisonExpression.createNotLike(left, t, u);
+ }
+ |
+ <BETWEEN> low = addExpression() <AND> high = addExpression()
+ {
+ left = ComparisonExpression.createBetween(left, low, high);
+ }
+ |
+ LOOKAHEAD(2)
+ <NOT> <BETWEEN> low = addExpression() <AND> high = addExpression()
+ {
+ left = ComparisonExpression.createNotBetween(left, low, high);
+ }
+ |
+ <IN>
+ "("
+ t = stringLitteral()
+ {
+ list = new ArrayList();
+ list.add( t );
+ }
+ (
+ ","
+ t = stringLitteral()
+ {
+ list.add( t );
+ }
+
+ )*
+ ")"
+ {
+ left = ComparisonExpression.createInFilter(left, list);
+ }
+ |
+ LOOKAHEAD(2)
+ <NOT> <IN>
+ "("
+ t = stringLitteral()
+ {
+ list = new ArrayList();
+ list.add( t );
+ }
+ (
+ ","
+ t = stringLitteral()
+ {
+ list.add( t );
+ }
+
+ )*
+ ")"
+ {
+ left = ComparisonExpression.createNotInFilter(left, list);
+ }
+
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression addExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ left = multExpr()
+ (
+ LOOKAHEAD( ("+"|"-") multExpr())
+ (
+ "+" right = multExpr()
+ {
+ left = ArithmeticExpression.createPlus(left, right);
+ }
+ |
+ "-" right = multExpr()
+ {
+ left = ArithmeticExpression.createMinus(left, right);
+ }
+ )
+
+ )*
+ {
+ return left;
+ }
+}
+
+Expression multExpr() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ left = unaryExpr()
+ (
+ "*" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createMultiply(left, right);
+ }
+ |
+ "/" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createDivide(left, right);
+ }
+ |
+ "%" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createMod(left, right);
+ }
+
+ )*
+ {
+ return left;
+ }
+}
+
+
+Expression unaryExpr() :
+{
+ String s=null;
+ Expression left=null;
+}
+{
+ (
+ LOOKAHEAD( "+" unaryExpr() )
+ "+" left=unaryExpr()
+ |
+ "-" left=unaryExpr()
+ {
+ left = UnaryExpression.createNegate(left);
+ }
+ |
+ <NOT> left=unaryExpr()
+ {
+ left = UnaryExpression.createNOT( asBooleanExpression(left) );
+ }
+ |
+ <XPATH> s=stringLitteral()
+ {
+ left = UnaryExpression.createXPath( s );
+ }
+ |
+ <XQUERY> s=stringLitteral()
+ {
+ left = UnaryExpression.createXQuery( s );
+ }
+ |
+ left = primaryExpr()
+ )
+ {
+ return left;
+ }
+
+}
+
+Expression primaryExpr() :
+{
+ Expression left=null;
+}
+{
+ (
+ left = literal()
+ |
+ left = variable()
+ |
+ "(" left = orExpression() ")"
+ )
+ {
+ return left;
+ }
+}
+
+
+
+ConstantExpression literal() :
+{
+ Token t;
+ String s;
+ ConstantExpression left=null;
+}
+{
+ (
+ (
+ s = stringLitteral()
+ {
+ left = new ConstantExpression(s);
+ }
+ )
+ |
+ (
+ t = <DECIMAL_LITERAL>
+ {
+ left = ConstantExpression.createFromDecimal(t.image);
+ }
+ )
+ |
+ (
+ t = <HEX_LITERAL>
+ {
+ left = ConstantExpression.createFromHex(t.image);
+ }
+ )
+ |
+ (
+ t = <OCTAL_LITERAL>
+ {
+ left = ConstantExpression.createFromOctal(t.image);
+ }
+ )
+ |
+ (
+ t = <FLOATING_POINT_LITERAL>
+ {
+ left = ConstantExpression.createFloat(t.image);
+ }
+ )
+ |
+ (
+ <TRUE>
+ {
+ left = ConstantExpression.TRUE;
+ }
+ )
+ |
+ (
+ <FALSE>
+ {
+ left = ConstantExpression.FALSE;
+ }
+ )
+ |
+ (
+ <NULL>
+ {
+ left = ConstantExpression.NULL;
+ }
+ )
+ )
+ {
+ return left;
+ }
+}
+
+String stringLitteral() :
+{
+ Token t;
+ StringBuffer rc = new StringBuffer();
+ boolean first=true;
+}
+{
+ t = <STRING_LITERAL>
+ {
+ // Decode the sting value.
+ String image = t.image;
+ for( int i=1; i < image.length()-1; i++ ) {
+ char c = image.charAt(i);
+ if( c == '\'' )
+ i++;
+ rc.append(c);
+ }
+ return rc.toString();
+ }
+}
+
+PropertyExpression variable() :
+{
+ Token t;
+ PropertyExpression left=null;
+}
+{
+ (
+ t=<ID>
+ {
+ left = new PropertyExpression(t.image);
+ }
+ )
+ {
+ return left;
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-client/src/main/javacc/StrictParser.jj
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/javacc/StrictParser.jj b/qpid-jms-client/src/main/javacc/StrictParser.jj
new file mode 100755
index 0000000..dfe8dab
--- /dev/null
+++ b/qpid-jms-client/src/main/javacc/StrictParser.jj
@@ -0,0 +1,563 @@
+/**
+ * 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.
+ */
+
+// ----------------------------------------------------------------------------
+// OPTIONS
+// ----------------------------------------------------------------------------
+options {
+ STATIC = false;
+ UNICODE_INPUT = true;
+ // some performance optimizations
+ ERROR_REPORTING = false;
+}
+
+// ----------------------------------------------------------------------------
+// PARSER
+// ----------------------------------------------------------------------------
+
+PARSER_BEGIN(StrictParser)
+/**
+ * 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.qpid.jms.selector.strict;
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.qpid.jms.selector.filter.*;
+
+/**
+ * JMS Selector Parser generated by JavaCC
+ *
+ * Do not edit this .java file directly - it is autogenerated from StrictParser.jj
+ */
+public class StrictParser {
+ private BooleanExpression asBooleanExpression(Expression value) throws ParseException {
+ if (value instanceof BooleanExpression) {
+ return (BooleanExpression) value;
+ }
+ if (value instanceof PropertyExpression) {
+ return UnaryExpression.createBooleanCast( value );
+ }
+ throw new ParseException("Expression will not result in a boolean value: " + value);
+ }
+}
+
+PARSER_END(StrictParser)
+
+// ----------------------------------------------------------------------------
+// Tokens
+// ----------------------------------------------------------------------------
+
+/* White Space */
+SPECIAL_TOKEN :
+{
+ " " | "\t" | "\n" | "\r" | "\f"
+}
+
+/* Comments */
+SKIP:
+{
+ <LINE_COMMENT: "--" (~["\n","\r"])* ("\n"|"\r"|"\r\n") >
+}
+
+SKIP:
+{
+ <BLOCK_COMMENT: "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/">
+}
+
+/* Reserved Words */
+TOKEN [IGNORE_CASE] :
+{
+ < NOT : "NOT">
+ | < AND : "AND">
+ | < OR : "OR">
+ | < BETWEEN : "BETWEEN">
+ | < LIKE : "LIKE">
+ | < ESCAPE : "ESCAPE">
+ | < IN : "IN">
+ | < IS : "IS">
+ | < TRUE : "TRUE" >
+ | < FALSE : "FALSE" >
+ | < NULL : "NULL" >
+ | < XPATH : "XPATH" >
+ | < XQUERY : "XQUERY" >
+}
+
+/* Literals */
+TOKEN [IGNORE_CASE] :
+{
+
+ < DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* (["l","L"])? >
+ | < HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+ | < OCTAL_LITERAL: "0" (["0"-"7"])* >
+ | < FLOATING_POINT_LITERAL:
+ (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? // matches: 5.5 or 5. or 5.5E10 or 5.E10
+ | "." (["0"-"9"])+ (<EXPONENT>)? // matches: .5 or .5E10
+ | (["0"-"9"])+ <EXPONENT> // matches: 5E10
+ >
+ | < #EXPONENT: "E" (["+","-"])? (["0"-"9"])+ >
+ | < STRING_LITERAL: "'" ( ("''") | ~["'"] )* "'" >
+}
+
+TOKEN [IGNORE_CASE] :
+{
+ < ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* >
+}
+
+// ----------------------------------------------------------------------------
+// Grammer
+// ----------------------------------------------------------------------------
+BooleanExpression JmsSelector() :
+{
+ Expression left=null;
+}
+{
+ (
+ left = orExpression()
+ )
+ {
+ return asBooleanExpression(left);
+ }
+
+}
+
+Expression orExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = andExpression()
+ (
+ <OR> right = andExpression()
+ {
+ left = LogicExpression.createOR(asBooleanExpression(left), asBooleanExpression(right));
+ }
+ )*
+ )
+ {
+ return left;
+ }
+
+}
+
+
+Expression andExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = equalityExpression()
+ (
+ <AND> right = equalityExpression()
+ {
+ left = LogicExpression.createAND(asBooleanExpression(left), asBooleanExpression(right));
+ }
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression equalityExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ (
+ left = comparisonExpression()
+ (
+
+ "=" right = comparisonExpression()
+ {
+ left = ComparisonExpression.createEqual(left, right);
+ }
+ |
+ "<>" right = comparisonExpression()
+ {
+ left = ComparisonExpression.createNotEqual(left, right);
+ }
+ |
+ LOOKAHEAD(2)
+ <IS> <NULL>
+ {
+ left = ComparisonExpression.createIsNull(left);
+ }
+ |
+ <IS> <NOT> <NULL>
+ {
+ left = ComparisonExpression.createIsNotNull(left);
+ }
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression comparisonExpression() :
+{
+ Expression left;
+ Expression right;
+ Expression low;
+ Expression high;
+ String t, u;
+ boolean not;
+ ArrayList list;
+}
+{
+ (
+ left = addExpression()
+ (
+
+ ">" right = addExpression()
+ {
+ left = ComparisonExpression.createGreaterThan(left, right);
+ }
+ |
+ ">=" right = addExpression()
+ {
+ left = ComparisonExpression.createGreaterThanEqual(left, right);
+ }
+ |
+ "<" right = addExpression()
+ {
+ left = ComparisonExpression.createLessThan(left, right);
+ }
+ |
+ "<=" right = addExpression()
+ {
+ left = ComparisonExpression.createLessThanEqual(left, right);
+ }
+ |
+ {
+ u=null;
+ }
+ <LIKE> t = stringLitteral()
+ [ <ESCAPE> u = stringLitteral() ]
+ {
+ left = ComparisonExpression.createLike(left, t, u);
+ }
+ |
+ LOOKAHEAD(2)
+ {
+ u=null;
+ }
+ <NOT> <LIKE> t = stringLitteral() [ <ESCAPE> u = stringLitteral() ]
+ {
+ left = ComparisonExpression.createNotLike(left, t, u);
+ }
+ |
+ <BETWEEN> low = addExpression() <AND> high = addExpression()
+ {
+ left = ComparisonExpression.createBetween(left, low, high);
+ }
+ |
+ LOOKAHEAD(2)
+ <NOT> <BETWEEN> low = addExpression() <AND> high = addExpression()
+ {
+ left = ComparisonExpression.createNotBetween(left, low, high);
+ }
+ |
+ <IN>
+ "("
+ t = stringLitteral()
+ {
+ list = new ArrayList();
+ list.add( t );
+ }
+ (
+ ","
+ t = stringLitteral()
+ {
+ list.add( t );
+ }
+
+ )*
+ ")"
+ {
+ left = ComparisonExpression.createInFilter(left, list);
+ }
+ |
+ LOOKAHEAD(2)
+ <NOT> <IN>
+ "("
+ t = stringLitteral()
+ {
+ list = new ArrayList();
+ list.add( t );
+ }
+ (
+ ","
+ t = stringLitteral()
+ {
+ list.add( t );
+ }
+
+ )*
+ ")"
+ {
+ left = ComparisonExpression.createNotInFilter(left, list);
+ }
+
+ )*
+ )
+ {
+ return left;
+ }
+}
+
+Expression addExpression() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ left = multExpr()
+ (
+ LOOKAHEAD( ("+"|"-") multExpr())
+ (
+ "+" right = multExpr()
+ {
+ left = ArithmeticExpression.createPlus(left, right);
+ }
+ |
+ "-" right = multExpr()
+ {
+ left = ArithmeticExpression.createMinus(left, right);
+ }
+ )
+
+ )*
+ {
+ return left;
+ }
+}
+
+Expression multExpr() :
+{
+ Expression left;
+ Expression right;
+}
+{
+ left = unaryExpr()
+ (
+ "*" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createMultiply(left, right);
+ }
+ |
+ "/" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createDivide(left, right);
+ }
+ |
+ "%" right = unaryExpr()
+ {
+ left = ArithmeticExpression.createMod(left, right);
+ }
+
+ )*
+ {
+ return left;
+ }
+}
+
+
+Expression unaryExpr() :
+{
+ String s=null;
+ Expression left=null;
+}
+{
+ (
+ LOOKAHEAD( "+" unaryExpr() )
+ "+" left=unaryExpr()
+ |
+ "-" left=unaryExpr()
+ {
+ left = UnaryExpression.createNegate(left);
+ }
+ |
+ <NOT> left=unaryExpr()
+ {
+ left = UnaryExpression.createNOT( asBooleanExpression(left) );
+ }
+ |
+ <XPATH> s=stringLitteral()
+ {
+ left = UnaryExpression.createXPath( s );
+ }
+ |
+ <XQUERY> s=stringLitteral()
+ {
+ left = UnaryExpression.createXQuery( s );
+ }
+ |
+ left = primaryExpr()
+ )
+ {
+ return left;
+ }
+
+}
+
+Expression primaryExpr() :
+{
+ Expression left=null;
+}
+{
+ (
+ left = literal()
+ |
+ left = variable()
+ |
+ "(" left = orExpression() ")"
+ )
+ {
+ return left;
+ }
+}
+
+
+
+ConstantExpression literal() :
+{
+ Token t;
+ String s;
+ ConstantExpression left=null;
+}
+{
+ (
+ (
+ s = stringLitteral()
+ {
+ left = new ConstantExpression(s);
+ }
+ )
+ |
+ (
+ t = <DECIMAL_LITERAL>
+ {
+ left = ConstantExpression.createFromDecimal(t.image);
+ }
+ )
+ |
+ (
+ t = <HEX_LITERAL>
+ {
+ left = ConstantExpression.createFromHex(t.image);
+ }
+ )
+ |
+ (
+ t = <OCTAL_LITERAL>
+ {
+ left = ConstantExpression.createFromOctal(t.image);
+ }
+ )
+ |
+ (
+ t = <FLOATING_POINT_LITERAL>
+ {
+ left = ConstantExpression.createFloat(t.image);
+ }
+ )
+ |
+ (
+ <TRUE>
+ {
+ left = ConstantExpression.TRUE;
+ }
+ )
+ |
+ (
+ <FALSE>
+ {
+ left = ConstantExpression.FALSE;
+ }
+ )
+ |
+ (
+ <NULL>
+ {
+ left = ConstantExpression.NULL;
+ }
+ )
+ )
+ {
+ return left;
+ }
+}
+
+String stringLitteral() :
+{
+ Token t;
+ StringBuffer rc = new StringBuffer();
+ boolean first=true;
+}
+{
+ t = <STRING_LITERAL>
+ {
+ // Decode the sting value.
+ String image = t.image;
+ for( int i=1; i < image.length()-1; i++ ) {
+ char c = image.charAt(i);
+ if( c == '\'' )
+ i++;
+ rc.append(c);
+ }
+ return rc.toString();
+ }
+}
+
+PropertyExpression variable() :
+{
+ Token t;
+ PropertyExpression left=null;
+}
+{
+ (
+ t=<ID>
+ {
+ left = new PropertyExpression(t.image);
+ }
+ )
+ {
+ return left;
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorParserTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorParserTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorParserTest.java
new file mode 100755
index 0000000..c0e73c2
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorParserTest.java
@@ -0,0 +1,71 @@
+/**
+ * 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.qpid.jms.selector;
+
+import junit.framework.TestCase;
+
+import org.apache.qpid.jms.selector.SelectorParser;
+import org.apache.qpid.jms.selector.filter.BooleanExpression;
+import org.apache.qpid.jms.selector.filter.ComparisonExpression;
+import org.apache.qpid.jms.selector.filter.Expression;
+import org.apache.qpid.jms.selector.filter.LogicExpression;
+import org.apache.qpid.jms.selector.filter.PropertyExpression;
+import org.apache.qpid.jms.selector.filter.XPathExpression;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SelectorParserTest extends TestCase {
+ private static final Logger LOG = LoggerFactory.getLogger(SelectorParserTest.class);
+
+ public void testParseXPath() throws Exception {
+ BooleanExpression filter = parse("XPATH '//title[@lang=''eng'']'");
+ assertTrue("Created XPath expression", filter instanceof XPathExpression);
+ LOG.info("Expression: " + filter);
+ }
+
+ public void testParseWithParensAround() throws Exception {
+ String[] values = {"x = 1 and y = 2", "(x = 1) and (y = 2)", "((x = 1) and (y = 2))"};
+
+ for (int i = 0; i < values.length; i++) {
+ String value = values[i];
+ LOG.info("Parsing: " + value);
+
+ BooleanExpression andExpression = parse(value);
+ assertTrue("Created LogicExpression expression", andExpression instanceof LogicExpression);
+ LogicExpression logicExpression = (LogicExpression)andExpression;
+ Expression left = logicExpression.getLeft();
+ Expression right = logicExpression.getRight();
+
+ assertTrue("Left is a binary filter", left instanceof ComparisonExpression);
+ assertTrue("Right is a binary filter", right instanceof ComparisonExpression);
+ ComparisonExpression leftCompare = (ComparisonExpression)left;
+ ComparisonExpression rightCompare = (ComparisonExpression)right;
+ assertPropertyExpression("left", leftCompare.getLeft(), "x");
+ assertPropertyExpression("right", rightCompare.getLeft(), "y");
+ }
+ }
+
+ protected void assertPropertyExpression(String message, Expression expression, String expected) {
+ assertTrue(message + ". Must be PropertyExpression", expression instanceof PropertyExpression);
+ PropertyExpression propExp = (PropertyExpression)expression;
+ assertEquals(message + ". Property name", expected, propExp.getName());
+ }
+
+ protected BooleanExpression parse(String text) throws Exception {
+ return SelectorParser.parse(text);
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorTest.java
new file mode 100755
index 0000000..29fc4db
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/selector/SelectorTest.java
@@ -0,0 +1,477 @@
+/**
+ * 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.qpid.jms.selector;
+
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+
+import org.apache.qpid.jms.selector.SelectorParser;
+import org.apache.qpid.jms.selector.filter.BooleanExpression;
+import org.apache.qpid.jms.selector.filter.FilterException;
+import org.apache.qpid.jms.selector.filter.Filterable;
+
+@SuppressWarnings("unchecked")
+public class SelectorTest extends TestCase {
+
+ static class MockMessage implements Filterable {
+
+ HashMap<String, Object> properties = new HashMap<String, Object>();
+ private String text;
+ private Object destination;
+ private String messageId;
+ private String type;
+ private Object localConnectionId;
+
+ public void setDestination(Object destination) {
+ this.destination=destination;
+ }
+ public void setJMSMessageID(String messageId) {
+ this.messageId = messageId;
+ }
+ public void setJMSType(String type) {
+ this.type = type;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setBooleanProperty(String key, boolean value) {
+ properties.put(key, value);
+ }
+
+ public void setStringProperty(String key, String value) {
+ properties.put(key, value);
+ }
+
+ public void setByteProperty(String key, byte value) {
+ properties.put(key, value);
+ }
+
+ public void setDoubleProperty(String key, double value) {
+ properties.put(key, value);
+ }
+
+ public void setFloatProperty(String key, float value) {
+ properties.put(key, value);
+ }
+
+ public void setLongProperty(String key, long value) {
+ properties.put(key, value);
+ }
+
+ public void setIntProperty(String key, int value) {
+ properties.put(key, value);
+ }
+
+ public void setShortProperty(String key, short value) {
+ properties.put(key, value);
+ }
+
+ public void setObjectProperty(String key, Object value) {
+ properties.put(key, value);
+ }
+
+ @Override
+ public <T> T getBodyAs(Class<T> type) throws FilterException {
+ if( type == String.class ) {
+ return type.cast(text);
+ }
+ return null;
+ }
+
+ @Override
+ public Object getProperty(String name) {
+ if( "JMSType".equals(name) ) {
+ return type;
+ }
+ if( "JMSMessageID".equals(name) ) {
+ return messageId;
+ }
+ return properties.get(name);
+ }
+
+ public <T> T getDestination() {
+ return (T)destination;
+ }
+
+ @Override
+ public Object getLocalConnectionId() {
+ return localConnectionId;
+ }
+ }
+
+ public void testBooleanSelector() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "(trueProp OR falseProp) AND trueProp", true);
+ assertSelector(message, "(trueProp OR falseProp) AND falseProp", false);
+ }
+
+ public void testXPathSelectors() throws Exception {
+ MockMessage message = new MockMessage();
+
+ message.setJMSType("xml");
+ message.setText("<root><a key='first' num='1'/><b key='second' num='2'>b</b></root>");
+
+ assertSelector(message, "XPATH 'root/a'", true);
+ assertSelector(message, "XPATH '//root/b'", true);
+ assertSelector(message, "XPATH 'root/c'", false);
+ assertSelector(message, "XPATH '//root/b/text()=\"b\"'", true);
+ assertSelector(message, "XPATH '//root/b=\"b\"'", true);
+ assertSelector(message, "XPATH '//root/b=\"c\"'", false);
+ assertSelector(message, "XPATH '//root/b!=\"c\"'", true);
+
+ assertSelector(message, "XPATH '//root/*[@key=''second'']'", true);
+ assertSelector(message, "XPATH '//root/*[@key=''third'']'", false);
+ assertSelector(message, "XPATH '//root/a[@key=''first'']'", true);
+ assertSelector(message, "XPATH '//root/a[@num=1]'", true);
+ assertSelector(message, "XPATH '//root/a[@key=''second'']'", false);
+
+ assertSelector(message, "XPATH '/root/*[@key=''first'' or @key=''third'']'", true);
+ assertSelector(message, "XPATH '//root/*[@key=''third'' or @key=''forth'']'", false);
+
+ assertSelector(message, "XPATH '/root/b=''b'' and /root/b[@key=''second'']'", true);
+ assertSelector(message, "XPATH '/root/b=''b'' and /root/b[@key=''first'']'", false);
+
+ assertSelector(message, "XPATH 'not(//root/a)'", false);
+ assertSelector(message, "XPATH 'not(//root/c)'", true);
+ assertSelector(message, "XPATH '//root/a[not(@key=''first'')]'", false);
+ assertSelector(message, "XPATH '//root/a[not(not(@key=''first''))]'", true);
+
+ assertSelector(message, "XPATH 'string(//root/b)'", true);
+ assertSelector(message, "XPATH 'string(//root/a)'", false);
+
+ assertSelector(message, "XPATH 'sum(//@num) < 10'", true);
+ assertSelector(message, "XPATH 'sum(//@num) > 10'", false);
+
+ assertSelector(message, "XPATH '//root/a[@num > 1]'", false);
+ assertSelector(message, "XPATH '//root/b[@num > 1]'", true);
+ }
+
+ public void testJMSPropertySelectors() throws Exception {
+ MockMessage message = createMessage();
+ message.setJMSType("selector-test");
+ message.setJMSMessageID("id:test:1:1:1:1");
+
+ assertSelector(message, "JMSType = 'selector-test'", true);
+ assertSelector(message, "JMSType = 'crap'", false);
+
+ assertSelector(message, "JMSMessageID = 'id:test:1:1:1:1'", true);
+ assertSelector(message, "JMSMessageID = 'id:not-test:1:1:1:1'", false);
+
+ message = createMessage();
+ message.setJMSType("1001");
+
+ assertSelector(message, "JMSType='1001'", true);
+ assertSelector(message, "JMSType='1001' OR JMSType='1002'", true);
+ assertSelector(message, "JMSType = 'crap'", false);
+ }
+
+ public void testBasicSelectors() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "name = 'James'", true);
+ assertSelector(message, "rank > 100", true);
+ assertSelector(message, "rank >= 123", true);
+ assertSelector(message, "rank >= 124", false);
+ }
+
+ public void testPropertyTypes() throws Exception {
+ MockMessage message = createMessage();
+ assertSelector(message, "byteProp = 123", true);
+ assertSelector(message, "byteProp = 10", false);
+ assertSelector(message, "byteProp2 = 33", true);
+ assertSelector(message, "byteProp2 = 10", false);
+
+ assertSelector(message, "shortProp = 123", true);
+ assertSelector(message, "shortProp = 10", false);
+
+ assertSelector(message, "shortProp = 123", true);
+ assertSelector(message, "shortProp = 10", false);
+
+ assertSelector(message, "intProp = 123", true);
+ assertSelector(message, "intProp = 10", false);
+
+ assertSelector(message, "longProp = 123", true);
+ assertSelector(message, "longProp = 10", false);
+
+ assertSelector(message, "floatProp = 123", true);
+ assertSelector(message, "floatProp = 10", false);
+
+ assertSelector(message, "doubleProp = 123", true);
+ assertSelector(message, "doubleProp = 10", false);
+ }
+
+ public void testAndSelectors() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "name = 'James' and rank < 200", true);
+ assertSelector(message, "name = 'James' and rank > 200", false);
+ assertSelector(message, "name = 'Foo' and rank < 200", false);
+ assertSelector(message, "unknown = 'Foo' and anotherUnknown < 200", false);
+ }
+
+ public void testOrSelectors() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "name = 'James' or rank < 200", true);
+ assertSelector(message, "name = 'James' or rank > 200", true);
+ assertSelector(message, "name = 'Foo' or rank < 200", true);
+ assertSelector(message, "name = 'Foo' or rank > 200", false);
+ assertSelector(message, "unknown = 'Foo' or anotherUnknown < 200", false);
+ }
+
+ public void testPlus() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "rank + 2 = 125", true);
+ assertSelector(message, "(rank + 2) = 125", true);
+ assertSelector(message, "125 = (rank + 2)", true);
+ assertSelector(message, "rank + version = 125", true);
+ assertSelector(message, "rank + 2 < 124", false);
+ assertSelector(message, "name + '!' = 'James!'", true);
+ }
+
+ public void testMinus() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "rank - 2 = 121", true);
+ assertSelector(message, "rank - version = 121", true);
+ assertSelector(message, "rank - 2 > 122", false);
+ }
+
+ public void testMultiply() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "rank * 2 = 246", true);
+ assertSelector(message, "rank * version = 246", true);
+ assertSelector(message, "rank * 2 < 130", false);
+ }
+
+ public void testDivide() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "rank / version = 61.5", true);
+ assertSelector(message, "rank / 3 > 100.0", false);
+ assertSelector(message, "rank / 3 > 100", false);
+ assertSelector(message, "version / 2 = 1", true);
+ }
+
+ public void testBetween() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "rank between 100 and 150", true);
+ assertSelector(message, "rank between 10 and 120", false);
+ }
+
+ public void testIn() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "name in ('James', 'Bob', 'Gromit')", true);
+ assertSelector(message, "name in ('Bob', 'James', 'Gromit')", true);
+ assertSelector(message, "name in ('Gromit', 'Bob', 'James')", true);
+
+ assertSelector(message, "name in ('Gromit', 'Bob', 'Cheddar')", false);
+ assertSelector(message, "name not in ('Gromit', 'Bob', 'Cheddar')", true);
+ }
+
+ public void testIsNull() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "dummy is null", true);
+ assertSelector(message, "dummy is not null", false);
+ assertSelector(message, "name is not null", true);
+ assertSelector(message, "name is null", false);
+ }
+
+ public void testLike() throws Exception {
+ MockMessage message = createMessage();
+ message.setStringProperty("modelClassId", "com.whatever.something.foo.bar");
+ message.setStringProperty("modelInstanceId", "170");
+ message.setStringProperty("modelRequestError", "abc");
+ message.setStringProperty("modelCorrelatedClientId", "whatever");
+
+ assertSelector(message, "modelClassId LIKE 'com.whatever.something.%' AND modelInstanceId = '170' AND (modelRequestError IS NULL OR modelCorrelatedClientId = 'whatever')",
+ true);
+
+ message.setStringProperty("modelCorrelatedClientId", "shouldFailNow");
+
+ assertSelector(message, "modelClassId LIKE 'com.whatever.something.%' AND modelInstanceId = '170' AND (modelRequestError IS NULL OR modelCorrelatedClientId = 'whatever')",
+ false);
+
+ message = createMessage();
+ message.setStringProperty("modelClassId", "com.whatever.something.foo.bar");
+ message.setStringProperty("modelInstanceId", "170");
+ message.setStringProperty("modelCorrelatedClientId", "shouldNotMatch");
+
+ assertSelector(message, "modelClassId LIKE 'com.whatever.something.%' AND modelInstanceId = '170' AND (modelRequestError IS NULL OR modelCorrelatedClientId = 'whatever')",
+ true);
+ }
+
+ /**
+ * Test cases from Mats Henricson
+ */
+ public void testMatsHenricsonUseCases() throws Exception {
+ MockMessage message = createMessage();
+ assertSelector(message, "SessionserverId=1870414179", false);
+
+ message.setLongProperty("SessionserverId", 1870414179);
+ assertSelector(message, "SessionserverId=1870414179", true);
+
+ message.setLongProperty("SessionserverId", 1234);
+ assertSelector(message, "SessionserverId=1870414179", false);
+
+ assertSelector(message, "Command NOT IN ('MirrorLobbyRequest', 'MirrorLobbyReply')", false);
+
+ message.setStringProperty("Command", "Cheese");
+ assertSelector(message, "Command NOT IN ('MirrorLobbyRequest', 'MirrorLobbyReply')", true);
+
+ message.setStringProperty("Command", "MirrorLobbyRequest");
+ assertSelector(message, "Command NOT IN ('MirrorLobbyRequest', 'MirrorLobbyReply')", false);
+ message.setStringProperty("Command", "MirrorLobbyReply");
+ assertSelector(message, "Command NOT IN ('MirrorLobbyRequest', 'MirrorLobbyReply')", false);
+ }
+
+ public void testFloatComparisons() throws Exception {
+ MockMessage message = createMessage();
+
+ // JMS 1.1 Section 3.8.1.1 : Approximate literals use the Java
+ // floating-point literal syntax.
+ // We will use the java varible x to demo valid floating point syntaxs.
+ double x;
+
+ // test decimals like x.x
+ x = 1.0;
+ x = -1.1;
+ x = 1.0E1;
+ x = 1.1E1;
+ x = -1.1E1;
+ assertSelector(message, "1.0 < 1.1", true);
+ assertSelector(message, "-1.1 < 1.0", true);
+ assertSelector(message, "1.0E1 < 1.1E1", true);
+ assertSelector(message, "-1.1E1 < 1.0E1", true);
+
+ // test decimals like x.
+ x = 1.;
+ x = 1.E1;
+ assertSelector(message, "1. < 1.1", true);
+ assertSelector(message, "-1.1 < 1.", true);
+ assertSelector(message, "1.E1 < 1.1E1", true);
+ assertSelector(message, "-1.1E1 < 1.E1", true);
+
+ // test decimals like .x
+ x = .5;
+ x = -.5;
+ x = .5E1;
+ assertSelector(message, ".1 < .5", true);
+ assertSelector(message, "-.5 < .1", true);
+ assertSelector(message, ".1E1 < .5E1", true);
+ assertSelector(message, "-.5E1 < .1E1", true);
+
+ // test exponents
+ x = 4E10;
+ x = -4E10;
+ x = 5E+10;
+ x = 5E-10;
+ assertSelector(message, "4E10 < 5E10", true);
+ assertSelector(message, "5E8 < 5E10", true);
+ assertSelector(message, "-4E10 < 2E10", true);
+ assertSelector(message, "-5E8 < 2E2", true);
+ assertSelector(message, "4E+10 < 5E+10", true);
+ assertSelector(message, "4E-10 < 5E-10", true);
+ }
+
+ public void testStringQuoteParsing() throws Exception {
+ MockMessage message = createMessage();
+ assertSelector(message, "quote = '''In God We Trust'''", true);
+ }
+
+ public void testLikeComparisons() throws Exception {
+ MockMessage message = createMessage();
+
+ assertSelector(message, "quote LIKE '''In G_d We Trust'''", true);
+ assertSelector(message, "quote LIKE '''In Gd_ We Trust'''", false);
+ assertSelector(message, "quote NOT LIKE '''In G_d We Trust'''", false);
+ assertSelector(message, "quote NOT LIKE '''In Gd_ We Trust'''", true);
+
+ assertSelector(message, "foo LIKE '%oo'", true);
+ assertSelector(message, "foo LIKE '%ar'", false);
+ assertSelector(message, "foo NOT LIKE '%oo'", false);
+ assertSelector(message, "foo NOT LIKE '%ar'", true);
+
+ assertSelector(message, "foo LIKE '!_%' ESCAPE '!'", true);
+ assertSelector(message, "quote LIKE '!_%' ESCAPE '!'", false);
+ assertSelector(message, "foo NOT LIKE '!_%' ESCAPE '!'", false);
+ assertSelector(message, "quote NOT LIKE '!_%' ESCAPE '!'", true);
+
+ assertSelector(message, "punctuation LIKE '!#$&()*+,-./:;<=>?@[\\]^`{|}~'", true);
+ }
+
+ public void testInvalidSelector() throws Exception {
+ MockMessage message = createMessage();
+ assertInvalidSelector(message, "3+5");
+ assertInvalidSelector(message, "True AND 3+5");
+ assertInvalidSelector(message, "=TEST 'test'");
+ }
+
+ protected MockMessage createMessage() {
+ MockMessage message = createMessage("FOO.BAR");
+ message.setJMSType("selector-test");
+ message.setJMSMessageID("connection:1:1:1:1");
+ message.setObjectProperty("name", "James");
+ message.setObjectProperty("location", "London");
+
+ message.setByteProperty("byteProp", (byte)123);
+ message.setByteProperty("byteProp2", (byte)33);
+ message.setShortProperty("shortProp", (short)123);
+ message.setIntProperty("intProp", 123);
+ message.setLongProperty("longProp", 123);
+ message.setFloatProperty("floatProp", 123);
+ message.setDoubleProperty("doubleProp", 123);
+
+ message.setIntProperty("rank", 123);
+ message.setIntProperty("version", 2);
+ message.setStringProperty("quote", "'In God We Trust'");
+ message.setStringProperty("foo", "_foo");
+ message.setStringProperty("punctuation", "!#$&()*+,-./:;<=>?@[\\]^`{|}~");
+ message.setBooleanProperty("trueProp", true);
+ message.setBooleanProperty("falseProp", false);
+ return message;
+ }
+
+ protected void assertInvalidSelector(MockMessage message, String text) {
+ try {
+ SelectorParser.parse(text);
+ fail("Created a valid selector");
+ } catch (FilterException e) {
+ }
+ }
+
+ protected void assertSelector(MockMessage message, String text, boolean expected) throws FilterException {
+ BooleanExpression selector = SelectorParser.parse(text);
+ assertTrue("Created a valid selector", selector != null);
+ boolean value = selector.matches(message);
+ assertEquals("Selector for: " + text, expected, value);
+ }
+
+ protected MockMessage createMessage(String subject) {
+ MockMessage message = new MockMessage();
+ message.setDestination(subject);
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml b/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
index c925d74..238c0f5 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/pom.xml
@@ -43,11 +43,6 @@
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-jms-discovery</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-jms-selector</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-selector/pom.xml
----------------------------------------------------------------------
diff --git a/qpid-jms-selector/pom.xml b/qpid-jms-selector/pom.xml
deleted file mode 100644
index 4b48346..0000000
--- a/qpid-jms-selector/pom.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-jms-parent</artifactId>
- <version>0.1-SNAPSHOT</version>
- </parent>
-
- <packaging>jar</packaging>
- <artifactId>qpid-jms-selector</artifactId>
- <name>QpidJMS Selector</name>
- <description>The Qpid JMS optional message selector validation library</description>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <dependencies>
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <configuration>
- <sourceDirectory>${basedir}/src/main/javacc</sourceDirectory>
- <outputDirectory>${basedir}/target/generated-sources/javacc</outputDirectory>
- </configuration>
- <goals>
- <goal>javacc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${basedir}/target/generated-sources/javacc</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence
- on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>
- javacc-maven-plugin
- </artifactId>
- <versionRange>[2.6,)</versionRange>
- <goals>
- <goal>javacc</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute>
- <runOnIncremental>true</runOnIncremental>
- </execute>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/LRUCache.java
----------------------------------------------------------------------
diff --git a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/LRUCache.java b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/LRUCache.java
deleted file mode 100755
index 6e9858d..0000000
--- a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/LRUCache.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * 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.qpid.jms.selector;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * A Simple LRU Cache
- *
- * @param <K>
- * @param <V>
- */
-
-public class LRUCache<K, V> extends LinkedHashMap<K, V> {
- private static final long serialVersionUID = -342098639681884413L;
- protected int maxCacheSize = 10000;
-
- /**
- * Default constructor for an LRU Cache The default capacity is 10000
- */
- public LRUCache() {
- this(0,10000, 0.75f, true);
- }
-
- /**
- * Constructs a LRUCache with a maximum capacity
- *
- * @param maximumCacheSize
- */
- public LRUCache(int maximumCacheSize) {
- this(0, maximumCacheSize, 0.75f, true);
- }
-
- /**
- * Constructs an empty <tt>LRUCache</tt> instance with the specified
- * initial capacity, maximumCacheSize,load factor and ordering mode.
- *
- * @param initialCapacity the initial capacity.
- * @param maximumCacheSize
- * @param loadFactor the load factor.
- * @param accessOrder the ordering mode - <tt>true</tt> for access-order,
- * <tt>false</tt> for insertion-order.
- * @throws IllegalArgumentException if the initial capacity is negative or
- * the load factor is non-positive.
- */
-
- public LRUCache(int initialCapacity, int maximumCacheSize, float loadFactor, boolean accessOrder) {
- super(initialCapacity, loadFactor, accessOrder);
- this.maxCacheSize = maximumCacheSize;
- }
-
- /**
- * @return Returns the maxCacheSize.
- */
- public int getMaxCacheSize() {
- return maxCacheSize;
- }
-
- /**
- * @param maxCacheSize The maxCacheSize to set.
- */
- public void setMaxCacheSize(int maxCacheSize) {
- this.maxCacheSize = maxCacheSize;
- }
-
- protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
- if( size() > maxCacheSize ) {
- onCacheEviction(eldest);
- return true;
- }
- return false;
- }
-
- protected void onCacheEviction(Map.Entry<K,V> eldest) {
- }
-}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/SelectorParser.java
----------------------------------------------------------------------
diff --git a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/SelectorParser.java b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/SelectorParser.java
deleted file mode 100644
index 9e68112..0000000
--- a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/SelectorParser.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.qpid.jms.selector;
-
-import org.apache.qpid.jms.selector.filter.BooleanExpression;
-import org.apache.qpid.jms.selector.filter.ComparisonExpression;
-import org.apache.qpid.jms.selector.filter.FilterException;
-import org.apache.qpid.jms.selector.hyphenated.HyphenatedParser;
-import org.apache.qpid.jms.selector.strict.StrictParser;
-
-import java.io.StringReader;
-
-/**
- */
-public class SelectorParser {
-
- private static final LRUCache cache = new LRUCache(100);
- private static final String CONVERT_STRING_EXPRESSIONS_PREFIX = "convert_string_expressions:";
- private static final String HYPHENATED_PROPS_PREFIX = "hyphenated_props:";
- private static final String NO_CONVERT_STRING_EXPRESSIONS_PREFIX = "no_convert_string_expressions:";
- private static final String NO_HYPHENATED_PROPS_PREFIX = "no_hyphenated_props:";
-
- public static BooleanExpression parse(String sql) throws FilterException {
- Object result = cache.get(sql);
- if (result instanceof FilterException) {
- throw (FilterException) result;
- } else if (result instanceof BooleanExpression) {
- return (BooleanExpression) result;
- } else {
- String actual = sql;
- boolean convertStringExpressions = false;
- boolean hyphenatedProps=false;
- while(true) {
- if( actual.startsWith(CONVERT_STRING_EXPRESSIONS_PREFIX)) {
- convertStringExpressions = true;
- actual = actual.substring(CONVERT_STRING_EXPRESSIONS_PREFIX.length());
- continue;
- }
- if( actual.startsWith(HYPHENATED_PROPS_PREFIX)) {
- hyphenatedProps = true;
- actual = actual.substring(HYPHENATED_PROPS_PREFIX.length());
- continue;
- }
- if( actual.startsWith(NO_CONVERT_STRING_EXPRESSIONS_PREFIX)) {
- convertStringExpressions = false;
- actual = actual.substring(NO_CONVERT_STRING_EXPRESSIONS_PREFIX.length());
- continue;
- }
- if( actual.startsWith(NO_HYPHENATED_PROPS_PREFIX)) {
- hyphenatedProps = false;
- actual = actual.substring(NO_HYPHENATED_PROPS_PREFIX.length());
- continue;
- }
- break;
- }
-
- if( convertStringExpressions ) {
- ComparisonExpression.CONVERT_STRING_EXPRESSIONS.set(true);
- }
- try {
- BooleanExpression e = null;
- if( hyphenatedProps ) {
- HyphenatedParser parser = new HyphenatedParser(new StringReader(actual));
- e = parser.JmsSelector();
- } else {
- StrictParser parser = new StrictParser(new StringReader(actual));
- e = parser.JmsSelector();
- }
- cache.put(sql, e);
- return e;
- } catch (Throwable e) {
- FilterException fe = new FilterException(actual, e);
- cache.put(sql, fe);
- throw fe;
- } finally {
- if( convertStringExpressions ) {
- ComparisonExpression.CONVERT_STRING_EXPRESSIONS.remove();
- }
- }
- }
- }
-
- public static void clearCache() {
- cache.clear();
- }
-}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/ArithmeticExpression.java
----------------------------------------------------------------------
diff --git a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/ArithmeticExpression.java b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/ArithmeticExpression.java
deleted file mode 100755
index 8aa0c25..0000000
--- a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/ArithmeticExpression.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * 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.qpid.jms.selector.filter;
-
-/**
- * An expression which performs an operation on two expression values
- */
-public abstract class ArithmeticExpression extends BinaryExpression {
-
- protected static final int INTEGER = 1;
- protected static final int LONG = 2;
- protected static final int DOUBLE = 3;
- boolean convertStringExpressions = false;
-
- /**
- * @param left
- * @param right
- */
- public ArithmeticExpression(Expression left, Expression right) {
- super(left, right);
- convertStringExpressions = ComparisonExpression.CONVERT_STRING_EXPRESSIONS.get()!=null;
- }
-
- public static Expression createPlus(Expression left, Expression right) {
- return new ArithmeticExpression(left, right) {
- @Override
- protected Object evaluate(Object lvalue, Object rvalue) {
- if (lvalue instanceof String) {
- String text = (String)lvalue;
- String answer = text + rvalue;
- return answer;
- } else {
- return plus(asNumber(lvalue), asNumber(rvalue));
- }
- }
-
- @Override
- public String getExpressionSymbol() {
- return "+";
- }
- };
- }
-
- public static Expression createMinus(Expression left, Expression right) {
- return new ArithmeticExpression(left, right) {
- @Override
- protected Object evaluate(Object lvalue, Object rvalue) {
- return minus(asNumber(lvalue), asNumber(rvalue));
- }
-
- @Override
- public String getExpressionSymbol() {
- return "-";
- }
- };
- }
-
- public static Expression createMultiply(Expression left, Expression right) {
- return new ArithmeticExpression(left, right) {
-
- @Override
- protected Object evaluate(Object lvalue, Object rvalue) {
- return multiply(asNumber(lvalue), asNumber(rvalue));
- }
-
- @Override
- public String getExpressionSymbol() {
- return "*";
- }
- };
- }
-
- public static Expression createDivide(Expression left, Expression right) {
- return new ArithmeticExpression(left, right) {
-
- @Override
- protected Object evaluate(Object lvalue, Object rvalue) {
- return divide(asNumber(lvalue), asNumber(rvalue));
- }
-
- @Override
- public String getExpressionSymbol() {
- return "/";
- }
- };
- }
-
- public static Expression createMod(Expression left, Expression right) {
- return new ArithmeticExpression(left, right) {
-
- @Override
- protected Object evaluate(Object lvalue, Object rvalue) {
- return mod(asNumber(lvalue), asNumber(rvalue));
- }
-
- @Override
- public String getExpressionSymbol() {
- return "%";
- }
- };
- }
-
- protected Number plus(Number left, Number right) {
- switch (numberType(left, right)) {
- case INTEGER:
- return Integer.valueOf(left.intValue() + right.intValue());
- case LONG:
- return Long.valueOf(left.longValue() + right.longValue());
- default:
- return new Double(left.doubleValue() + right.doubleValue());
- }
- }
-
- protected Number minus(Number left, Number right) {
- switch (numberType(left, right)) {
- case INTEGER:
- return Integer.valueOf(left.intValue() - right.intValue());
- case LONG:
- return Long.valueOf(left.longValue() - right.longValue());
- default:
- return new Double(left.doubleValue() - right.doubleValue());
- }
- }
-
- protected Number multiply(Number left, Number right) {
- switch (numberType(left, right)) {
- case INTEGER:
- return Integer.valueOf(left.intValue() * right.intValue());
- case LONG:
- return Long.valueOf(left.longValue() * right.longValue());
- default:
- return new Double(left.doubleValue() * right.doubleValue());
- }
- }
-
- protected Number divide(Number left, Number right) {
- return new Double(left.doubleValue() / right.doubleValue());
- }
-
- protected Number mod(Number left, Number right) {
- return new Double(left.doubleValue() % right.doubleValue());
- }
-
- private int numberType(Number left, Number right) {
- if (isDouble(left) || isDouble(right)) {
- return DOUBLE;
- } else if (left instanceof Long || right instanceof Long) {
- return LONG;
- } else {
- return INTEGER;
- }
- }
-
- private boolean isDouble(Number n) {
- return n instanceof Float || n instanceof Double;
- }
-
- protected Number asNumber(Object value) {
- if (value instanceof Number) {
- return (Number)value;
- } else {
- if( convertStringExpressions && value instanceof String) {
- String v = (String) value;
- try {
- if( v.contains(".") ) {
- return new Double(v);
- } else {
- return Long.valueOf(v);
- }
- } catch (NumberFormatException e) {
- throw new RuntimeException("Cannot convert value: " + value + " into a number");
- }
- }
- throw new RuntimeException("Cannot convert value: " + value + " into a number");
- }
- }
-
- @Override
- public Object evaluate(Filterable message) throws FilterException {
- Object lvalue = left.evaluate(message);
- if (lvalue == null) {
- return null;
- }
- Object rvalue = right.evaluate(message);
- if (rvalue == null) {
- return null;
- }
- return evaluate(lvalue, rvalue);
- }
-
- /**
- * @param lvalue
- * @param rvalue
- * @return
- */
- protected abstract Object evaluate(Object lvalue, Object rvalue);
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BinaryExpression.java
----------------------------------------------------------------------
diff --git a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BinaryExpression.java b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BinaryExpression.java
deleted file mode 100755
index c36cecb..0000000
--- a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BinaryExpression.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.qpid.jms.selector.filter;
-
-/**
- * An expression which performs an operation on two expression values.
- *
- */
-public abstract class BinaryExpression implements Expression {
- protected Expression left;
- protected Expression right;
-
- public BinaryExpression(Expression left, Expression right) {
- this.left = left;
- this.right = right;
- }
-
- public Expression getLeft() {
- return left;
- }
-
- public Expression getRight() {
- return right;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "(" + left.toString() + " " + getExpressionSymbol() + " " + right.toString() + ")";
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return toString().hashCode();
- }
-
- /**
- * TODO: more efficient hashCode()
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object o) {
-
- if (o == null || !this.getClass().equals(o.getClass())) {
- return false;
- }
- return toString().equals(o.toString());
- }
-
- /**
- * Returns the symbol that represents this binary expression. For example, addition is
- * represented by "+"
- *
- * @return
- */
- public abstract String getExpressionSymbol();
-
- /**
- * @param expression
- */
- public void setRight(Expression expression) {
- right = expression;
- }
-
- /**
- * @param expression
- */
- public void setLeft(Expression expression) {
- left = expression;
- }
-}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/98a99d3b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BooleanExpression.java
----------------------------------------------------------------------
diff --git a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BooleanExpression.java b/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BooleanExpression.java
deleted file mode 100755
index 21a3d4b..0000000
--- a/qpid-jms-selector/src/main/java/org/apache/qpid/jms/selector/filter/BooleanExpression.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.qpid.jms.selector.filter;
-
-/**
- * A BooleanExpression is an expression that always
- * produces a Boolean result.
- */
-public interface BooleanExpression extends Expression {
-
- /**
- * @param message
- * @return true if the expression evaluates to Boolean.TRUE.
- * @throws FilterException
- */
- boolean matches(Filterable message) throws FilterException;
-
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org