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:32 UTC
[27/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/servicedocument/AtomInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/AtomInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/AtomInfo.java
new file mode 100644
index 0000000..86f2cff
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/AtomInfo.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.servicedocument;
+
+import java.util.List;
+
+/**
+ * A AtomInfo
+ * <p>AtomInfo represents the structure of Service Document according RFC 5023 (for ATOM format)
+ * @author SAP AG
+ */
+public interface AtomInfo {
+
+ /**
+ * Get the list of workspaces
+ *
+ * @return a list of {@link Workspace}
+ */
+ public List<Workspace> getWorkspaces();
+
+ /**
+ * Get common attributes
+ *
+ * @return {@link CommonAttributes}
+ */
+ public CommonAttributes getCommonAttributes();
+
+ /**
+ * Get the list of extension elements
+ *
+ * @return a list of {@link ExtensionElement}
+ */
+ public List<ExtensionElement> getExtesionElements();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Categories.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Categories.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Categories.java
new file mode 100644
index 0000000..5923636
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Categories.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+import java.util.List;
+
+/**
+ * A Categories element
+ * <p>Categories element provides a list of the categories that can be applied to the members of a Collection
+ * <p>If the "href" attribute is provided, the Categories element MUST be empty and MUST NOT have the "fixed" or "scheme" attributes
+ * @author SAP AG
+ */
+
+public interface Categories {
+
+ /**
+ * Get the IRI reference identifying a Category Document
+ *
+ * @return href as String
+ */
+ public String getHref();
+
+ /**
+ * Get the attribute fixed that indicates whether the list of categories is a fixed or an open set
+ *
+ * @return {@link Fixed}
+ */
+ public Fixed getFixed();
+
+ /**
+ * Get the scheme
+ *
+ * @return scheme as String
+ */
+ public String getScheme();
+
+ /**
+ * Get the list of categories
+ *
+ * @return list of {@link Category}
+ */
+ public List<Category> getCategoryList();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Category.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Category.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Category.java
new file mode 100644
index 0000000..a4d3553
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Category.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.servicedocument;
+
+/**
+ * A Category element
+ * <p>Category element
+ * @author SAP AG
+ */
+public interface Category {
+ /**
+ * Get the scheme
+ *
+ * @return scheme as String
+ */
+ public String getScheme();
+
+ /**
+ * Get the term
+ *
+ * @return term as String
+ */
+ public String getTerm();
+
+ /**
+ * Get common attributes
+ *
+ * @return {@link CommonAttributes}
+ */
+ public CommonAttributes getCommonAttributes();
+
+ /**
+ * Get the label
+ *
+ * @return label as String
+ */
+ public String getLabel();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Collection.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Collection.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Collection.java
new file mode 100644
index 0000000..60f48e1
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Collection.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.api.servicedocument;
+
+import java.util.List;
+
+/**
+ * A Collection
+ * <p>Collection element describes a Collection
+ * @author SAP AG
+ */
+public interface Collection {
+ /**
+ * Get the human-readable title for the Collection
+ *
+ * @return {@link Title}
+ */
+ public Title getTitle();
+
+ /**
+ * Get the "href" attribute, whose value gives IRI of the Collection
+ *
+ * @return href as String
+ */
+ public String getHref();
+
+ /**
+ * Get common attributes
+ *
+ * @return {@link CommonAttributes}
+ */
+ public CommonAttributes getCommonAttributes();
+
+ /**
+ * Get the media range that specifies a type of representation
+ * that can be POSTed to a Collection
+ * @return a list of {@link Accept}
+ */
+ public List<Accept> getAcceptElements();
+
+ /**
+ *
+ *
+ * @return a list of {@link Categories}
+ */
+ public List<Categories> getCategories();
+
+ /**
+ * Get the list of extension elements
+ *
+ * @return a list of {@link ExtensionElement}
+ */
+ public List<ExtensionElement> getExtesionElements();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/CommonAttributes.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/CommonAttributes.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/CommonAttributes.java
new file mode 100644
index 0000000..bc22f15
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/CommonAttributes.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.servicedocument;
+
+import java.util.List;
+
+/**
+ * A CommonAttributes
+ * @author SAP AG
+ */
+public interface CommonAttributes {
+ /**
+ * Get the a base URI
+ *
+ * @return base as String
+ */
+ public String getBase();
+
+ /**
+ * Get the natural language for the element
+ *
+ * @return language as String
+ */
+ public String getLang();
+
+ /**
+ * Get the list of any attributes
+ *
+ * @return list of {@link ExtensionAttribute}
+ */
+ public List<ExtensionAttribute> getAttributes();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionAttribute.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionAttribute.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionAttribute.java
new file mode 100644
index 0000000..c946f00
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionAttribute.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.servicedocument;
+
+/**
+ * A ExtensionAttribute
+ * <p>ExtensionAttribute is an attribute of an extension element
+ * @author SAP AG
+ */
+public interface ExtensionAttribute {
+ /**
+ * Get the namespace
+ *
+ * @return namespace as String
+ */
+ public String getNamespace();
+
+ /**
+ * Get the prefix of the attribute
+ *
+ * @return prefix as String
+ */
+ public String getPrefix();
+
+ /**
+ * Get the local name of the attribute
+ *
+ * @return name as String
+ */
+ public String getName();
+
+ /**
+ * Get the text
+ *
+ * @return text as String
+ */
+ public String getText();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionElement.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionElement.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionElement.java
new file mode 100644
index 0000000..1797f79
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ExtensionElement.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.api.servicedocument;
+
+import java.util.List;
+
+/**
+ * A ExtensionElement
+ * <p>ExtensionElement is an element that is defined in any namespace except
+ * the namespace "app"
+ * @author SAP AG
+ */
+public interface ExtensionElement {
+ /**
+ * Get the namespace
+ *
+ * @return namespace as String
+ */
+ public String getNamespace();
+
+ /**
+ * Get the prefix of the element
+ *
+ * @return prefix as String
+ */
+ public String getPrefix();
+
+ /**
+ * Get the local name of the element
+ *
+ * @return name as String
+ */
+ public String getName();
+
+ /**
+ * Get the text
+ *
+ * @return text as String
+ */
+ public String getText();
+
+ /**
+ * Get nested elements
+ *
+ * @return a list of {@link ExtensionElement}
+ */
+ public List<ExtensionElement> getElements();
+
+ /**
+ * Get attributes
+ *
+ * @return a list of {@link ExtensionAttribute}
+ */
+ public List<ExtensionAttribute> getAttributes();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Fixed.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Fixed.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Fixed.java
new file mode 100644
index 0000000..5b28ee5
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Fixed.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+/**
+* Fixed
+* <p>Fixed indicates whether the list of categories is a fixed or an open set
+* Fixed can either be yes or no
+* @author SAP AG
+*/
+public enum Fixed {
+ YES, NO;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocument.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocument.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocument.java
new file mode 100644
index 0000000..b978820
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocument.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+
+/**
+ * A Service document
+ * <p>Service document lists all EntitySets
+ * @author SAP AG
+ */
+public interface ServiceDocument {
+ /**
+ * Get the list of the EntitySets
+ *
+ * @return a list of {@link EdmEntitySetInfo}
+ */
+ public List<EdmEntitySetInfo> getEntitySetsInfo() throws EntityProviderException;
+
+ /**
+ * Get additional information if the service document is in atom format
+ *
+ * @return {@link AtomInfo} or null
+ */
+ public AtomInfo getAtomInfo();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParser.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParser.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParser.java
new file mode 100644
index 0000000..3f35736
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParser.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+import java.io.InputStream;
+
+/**
+ * @author SAP AG
+ */
+public interface ServiceDocumentParser {
+ public ServiceDocument parseXml(InputStream in) throws ServiceDocumentParserException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParserException.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParserException.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParserException.java
new file mode 100644
index 0000000..2c27d3f
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/ServiceDocumentParserException.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+/**
+ * @author SAP AG
+ */
+public class ServiceDocumentParserException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public ServiceDocumentParserException(final String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Title.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Title.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Title.java
new file mode 100644
index 0000000..05c219c
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Title.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+/**
+ * A Title element
+ * <p>Title element gives a human-readable title
+ * @author SAP AG
+ */
+public interface Title {
+ /**
+ * @return text as String
+ */
+ public String getText();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Workspace.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Workspace.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Workspace.java
new file mode 100644
index 0000000..656b34e
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/servicedocument/Workspace.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.servicedocument;
+
+import java.util.List;
+
+/**
+ * A Workspace element
+ * <p>Workspaces are server-defined groups of Collections.
+ * @author SAP AG
+ */
+public interface Workspace {
+ /**
+ * Get the human-readable title for the Workspace
+ *
+ * @return {@link Title}
+ */
+ public Title getTitle();
+
+ /**
+ * Get the list of the Collections
+ *
+ * @return a list of {@link Collection}
+ */
+ public List<Collection> getCollections();
+
+ /**
+ * Get common attributes
+ *
+ * @return {@link CommonAttributes}
+ */
+ public CommonAttributes getCommonAttributes();
+
+ /**
+ * Get the list of extension elements
+ *
+ * @return a list of {@link ExtensionElement}
+ */
+ public List<ExtensionElement> getExtesionElements();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java
new file mode 100644
index 0000000..7475457
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/ExpandSelectTreeNode.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+
+/**
+ * Expression tree node with information about selected properties and to be expanded links.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface ExpandSelectTreeNode {
+
+ /**
+ * Determines whether all properties (including navigation properties) have been selected.
+ */
+ public boolean isAll();
+
+ /**
+ * <p>Gets the list of explicitly selected {@link EdmProperty properties}.</p>
+ * <p>This list does not contain any navigation properties.
+ * It is empty if {@link #isAll()} returns <code>true</code>.</p>
+ * @return List of selected properties
+ */
+ public List<EdmProperty> getProperties();
+
+ /**
+ * Gets the links that have to be included or expanded.
+ * @return a Map from EdmNavigationProperty Name to its related {@link ExpandSelectTreeNode};
+ * if that node is <code>null</code>, a deferred link has been requested,
+ * otherwise the link must be expanded with information found in that node
+ */
+ public Map<String, ExpandSelectTreeNode> getLinks();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/KeyPredicate.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/KeyPredicate.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/KeyPredicate.java
new file mode 100644
index 0000000..6142e67
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/KeyPredicate.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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;
+
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+
+/**
+ * Key predicate, consisting of a simple-type property and its value as String literal
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface KeyPredicate {
+
+ /**
+ * <p>Gets the literal String in default representation.</p>
+ * <p>The description for {@link org.apache.olingo.odata2.api.edm.EdmLiteral} has some motivation for using
+ * this representation.</p>
+ * @return String literal in default (<em>not</em> URI) representation
+ * @see org.apache.olingo.odata2.api.edm.EdmLiteralKind
+ */
+ public String getLiteral();
+
+ /**
+ * Gets the key property.
+ * @return {@link EdmProperty} simple-type property
+ */
+ public EdmProperty 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/NavigationPropertySegment.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/NavigationPropertySegment.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/NavigationPropertySegment.java
new file mode 100644
index 0000000..08a528e
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/NavigationPropertySegment.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+
+/**
+ * Navigation property segment, consisting of a navigation property and its
+ * target entity set.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface NavigationPropertySegment {
+
+ /**
+ * Gets the navigation property.
+ * @return {@link EdmNavigationProperty} navigation property
+ */
+ public EdmNavigationProperty getNavigationProperty();
+
+ /**
+ * Gets the target entity set.
+ * @return {@link EdmEntitySet} the target entity set
+ */
+ public EdmEntitySet getTargetEntitySet();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/NavigationSegment.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/NavigationSegment.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/NavigationSegment.java
new file mode 100644
index 0000000..daf22c8
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/NavigationSegment.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+
+/**
+ * Navigation segment, consisting of a navigation property, its target entity set,
+ * and, optionally, a list of key predicates to determine a single entity out of
+ * the target entity set.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface NavigationSegment {
+
+ /**
+ * Gets the navigation property.
+ * @return {@link EdmNavigationProperty} navigation property of this navigation segment
+ */
+ public EdmNavigationProperty getNavigationProperty();
+
+ /**
+ * Gets the target entity set.
+ * @return {@link EdmEntitySet} entity set of this navigation segment
+ */
+ public EdmEntitySet getEntitySet();
+
+ /**
+ * Gets the key predicate for the target entity set.
+ * @return List of {@link KeyPredicate}: key predicate of this navigation segment
+ */
+ public List<KeyPredicate> getKeyPredicates();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathInfo.java
new file mode 100644
index 0000000..e4f2409
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathInfo.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * Object to keep OData URI information.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface PathInfo {
+
+ /**
+ * Gets preceding path segments.
+ * @return List of path segments
+ */
+ List<PathSegment> getPrecedingSegments();
+
+ /**
+ * Gets OData path segments as immutable list.
+ * @return List of path segments
+ */
+ List<PathSegment> getODataSegments();
+
+ /**
+ * Gets the root URI of this service.
+ * @return absolute base URI of the request
+ */
+ URI getServiceRoot();
+
+ /**
+ * Get the absolute request URI including any query parameters.
+ * @return the absolute request URI
+ */
+ URI getRequestUri();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathSegment.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathSegment.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathSegment.java
new file mode 100644
index 0000000..0629b19
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/PathSegment.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;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>URI path segment consisting of an URI path element and URI matrix parameters.</p>
+ * <p>Example URI:
+ * <pre>{@code //moremaps.com/map/color;mul=50,25;long=20;scale=32000}</pre>
+ * where <code>color</code> is a path segment,
+ * <code>mul</code>, <code>long</code>, and <code>scale</code> are matrix parameters,
+ * and the matrix parameter <code>mul</code> has a multi-value list.</p>
+ *
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface PathSegment {
+
+ /**
+ * Gets a URI path element. In the example above, <code>color</code> will be an element.
+ * @return a URI path element
+ */
+ String getPath();
+
+ /**
+ * <p>Gets the matrix parameters of this path segment.</p>
+ * <p>In the {@link PathSegment} example, <code>mul</code>, <code>long</code>,
+ * and <code>scale</code> are matrix parameters.</p>
+ * @return an immutable map of matrix parameters and their values
+ */
+ Map<String, List<String>> getMatrixParameters();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/SelectItem.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/SelectItem.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/SelectItem.java
new file mode 100644
index 0000000..ae3a52d
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/SelectItem.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;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+
+/**
+ * An item of a $select system query option.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ */
+public interface SelectItem {
+
+ /**
+ * <code>true</code> if select=*
+ * @return <code>true</code> if select=*
+ */
+ public boolean isStar();
+
+ /**
+ * Gets the EDM property.
+ * @return {@link EdmProperty} property of this select item
+ */
+ public EdmProperty getProperty();
+
+ /**
+ * Gets the navigation-property segments for this select item.
+ * @return List of {@link NavigationPropertySegment} for this select item or Collection.EmptyList
+ */
+ public List<NavigationPropertySegment> getNavigationPropertySegments();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriInfo.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriInfo.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriInfo.java
new file mode 100644
index 0000000..ce60329
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriInfo.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.commons.InlineCount;
+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.expression.FilterExpression;
+import org.apache.olingo.odata2.api.uri.expression.OrderByExpression;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetComplexPropertyUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityLinkCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksCountUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetMediaResourceUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetMetadataUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetServiceDocumentUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
+import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
+
+/**
+ * Structured parts of the request URI - the result of URI parsing.
+ * @org.apache.olingo.odata2.DoNotImplement
+ * @author SAP AG
+ * @see UriParser
+ */
+public interface UriInfo extends GetServiceDocumentUriInfo,
+ GetEntitySetUriInfo, GetEntityUriInfo,
+ GetComplexPropertyUriInfo, GetSimplePropertyUriInfo,
+ GetEntityLinkUriInfo, GetEntitySetLinksUriInfo,
+ GetMetadataUriInfo,
+ GetFunctionImportUriInfo,
+ GetEntitySetCountUriInfo, GetEntityCountUriInfo,
+ GetMediaResourceUriInfo,
+ GetEntityLinkCountUriInfo, GetEntitySetLinksCountUriInfo,
+ PutMergePatchUriInfo, PostUriInfo, DeleteUriInfo {
+
+ /**
+ * Gets the target entity container.
+ * @return {@link EdmEntityContainer} the target entity container
+ */
+ @Override
+ public EdmEntityContainer getEntityContainer();
+
+ /**
+ * Gets the start entity set - identical to the target entity set if no navigation
+ * has been used.
+ * @return {@link EdmEntitySet}
+ */
+ @Override
+ public EdmEntitySet getStartEntitySet();
+
+ /**
+ * Gets the target entity set after navigation.
+ * @return {@link EdmEntitySet} target entity set
+ */
+ @Override
+ public EdmEntitySet getTargetEntitySet();
+
+ /**
+ * Gets the function import.
+ * @return {@link EdmFunctionImport} the function import
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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()
+ */
+ @Override
+ 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()
+ */
+ @Override
+ public List<KeyPredicate> getTargetKeyPredicates();
+
+ /**
+ * Gets the navigation segments, or an empty list if no navigation has been used.
+ * @return List of {@link NavigationSegment}
+ */
+ @Override
+ 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}
+ */
+ @Override
+ public List<EdmProperty> getPropertyPath();
+
+ /**
+ * Determines whether $count has been used in the request URI.
+ * @return whether $count has been used
+ */
+ @Override
+ public boolean isCount();
+
+ /**
+ * Determines whether $value has been used in the request URI.
+ * @return whether $value has been used
+ */
+ @Override
+ public boolean isValue();
+
+ /**
+ * Determines whether $links has been used in the request URI.
+ * @return whether $links has been used
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getFormat();
+
+ /**
+ * 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
+ */
+ @Override
+ public FilterExpression getFilter();
+
+ /**
+ * Gets the value of the $inlinecount system query option.
+ * @return {@link InlineCount} the inline count or null
+ */
+ @Override
+ public InlineCount getInlineCount();
+
+ /**
+ * Gets the value of the $orderby system query option as root object of the
+ * expression tree built during URI parsing.
+ * @return the order-by expression or null
+ */
+ @Override
+ public OrderByExpression getOrderBy();
+
+ /**
+ * Gets the value of the $skiptoken system query option.
+ * @return skip token or null
+ */
+ @Override
+ public String getSkipToken();
+
+ /**
+ * Gets the value of the $skip system query option.
+ * @return skip or null
+ */
+ @Override
+ public Integer getSkip();
+
+ /**
+ * Gets the value of the $top system query option.
+ * @return top or null
+ */
+ @Override
+ public Integer getTop();
+
+ /**
+ * Gets the value of the $expand system query option as a list of
+ * lists of navigation-property segments, or an empty list if not used.
+ * @return List of a list of {@link NavigationPropertySegment} to be expanded
+ */
+ @Override
+ public List<ArrayList<NavigationPropertySegment>> getExpand();
+
+ /**
+ * Gets the value of the $select system query option as a list of select items,
+ * or an empty list if not used.
+ * @return List of {@link SelectItem} to be selected
+ */
+ @Override
+ public List<SelectItem> getSelect();
+
+ /**
+ * 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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/UriNotMatchingException.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriNotMatchingException.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriNotMatchingException.java
new file mode 100644
index 0000000..4ff467b
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriNotMatchingException.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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;
+
+import org.apache.olingo.odata2.api.exception.MessageReference;
+import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
+
+/**
+ * URI-parsing exception resulting in a 404 Not Found response.
+ * @author SAP AG
+ */
+public class UriNotMatchingException extends ODataNotFoundException {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final MessageReference MATCHPROBLEM = createMessageReference(UriNotMatchingException.class, "MATCHPROBLEM");
+ public static final MessageReference NOTFOUND = createMessageReference(UriNotMatchingException.class, "NOTFOUND");
+ public static final MessageReference CONTAINERNOTFOUND = createMessageReference(UriNotMatchingException.class, "CONTAINERNOTFOUND");
+ public static final MessageReference ENTITYNOTFOUND = createMessageReference(UriNotMatchingException.class, "ENTITYNOTFOUND");
+ public static final MessageReference PROPERTYNOTFOUND = createMessageReference(UriNotMatchingException.class, "PROPERTYNOTFOUND");
+
+ public UriNotMatchingException(final MessageReference messageReference) {
+ super(messageReference);
+ }
+
+ public UriNotMatchingException(final MessageReference messageReference, final Throwable cause) {
+ super(messageReference, cause);
+ }
+
+ public UriNotMatchingException(final MessageReference messageReference, final String errorCode) {
+ super(messageReference, errorCode);
+ }
+
+ public UriNotMatchingException(final MessageReference messageReference, final Throwable cause, final String errorCode) {
+ super(messageReference, cause, errorCode);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriParser.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriParser.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriParser.java
new file mode 100644
index 0000000..5cca5f4
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriParser.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.exception.ODataMessageException;
+import org.apache.olingo.odata2.api.rt.RuntimeDelegate;
+import org.apache.olingo.odata2.api.uri.expression.ExpressionParserException;
+import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
+import org.apache.olingo.odata2.api.uri.expression.OrderByExpression;
+
+/**
+ * Wrapper for UriParser functionality.
+ * @author SAP AG
+ */
+public abstract class UriParser {
+
+ /**
+ * Parses path segments and query parameters for the given EDM.
+ * @param edm Entity Data Model
+ * @param pathSegments list of path segments
+ * @param queryParameters query parameters
+ * @return {@link UriInfo} information about the parsed URI
+ * @throws ODataException
+ */
+ public static UriInfo parse(final Edm edm, final List<PathSegment> pathSegments, final Map<String, String> queryParameters) throws ODataException {
+ return RuntimeDelegate.getUriParser(edm).parse(pathSegments, queryParameters);
+ }
+
+ /**
+ * Parses path segments and query parameters.
+ * @param pathSegments list of path segments
+ * @param queryParameters query parameters
+ * @return {@link UriInfo} information about the parsed URI
+ * @throws UriSyntaxException
+ * @throws UriNotMatchingException
+ * @throws EdmException
+ */
+ public abstract UriInfo parse(List<PathSegment> pathSegments, Map<String, String> queryParameters) throws UriSyntaxException, UriNotMatchingException, EdmException;
+
+ /**
+ * Parses a $filter expression string and create an expression tree.
+ * <p>The current expression parser supports expressions as defined in the
+ * OData specification 2.0 with the following restrictions:
+ * <ul>
+ * <li>the methods "cast", "isof" and "replace" are not supported</li>
+ * </ul></p>
+ *
+ * <p>The expression parser can be used with providing an Entity Data Model (EDM)
+ * and without providing it. When an EDM is provided the expression parser will be
+ * as strict as possible. That means:
+ * <ul>
+ * <li>All properties used in the expression must be defined inside the EDM,</li>
+ * <li>the types of EDM properties will be checked against the lists of allowed
+ * types per method and per binary or unary operator, respectively</li>
+ * </ul>
+ * If no EDM is provided the expression parser performs a lax validation:
+ * <ul>
+ * <li>The properties used in the expression are not looked up inside the EDM
+ * and the type of the expression node representing the property will be "null",</li>
+ * <li>expression nodes with EDM type "null" are not considered during the parameter
+ * type validation, so the return type of the parent expression node will
+ * also become "null".</li>
+ * </ul>
+ * @param edm entity data model of the accessed OData service
+ * @param edmType EDM type of the OData entity/complex type/... addressed by the URL
+ * @param expression $filter expression string to be parsed
+ * @return expression tree which can be traversed with help of the interfaces
+ * {@link org.apache.olingo.odata2.api.uri.expression.ExpressionVisitor ExpressionVisitor}
+ * and {@link org.apache.olingo.odata2.api.uri.expression.Visitable Visitable}
+ * @throws ExpressionParserException thrown due to errors while parsing the $filter expression string
+ * @throws ODataMessageException for extensibility
+ */
+ public static FilterExpression parseFilter(final Edm edm, final EdmEntityType edmType, final String expression) throws ExpressionParserException, ODataMessageException {
+ return RuntimeDelegate.getUriParser(edm).parseFilterString(edmType, expression);
+ }
+
+ /**
+ * Parses a $filter expression string and create an expression tree.
+ * <p>The current expression parser supports expressions as defined in the
+ * OData specification 2.0 with the following restrictions:
+ * <ul>
+ * <li>the methods "cast", "isof" and "replace" are not supported</li>
+ * </ul></p>
+ *
+ * <p>The expression parser can be used with providing an Entity Data Model (EDM)
+ * and without providing it. When an EDM is provided the expression parser will be
+ * as strict as possible. That means:
+ * <ul>
+ * <li>All properties used in the expression must be defined inside the EDM,</li>
+ * <li>the types of EDM properties will be checked against the lists of allowed
+ * types per method and per binary or unary operator, respectively</li>
+ * </ul>
+ * If no EDM is provided the expression parser performs a lax validation:
+ * <ul>
+ * <li>The properties used in the expression are not looked up inside the EDM
+ * and the type of the expression node representing the property will be "null",</li>
+ * <li>expression nodes with EDM type "null" are not considered during the parameter
+ * type validation, so the return type of the parent expression node will
+ * also become "null".</li>
+ * </ul>
+ * @param edmType EDM type of the OData entity/complex type/... addressed by the URL
+ * @param expression $filter expression string to be parsed
+ * @return expression tree which can be traversed with help of the interfaces
+ * {@link org.apache.olingo.odata2.api.uri.expression.ExpressionVisitor ExpressionVisitor}
+ * and {@link org.apache.olingo.odata2.api.uri.expression.Visitable Visitable}
+ * @throws ExpressionParserException thrown due to errors while parsing the $filter expression string
+ * @throws ODataMessageException for extensibility
+ */
+ public abstract FilterExpression parseFilterString(EdmEntityType edmType, String expression) throws ExpressionParserException, ODataMessageException;
+
+ /**
+ * Parses a $orderby expression string and creates an expression tree.
+ * @param edm EDM model of the accessed OData service
+ * @param edmType EDM type of the OData entity/complex type/... addressed by the URL
+ * @param expression $orderby expression string to be parsed
+ * @return expression tree which can be traversed with help of the interfaces
+ * {@link org.apache.olingo.odata2.api.uri.expression.ExpressionVisitor ExpressionVisitor}
+ * and {@link org.apache.olingo.odata2.api.uri.expression.Visitable Visitable}
+ * @throws ExpressionParserException thrown due to errors while parsing the $orderby expression string
+ * @throws ODataMessageException used for extensibility
+ */
+ public static OrderByExpression parseOrderBy(final Edm edm, final EdmEntityType edmType, final String expression) throws ExpressionParserException, ODataMessageException {
+ return RuntimeDelegate.getUriParser(edm).parseOrderByString(edmType, expression);
+ }
+
+ /**
+ * Parses a $orderby expression string and creates an expression tree.
+ * @param edmType EDM type of the OData entity/complex type/... addressed by the URL
+ * @param expression $orderby expression string to be parsed
+ * @return expression tree which can be traversed with help of the interfaces
+ * {@link org.apache.olingo.odata2.api.uri.expression.ExpressionVisitor ExpressionVisitor}
+ * and {@link org.apache.olingo.odata2.api.uri.expression.Visitable Visitable}
+ * @throws ExpressionParserException thrown due to errors while parsing the $orderby expression string
+ * @throws ODataMessageException used for extensibility
+ */
+ public abstract OrderByExpression parseOrderByString(EdmEntityType edmType, String expression) throws ExpressionParserException, ODataMessageException;
+
+ /**
+ * Creates an optimized expression tree out of $expand and $select expressions.
+ * @param select List of {@link SelectItem select items}
+ * @param expand List of Lists of {@link NavigationPropertySegment navigation property segments}
+ * @return expression tree of type {@link ExpandSelectTreeNode}
+ * @throws EdmException
+ */
+ public static ExpandSelectTreeNode createExpandSelectTree(final List<SelectItem> select, final List<ArrayList<NavigationPropertySegment>> expand) throws EdmException {
+ return RuntimeDelegate.getUriParser(null).buildExpandSelectTree(select, expand);
+ }
+
+ /**
+ * Creates an optimized expression tree out of $expand and $select expressions.
+ * @param select List of {@link SelectItem select items}
+ * @param expand List of Lists of {@link NavigationPropertySegment navigation property segments}
+ * @return expression tree of type {@link ExpandSelectTreeNode}
+ * @throws EdmException
+ */
+ public abstract ExpandSelectTreeNode buildExpandSelectTree(List<SelectItem> select, List<ArrayList<NavigationPropertySegment>> expand) throws EdmException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriSyntaxException.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriSyntaxException.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriSyntaxException.java
new file mode 100644
index 0000000..e5da915
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/UriSyntaxException.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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;
+
+import org.apache.olingo.odata2.api.exception.MessageReference;
+import org.apache.olingo.odata2.api.exception.ODataBadRequestException;
+
+/**
+ * Exception for violation of the OData URI construction rules,
+ * resulting in a 400 Bad Request response.
+ * @author SAP AG
+ */
+public class UriSyntaxException extends ODataBadRequestException {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final MessageReference URISYNTAX = createMessageReference(UriSyntaxException.class, "URISYNTAX");
+ public static final MessageReference ENTITYSETINSTEADOFENTITY = createMessageReference(UriSyntaxException.class, "ENTITYSETINSTEADOFENTITY");
+ public static final MessageReference NOTEXT = createMessageReference(UriSyntaxException.class, "NOTEXT");
+ public static final MessageReference NOMEDIARESOURCE = createMessageReference(UriSyntaxException.class, "NOMEDIARESOURCE");
+ public static final MessageReference NONAVIGATIONPROPERTY = createMessageReference(UriSyntaxException.class, "NONAVIGATIONPROPERTY");
+ public static final MessageReference MISSINGPARAMETER = createMessageReference(UriSyntaxException.class, "MISSINGPARAMETER");
+ public static final MessageReference MISSINGKEYPREDICATENAME = createMessageReference(UriSyntaxException.class, "MISSINGKEYPREDICATENAME");
+ public static final MessageReference DUPLICATEKEYNAMES = createMessageReference(UriSyntaxException.class, "DUPLICATEKEYNAMES");
+ public static final MessageReference EMPTYSEGMENT = createMessageReference(UriSyntaxException.class, "EMPTYSEGMENT");
+ public static final MessageReference MUSTNOTBELASTSEGMENT = createMessageReference(UriSyntaxException.class, "MUSTNOTBELASTSEGMENT");
+ public static final MessageReference MUSTBELASTSEGMENT = createMessageReference(UriSyntaxException.class, "MUSTBELASTSEGMENT");
+ public static final MessageReference INVALIDSEGMENT = createMessageReference(UriSyntaxException.class, "INVALIDSEGMENT");
+ public static final MessageReference INVALIDVALUE = createMessageReference(UriSyntaxException.class, "INVALIDVALUE");
+ public static final MessageReference INVALIDNULLVALUE = createMessageReference(UriSyntaxException.class, "INVALIDNULLVALUE");
+ public static final MessageReference INVALIDNEGATIVEVALUE = createMessageReference(UriSyntaxException.class, "INVALIDNEGATIVEVALUE");
+ public static final MessageReference INVALIDRETURNTYPE = createMessageReference(UriSyntaxException.class, "INVALIDRETURNTYPE");
+ public static final MessageReference INVALIDPROPERTYTYPE = createMessageReference(UriSyntaxException.class, "INVALIDPROPERTYTYPE");
+ public static final MessageReference INVALIDKEYPREDICATE = createMessageReference(UriSyntaxException.class, "INVALIDKEYPREDICATE");
+ public static final MessageReference INVALIDSYSTEMQUERYOPTION = createMessageReference(UriSyntaxException.class, "INVALIDSYSTEMQUERYOPTION");
+ public static final MessageReference INVALIDFILTEREXPRESSION = createMessageReference(UriSyntaxException.class, "INVALIDFILTEREXPRESSION");
+ public static final MessageReference INVALIDORDERBYEXPRESSION = createMessageReference(UriSyntaxException.class, "INVALIDORDERBYEXPRESSION");
+ public static final MessageReference LITERALFORMAT = createMessageReference(UriSyntaxException.class, "LITERALFORMAT");
+ public static final MessageReference UNKNOWNLITERAL = createMessageReference(UriSyntaxException.class, "UNKNOWNLITERAL");
+ public static final MessageReference INCOMPATIBLELITERAL = createMessageReference(UriSyntaxException.class, "INCOMPATIBLELITERAL");
+ public static final MessageReference INCOMPATIBLESYSTEMQUERYOPTION = createMessageReference(UriSyntaxException.class, "INCOMPATIBLESYSTEMQUERYOPTION");
+
+ public UriSyntaxException(final MessageReference MessageReference) {
+ super(MessageReference);
+ }
+
+ public UriSyntaxException(final MessageReference messageReference, final Throwable cause) {
+ super(messageReference, cause);
+ }
+
+ public UriSyntaxException(final MessageReference MessageReference, final String errorCode) {
+ super(MessageReference, errorCode);
+ }
+
+ public UriSyntaxException(final MessageReference messageReference, final Throwable cause, final String errorCode) {
+ super(messageReference, cause, errorCode);
+ }
+}
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/BinaryExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/BinaryExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/BinaryExpression.java
new file mode 100644
index 0000000..4f823c6
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/BinaryExpression.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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 binary 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>
+ * A binary expression node is inserted in the expression tree for any valid
+ * ODATA binary operator in {@link BinaryOperator} (e.g. for "and", "div", "eg", ... )
+ * <br>
+ * @author SAP AG
+ */
+public interface BinaryExpression extends CommonExpression {
+ /**
+ * @return Operator object that represents the used operator
+ * @see BinaryOperator
+ */
+ public BinaryOperator getOperator();
+
+ /**
+ * @return Expression sub tree of the left operand
+ */
+ public CommonExpression getLeftOperand();
+
+ /**
+ * @return Expression sub tree of the right operand
+ */
+ public CommonExpression getRightOperand();
+}
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/BinaryOperator.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/BinaryOperator.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/BinaryOperator.java
new file mode 100644
index 0000000..2aa9a75
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/BinaryOperator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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 binary operators of the ODATA expression parser
+ * for ODATA version 2.0 (with some restrictions)
+ * @author SAP AG
+*/
+public enum BinaryOperator {
+ AND("and"), OR("or"), EQ("eq"), NE("ne"), LT("lt"), LE("le"), GT("gt"), GE("ge"), ADD("add"), SUB("sub"), MUL("mul"), DIV("div"), MODULO("mod"),
+
+ /**
+ * Property access operator. E.g. $filter=address/city eq "Sydney"
+ */
+ PROPERTY_ACCESS("/", "property access");
+
+ private String uriSyntax;
+ private String stringRespresentation;
+
+ private BinaryOperator(final String uriSyntax) {
+ this.uriSyntax = uriSyntax;
+ stringRespresentation = uriSyntax;
+ }
+
+ private BinaryOperator(final String syntax, final String stringRespresentation) {
+ uriSyntax = syntax;
+ this.stringRespresentation = stringRespresentation;
+ }
+
+ /**
+ * @return Operator name for usage in text
+ */
+ @Override
+ public String toString() {
+ return stringRespresentation;
+ }
+
+ /**
+ * @return URI literal of the binary operator as used in the URL.
+ */
+ public String toUriLiteral() {
+ return uriSyntax;
+ }
+}
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/CommonExpression.java
----------------------------------------------------------------------
diff --git a/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/CommonExpression.java b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/CommonExpression.java
new file mode 100644
index 0000000..fc6be63
--- /dev/null
+++ b/odata-api/src/main/java/org/apache/olingo/odata2/api/uri/expression/CommonExpression.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.EdmType;
+
+/**
+ * Parent class of all classes used to build the expression tree returned by
+ * <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>This interface defines the default methods for all expression tree nodes
+ * <br>
+ * <br>
+ * @author SAP AG
+ */
+public interface CommonExpression extends Visitable {
+ /**
+ * @return Kind of this expression
+ * @see ExpressionKind
+ */
+ ExpressionKind getKind();
+
+ /**
+ * @return The return type of the value represented with
+ * this expression. For example the {@link #getEdmType()} method
+ * for an expression representing the "concat" method will return always
+ * "Edm.String".<br>
+ * <br>
+ * <p>This type information is set while parsing the $filter or $orderby
+ * expressions and used to do a first validation of the expression.
+ * For calculating operators like "add, sub, mul" this type
+ * information is purely based on input and output types of the
+ * operator as defined in the OData specification.
+ * So for $filter=2 add 7 the {@link #getEdmType()} method of the binary expression
+ * will return Edm.Byte and not Edm.Int16 because the parser performs no real
+ * addition.<br>
+ * <br>
+ * <p>However, the application may change this type while evaluating the
+ * expression tree.
+ */
+ EdmType getEdmType();
+
+ /**
+ * Set the edmType of this expression node
+ * @param edmType Type to be set
+ * @return A self reference for method chaining"
+ */
+ CommonExpression setEdmType(EdmType edmType);
+
+ /**
+ * Returns the URI literal which lead to the creation of this expression.
+ * @return URI literal
+ */
+ String getUriLiteral();
+}