You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2016/03/16 04:44:52 UTC

[42/49] bookkeeper git commit: BOOKKEEPER-769: Remove the Hedwig Code

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/PropertyExprFunction.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/PropertyExprFunction.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/PropertyExprFunction.java
deleted file mode 100644
index 83df4f1..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/PropertyExprFunction.java
+++ /dev/null
@@ -1,512 +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.hedwig.jms.selector;
-
-import org.apache.hedwig.jms.message.MessageImpl;
-
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-/**
- * Handles property (and header) dereference against message evaluation (based on identifier specified).
- */
-public abstract class PropertyExprFunction implements ExprFunction {
-
-    public static class LookupExpr extends PropertyExprFunction {
-        private final String identifier;
-
-        public LookupExpr(String identifier) {
-            this.identifier = identifier;
-        }
-
-        @Override
-        public void evaluate(SelectorEvalState state) throws SelectorEvaluationException {
-            // No (stack) params required ...
-
-            SelectorConstant result = doEvaluate(state.getMessage());
-            if (MyNode.logger.isTraceEnabled()) MyNode.logger.trace(getClass() + ": identifier '" +
-                identifier + "' -> " + result);
-            state.getStack().push(result);
-            return;
-        }
-
-        private SelectorConstant doEvaluate(final MessageImpl message) throws SelectorEvaluationException {
-
-
-            if (!message.propertyExists(identifier)) {
-                // defaulting to String, does it matter ?
-                return new SelectorConstant((String) null);
-            }
-
-            final Object val = message.getSelectorProcessingPropertyValue(identifier);
-
-            if (val instanceof Byte) {
-                return new SelectorConstant((int) (Byte) val);
-            }
-            if (val instanceof Short) {
-                return new SelectorConstant((int) (Short) val);
-            }
-            if (val instanceof Integer) {
-                return new SelectorConstant((Integer) val);
-            }
-            if (val instanceof Long) {
-                long lval = (Long) val;
-                if (lval >= (long) Integer.MAX_VALUE || lval <= (long) Integer.MIN_VALUE)
-                    throw new SelectorEvaluationException(getClass() + " long value " + lval +
-                        " out of range for an int");
-
-                return new SelectorConstant((int) lval);
-            }
-            if (val instanceof Boolean) {
-                return new SelectorConstant((Boolean) val);
-            }
-            if (val instanceof Float) {
-                return new SelectorConstant((double) (Float) val);
-            }
-            if (val instanceof Double) {
-                return new SelectorConstant((Double) val);
-            }
-            if (val instanceof String) {
-                return new SelectorConstant((String) val);
-            }
-
-
-            throw new SelectorEvaluationException(getClass() + " Unable to interpret value '" + val +
-                "' for identifier " + identifier);
-        }
-
-        @Override
-        public String toString() {
-            final StringBuilder sb = new StringBuilder();
-            sb.append("LookupExpr");
-            sb.append("{identifier='").append(identifier).append('\'');
-            sb.append('}');
-            return sb.toString();
-        }
-    }
-
-    public static class IsNullExpr extends PropertyExprFunction {
-
-        private final boolean negate;
-
-        public IsNullExpr(boolean negate) {
-            this.negate = negate;
-        }
-
-        @Override
-        public void evaluate(SelectorEvalState state) throws SelectorEvaluationException {
-
-            final SelectorConstant result = doEvaluate(state);
-            if (MyNode.logger.isTraceEnabled()) MyNode.logger.trace(getClass() + " -> " + result);
-            state.getStack().push(result);
-        }
-
-        private SelectorConstant doEvaluate(SelectorEvalState state) throws SelectorEvaluationException {
-
-            if (state.getStack().isEmpty())
-                throw new SelectorEvaluationException(getClass() + " stack corruption ? " + state.getStack());
-
-            final SelectorConstant value = state.getStack().pop();
-
-            boolean result = value.isNull();
-            if (negate) result = !result;
-            return new SelectorConstant(result);
-        }
-
-        @Override
-        public String toString() {
-            final StringBuilder sb = new StringBuilder();
-            sb.append("IsNullExpr");
-            sb.append("{negate=").append(negate);
-            sb.append('}');
-            return sb.toString();
-        }
-    }
-
-    public static class InExpr extends PropertyExprFunction {
-
-        private final boolean negate;
-
-        public InExpr(boolean negate) {
-            this.negate = negate;
-        }
-
-        @Override
-        public void evaluate(SelectorEvalState state) throws SelectorEvaluationException {
-            if (state.getStack().size() < 2)
-                throw new SelectorEvaluationException(getClass() + " stack corruption ? " + state.getStack());
-
-            final SelectorConstant paramSet = state.getStack().pop();
-            final SelectorConstant checkFor = state.getStack().pop();
-
-            final SelectorConstant result = doEvaluate(paramSet, checkFor);
-            if (MyNode.logger.isTraceEnabled()) MyNode.logger.trace(getClass() + ": checkFor '" +
-                checkFor + "', paramSet '" + paramSet+ "' -> " + result);
-
-            state.getStack().push(result);
-            return ;
-
-        }
-
-        private SelectorConstant doEvaluate(SelectorConstant paramSet, SelectorConstant checkFor)
-            throws SelectorEvaluationException {
-
-            if (checkFor.isNull()){
-                return new SelectorConstant((String) null);
-            }
-
-            if (SelectorConstant.SelectorDataType.STRING_SET != paramSet.type) {
-                throw new SelectorEvaluationException(getClass() + " Expected string list, found : " +
-                    paramSet.type + ", for " + paramSet);
-            }
-            if (SelectorConstant.SelectorDataType.STRING != checkFor.type){
-                throw new SelectorEvaluationException(getClass() + " Expected string , found : " +
-                    checkFor.type + ", for " + checkFor);
-            }
-
-            boolean result = paramSet.getStringSet().contains(checkFor.getStringValue());
-            if (negate) result = !result;
-            return new SelectorConstant(result);
-        }
-
-        @Override
-        public String toString() {
-            final StringBuilder sb = new StringBuilder();
-            sb.append("InExpr");
-            sb.append("{negate=").append(negate);
-            sb.append('}');
-            return sb.toString();
-        }
-    }
-
-    public static class LikeExpr extends PropertyExprFunction {
-
-        private final Pattern likePattern;
-        private final String likePatternStr;
-        private final boolean negate;
-
-        public LikeExpr(String likeExpression, String escapeCharacter, boolean negate) throws ParseException {
-            if (null != escapeCharacter && 1 != escapeCharacter.length()) {
-                throw new ParseException(getClass() + " Escape character must be a single character : '" +
-                    escapeCharacter + "'");
-            }
-            this.likePatternStr = generateRegexpPattern(likeExpression, escapeCharacter);
-            try {
-                this.likePattern = Pattern.compile(this.likePatternStr, Pattern.DOTALL);
-            } catch (PatternSyntaxException psEx){
-                throw new ParseException(LikeExpr.class + " Unable to compile '" + likeExpression +
-                    "' into regexp Pattern using '" + this.likePatternStr+ "'");
-            }
-            this.negate = negate;
-        }
-
-        private static String generateRegexpWithoutWildcard(final String expression){
-            int indxOffset = 0;
-            int substringOffset = 0;
-            StringBuilder sb = new StringBuilder();
-            while (indxOffset < expression.length()){
-                final int indxUnder = expression.indexOf('_', indxOffset);
-                final int indxMod = expression.indexOf('%', indxOffset);
-                if (-1 == indxUnder && -1 == indxMod) break;
-
-                final int indx;
-
-                if (-1 != indxUnder && -1 != indxMod) indx = Math.min(indxUnder, indxMod);
-                else if (-1 != indxUnder) indx = indxUnder;
-                else indx = indxMod;
-
-                if (indx != substringOffset) {
-                    sb.append(Pattern.quote(expression.substring(substringOffset, indx)));
-                }
-                sb.append(indx == indxUnder ? "." : ".*");
-                substringOffset = indx + 1;
-                indxOffset = indx + 1;
-            }
-            if (expression.length() != substringOffset) {
-                sb.append(Pattern.quote(expression.substring(substringOffset)));
-            }
-
-            return sb.toString();
-        }
-
-        // If wildcard if prefixed with escapeChar, ignore it.
-        private static String generateRegexpWithWildcard(final String expression, char escapeChar){
-            int indxOffset = 0;
-            int substringOffset = 0;
-            StringBuilder sb = new StringBuilder();
-            while (indxOffset < expression.length()){
-                final int indxUnder = expression.indexOf('_', indxOffset);
-                final int indxMod = expression.indexOf('%', indxOffset);
-                if (-1 == indxUnder && -1 == indxMod) break;
-
-                final int indx;
-
-                if (-1 != indxUnder && -1 != indxMod) indx = Math.min(indxUnder, indxMod);
-                else if (-1 != indxUnder) indx = indxUnder;
-                else indx = indxMod;
-
-                if (indx > 0 && escapeChar == expression.charAt(indx - 1)) {
-                    // ignore it.
-                    indxOffset = indx + 1;
-                    continue;
-                }
-
-                if (indx != substringOffset) {
-                    sb.append(Pattern.quote(expression.substring(substringOffset, indx)));
-                }
-                sb.append(indx == indxUnder ? "." : ".*");
-                substringOffset = indx + 1;
-                indxOffset = indx + 1;
-            }
-            if (expression.length() != substringOffset) {
-                sb.append(Pattern.quote(expression.substring(substringOffset)));
-            }
-
-            return sb.toString();
-        }
-
-        private static String generateRegexpPattern(final String likeExpression,
-                                                    final String escapeCharacterStr) throws ParseException {
-
-            if (null == escapeCharacterStr){
-                // Ok, hand-generating the pattern seems to be the only generic way to handle this, sigh :-(
-
-                String rpat = generateRegexpWithoutWildcard(likeExpression);
-                return rpat;
-            }
-
-            // expect this to be there ...
-            final char escapeChar = escapeCharacterStr.charAt(0);
-
-            // Test when escapeChar == ']', '[' and '^'. done !
-            String rpat = generateRegexpWithWildcard(likeExpression, escapeChar);
-
-            rpat = rpat.replace(escapeChar + "%", "%");
-            rpat = rpat.replace(escapeChar + "_", "_");
-
-            return rpat;
-        }
-
-        @Override
-        public void evaluate(SelectorEvalState state) throws SelectorEvaluationException {
-
-            if (state.getStack().isEmpty()) throw new SelectorEvaluationException(getClass() +
-                " stack corruption ? " + state.getStack());
-
-            final SelectorConstant checkFor = state.getStack().pop();
-
-            final SelectorConstant result = doEvaluate(checkFor);
-            if (MyNode.logger.isTraceEnabled()) MyNode.logger.trace(getClass() + ": checkFor '" +
-                checkFor + "' -> " + result);
-
-            state.getStack().push(result);
-            return ;
-        }
-
-        private SelectorConstant doEvaluate(SelectorConstant checkFor) throws SelectorEvaluationException {
-            if (checkFor.isNull()){
-                return new SelectorConstant((String) null);
-            }
-
-            if (SelectorConstant.SelectorDataType.STRING != checkFor.type){
-                throw new SelectorEvaluationException(getClass() + " Expected string , found : " +
-                    checkFor.type + ", for " + checkFor);
-            }
-
-
-            final String value = checkFor.getStringValue();
-
-            if (null == value) {
-                return new SelectorConstant((Boolean) null);
-            }
-
-            boolean result = likePattern.matcher(value).matches();
-            if (negate) result = !result;
-            return new SelectorConstant(result);
-        }
-
-        @Override
-        public String toString() {
-            final StringBuilder sb = new StringBuilder();
-            sb.append("LikeExpr");
-            sb.append("{likePatternStr=").append(likePatternStr);
-            sb.append(", negate=").append(negate);
-            sb.append('}');
-            return sb.toString();
-        }
-    }
-
-    public static class BetweenExpr extends PropertyExprFunction {
-
-        private final boolean negate;
-
-        public BetweenExpr(boolean negate) {
-            this.negate = negate;
-        }
-
-        @Override
-        public void evaluate(SelectorEvalState state) throws SelectorEvaluationException {
-            if (state.getStack().size() < 3){
-                throw new SelectorEvaluationException(getClass() + " stack corruption ? " + state.getStack());
-            }
-
-            final SelectorConstant right = state.getStack().pop();
-            final SelectorConstant left = state.getStack().pop();
-
-            final SelectorConstant checkFor = state.getStack().pop();
-
-            final SelectorConstant result = doEvaluate(checkFor, left, right);
-            if (MyNode.logger.isTraceEnabled()) MyNode.logger.trace(getClass() + ": left '" + left +
-                "', right '" + right + "', checkFor '" + checkFor + "' -> " + result);
-            state.getStack().push(result);
-        }
-
-        private SelectorConstant doEvaluate(final SelectorConstant checkFor, final SelectorConstant left,
-                                            final SelectorConstant right) throws SelectorEvaluationException {
-
-            if (left.isNull() || right.isNull()) {
-                // Unexpected for a bound to be null ...
-                throw new SelectorEvaluationException(getClass() + " Unexpected for left or right bound to be null " +
-                    left + ", " + right);
-            }
-
-            if (checkFor.isNull()){
-                // If checkFor is null, then it cant be between anyway - return unknown.
-                return new SelectorConstant((Boolean) null);
-            }
-
-            final Boolean result;
-
-            // Between left and right ...
-            switch (left.type) {
-                case INT: {
-                    switch (right.type) {
-                        case INT: {
-                            result = handleBetweenIntAndInt(checkFor, left.getIntValue(),
-                                right.getIntValue());
-                            break;
-                        }
-                        case DOUBLE: {
-                            result = handleBetweenIntAndDouble(checkFor, left.getIntValue(),
-                                right.getDoubleValue());
-                            break;
-                        }
-                        default:
-                            throw new SelectorEvaluationException(getClass() + " Unsupported type for right " +
-                                right.type);
-                    }
-                    break;
-                }
-                case DOUBLE: {
-                    switch (right.type) {
-                        case INT: {
-                            result = handleBetweenIntAndDouble(checkFor, right.getIntValue(),
-                                left.getDoubleValue());
-                            break;
-                        }
-                        case DOUBLE: {
-                            result = handleBetweenDoubleAndDouble(checkFor, left.getDoubleValue(),
-                                right.getDoubleValue());
-                            break;
-                        }
-                        default:
-                            throw new SelectorEvaluationException(getClass() +
-                                " Unsupported type for right " + right.type);
-                    }
-                    break;
-                }
-                default:
-                    throw new SelectorEvaluationException(getClass() + " Unsupported type for left " + right.type);
-            }
-
-            if (null == result) {
-                // Cannot find the result as the type we expected.
-                return new SelectorConstant((Boolean) null);
-            }
-
-
-            return new SelectorConstant(negate ? !result : result);
-        }
-
-        private Boolean handleBetweenIntAndInt(SelectorConstant checkFor, int intBound,
-                                               int otherIntBound) throws SelectorEvaluationException {
-            final int low = Math.min(intBound, otherIntBound);
-            final int high = Math.max(intBound, otherIntBound);
-
-            assert ! checkFor.isNull();
-
-
-            switch (checkFor.type){
-                case INT:
-                    return checkFor.getIntValue() >= low && checkFor.getIntValue() <= high;
-                case DOUBLE:
-                    return checkFor.getDoubleValue() >= low && checkFor.getDoubleValue() <= high;
-                default:
-                    throw new SelectorEvaluationException(getClass() +
-                        " Identifier value is of illegal type " + checkFor.type + " ... " + checkFor);
-            }
-        }
-
-        private Boolean handleBetweenIntAndDouble(SelectorConstant checkFor, int intBound,
-                                                  double doubleBound) throws SelectorEvaluationException {
-            final double low = Math.min((double) intBound, doubleBound);
-            final double high = Math.max((double) intBound, doubleBound);
-
-            assert ! checkFor.isNull();
-
-
-            switch (checkFor.type){
-                case INT:
-                    return checkFor.getIntValue() >= low && checkFor.getIntValue() <= high;
-                case DOUBLE:
-                    return checkFor.getDoubleValue() >= low && checkFor.getDoubleValue() <= high;
-                default:
-                    throw new SelectorEvaluationException(getClass() +
-                        " Identifier value is of illegal type " + checkFor.type + " ... " + checkFor);
-            }
-        }
-
-        private Boolean handleBetweenDoubleAndDouble(SelectorConstant checkFor, double doubleBound,
-                                                     double otherDoubleBound) throws SelectorEvaluationException {
-            final double low = Math.min(doubleBound, otherDoubleBound);
-            final double high = Math.max(doubleBound, otherDoubleBound);
-
-            assert ! checkFor.isNull();
-
-
-            switch (checkFor.type){
-                case INT:
-                    return checkFor.getIntValue() >= low && checkFor.getIntValue() <= high;
-                case DOUBLE:
-                    return checkFor.getDoubleValue() >= low && checkFor.getDoubleValue() <= high;
-                default:
-                    throw new SelectorEvaluationException(getClass() +
-                        " Identifier value is of illegal type " + checkFor.type + " ... " + checkFor);
-            }
-        }
-
-        @Override
-        public String toString() {
-            final StringBuilder sb = new StringBuilder();
-            sb.append("BetweenExpr");
-            sb.append("{negate=").append(negate);
-            sb.append('}');
-            return sb.toString();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorConstant.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorConstant.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorConstant.java
deleted file mode 100644
index e4af1c7..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorConstant.java
+++ /dev/null
@@ -1,187 +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.hedwig.jms.selector;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * A constant in the AST ends up getting pushed into the stack as this.
- */
-public class SelectorConstant {
-
-    public enum SelectorDataType {BOOLEAN, INT, DOUBLE, STRING, STRING_SET}
-
-    public final SelectorDataType type;
-
-    private final Boolean boolValue;
-    private final Integer intValue;
-    private final Double doubleValue;
-    private final String stringValue;
-
-    private final Set<String> stringSet;
-
-    public SelectorConstant(Boolean boolValue) {
-        this.type = SelectorDataType.BOOLEAN;
-        this.boolValue = boolValue;
-        this.intValue = null;
-        this.doubleValue = null;
-        this.stringValue = null;
-        this.stringSet = null;
-    }
-
-    public SelectorConstant(Integer intValue) {
-        this.type = SelectorDataType.INT;
-        this.boolValue = null;
-        this.intValue = intValue;
-        this.doubleValue = null;
-        this.stringValue = null;
-        this.stringSet = null;
-    }
-
-    public SelectorConstant(Double doubleValue) {
-        this.type = SelectorDataType.DOUBLE;
-        this.boolValue = null;
-        this.intValue = null;
-        this.doubleValue = doubleValue;
-        this.stringValue = null;
-        this.stringSet = null;
-    }
-
-    public SelectorConstant(String stringValue) {
-        this.type = SelectorDataType.STRING;
-        this.boolValue = null;
-        this.intValue = null;
-        this.doubleValue = null;
-        this.stringValue = stringValue;
-        this.stringSet = null;
-    }
-
-    public SelectorConstant(Set<String> stringSet) {
-        this.type = SelectorDataType.STRING_SET;
-        this.boolValue = null;
-        this.intValue = null;
-        this.doubleValue = null;
-        this.stringValue = null;
-        this.stringSet = stringSet;
-    }
-
-    public void addToStringSet(String value) throws ParseException {
-        if (SelectorDataType.STRING_SET != type)
-            throw new ParseException(getClass() + " Attempting to add to a non-string_list type : " + type);
-        if (null == this.stringSet) throw new ParseException(getClass() +
-            " Attempting to add to a null string_list : " + stringSet);
-        this.stringSet.add(value);
-    }
-
-    public boolean isNull() {
-        switch (type) {
-            case BOOLEAN:
-                return null == boolValue;
-            case INT:
-                return null == intValue;
-            case DOUBLE:
-                return null == doubleValue;
-            case STRING:
-                return null == stringValue;
-            case STRING_SET:
-                return null == stringSet;
-            default:
-                throw new IllegalStateException(getClass() + " Unknown type ? " + type);
-        }
-    }
-
-    public boolean isTrue() throws SelectorEvaluationException {
-        switch (type) {
-            case BOOLEAN:
-                return null != boolValue && Boolean.TRUE.equals(boolValue);
-            default:
-                throw new SelectorEvaluationException(getClass() + " Unexpected type " + type +
-                    ", value " + getValueAsString());
-        }
-    }
-
-    public String getValueAsString() throws SelectorEvaluationException {
-        switch (type) {
-            case BOOLEAN:
-                return Boolean.toString(boolValue);
-            case INT:
-                return Integer.toString(intValue);
-            case DOUBLE:
-                return Double.toString(doubleValue);
-            case STRING:
-                return stringValue;
-            case STRING_SET:
-                return null != stringSet ? stringSet.toString() : "null";
-            default:
-                throw new SelectorEvaluationException(getClass() + " Unexpected type : " + type);
-        }
-    }
-
-    public String toString() {
-        try {
-            switch (type) {
-                case BOOLEAN:
-                    return "boolean : " + getValueAsString();
-                case INT:
-                    return "int : " + getValueAsString();
-                case DOUBLE:
-                    return "double : " + getValueAsString();
-                case STRING:
-                    return "string : " + getValueAsString();
-                case STRING_SET:
-                    return "string_list : " + getValueAsString();
-                default:
-                    throw new IllegalStateException(getClass() + " Unexpected type");
-            }
-        } catch (SelectorEvaluationException seEx) {
-            throw new IllegalStateException(getClass() + " Unexpected exception", seEx);
-        }
-    }
-
-    public Boolean getBoolValue() throws SelectorEvaluationException {
-        if (SelectorDataType.BOOLEAN != type)
-            throw new SelectorEvaluationException(getClass() + " Illegal access to boolean for type " + type);
-        return boolValue;
-    }
-
-    public Integer getIntValue() throws SelectorEvaluationException {
-        if (SelectorDataType.INT != type)
-            throw new SelectorEvaluationException(getClass() + " Illegal access to boolean for type " + type);
-        return intValue;
-    }
-
-    public Double getDoubleValue() throws SelectorEvaluationException {
-        if (SelectorDataType.DOUBLE != type)
-            throw new SelectorEvaluationException(getClass() + " Illegal access to boolean for type " + type);
-        return doubleValue;
-    }
-
-    public String getStringValue() throws SelectorEvaluationException {
-        if (SelectorDataType.STRING != type)
-            throw new SelectorEvaluationException(getClass() + " Illegal access to boolean for type " + type);
-        return stringValue;
-    }
-
-    public Set<String> getStringSet() throws SelectorEvaluationException {
-        if (SelectorDataType.STRING_SET != type)
-            throw new SelectorEvaluationException(getClass() + " Illegal access to boolean for type " + type);
-        // wrap to prevent changes ...
-        return Collections.unmodifiableSet(stringSet);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvalState.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvalState.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvalState.java
deleted file mode 100644
index d760e0c..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvalState.java
+++ /dev/null
@@ -1,56 +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.hedwig.jms.selector;
-
-import org.apache.hedwig.jms.message.MessageImpl;
-
-import java.util.ArrayDeque;
-import java.util.Deque;
-
-/**
- * Holds (any) state data required to evaluate a Selector.
- */
-public class SelectorEvalState {
-    private final MessageImpl message;
-    private final Deque<SelectorConstant> stack;
-
-    // Used ONLY for debugging ... it is sad that this is part of SelectorEvalState - but I dont
-    // have time to do anything else right now !
-    private int debugIndentCount = 0;
-
-    public SelectorEvalState(MessageImpl message) {
-        this.message = message;
-        this.stack = new ArrayDeque<SelectorConstant>(32);
-    }
-
-    public MessageImpl getMessage() {
-        return message;
-    }
-
-    public Deque<SelectorConstant> getStack() {
-        return stack;
-    }
-
-    public int getDebugIndentCount() {
-        return debugIndentCount;
-    }
-
-    public void setDebugIndentCount(int debugIndentCount) {
-        this.debugIndentCount = debugIndentCount;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvaluationException.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvaluationException.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvaluationException.java
deleted file mode 100644
index 7425189..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/SelectorEvaluationException.java
+++ /dev/null
@@ -1,39 +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.hedwig.jms.selector;
-
-/**
- * Thrown when evaluating a selector.
- */
-public class SelectorEvaluationException extends Exception {
-
-    public SelectorEvaluationException() {
-    }
-
-    public SelectorEvaluationException(String message) {
-        super(message);
-    }
-
-    public SelectorEvaluationException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public SelectorEvaluationException(Throwable cause) {
-        super(cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/TreeDumperSelectorParserVisitor.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/TreeDumperSelectorParserVisitor.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/TreeDumperSelectorParserVisitor.java
deleted file mode 100644
index dedda05..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/TreeDumperSelectorParserVisitor.java
+++ /dev/null
@@ -1,261 +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.hedwig.jms.selector;
-
-/**
- * To dump the AST - used ONLY for debugging
- */
-public class TreeDumperSelectorParserVisitor implements SelectorParserVisitor{
-
-    private static final int INDENT_PER_LEVEL = 4;
-
-    private static void emitDebug(SimpleNode node, SelectorEvalState data, boolean start)
-        throws SelectorEvaluationException {
-
-        if (!start && 0 == node.jjtGetNumChildren()) return ;
-
-        final StringBuilder sb = new StringBuilder();
-        int count = data.getDebugIndentCount();
-        for (int i = 0;i < count * INDENT_PER_LEVEL; i ++){
-            sb.append(' ');
-        }
-
-        sb.append(node.getClass().getName()).append(" -> ").append(node);
-        sb.append(", Constant -> ").append(node.getConstantValueInternal());
-        sb.append(", Func -> ").append(node.getExprFunctionInternal());
-        if (0 != node.jjtGetNumChildren()) sb.append(start ? " OPEN" : " CLOSE");
-
-        MyNode.logger.trace(sb.toString());
-    }
-
-    @Override
-    public Object visit(SimpleNode node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTOrExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTAndExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTNotExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTGreaterThan node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTLessThan node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTLessThanEqualTo node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTGreaterThanEqualTo node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTEqualTo node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTNotEqualTo node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTIsNullExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTBetweenExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTInExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTLikeExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTAddExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTSubExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTDivideExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTMultiplyExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTNegateExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTLookupExpr node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        data.setDebugIndentCount(data.getDebugIndentCount() + 1);
-        node.childrenAccept(this, data);
-        data.setDebugIndentCount(data.getDebugIndentCount() - 1);
-        emitDebug(node, data, false);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTConstant node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        if (0 != node.jjtGetNumChildren()) throw new SelectorEvaluationException(getClass() +
-            " parse error ? " + node);
-        return null;
-    }
-
-    @Override
-    public Object visit(ASTStringVarargParams node, SelectorEvalState data) throws SelectorEvaluationException {
-        emitDebug(node, data, true);
-        if (0 != node.jjtGetNumChildren()) throw new SelectorEvaluationException(getClass() +
-            " parse error ? " + node);
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryArithmeticFunction.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryArithmeticFunction.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryArithmeticFunction.java
deleted file mode 100644
index 59170e7..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryArithmeticFunction.java
+++ /dev/null
@@ -1,73 +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.hedwig.jms.selector;
-
-import org.apache.hedwig.jms.message.MessageImpl;
-
-/**
- * Unary arithematic operations
- */
-public abstract class UnaryArithmeticFunction implements ExprFunction {
-
-    public static final UnaryArithmeticFunction NEGATE_FUNCTION = new UnaryArithmeticFunction() {
-
-        @Override
-        protected SelectorConstant evaluateImpl(SelectorConstant value, MessageImpl message)
-            throws SelectorEvaluationException {
-
-            switch (value.type) {
-                case INT: {
-                    Integer val = value.getIntValue();
-                    if (null == val) return new SelectorConstant((Integer) null);
-                    return new SelectorConstant(-(int) val);
-                }
-                case DOUBLE: {
-                    Double val = value.getDoubleValue();
-                    if (null == val) return new SelectorConstant((Double) null);
-                    return new SelectorConstant(-(double) val);
-                }
-                default:
-                    throw new SelectorEvaluationException(getClass() + " Invalid value type ? " + value);
-            }
-        }
-    };
-
-    public void evaluate(SelectorEvalState state) throws SelectorEvaluationException {
-        if (state.getStack().size() < 1)
-            throw new SelectorEvaluationException(getClass() + " stack corruption ? " + state.getStack());
-
-        SelectorConstant value = state.getStack().pop();
-
-        SelectorConstant result = evaluateImpl(value, state.getMessage());
-
-        if (null != result) state.getStack().push(result);
-        else
-            throw new SelectorEvaluationException(getClass() +
-                " Unexpected to return a null response in binary function evaluation");
-    }
-
-    protected abstract SelectorConstant evaluateImpl(SelectorConstant value, MessageImpl message)
-        throws SelectorEvaluationException;
-
-
-
-    @Override
-    public String toString(){
-        return getClass().getName();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryExprFunction.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryExprFunction.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryExprFunction.java
deleted file mode 100644
index c50514b..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/UnaryExprFunction.java
+++ /dev/null
@@ -1,65 +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.hedwig.jms.selector;
-
-import org.apache.hedwig.jms.message.MessageImpl;
-
-/**
- * Unary function's.
- */
-public abstract class UnaryExprFunction implements ExprFunction {
-
-    public static final UnaryExprFunction NOT_FUNCTION = new UnaryExprFunction() {
-
-        @Override
-        protected SelectorConstant evaluateImpl(SelectorConstant value, MessageImpl message)
-            throws SelectorEvaluationException {
-            if (SelectorConstant.SelectorDataType.BOOLEAN != value.type) {
-                throw new SelectorEvaluationException(getClass() + " Invalid value type ? " + value);
-            }
-
-            final Boolean boolValue = value.getBoolValue();
-            final Boolean result = null == boolValue ? null : !boolValue;
-            return new SelectorConstant(result);
-        }
-    };
-
-    public void evaluate(SelectorEvalState state) throws SelectorEvaluationException {
-        if (state.getStack().size() < 1)
-            throw new SelectorEvaluationException(getClass() + " stack corruption ? " + state.getStack());
-
-        SelectorConstant value = state.getStack().pop();
-
-        SelectorConstant result = evaluateImpl(value, state.getMessage());
-
-        if (null != result) state.getStack().push(result);
-        else
-            throw new SelectorEvaluationException(getClass() +
-                " Unexpected to return a null response in binary function evaluation");
-    }
-
-    protected abstract SelectorConstant evaluateImpl(SelectorConstant value, MessageImpl message)
-        throws SelectorEvaluationException;
-
-
-
-    @Override
-    public String toString(){
-        return getClass().getName();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/ValueComparisonFunction.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/ValueComparisonFunction.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/ValueComparisonFunction.java
deleted file mode 100644
index 24957d3..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/ValueComparisonFunction.java
+++ /dev/null
@@ -1,329 +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.hedwig.jms.selector;
-
-import org.apache.hedwig.jms.message.MessageImpl;
-
-/**
- * Comparison of values ..
- */
-public abstract class ValueComparisonFunction extends BinaryExprFunction {
-
-    protected SelectorConstant evaluateImpl(SelectorConstant left, SelectorConstant right,
-                                            MessageImpl message) throws SelectorEvaluationException {
-
-        switch (left.type) {
-            case INT: {
-                switch (right.type) {
-                    case INT:
-                        return new SelectorConstant(compareWithInt(left.getIntValue(), right.getIntValue()));
-                    case DOUBLE:
-                        return new SelectorConstant(compareWithInt(left.getIntValue(), right.getDoubleValue()));
-                    default:
-                        throw new SelectorEvaluationException(getClass() + " Unexpected type : " +
-                            right.type + ". left : " + left + ", right : " + right);
-                }
-            }
-            case DOUBLE: {
-                switch (right.type) {
-                    case INT:
-                        return new SelectorConstant(compareWithDouble(left.getDoubleValue(), right.getIntValue()));
-                    case DOUBLE:
-                        return new SelectorConstant(compareWithDouble(left.getDoubleValue(), right.getDoubleValue()));
-                    default:
-                        throw new SelectorEvaluationException(getClass() + " Unexpected type : " +
-                            right.type + ". left : " + left + ", right : " + right);
-                }
-            }
-            case BOOLEAN: {
-                switch (right.type) {
-                    case BOOLEAN:
-                        return new SelectorConstant(compareWithBoolean(left.getBoolValue(), right.getBoolValue()));
-                    default:
-                        throw new SelectorEvaluationException(getClass() + " Unexpected type : " +
-                            right.type + ". left : " + left + ", right : " + right);
-                }
-            }
-
-            case STRING: {
-                switch (right.type) {
-                    case STRING:
-                        return new SelectorConstant(compareWithString(left.getStringValue(), right.getStringValue()));
-                    default:
-                        throw new SelectorEvaluationException(getClass() + " Unexpected type : " +
-                            right.type + ". left : " + left + ", right : " + right);
-                }
-            }
-
-            default:
-                throw new SelectorEvaluationException(getClass() + " Unsupported type : " +
-                    left.type + ". left : " + left + ", right : " + right);
-        }
-    }
-
-    protected abstract Boolean compareWithInt(Integer left, Double right) throws SelectorEvaluationException;
-
-    protected abstract Boolean compareWithInt(Integer left, Integer right) throws SelectorEvaluationException;
-
-    protected abstract Boolean compareWithDouble(Double left, Double right) throws SelectorEvaluationException;
-
-    protected abstract Boolean compareWithDouble(Double left, Integer right) throws SelectorEvaluationException;
-
-    protected abstract Boolean compareWithString(String left, String right) throws SelectorEvaluationException;
-
-    protected abstract Boolean compareWithBoolean(Boolean left, Boolean right) throws SelectorEvaluationException;
-
-
-    public static final ValueComparisonFunction GREATER_THAN_FUNCTION = new ValueComparisonFunction() {
-        @Override
-        protected Boolean compareWithInt(Integer left, Double right) {
-            if (null == left || null == right) return null;
-            return (double) left > right;
-        }
-
-        @Override
-        protected Boolean compareWithInt(Integer left, Integer right) {
-            if (null == left || null == right) return null;
-            return left > right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Double right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return left > right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Integer right) {
-            if (null == left || null == right) return null;
-            return left > (double) right;
-        }
-
-        @Override
-        protected Boolean compareWithString(String left, String right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass()
-                    + " Unsupported string comparison for greater_than operator");
-        }
-
-        @Override
-        protected Boolean compareWithBoolean(Boolean left, Boolean right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass()
-                    + " Unsupported boolean comparison for greater_than operator");
-        }
-    };
-
-
-    public static final ValueComparisonFunction GREATER_THAN_EQUAL_TO_FUNCTION = new ValueComparisonFunction() {
-        @Override
-        protected Boolean compareWithInt(Integer left, Double right) {
-            if (null == left || null == right) return null;
-            return (double) left >= right;
-        }
-
-        @Override
-        protected Boolean compareWithInt(Integer left, Integer right) {
-            if (null == left || null == right) return null;
-            return left >= right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Double right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return left >= right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Integer right) {
-            if (null == left || null == right) return null;
-            return left >= (double) right;
-        }
-
-        @Override
-        protected Boolean compareWithString(String left, String right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass() +
-                " Unsupported string comparison for greater_than operator");
-        }
-
-        @Override
-        protected Boolean compareWithBoolean(Boolean left, Boolean right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass() +
-                " Unsupported boolean comparison for greater_than operator");
-        }
-    };
-
-    public static final ValueComparisonFunction LESS_THAN_FUNCTION = new ValueComparisonFunction() {
-        @Override
-        protected Boolean compareWithInt(Integer left, Double right) {
-            if (null == left || null == right) return null;
-            return (double) left < right;
-        }
-
-        @Override
-        protected Boolean compareWithInt(Integer left, Integer right) {
-            if (null == left || null == right) return null;
-            return left < right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Double right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return left < right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Integer right) {
-            if (null == left || null == right) return null;
-            return left < (double) right;
-        }
-
-        @Override
-        protected Boolean compareWithString(String left, String right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass() +
-                " Unsupported string comparison for greater_than operator");
-        }
-
-        @Override
-        protected Boolean compareWithBoolean(Boolean left, Boolean right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass() +
-                " Unsupported boolean comparison for greater_than operator");
-        }
-    };
-
-
-    public static final ValueComparisonFunction LESS_THAN_EQUAL_TO_FUNCTION = new ValueComparisonFunction() {
-        @Override
-        protected Boolean compareWithInt(Integer left, Double right) {
-            if (null == left || null == right) return null;
-            return (double) left <= right;
-        }
-
-        @Override
-        protected Boolean compareWithInt(Integer left, Integer right) {
-            if (null == left || null == right) return null;
-            return left <= right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Double right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return left <= right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Integer right) {
-            if (null == left || null == right) return null;
-            return left <= (double) right;
-        }
-
-        @Override
-        protected Boolean compareWithString(String left, String right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass() +
-                " Unsupported string comparison for greater_than operator");
-        }
-
-        @Override
-        protected Boolean compareWithBoolean(Boolean left, Boolean right) throws SelectorEvaluationException {
-            throw new SelectorEvaluationException(getClass() +
-                " Unsupported boolean comparison for greater_than operator");
-        }
-    };
-
-    public static final ValueComparisonFunction EQUAL_TO_FUNCTION = new ValueComparisonFunction() {
-        @Override
-        protected Boolean compareWithInt(Integer left, Double right) {
-            if (null == left || null == right) return null;
-            return (double) left == right;
-        }
-
-        @Override
-        protected Boolean compareWithInt(Integer left, Integer right) {
-            if (null == left || null == right) return null;
-            return (int) left == right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Double right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return (double) left == right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Integer right) {
-            if (null == left || null == right) return null;
-            return left == (double) right;
-        }
-
-        @Override
-        protected Boolean compareWithString(String left, String right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return left.equals(right);
-        }
-
-        @Override
-        protected Boolean compareWithBoolean(Boolean left, Boolean right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return left.equals(right);
-        }
-    };
-
-
-    public static final ValueComparisonFunction NOT_EQUAL_TO_FUNCTION = new ValueComparisonFunction() {
-        @Override
-        protected Boolean compareWithInt(Integer left, Double right) {
-            if (null == left || null == right) return null;
-            return (double) left != right;
-        }
-
-        @Override
-        protected Boolean compareWithInt(Integer left, Integer right) {
-            if (null == left || null == right) return null;
-            return (int) left != right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Double right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return (double) left != right;
-        }
-
-        @Override
-        protected Boolean compareWithDouble(Double left, Integer right) {
-            if (null == left || null == right) return null;
-            return left != (double) right;
-        }
-
-        @Override
-        protected Boolean compareWithString(String left, String right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return !left.equals(right);
-        }
-
-        @Override
-        protected Boolean compareWithBoolean(Boolean left, Boolean right) throws SelectorEvaluationException {
-            if (null == left || null == right) return null;
-            return !left.equals(right);
-        }
-    };
-
-
-
-    @Override
-    public String toString(){
-        return getClass().getName();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/package-info.html
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/package-info.html b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/package-info.html
deleted file mode 100644
index e426eb8..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/selector/package-info.html
+++ /dev/null
@@ -1,35 +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.
--->
-
-
-Contains implementation of the selector, associated files and interpreter. <br/>
-This depends on files generated by the grammar at $HEDWIG_CLIENT_JMS/src/main/grammar/javacc/selector_grammar.jjt <br/>
-<p/>
-This package depends on message package to pull headers, etc. <br/>
-<p/>
-<p/>
-The code essentially is split into three things :
-<ul>
-  <li>Basic implementation of the selector, interpreter and grammar interface code : split between this
-    package and the generated package (of same name).</li>
-  <li>State objects, visitor implementation, etc to help evaluate the generated AST based on the message.
-    MyNode, SelectorConstant, SelectorEvalState, etc.</li>
-  <li>The functions to evaluate and implement functionality - expose constructs to interpreter to evaluate.
-    *Function classes.</li>
-</ul>
-
-The code relies heavily on the javacc grammar and the interpreter generated based on it : so please modify with care !

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionFactoryImpl.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionFactoryImpl.java
deleted file mode 100644
index 6ef0970..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionFactoryImpl.java
+++ /dev/null
@@ -1,64 +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.hedwig.jms.spi;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.Referenceable;
-import java.io.Serializable;
-
-/**
- * Implementation of jmx ConnectionFactory
- * MUST be MT-safe (2.8)
- */
-public class HedwigConnectionFactoryImpl implements ConnectionFactory, TopicConnectionFactory,
-    Referenceable, Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @Override
-    public HedwigConnectionImpl createConnection() throws JMSException {
-        HedwigConnectionImpl retval = new HedwigConnectionImpl();
-        return retval;
-    }
-
-    @Override
-    public HedwigConnectionImpl createConnection(String user, String password) throws JMSException {
-        HedwigConnectionImpl retval = new HedwigConnectionImpl(user, password);
-        return retval;
-    }
-
-    @Override
-    public Reference getReference() throws NamingException {
-        return new Reference(getClass().getName());
-    }
-
-    @Override
-    public TopicConnection createTopicConnection() throws JMSException {
-        return new HedwigConnectionImpl();
-    }
-
-    @Override
-    public TopicConnection createTopicConnection(String user, String password) throws JMSException {
-        return new HedwigConnectionImpl(user, password);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/9a8d62b1/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionImpl.java
----------------------------------------------------------------------
diff --git a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionImpl.java b/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionImpl.java
deleted file mode 100644
index 98f4273..0000000
--- a/hedwig-client-jms/src/main/java/org/apache/hedwig/jms/spi/HedwigConnectionImpl.java
+++ /dev/null
@@ -1,164 +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.hedwig.jms.spi;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.hedwig.client.conf.ClientConfiguration;
-import org.apache.hedwig.jms.ConnectionImpl;
-import org.apache.hedwig.jms.MessagingSessionFacade;
-import org.apache.hedwig.jms.SessionImpl;
-
-import javax.jms.JMSException;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * Returns the hedwig specific functionality of the Connection - which is tied to this spi impl.
- * Coupled with HedwigMessagingSessionFacade.
- *
- */
-public class HedwigConnectionImpl extends ConnectionImpl {
-
-    private ClientConfiguration hedwigClientConfig;
-
-    public HedwigConnectionImpl() throws JMSException {
-        super();
-        init(getUser(), getPassword());
-    }
-
-    public HedwigConnectionImpl(String user, String password) throws JMSException {
-        super (user, password);
-        init(getUser(), getPassword());
-    }
-
-    @Override
-    protected SessionImpl createSessionInstance(boolean transacted, int acknowledgeMode,
-                                                MessagingSessionFacade.DestinationType type) throws JMSException {
-        if (null == type) return new SessionImpl(this, transacted, acknowledgeMode);
-        switch (type){
-            case QUEUE:
-                return new QueueSessionImpl(this, transacted, acknowledgeMode);
-            case TOPIC:
-                return new TopicSessionImpl(this, transacted, acknowledgeMode);
-            default:
-                throw new JMSException("Unknown type " + type);
-        }
-    }
-
-    @Override
-    protected void doStart(String user, String password) throws JMSException {
-        // noop for now ...
-    }
-
-    protected void init(String user, String password) throws JMSException {
-        // load to check sanity.
-        hedwigClientConfig = loadConfig();
-
-        // TODO: Set configuration options specified by the user of api - user/passwd/etc.
-    }
-
-    // copied from earlier code ...
-    private ClientConfiguration loadConfig() throws JMSException {
-        ClientConfiguration config = new ClientConfiguration();
-
-        // TODO: This is not very extensible and useful ... we need to pick the info from
-        // configuration specified by user, NOT only from static files !
-        // Also, we need to be able to support multiple configuration in a single client !
-        // We need a better solution ....
-
-        try {
-            // 1. try to load the client configuration as specified from a
-            // system property
-            if (System.getProperty(HEDWIG_CLIENT_CONFIG_FILE) != null) {
-                File configFile = new File(System.getProperty(HEDWIG_CLIENT_CONFIG_FILE));
-                if (!configFile.exists()) {
-                    throw new JMSException(
-                            "Cannot create connection: cannot find Hedwig client configuration file specified as ["
-                                    + System.getProperty(HEDWIG_CLIENT_CONFIG_FILE) + "]");
-                }
-                config.loadConf(configFile.toURI().toURL());
-            } else {
-                // 2. try to load a "hedwig-client.cfg" file from the classpath
-                config.loadConf(new URL(null, "classpath://hedwig-client.cfg", new URLStreamHandler() {
-                    protected URLConnection openConnection(URL u) throws IOException {
-                        // rely on the relevant classloader - not system classloader.
-                        final URL resourceUrl = HedwigConnectionImpl.this.getClass().getClassLoader().
-                            getResource(u.getPath());
-                        return resourceUrl.openConnection();
-                    }
-                }));
-            }
-
-        } catch (MalformedURLException e) {
-            JMSException je = new JMSException("Cannot load Hedwig client configuration file " + e);
-            je.setLinkedException(e);
-            throw je;
-        } catch (ConfigurationException e) {
-            JMSException je = new JMSException("Cannot load Hedwig client configuration " + e);
-            je.setLinkedException(e);
-            throw je;
-        }
-
-        /*
-        System.out.println("getConsumedMessagesBufferSize : " + config.getConsumedMessagesBufferSize());
-        System.out.println("getDefaultServerHost : " + config.getDefaultServerHost());
-        System.out.println("isSSLEnabled : " + config.isSSLEnabled());
-        System.out.println("getMaximumMessageSize : " + config.getMaximumMessageSize());
-        System.out.println("getMaximumOutstandingMessages : " + config.getMaximumOutstandingMessages());
-        System.out.println("getMaximumServerRedirects : "  + config.getMaximumServerRedirects());
-        System.out.println("getServerAckResponseTimeout : "  + config.getServerAckResponseTimeout());
-        */
-
-        return config;
-    }
-
-    public ClientConfiguration getHedwigClientConfig() {
-        return hedwigClientConfig;
-    }
-
-    @Override
-    protected void doStop() {
-        // nothing specific to be done.
-    }
-
-    @Override
-    protected void doClose(){
-        // nothing specific to be done.
-    }
-
-    @Override
-    protected MessagingSessionFacade createMessagingSessionFacade(SessionImpl session) throws JMSException {
-        return new HedwigMessagingSessionFacade(this, session);
-    }
-
-    @Override
-    public TopicSessionImpl createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException {
-        return (TopicSessionImpl) createSessionImpl(transacted, acknowledgeMode,
-            MessagingSessionFacade.DestinationType.TOPIC);
-    }
-
-    @Override
-    public QueueSessionImpl createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException {
-        return (QueueSessionImpl) createSessionImpl(transacted, acknowledgeMode,
-            MessagingSessionFacade.DestinationType.QUEUE);
-    }
-}