You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2013/07/26 13:22:31 UTC
[26/51] [partial] initial commit
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExceptionVisitExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExceptionVisitExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExceptionVisitExpression.java
new file mode 100644
index 0000000..e24a845
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExceptionVisitExpression.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+import org.apache.olingo.odata2.api.exception.MessageReference;
+import org.apache.olingo.odata2.api.exception.ODataMessageException;
+
+/**
+ * Exception thrown while traversing/visiting a filter expression tree
+ * @author SAP AG
+ */
+public class ExceptionVisitExpression extends ODataMessageException {
+ private static final long serialVersionUID = 7701L;
+
+ public static final MessageReference COMMON = createMessageReference(ExceptionVisitExpression.class, "COMMON");
+
+ private CommonExpression filterTree;
+
+ public ExceptionVisitExpression() {
+ super(COMMON);
+ }
+
+ /**
+ * Create {@link ExceptionVisitExpression} with given {@link MessageReference}.
+ *
+ * @param messageReference
+ * references the message text (and additional values) of this {@link ExceptionVisitExpression}
+ */
+ public ExceptionVisitExpression(final MessageReference messageReference) {
+ super(messageReference);
+ }
+
+ /**
+ * Create {@link ExceptionVisitExpression} with given {@link MessageReference} and cause {@link Throwable} which caused
+ * this {@link ExceptionVisitExpression}.
+ *
+ * @param message
+ * references the message text (and additional values) of this {@link ExceptionVisitExpression}
+ * @param cause
+ * exception which caused this {@link ExceptionVisitExpression}
+ */
+ public ExceptionVisitExpression(final MessageReference message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Get erroneous filter for debug information
+ * @return Erroneous filter tree
+ */
+ public CommonExpression getFilterTree() {
+ return filterTree;
+ }
+
+ /**
+ * Sets erroneous filter tree for debug information.
+ * @param filterTree Erroneous filter tree
+ */
+ public void setFilterTree(final CommonExpression filterTree) {
+ this.filterTree = filterTree;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionKind.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionKind.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionKind.java
new file mode 100644
index 0000000..9b22787
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionKind.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Enumeration describing all possible node types inside an expression tree
+ * @author SAP AG
+ */
+public enum ExpressionKind {
+ /**
+ * Used to mark the root node of a filter expression tree
+ * @see FilterExpression
+ */
+ FILTER,
+ /**
+ * Literal expressions like "1.1d" or "'This is a string'"
+ * @see LiteralExpression
+ */
+ LITERAL,
+
+ /**
+ * Unary operator expressions like "not" and "-"
+ * @see UnaryExpression
+ */
+ UNARY,
+
+ /**
+ * Binary operator expressions like "eq" and "or"
+ * @see BinaryExpression
+ */
+ BINARY,
+
+ /**
+ * Method operator expressions like "substringof" and "concat"
+ * @see MethodExpression
+ */
+ METHOD,
+
+ /**
+ * Member access expressions like "/" in "adress/street"
+ * @see MemberExpression
+ */
+ MEMBER,
+
+ /**
+ * Property expressions like "age"
+ * @see PropertyExpression
+ */
+ PROPERTY,
+
+ /**
+ * Order expressions like "age desc"
+ * @see OrderExpression
+ */
+ ORDER,
+
+ /**
+ * Orderby expression like "age desc, name asc"
+ * @see OrderByExpression
+ */
+ ORDERBY;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionParserException.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionParserException.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionParserException.java
new file mode 100644
index 0000000..5816ea9
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionParserException.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+import org.apache.olingo.odata2.api.exception.MessageReference;
+import org.apache.olingo.odata2.api.exception.ODataBadRequestException;
+
+/**
+ * Exception thrown while parsing a filter or orderby expression
+ * @author SAP AG
+ */
+public class ExpressionParserException extends ODataBadRequestException {
+ private static final long serialVersionUID = 7702L;
+
+ public static final MessageReference COMMON_ERROR = createMessageReference(ExpressionParserException.class, "COMMON");
+
+ //token related exception texts
+ public static final MessageReference ERROR_IN_TOKENIZER = createMessageReference(ExpressionParserException.class, "ERROR_IN_TOKENIZER");
+ public static final MessageReference TOKEN_UNDETERMINATED_STRING = createMessageReference(ExpressionParserException.class, "TOKEN_UNDETERMINATED_STRING");
+ public static final MessageReference INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING = createMessageReference(ExpressionParserException.class, "INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING");
+
+ //parsing
+ public static final MessageReference EXPRESSION_EXPECTED_AFTER_POS = createMessageReference(ExpressionParserException.class, "EXPRESSION_EXPECTED_AFTER_POS");
+ public static final MessageReference COMMA_OR_END_EXPECTED_AT_POS = createMessageReference(ExpressionParserException.class, "COMMA_OR_END_EXPECTED_AT_POS");
+ public static final MessageReference EXPRESSION_EXPECTED_AT_POS = createMessageReference(ExpressionParserException.class, "EXPRESSION_EXPECTED_AT_POS");
+ public static final MessageReference MISSING_CLOSING_PHARENTHESIS = createMessageReference(ExpressionParserException.class, "MISSING_CLOSING_PHARENTHESIS");
+ public static final MessageReference COMMA_OR_CLOSING_PHARENTHESIS_EXPECTED_AFTER_POS = createMessageReference(ExpressionParserException.class, "COMMA_OR_CLOSING_PHARENTHESIS_EXPECTED_AFTER_POS");
+ public static final MessageReference INVALID_METHOD_CALL = createMessageReference(ExpressionParserException.class, "INVALID_METHOD_CALL");
+ public static final MessageReference TYPE_EXPECTED_AT = createMessageReference(ExpressionParserException.class, "TYPE_EXPECTED_AT");
+
+ //validation exceptions texts - method
+ public static final MessageReference METHOD_WRONG_ARG_EXACT = createMessageReference(ExpressionParserException.class, "METHOD_WRONG_ARG_EXACT");
+ public static final MessageReference METHOD_WRONG_ARG_BETWEEN = createMessageReference(ExpressionParserException.class, "METHOD_WRONG_ARG_BETWEEN");
+ public static final MessageReference METHOD_WRONG_ARG_X_OR_MORE = createMessageReference(ExpressionParserException.class, "METHOD_WRONG_ARG_X_OR_MORE");
+ public static final MessageReference METHOD_WRONG_ARG_X_OR_LESS = createMessageReference(ExpressionParserException.class, "METHOD_WRONG_ARG_X_OR_LESS");
+ public static final MessageReference METHOD_WRONG_INPUT_TYPE = createMessageReference(ExpressionParserException.class, "METHOD_WRONG_INPUT_TYPE");
+
+ //validation exceptions texts - member
+ public static final MessageReference LEFT_SIDE_NOT_STRUCTURAL_TYPE = createMessageReference(ExpressionParserException.class, "LEFT_SIDE_NOT_STRUCTURAL_TYPE");
+ public static final MessageReference LEFT_SIDE_NOT_A_PROPERTY = createMessageReference(ExpressionParserException.class, "LEFT_SIDE_NOT_A_PROPERTY");
+ public static final MessageReference PROPERTY_NAME_NOT_FOUND_IN_TYPE = createMessageReference(ExpressionParserException.class, "PROPERTY_NAME_NOT_FOUND_IN_TYPE");
+
+ //validation exceptions texts - binary
+ public static final MessageReference INVALID_TYPES_FOR_BINARY_OPERATOR = createMessageReference(ExpressionParserException.class, "INVALID_TYPES_FOR_BINARY_OPERATOR");
+
+ //orderby
+ public static final MessageReference INVALID_SORT_ORDER = createMessageReference(ExpressionParserException.class, "INVALID_SORT_ORDER");
+
+ //instance attributes
+ private CommonExpression filterTree;
+
+ //Constructors
+ public ExpressionParserException() {
+ super(COMMON_ERROR);
+ }
+
+ /**
+ * Create {@link ExpressionParserException} with given {@link MessageReference}.
+ *
+ * @param messageReference
+ * references the message text (and additional values) of this {@link ExpressionParserException}
+ */
+ public ExpressionParserException(final MessageReference messageReference) {
+ super(messageReference);
+ }
+
+ /**
+ * Create {@link ExpressionParserException} with given {@link MessageReference} and cause {@link Throwable} which caused
+ * this {@link ExpressionParserException}.
+ *
+ * @param messageReference
+ * References the message text (and additional values) of this {@link ExpressionParserException}
+ * @param cause
+ * Exception which caused this {@link ExpressionParserException}
+ */
+ public ExpressionParserException(final MessageReference messageReference, final Throwable cause) {
+ super(messageReference, cause);
+ }
+
+ /**
+ * Gets erroneous filter expression tree for debug information.
+ * @return erroneous filter tree
+ */
+ public CommonExpression getFilterTree() {
+ return filterTree;
+ }
+
+ /**
+ * Sets erroneous filter tree for debug information.
+ * @param filterTree filter tree to be set
+ */
+ public void setFilterTree(final CommonExpression filterTree) {
+ this.filterTree = filterTree;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionVisitor.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionVisitor.java
new file mode 100644
index 0000000..06c8c8d
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/ExpressionVisitor.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+
+/**
+ * Interface {@link ExpressionVisitor} is used to traverse a $filter or $orderby expression tree.
+ * Any class instance implementing this interface can be passed to the method {@link Visitable#accept(ExpressionVisitor)}
+ * of an expression node to start the traversing. While traversing, the appropriate methods of the visitor implementation
+ * will be called.
+ * @author SAP AG
+ */
+public interface ExpressionVisitor {
+ /**
+ * Visits a filter expression
+ * @param filterExpression
+ * The visited filter expression node
+ * @param expressionString
+ * The $filter expression string used to build the filter expression tree
+ * @param expression
+ * The expression node representing the first <i>operator</i>,<i>method</i>,<i>literal</i> or <i>property</i> of the expression tree
+ * @return
+ * The overall result of evaluating the whole filter expression tree
+ */
+ Object visitFilterExpression(FilterExpression filterExpression, String expressionString, Object expression);
+
+ /**
+ * Visits a binary expression
+ * @param binaryExpression
+ * The visited binary expression node
+ * @param operator
+ * The operator used in the binary expression
+ * @param leftSide
+ * The result of visiting the left expression node
+ * @param rightSide
+ * The result of visiting the right expression node
+ * @return
+ * Returns the result from evaluating operator, leftSide and rightSide
+ */
+ Object visitBinary(BinaryExpression binaryExpression, BinaryOperator operator, Object leftSide, Object rightSide);
+
+ /**
+ * Visits a orderby expression
+ * @param orderByExpression
+ * The visited orderby expression node
+ * @param expressionString
+ * The $orderby expression string used to build the orderby expression tree
+ * @param orders
+ * The result of visiting the orders of the orderby expression
+ * @return
+ * The overall result of evaluating the orderby expression tree
+ */
+ Object visitOrderByExpression(OrderByExpression orderByExpression, String expressionString, List<Object> orders);
+
+ /**
+ * Visits a order expression
+ * @param orderExpression
+ * The visited order expression node
+ * @param filterResult
+ * The result of visiting the filter expression contained in the order
+ * @param sortOrder
+ * The sort order
+ * @return
+ * The overall result of evaluating the order
+ */
+ Object visitOrder(OrderExpression orderExpression, Object filterResult, SortOrder sortOrder);
+
+ /**
+ * Visits a literal expression
+ * @param literal
+ * The visited literal expression node
+ * @param edmLiteral
+ * The detected EDM literal (value and type)
+ * @return
+ * The value of the literal
+ */
+ Object visitLiteral(LiteralExpression literal, EdmLiteral edmLiteral);
+
+ /**
+ * Visits a method expression
+ * @param methodExpression
+ * The visited method expression node
+ * @param method
+ * The method used in the method expression
+ * @param parameters
+ * The result of visiting the parameters of the method
+ * @return
+ * Returns the result from evaluating the method and the method parameters
+ */
+ Object visitMethod(MethodExpression methodExpression, MethodOperator method, List<Object> parameters);
+
+ /**
+ * Visits a member expression (e.g. <path property>/<member property>)
+ * @param memberExpression
+ * The visited member expression node
+ * @param path
+ * The result of visiting the path property expression node (the left side of the property operator)
+ * @param property
+ * The result of visiting the member property expression node
+ * @return
+ * Returns the <b>value</b> of the corresponding property (which may be a single EDM value or a structured EDM value)
+ */
+ Object visitMember(MemberExpression memberExpression, Object path, Object property);
+
+ /**
+ * Visits a property expression
+ * @param propertyExpression
+ * The visited property expression node
+ * @param uriLiteral
+ * The URI literal of the property
+ * @param edmProperty
+ * The EDM property matching the property name used in the expression String
+ * @return
+ * Returns the <b>value</b> of the corresponding property ( which may be a single EDM value or a structured EDM value)
+ */
+ Object visitProperty(PropertyExpression propertyExpression, String uriLiteral, EdmTyped edmProperty);
+
+ /**
+ * Visits a unary expression
+ * @param unaryExpression
+ * The visited unary expression node
+ * @param operator
+ * The operator used in the unary expression
+ * @param operand
+ * The result of visiting the operand expression node
+ * @return
+ * Returns the result from evaluating operator and operand
+ */
+ Object visitUnary(UnaryExpression unaryExpression, UnaryOperator operator, Object operand);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/FilterExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/FilterExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/FilterExpression.java
new file mode 100644
index 0000000..7f3499c
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/FilterExpression.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Represents a $filter expression in the expression tree returned by {@link org.apache.olingo.odata2.api.uri.UriParser#parseFilterString(org.apache.olingo.odata2.api.edm.EdmEntityType, String)}
+ * Used to define the <b>root</b> expression node in an $filter expression tree.
+ *
+ * @author SAP AG
+ */
+public interface FilterExpression extends CommonExpression {
+
+ /**
+ * @return Returns the $filter expression string used to build the expression tree
+ */
+ String getExpressionString();
+
+ /**
+ * @return Returns the expression node representing the first <i>operator</i>,<i>method</i>,<i>literal</i> or <i>property</i> of the expression tree
+ */
+ CommonExpression getExpression();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/LiteralExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/LiteralExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/LiteralExpression.java
new file mode 100644
index 0000000..74dc2a0
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/LiteralExpression.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Represents a literal expression node in the expression tree returned by the methods:
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseFilterString(org.apache.olingo.odata2.api.edm.EdmEntityType, String) }</li>
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseOrderByString(org.apache.olingo.odata2.api.edm.EdmEntityType, String) }</li>
+ * <br>
+ * <br>
+ * <p>A literal expression node is inserted in the expression tree for any token witch is no
+ * valid <i>operator</i>, <i>method</i> or <i>property</i>.
+ * <br>
+ * <br>
+ * <p><b>For example</b> the filter "$filter=age eq 12" will result in an expression tree
+ * with a literal expression node for "12".
+ * <br>
+ * <br>
+ * @author SAP AG
+ */
+public interface LiteralExpression extends CommonExpression {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MemberExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MemberExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MemberExpression.java
new file mode 100644
index 0000000..6f4f51b
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MemberExpression.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Represents a member expression in the expression tree returned by the methods:
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseFilterString(org.apache.olingo.odata2.api.edm.EdmEntityType, String)}</li>
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseOrderByString(org.apache.olingo.odata2.api.edm.EdmEntityType, String)}</li>
+ * <br>
+ * <br>
+ * <p>A member expression node is inserted in the expression tree for any member operator ("/")
+ * which is used to reference a property of an complex type or entity type.
+ * <br>
+ * <br>
+ * <p><b>For example:</b> The expression "address/city eq 'Heidelberg' will result in an expression tree
+ * containing a member expression node for accessing property "city" which is part of the
+ * complex property "address". Method {@link #getPath()} will return a reference to the "address" property,
+ * method {@link #getProperty()} will return a refence to the "city" property.
+ * @author SAP AG
+ */
+public interface MemberExpression extends CommonExpression {
+ /**
+ * @return
+ * Returns the CommonExpression forming the path (the left side of '/') of the method operator.
+ * For OData 2.0 the value returned by {@link #getPath()} is a {@link PropertyExpression}
+ */
+ public CommonExpression getPath();
+
+ /**
+ * @return
+ * Return the CommonExpression forming the property (the right side of '/') of the method operator.
+ * For OData 2.0 the value returned by {@link #getProperty()} is a {@link PropertyExpression}
+ */
+ public CommonExpression getProperty();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodExpression.java
new file mode 100644
index 0000000..574a587
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodExpression.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+import java.util.List;
+
+/**
+ * Represents a method expression in the expression tree returned by the methods:
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseFilterString(org.apache.olingo.odata2.api.edm.EdmEntityType, String) }</li>
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseOrderByString(org.apache.olingo.odata2.api.edm.EdmEntityType, String) }</li>
+ * <br>
+ * <br>
+ * <p>A method expression node is inserted in the expression tree for any valid
+ * OData method operator in {@link MethodOperator} (e.g. for "substringof", "concat", "year", ... )
+ * <br>
+ * <br>
+ * @author SAP AG
+ */
+public interface MethodExpression extends CommonExpression {
+
+ /**
+ * @return Returns the method object that represents the used method
+ * @see MethodOperator
+ */
+ public MethodOperator getMethod();
+
+ /**
+ * @return Returns the number of provided method parameters
+ */
+ public int getParameterCount();
+
+ /**
+ * @return Returns a ordered list of expressions defining the input parameters for the used method
+ * @see CommonExpression
+ */
+ public List<CommonExpression> getParameters();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodOperator.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodOperator.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodOperator.java
new file mode 100644
index 0000000..71cc7f1
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/MethodOperator.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Enumerations for all supported methods of the ODATA expression parser
+ * for ODATA version 2.0 (with some restrictions).
+ * @author SAP AG
+ */
+public enum MethodOperator {
+ ENDSWITH("endswith"), INDEXOF("indexof"), STARTSWITH("startswith"), TOLOWER("tolower"), TOUPPER("toupper"), TRIM("trim"), SUBSTRING("substring"), SUBSTRINGOF("substringof"), CONCAT("concat"), LENGTH("length"), YEAR("year"), MONTH("month"), DAY("day"), HOUR("hour"), MINUTE("minute"), SECOND("second"), ROUND("round"), FLOOR("floor"), CEILING("ceiling");
+
+ private String syntax;
+ private String stringRespresentation;
+
+ private MethodOperator(final String syntax) {
+ this.syntax = syntax;
+ stringRespresentation = syntax;
+ }
+
+ /**
+ * @return Operators name for usage in in text
+ */
+ @Override
+ public String toString() {
+ return stringRespresentation;
+ }
+
+ /**
+ * @return URI literal of the unary operator as used in the URL.
+ */
+ public String toUriLiteral() {
+ return syntax;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderByExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderByExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderByExpression.java
new file mode 100644
index 0000000..8645a0c
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderByExpression.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+import java.util.List;
+
+/**
+ * Represents a $orderby expression in the expression tree returned by
+ * {@link org.apache.olingo.odata2.api.uri.UriParser#parseOrderByString(org.apache.olingo.odata2.api.edm.EdmEntityType, String) }
+ * Used to define the <b>root</b> expression node in an $filter expression tree.
+ *
+ * @author SAP AG
+ */
+public interface OrderByExpression extends CommonExpression {
+ /**
+ * @return Returns the $filter expression string used to build the expression tree
+ */
+ String getExpressionString();
+
+ /**
+ * @return
+ * Returns a ordered list of order expressions contained in the $orderby expression string
+ * <p>
+ * <b>For example</b>: The orderby expression build from "$orderby=name asc, age desc"
+ * would contain to order expression.
+ */
+ public List<OrderExpression> getOrders();
+
+ /**
+ * @return Returns the count of order expressions contained in the $orderby expression string
+ */
+ public int getOrdersCount();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderExpression.java
new file mode 100644
index 0000000..4bd8a8b
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/OrderExpression.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Represents a order expression in the expression tree returned by the method
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseOrderByString(org.apache.olingo.odata2.api.edm.EdmEntityType, String) }</li>
+ * <br>
+ * <br>
+ * <p>A order expression node is inserted in the expression tree for any valid
+ * OData order. For example for "$orderby=age desc, name asc" two order expression node
+ * will be inserted into the expression tree
+ * <br>
+ * <br>
+ * @author SAP AG
+ */
+public interface OrderExpression extends CommonExpression {
+
+ /**
+ * @return Returns the sort order (ascending or descending) of the order expression
+ */
+ SortOrder getSortOrder();
+
+ /**
+ * @return Returns the expression node which defines the data used to order the output
+ * send back to the client. In the simplest case this would be a {@link PropertyExpression}.
+ * @see CommonExpression
+ */
+ CommonExpression getExpression();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/PropertyExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/PropertyExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/PropertyExpression.java
new file mode 100644
index 0000000..534cc3a
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/PropertyExpression.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+
+/**
+ * Represents a property expression in the expression tree returned by the methods:
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseFilterString(org.apache.olingo.odata2.api.edm.EdmEntityType, String)}</li>
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseOrderByString(org.apache.olingo.odata2.api.edm.EdmEntityType, String)}</li>
+ * <br>
+ * <br>
+ * <p>A property expression node is inserted in the expression tree for any property.
+ * If an EDM is available during parsing the property is automatically verified
+ * against the EDM.
+ * <br>
+ * <br>
+ * @author SAP AG
+ */
+public interface PropertyExpression extends CommonExpression {
+ /**
+ * @return the property name as used in the EDM
+ */
+ public String getPropertyName();
+
+ /**
+ * @return Returns the EDM property matching the property name used in the expression String.
+ * This may be an instance of EdmProperty or EdmNavigationProperty
+ * @see EdmTyped
+ */
+ public EdmTyped getEdmProperty();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/SortOrder.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/SortOrder.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/SortOrder.java
new file mode 100644
index 0000000..b23849d
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/SortOrder.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Enumeration describing all possible sort orders used in an $orderby expression
+ * @author SAP AG
+ */
+public enum SortOrder {
+
+ /**
+ * Sort order ascending
+ */
+ asc("asc"),
+
+ /**
+ * Sort order descending
+ */
+ desc("desc");
+
+ private String syntax;
+ private String stringRespresentation;
+
+ private SortOrder(final String syntax) {
+ this.syntax = syntax;
+ stringRespresentation = syntax;
+ }
+
+ /**
+ * @return Operators name for usage in in text
+ */
+ @Override
+ public String toString() {
+ return stringRespresentation;
+ }
+
+ /**
+ * @return URI literal of the unary operator as used in the URL.
+ */
+ public String toUriLiteral() {
+ return syntax;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryExpression.java
new file mode 100644
index 0000000..9c54c56
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryExpression.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Represents a unary expression node in the expression tree returned by the methods:
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseFilterString(org.apache.olingo.odata2.api.edm.EdmEntityType, String)}</li>
+ * <li>{@link org.apache.olingo.odata2.api.uri.UriParser#parseOrderByString(org.apache.olingo.odata2.api.edm.EdmEntityType, String)}</li>
+ * <br>
+ * <br>
+ * <p>A unary expression node is inserted in the expression tree for any valid
+ * ODATA unary operator in {@link UnaryOperator} (e.g. for "not or "-" )
+ * <br>
+ * <br>
+ * @author SAP AG
+ */
+public interface UnaryExpression extends CommonExpression {
+
+ /**
+ * @return Returns the operator object that represents the used operator
+ * @see UnaryOperator
+ */
+ public UnaryOperator getOperator();
+
+ /**
+ * @return Returns the expression node of the operand of the unary operator
+ * @see CommonExpression
+ */
+ public CommonExpression getOperand();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryOperator.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryOperator.java
new file mode 100644
index 0000000..fbbf11f
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/UnaryOperator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+/**
+ * Enumerations for supported unary operators of the OData expression parser
+ * for OData version 2.0
+ * @author SAP AG
+ */
+public enum UnaryOperator {
+ MINUS("-", "negation"), NOT("not");
+
+ private String syntax;
+ private String stringRespresentation;
+
+ private UnaryOperator(final String syntax) {
+ this.syntax = syntax;
+ stringRespresentation = syntax;
+ }
+
+ private UnaryOperator(final String syntax, final String stringRespresentation) {
+ this.syntax = syntax;
+ this.stringRespresentation = stringRespresentation;
+ }
+
+ /**
+ * @return Methods name for usage in in text
+ */
+ @Override
+ public String toString() {
+ return stringRespresentation;
+ }
+
+ /**
+ * @return Syntax of the unary operator as used in the URL.
+ */
+ public String toUriLiteral() {
+ return syntax;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/Visitable.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/Visitable.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/Visitable.java
new file mode 100644
index 0000000..3659aa7
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/Visitable.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.expression;
+
+import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+
+/**
+ * The interface {@link Visitable} is part of the visitor pattern used to traverse
+ * the expression tree build from a $filter expression string or $orderby expression string.
+ * It is implemented by each class used as node in an expression tree.
+ * @author SAP AG
+ * @see ExpressionVisitor
+ *
+ */
+public interface Visitable {
+
+ /**
+ * Method {@link #accept(ExpressionVisitor)} is called when traversing the expression tree. This method is invoked on each
+ * expression used as node in an expression tree. The implementations should
+ * behave as follows:
+ * <li>Call accept on all sub nodes and store the returned Objects
+ * <li>Call the appropriate method on the {@link ExpressionVisitor} instance and provide the stored objects to that instance
+ * <li>Return the object which should be passed to the processing algorithm of the parent expression node
+ * <br>
+ * <br>
+ * @param visitor
+ * Object ( implementing {@link ExpressionVisitor}) whose methods are called during traversing a expression node of the expression tree.
+ * @return
+ * Object which should be passed to the processing algorithm of the parent expression node
+ * @throws ExceptionVisitExpression
+ * Exception occurred the OData library while traversing the tree
+ * @throws ODataApplicationException
+ * Exception thrown by the application who implemented the visitor
+ */
+ Object accept(ExpressionVisitor visitor) throws ExceptionVisitExpression, ODataApplicationException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/package-info.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/package-info.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/package-info.java
new file mode 100644
index 0000000..0dd23e2
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/package-info.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Expression Parser
+ * <p>This package contains all classes necessary to decribe an expression tree(e.g. a filter or order by tree)
+ *
+ * <p>Trees can be traversed by implementing the {@link org.apache.olingo.odata2.api.uri.expression.ExpressionVisitor} interface and calling the accept() method.
+ * <br>Different types of expressions can be found in {@link org.apache.olingo.odata2.api.uri.expression.ExpressionKind}.
+ */
+package org.apache.olingo.odata2.api.uri.expression;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/DeleteUriInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/DeleteUriInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/DeleteUriInfo.java
new file mode 100644
index 0000000..cf742fc
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/DeleteUriInfo.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.info;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+
+/**
+ * Access to the parts of the request URI that are relevant for DELETE requests.
+ * @org.apache.olingo.odata2.DoNotImplement
+* @author SAP AG
+*/
+public interface DeleteUriInfo {
+ /**
+ * Gets the target entity container.
+ * @return {@link EdmEntityContainer} the target entity container
+ */
+ public EdmEntityContainer getEntityContainer();
+
+ /**
+ * Gets the start entity set - identical to the target entity set if no navigation
+ * has been used.
+ * @return {@link EdmEntitySet}
+ */
+ public EdmEntitySet getStartEntitySet();
+
+ /**
+ * Gets the target entity set after navigation.
+ * @return {@link EdmEntitySet} target entity set
+ */
+ public EdmEntitySet getTargetEntitySet();
+
+ /**
+ * Gets the function import.
+ * @return {@link EdmFunctionImport} the function import
+ */
+ public EdmFunctionImport getFunctionImport();
+
+ /**
+ * Gets the target type of the request: an entity type, a simple type, or a complex type.
+ * @return {@link EdmType} the target type
+ */
+ public EdmType getTargetType();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the start entity set,
+ * or an empty list if not used.
+ * @return List of {@link KeyPredicate}
+ * @see #getStartEntitySet()
+ */
+ public List<KeyPredicate> getKeyPredicates();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the target entity set,
+ * or an empty list if not used - identical to the key predicates from the last entry
+ * retrieved from {@link #getNavigationSegments()} or, if no navigation has been used,
+ * to the result of {@link #getKeyPredicates()}.
+ * @return List of {@link KeyPredicate}
+ * @see #getTargetEntitySet()
+ */
+ public List<KeyPredicate> getTargetKeyPredicates();
+
+ /**
+ * Gets the navigation segments, or an empty list if no navigation has been used.
+ * @return List of {@link NavigationSegment}
+ */
+ public List<NavigationSegment> getNavigationSegments();
+
+ /**
+ * Gets the path used to select a (simple or complex) property of an entity,
+ * or an empty list if no property is accessed.
+ * @return List of {@link EdmProperty}
+ */
+ public List<EdmProperty> getPropertyPath();
+
+ /**
+ * Gets the parameters of a function import as Map from parameter names to
+ * their corresponding typed values, or an empty list if no function import
+ * is used or no parameters are given in the URI.
+ * @return Map of {@literal <String,} {@link EdmLiteral}{@literal >} function import parameters
+ */
+ public Map<String, EdmLiteral> getFunctionImportParameters();
+
+ /**
+ * Gets the custom query options as Map from option names to their
+ * corresponding String values, or an empty list if no custom query options
+ * are given in the URI.
+ * @return Map of {@literal <String, String>} custom query options
+ */
+ public Map<String, String> getCustomQueryOptions();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetComplexPropertyUriInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetComplexPropertyUriInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetComplexPropertyUriInfo.java
new file mode 100644
index 0000000..c8f2798
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetComplexPropertyUriInfo.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.info;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+
+/**
+ * Access to the parts of the request URI that are relevant for GET requests
+ * of complex properties.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface GetComplexPropertyUriInfo {
+ /**
+ * Gets the target entity container.
+ * @return {@link EdmEntityContainer} the target entity container
+ */
+ public EdmEntityContainer getEntityContainer();
+
+ /**
+ * Gets the start entity set - identical to the target entity set if no navigation
+ * has been used.
+ * @return {@link EdmEntitySet}
+ */
+ public EdmEntitySet getStartEntitySet();
+
+ /**
+ * Gets the target entity set after navigation.
+ * @return {@link EdmEntitySet} target entity set
+ */
+ public EdmEntitySet getTargetEntitySet();
+
+ /**
+ * Gets the function import.
+ * @return {@link EdmFunctionImport} the function import
+ */
+ public EdmFunctionImport getFunctionImport();
+
+ /**
+ * Gets the target complex type of the request.
+ * @return {@link EdmType} the target type
+ */
+ public EdmType getTargetType();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the start entity set,
+ * or an empty list if not used.
+ * @return List of {@link KeyPredicate}
+ * @see #getStartEntitySet()
+ */
+ public List<KeyPredicate> getKeyPredicates();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the target entity set,
+ * or an empty list if not used - identical to the key predicates from the last entry
+ * retrieved from {@link #getNavigationSegments()} or, if no navigation has been used,
+ * to the result of {@link #getKeyPredicates()}.
+ * @return List of {@link KeyPredicate}
+ * @see #getTargetEntitySet()
+ */
+ public List<KeyPredicate> getTargetKeyPredicates();
+
+ /**
+ * Gets the navigation segments, or an empty list if no navigation has been used.
+ * @return List of {@link NavigationSegment}
+ */
+ public List<NavigationSegment> getNavigationSegments();
+
+ /**
+ * Gets the path used to select a (simple or complex) property of an entity,
+ * or an empty list if no property is accessed.
+ * @return List of {@link EdmProperty}
+ */
+ public List<EdmProperty> getPropertyPath();
+
+ /**
+ * Gets the value of the $format system query option.
+ * @return the format (as set as <code>$format</code> query parameter) or null
+ */
+ public String getFormat();
+
+ /**
+ * Gets the parameters of a function import as Map from parameter names to
+ * their corresponding typed values, or an empty list if no function import
+ * is used or no parameters are given in the URI.
+ * @return Map of {@literal <String,} {@link EdmLiteral}{@literal >} function import parameters
+ */
+ public Map<String, EdmLiteral> getFunctionImportParameters();
+
+ /**
+ * Gets the custom query options as Map from option names to their
+ * corresponding String values, or an empty list if no custom query options
+ * are given in the URI.
+ * @return Map of {@literal <String, String>} custom query options
+ */
+ public Map<String, String> getCustomQueryOptions();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityCountUriInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityCountUriInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityCountUriInfo.java
new file mode 100644
index 0000000..c4ed2d9
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityCountUriInfo.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.info;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
+
+/**
+ * Access to the parts of the request URI that are relevant for GET requests
+ * of the count of a single entity (also known as existence check).
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface GetEntityCountUriInfo {
+ /**
+ * Gets the target entity container.
+ * @return {@link EdmEntityContainer} the target entity container
+ */
+ public EdmEntityContainer getEntityContainer();
+
+ /**
+ * Gets the start entity set - identical to the target entity set if no navigation
+ * has been used.
+ * @return {@link EdmEntitySet}
+ */
+ public EdmEntitySet getStartEntitySet();
+
+ /**
+ * Gets the target entity set after navigation.
+ * @return {@link EdmEntitySet} target entity set
+ */
+ public EdmEntitySet getTargetEntitySet();
+
+ /**
+ * Gets the function import.
+ * @return {@link EdmFunctionImport} the function import
+ */
+ public EdmFunctionImport getFunctionImport();
+
+ /**
+ * Gets the target entity type of the request.
+ * @return {@link EdmType} the target type
+ */
+ public EdmType getTargetType();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the start entity set,
+ * or an empty list if not used.
+ * @return List of {@link KeyPredicate}
+ * @see #getStartEntitySet()
+ */
+ public List<KeyPredicate> getKeyPredicates();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the target entity set,
+ * or an empty list if not used - identical to the key predicates from the last entry
+ * retrieved from {@link #getNavigationSegments()} or, if no navigation has been used,
+ * to the result of {@link #getKeyPredicates()}.
+ * @return List of {@link KeyPredicate}
+ * @see #getTargetEntitySet()
+ */
+ public List<KeyPredicate> getTargetKeyPredicates();
+
+ /**
+ * Gets the navigation segments, or an empty list if no navigation has been used.
+ * @return List of {@link NavigationSegment}
+ */
+ public List<NavigationSegment> getNavigationSegments();
+
+ /**
+ * Determines whether $count has been used in the request URI.
+ * @return whether $count has been used
+ */
+ public boolean isCount();
+
+ /**
+ * Gets the value of the $filter system query option as root object of the
+ * expression tree built during URI parsing.
+ * @return the filter expression or null
+ */
+ public FilterExpression getFilter();
+
+ /**
+ * Gets the parameters of a function import as Map from parameter names to
+ * their corresponding typed values, or an empty list if no function import
+ * is used or no parameters are given in the URI.
+ * @return Map of {@literal <String,} {@link EdmLiteral}{@literal >} function import parameters
+ */
+ public Map<String, EdmLiteral> getFunctionImportParameters();
+
+ /**
+ * Gets the custom query options as Map from option names to their
+ * corresponding String values, or an empty list if no custom query options
+ * are given in the URI.
+ * @return Map of {@literal <String, String>} custom query options
+ */
+ public Map<String, String> getCustomQueryOptions();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkCountUriInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkCountUriInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkCountUriInfo.java
new file mode 100644
index 0000000..6f89fb5
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkCountUriInfo.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.info;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+
+/**
+ * Access to the parts of the request URI that are relevant for GET requests
+ * of the number of links to a single entity (also known as existence check).
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface GetEntityLinkCountUriInfo {
+ /**
+ * Gets the target entity container.
+ * @return {@link EdmEntityContainer} the target entity container
+ */
+ public EdmEntityContainer getEntityContainer();
+
+ /**
+ * Gets the start entity set - identical to the target entity set if no navigation
+ * has been used.
+ * @return {@link EdmEntitySet}
+ */
+ public EdmEntitySet getStartEntitySet();
+
+ /**
+ * Gets the target entity set after navigation.
+ * @return {@link EdmEntitySet} target entity set
+ */
+ public EdmEntitySet getTargetEntitySet();
+
+ /**
+ * Gets the function import.
+ * @return {@link EdmFunctionImport} the function import
+ */
+ public EdmFunctionImport getFunctionImport();
+
+ /**
+ * Gets the target entity type of the request.
+ * @return {@link EdmType} the target type
+ */
+ public EdmType getTargetType();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the start entity set,
+ * or an empty list if not used.
+ * @return List of {@link KeyPredicate}
+ * @see #getStartEntitySet()
+ */
+ public List<KeyPredicate> getKeyPredicates();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the target entity set,
+ * or an empty list if not used - identical to the key predicates from the last entry
+ * retrieved from {@link #getNavigationSegments()} or, if no navigation has been used,
+ * to the result of {@link #getKeyPredicates()}.
+ * @return List of {@link KeyPredicate}
+ * @see #getTargetEntitySet()
+ */
+ public List<KeyPredicate> getTargetKeyPredicates();
+
+ /**
+ * Gets the navigation segments, or an empty list if no navigation has been used.
+ * @return List of {@link NavigationSegment}
+ */
+ public List<NavigationSegment> getNavigationSegments();
+
+ /**
+ * Determines whether $count has been used in the request URI.
+ * @return whether $count has been used
+ */
+ public boolean isCount();
+
+ /**
+ * Determines whether $links has been used in the request URI.
+ * @return whether $links has been used
+ */
+ public boolean isLinks();
+
+ /**
+ * Gets the parameters of a function import as Map from parameter names to
+ * their corresponding typed values, or an empty list if no function import
+ * is used or no parameters are given in the URI.
+ * @return Map of {@literal <String,} {@link EdmLiteral}{@literal >} function import parameters
+ */
+ public Map<String, EdmLiteral> getFunctionImportParameters();
+
+ /**
+ * Gets the custom query options as Map from option names to their
+ * corresponding String values, or an empty list if no custom query options
+ * are given in the URI.
+ * @return Map of {@literal <String, String>} custom query options
+ */
+ public Map<String, String> getCustomQueryOptions();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkUriInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkUriInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkUriInfo.java
new file mode 100644
index 0000000..36afb71
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntityLinkUriInfo.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.info;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+
+/**
+ * Access to the parts of the request URI that are relevant for GET requests
+ * of the URI of a single entity.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface GetEntityLinkUriInfo {
+ /**
+ * Gets the target entity container.
+ * @return {@link EdmEntityContainer} the target entity container
+ */
+ public EdmEntityContainer getEntityContainer();
+
+ /**
+ * Gets the start entity set - identical to the target entity set if no navigation
+ * has been used.
+ * @return {@link EdmEntitySet}
+ */
+ public EdmEntitySet getStartEntitySet();
+
+ /**
+ * Gets the target entity set after navigation.
+ * @return {@link EdmEntitySet} target entity set
+ */
+ public EdmEntitySet getTargetEntitySet();
+
+ /**
+ * Gets the function import.
+ * @return {@link EdmFunctionImport} the function import
+ */
+ public EdmFunctionImport getFunctionImport();
+
+ /**
+ * Gets the target entity type of the request.
+ * @return {@link EdmType} the target type
+ */
+ public EdmType getTargetType();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the start entity set,
+ * or an empty list if not used.
+ * @return List of {@link KeyPredicate}
+ * @see #getStartEntitySet()
+ */
+ public List<KeyPredicate> getKeyPredicates();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the target entity set,
+ * or an empty list if not used - identical to the key predicates from the last entry
+ * retrieved from {@link #getNavigationSegments()} or, if no navigation has been used,
+ * to the result of {@link #getKeyPredicates()}.
+ * @return List of {@link KeyPredicate}
+ * @see #getTargetEntitySet()
+ */
+ public List<KeyPredicate> getTargetKeyPredicates();
+
+ /**
+ * Gets the navigation segments, or an empty list if no navigation has been used.
+ * @return List of {@link NavigationSegment}
+ */
+ public List<NavigationSegment> getNavigationSegments();
+
+ /**
+ * Determines whether $links has been used in the request URI.
+ * @return whether $links has been used
+ */
+ public boolean isLinks();
+
+ /**
+ * Gets the value of the $format system query option.
+ * @return the format (as set as <code>$format</code> query parameter) or null
+ */
+ public String getFormat();
+
+ /**
+ * Gets the parameters of a function import as Map from parameter names to
+ * their corresponding typed values, or an empty list if no function import
+ * is used or no parameters are given in the URI.
+ * @return Map of {@literal <String,} {@link EdmLiteral}{@literal >} function import parameters
+ */
+ public Map<String, EdmLiteral> getFunctionImportParameters();
+
+ /**
+ * Gets the custom query options as Map from option names to their
+ * corresponding String values, or an empty list if no custom query options
+ * are given in the URI.
+ * @return Map of {@literal <String, String>} custom query options
+ */
+ public Map<String, String> getCustomQueryOptions();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntitySetCountUriInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntitySetCountUriInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntitySetCountUriInfo.java
new file mode 100644
index 0000000..a05af1f
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/info/GetEntitySetCountUriInfo.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * 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.olingo.odata2.api.uri.info;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
+
+/**
+ * Access to the parts of the request URI that are relevant for GET requests
+ * of the number of entities.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface GetEntitySetCountUriInfo {
+ /**
+ * Gets the target entity container.
+ * @return {@link EdmEntityContainer} the target entity container
+ */
+ public EdmEntityContainer getEntityContainer();
+
+ /**
+ * Gets the start entity set - identical to the target entity set if no navigation
+ * has been used.
+ * @return {@link EdmEntitySet}
+ */
+ public EdmEntitySet getStartEntitySet();
+
+ /**
+ * Gets the target entity set after navigation.
+ * @return {@link EdmEntitySet} target entity set
+ */
+ public EdmEntitySet getTargetEntitySet();
+
+ /**
+ * Gets the function import.
+ * @return {@link EdmFunctionImport} the function import
+ */
+ public EdmFunctionImport getFunctionImport();
+
+ /**
+ * Gets the target entity type of the request.
+ * @return {@link EdmType} the target type
+ */
+ public EdmType getTargetType();
+
+ /**
+ * Gets the key predicates used to select a single entity out of the start entity set,
+ * or an empty list if not used.
+ * @return List of {@link KeyPredicate}
+ * @see #getStartEntitySet()
+ */
+ public List<KeyPredicate> getKeyPredicates();
+
+ /**
+ * Gets the navigation segments, or an empty list if no navigation has been used.
+ * @return List of {@link NavigationSegment}
+ */
+ public List<NavigationSegment> getNavigationSegments();
+
+ /**
+ * Determines whether $count has been used in the request URI.
+ * @return whether $count has been used
+ */
+ public boolean isCount();
+
+ /**
+ * Gets the value of the $filter system query option as root object of the
+ * expression tree built during URI parsing.
+ * @return the filter expression or null
+ */
+ public FilterExpression getFilter();
+
+ /**
+ * Gets the value of the $skip system query option.
+ * @return skip or null
+ */
+ public Integer getSkip();
+
+ /**
+ * Gets the value of the $top system query option.
+ * @return top or null
+ */
+ public Integer getTop();
+
+ /**
+ * Gets the parameters of a function import as Map from parameter names to
+ * their corresponding typed values, or an empty list if no function import
+ * is used or no parameters are given in the URI.
+ * @return Map of {@literal <String,} {@link EdmLiteral}{@literal >} function import parameters
+ */
+ public Map<String, EdmLiteral> getFunctionImportParameters();
+
+ /**
+ * Gets the custom query options as Map from option names to their
+ * corresponding String values, or an empty list if no custom query options
+ * are given in the URI.
+ * @return Map of {@literal <String, String>} custom query options
+ */
+ public Map<String, String> getCustomQueryOptions();
+}