olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chri...@apache.org
Subject [04/21] [OLINGO-77] Refactored java package names
Date Fri, 06 Dec 2013 14:51:40 GMT
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java b/odata4-lib/odata4-consumer-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
new file mode 100644
index 0000000..4344cad
--- /dev/null
+++ b/odata4-lib/odata4-consumer-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.odata4.consumer.core.testutil;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+
+/**
+ * @author SAP AG
+ */
+public class StringHelper {
+
+  public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
+    final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
+    final StringBuilder stringBuilder = new StringBuilder();
+    String line = null;
+
+    while ((line = bufferedReader.readLine()) != null) {
+      stringBuilder.append(line);
+      if (preserveLineBreaks) {
+        stringBuilder.append("\n");
+      }
+    }
+
+    bufferedReader.close();
+
+    final String result = stringBuilder.toString();
+
+    return result;
+  }
+
+  public static String inputStreamToString(final InputStream in) throws IOException {
+    return inputStreamToString(in, false);
+  }
+
+  /**
+   * Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
+   * 
+   * @param content to encapsulate content
+   * @return content as stream
+   */
+  public static InputStream encapsulate(final String content) {
+    try {
+      return encapsulate(content, "UTF-8");
+    } catch (UnsupportedEncodingException e) {
+      // we know that UTF-8 is supported
+      throw new RuntimeException("UTF-8 MUST be supported.", e);
+    }
+  }
+
+  /**
+   * Encapsulate given content in an {@link InputStream} with given charset.
+   * 
+   * @param content to encapsulate content
+   * @param charset to be used charset
+   * @return content as stream
+   * @throws UnsupportedEncodingException if charset is not supported
+   */
+  public static InputStream encapsulate(final String content, final String charset)
+      throws UnsupportedEncodingException {
+    return new ByteArrayInputStream(content.getBytes(charset));
+  }
+
+  /**
+   * Generate a string with given length containing random upper case characters ([A-Z]).
+   * 
+   * @param len length of to generated string
+   * @return random upper case characters ([A-Z]).
+   */
+  public static InputStream generateDataStream(final int len) {
+    return encapsulate(generateData(len));
+  }
+
+  /**
+   * Generate a string with given length containing random upper case characters ([A-Z]).
+   * 
+   * @param len length of to generated string
+   * @return random upper case characters ([A-Z]).
+   */
+  public static String generateData(final int len) {
+    StringBuilder b = new StringBuilder(len);
+    for (int j = 0; j < len; j++) {
+      char c = (char) (Math.random() * 26 + 65);
+      b.append(c);
+    }
+    return b.toString();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/KeyPredicate.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/KeyPredicate.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/KeyPredicate.java
new file mode 100644
index 0000000..d4dcd29
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/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.odata4.producer.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+
+/**
+ * Key predicate, consisting of a simple-type property and its value as String literal
+ * @org.apache.olingo.odata2.DoNotImplement
+ * 
+ */
+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-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
new file mode 100644
index 0000000..66bd8e5
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.odata4.producer.api.uri;
+
+public interface UriInfo {
+  public UriInfoKind getKind();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.java
new file mode 100644
index 0000000..629e640
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.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.odata4.producer.api.uri;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmBindingTarget;
+
+public class UriInfo1 {
+  private UriType uriType;
+  private EdmBindingTarget bindingTarget;
+  private List<String> keyNames = Collections.emptyList();
+
+  public UriType getUriType() {
+    return uriType;
+  }
+
+  public void setUriType(final UriType uriType) {
+    this.uriType = uriType;
+  }
+
+  public EdmBindingTarget getBindingTarget() {
+    return bindingTarget;
+  }
+
+  public void setBindingTarget(final EdmBindingTarget bindingTarget) {
+    this.bindingTarget = bindingTarget;
+  }
+
+  public void setKeyNames(final List<String> keyNames) {
+    this.keyNames = keyNames;
+  }
+
+  public List<String> getKeyNames() {
+    return keyNames;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
new file mode 100644
index 0000000..13b6673
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.odata4.producer.api.uri;
+
+public interface UriInfoBatch {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
new file mode 100644
index 0000000..b39041b
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.odata4.producer.api.uri;
+
+public enum UriInfoKind {
+  batch, all, crossjoin;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfo.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfo.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfo.java
new file mode 100644
index 0000000..f3d17a4
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfo.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.odata4.producer.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+
+public interface UriPathInfo {
+  public UriPathInfoKind getKind();
+
+  public EdmEntityContainer getEntityContainer();
+
+  public boolean isCollection();
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
new file mode 100644
index 0000000..50aed08
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.odata4.producer.api.uri;
+
+public enum UriPathInfoKind {
+  entitySet, singleton, actionImport, functioncall;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriType.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriType.java
new file mode 100644
index 0000000..a06a712
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriType.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.odata4.producer.api.uri;
+
+public enum UriType {
+  TYPE_ENTITY_SET,
+  TYPE_ENTITY_SET_COUNT,
+  TYPE_MEDIA_REFERENCE,
+  TYPE_REFERENCE_COLLECTION,
+  /*
+   * Singleton
+   */
+  TYPE_ENTITY,
+  TYPE_MEDIA_STREAM,
+  TYPE_REFERENCE,
+
+  /*
+   * Property Path
+   */
+  TYPE_PROPERTY_PRIMITIVE,
+  TYPE_PROPERTY_PRIMITIVE_COLLECTION,
+  TYPE_PROPERTY_PRIMITIVE_VALUE,
+  TYPE_PROPERTY_COMPLEX,
+
+  /*
+   * Crossjoin
+   */
+  TYPE_CROSSJOIN,
+
+  /*
+   * $all
+   */
+  TYPE_SERVICE_ALL,
+  /*
+   * ActionImport
+   */
+  TYPE_AI_ENTITY,
+  /*
+   * FunctionImport
+   */
+  TYPE_FI_ENTITY,
+  TYPE_FI_ENTITY_SET,
+  TYPE_FI_ENTITY_SET_COUNT,
+  TYPE_FI_PROPERTY_PRIMITIVE,
+  TYPE_FI_PROPERTY_PRIMITIVE_COLL,
+  TYPE_FI_PROPERTY_PRIMITIVE_COLL_COUNT,
+  TYPE_FI_PROPERTY_COMPLEX,
+  TYPE_FI_PROPERTY_COMPLEX_COLL,
+  TYPE_FI_PROPERTY_COMPLEX_COLL_COUNT,
+  /*
+   * BoundFunction
+   */
+  TYPE_BF_ENTITY,
+  TYPE_BF_ENTITY_SET,
+  TYPE_BF_PROP_PRIM,
+  TYPE_BF_PROP_COMP,
+  TYPE_BF_PROP_COMP_COLL,
+  TYPE_BF_PROP_PRIM_COLL,
+  /*
+   * BoundAction
+   */
+  TYPE_BA_ENTITY_SET,
+  TYPE_BA_ENTITY,
+  TYPE_BA_PROP_PRIM,
+  TYPE_BA_PROP_PRIM_COLL,
+  TYPE_BA_PROP_COMP;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/KeyPredicate.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/KeyPredicate.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/KeyPredicate.java
deleted file mode 100644
index 812a1b5..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/KeyPredicate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.producer.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmProperty;
-
-
-/**
- * Key predicate, consisting of a simple-type property and its value as String literal
- * @org.apache.olingo.odata2.DoNotImplement
- * 
- */
-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-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo.java
deleted file mode 100644
index a5ee342..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-
-package org.apache.olingo.producer.api.uri;
-
-public interface UriInfo {
-  public UriInfoKind getKind();
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo1.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo1.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo1.java
deleted file mode 100644
index e629657..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfo1.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.producer.api.uri;
-
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-
-
-public class UriInfo1 {
-  private UriType uriType;
-  private EdmBindingTarget bindingTarget;
-  private List<String> keyNames = Collections.emptyList();
-
-  public UriType getUriType() {
-    return uriType;
-  }
-
-  public void setUriType(final UriType uriType) {
-    this.uriType = uriType;
-  }
-
-  public EdmBindingTarget getBindingTarget() {
-    return bindingTarget;
-  }
-
-  public void setBindingTarget(final EdmBindingTarget bindingTarget) {
-    this.bindingTarget = bindingTarget;
-  }
-
-  public void setKeyNames(final List<String> keyNames) {
-    this.keyNames = keyNames;
-  }
-
-  public List<String> getKeyNames() {
-    return keyNames;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoBatch.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoBatch.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoBatch.java
deleted file mode 100644
index 0d2add1..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoBatch.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-
-package org.apache.olingo.producer.api.uri;
-
-public interface UriInfoBatch  {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoKind.java
deleted file mode 100644
index e099d24..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriInfoKind.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-
-package org.apache.olingo.producer.api.uri;
-
-public enum UriInfoKind {
-  batch,all, crossjoin;
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfo.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfo.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfo.java
deleted file mode 100644
index 5f15f5c..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-
-package org.apache.olingo.producer.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-
-public interface UriPathInfo {
-  public UriPathInfoKind getKind();
-
-  public EdmEntityContainer getEntityContainer();
-
-  public boolean isCollection();
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfoKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfoKind.java
deleted file mode 100644
index 878679e..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriPathInfoKind.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-
-package org.apache.olingo.producer.api.uri;
-
-public enum UriPathInfoKind {
-  entitySet, singleton, actionImport, functioncall;
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriType.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriType.java
deleted file mode 100644
index 11e1521..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/producer/api/uri/UriType.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.producer.api.uri;
-
-
-public enum UriType {
-  TYPE_ENTITY_SET,
-  TYPE_ENTITY_SET_COUNT,
-  TYPE_MEDIA_REFERENCE,
-  TYPE_REFERENCE_COLLECTION,
-  /*
-   * Singleton
-   */
-  TYPE_ENTITY,
-  TYPE_MEDIA_STREAM,
-  TYPE_REFERENCE,
-
-  /*
-   * Property Path
-   */
-  TYPE_PROPERTY_PRIMITIVE,
-  TYPE_PROPERTY_PRIMITIVE_COLLECTION,
-  TYPE_PROPERTY_PRIMITIVE_VALUE,
-  TYPE_PROPERTY_COMPLEX,
-
-  /*
-   * Crossjoin
-   */
-  TYPE_CROSSJOIN,
-
-  /*
-   * $all
-   */
-  TYPE_SERVICE_ALL,
-  /*
-   * ActionImport
-   */
-  TYPE_AI_ENTITY,
-  /*
-   * FunctionImport
-   */
-  TYPE_FI_ENTITY,
-  TYPE_FI_ENTITY_SET,
-  TYPE_FI_ENTITY_SET_COUNT,
-  TYPE_FI_PROPERTY_PRIMITIVE,
-  TYPE_FI_PROPERTY_PRIMITIVE_COLL,
-  TYPE_FI_PROPERTY_PRIMITIVE_COLL_COUNT,
-  TYPE_FI_PROPERTY_COMPLEX,
-  TYPE_FI_PROPERTY_COMPLEX_COLL,
-  TYPE_FI_PROPERTY_COMPLEX_COLL_COUNT,
-  /*
-   * BoundFunction
-   */
-  TYPE_BF_ENTITY,
-  TYPE_BF_ENTITY_SET,
-  TYPE_BF_PROP_PRIM,
-  TYPE_BF_PROP_COMP,
-  TYPE_BF_PROP_COMP_COLL,
-  TYPE_BF_PROP_PRIM_COLL,
-  /*
-   * BoundAction
-   */
-  TYPE_BA_ENTITY_SET,
-  TYPE_BA_ENTITY,
-  TYPE_BA_PROP_PRIM,
-  TYPE_BA_PROP_PRIM_COLL,
-  TYPE_BA_PROP_COMP;
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java
new file mode 100644
index 0000000..7f9761c
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.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.odata4.producer.core.uri;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.antlr.v4.runtime.BaseErrorListener;
+import org.antlr.v4.runtime.Parser;
+import org.antlr.v4.runtime.RecognitionException;
+import org.antlr.v4.runtime.Recognizer;
+import org.apache.olingo.producer.core.uri.antlr.UriLexer;
+
+public class ErrorHandler<T> extends BaseErrorListener {
+  @Override
+  public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
+      final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
+    System.err.println("-");
+    // check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
+    List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
+    Collections.reverse(stack);
+    System.err.println("rule stack: " + stack);
+    if (e != null && e.getOffendingToken() != null) {
+
+      // String lexerTokenName =TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
+      String lexerTokenName = "";
+      try {
+        // lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+        lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+      } catch (ArrayIndexOutOfBoundsException es) {
+        lexerTokenName = "token error";
+      }
+      System.err.println("line " + line + ":" + charPositionInLine + " at " +
+          offendingSymbol + "/" + lexerTokenName + ": " + msg);
+    } else {
+      System.err.println("line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.java
new file mode 100644
index 0000000..bbc301f
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.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.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.producer.api.uri.KeyPredicate;
+
+/**
+ *  
+ */
+public class KeyPredicateImpl implements KeyPredicate {
+
+  public KeyPredicateImpl(final String literal, final EdmProperty property) {
+    super();
+    this.literal = literal;
+    this.property = property;
+  }
+
+  private String literal;
+  private EdmProperty property;
+
+  @Override
+  public String getLiteral() {
+    return literal;
+  }
+
+  public void setValue(final String value) {
+    literal = value;
+  }
+
+  @Override
+  public EdmProperty getProperty() {
+    return property;
+  }
+
+  public void setProperty(final EdmProperty property) {
+    this.property = property;
+  }
+
+  @Override
+  public String toString() {
+    return "KeyPredicate: literal=" + literal + ", propertyName=" + property;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
new file mode 100644
index 0000000..8a4fe52
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.producer.api.uri.UriInfo;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoBatch;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfo;
+
+public class UriInfoImpl implements UriInfo, UriInfoBatch {
+  private UriInfoKind kind;
+  private List<UriPathInfo> uriPathInfos = new ArrayList<UriPathInfo>();
+
+  @Override
+  public UriInfoKind getKind() {
+    return kind;
+  }
+
+  public UriInfoImpl setKind(final UriInfoKind kind) {
+    this.kind = kind;
+    return this;
+  }
+
+  public void addUriPathInfo(final UriPathInfo uriPathInfo) {
+    uriPathInfos.add(uriPathInfo);
+  }
+
+  /*
+   * private Edm edm = null;
+   * private List<UriPathInfoImpl> pathInfos = new ArrayList<UriPathInfoImpl>();
+   * 
+   * public Edm getEdm() {
+   * return edm;
+   * }
+   * 
+   * public void addUriPathInfo(final UriPathInfoImpl uriPathInfoImpl) {
+   * pathInfos.add(uriPathInfoImpl);
+   * }
+   * 
+   * public UriPathInfoImpl getLastUriPathInfo() {
+   * if (!pathInfos.isEmpty()) {
+   * return pathInfos.get(pathInfos.size() - 1);
+   * } else {
+   * return null;
+   * }
+   * }
+   */
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
new file mode 100644
index 0000000..737aa00
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.DefaultErrorStrategy;
+import org.antlr.v4.runtime.atn.PredictionMode;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmNamed;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+import org.apache.olingo.producer.core.uri.antlr.UriLexer;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.AllAltContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.BatchAltContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.CrossjoinAltContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.EntityAltContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.MetadataAltContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.OdataRelativeUriContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentsAltContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentsContext;
+import org.apache.olingo.producer.core.uri.antlr.UriParserParser.ResourcePathAltContext;
+
+public class UriParserImpl {
+
+  private EdmEntityContainer entityContainer = null;
+
+  public UriInfoImpl readUri(final String uri, final Edm edm) {
+    entityContainer = edm.getEntityContainer(null);// "RefScenario","Container1"
+
+    UriInfoImpl ret = new UriInfoImpl();
+    OdataRelativeUriContext root = parseUri(uri);
+
+    ret = readODataRelativeUri(root);
+    return ret;
+  }
+
+  UriInfoImpl readODataRelativeUri(final OdataRelativeUriContext root) {
+    root.getChildCount();
+
+    if (root instanceof BatchAltContext) {
+      return new UriInfoImpl().setKind(UriInfoKind.batch);
+
+    } else if (root instanceof EntityAltContext) {
+      // TODO implement
+    } else if (root instanceof MetadataAltContext) {
+      // TODO implement
+    } else if (root instanceof ResourcePathAltContext) {
+
+      return readResourcePath(root);
+
+    }
+
+    return null;
+  }
+
+  private UriInfoImpl readResourcePath(final OdataRelativeUriContext root) {
+    ParseTree firstChild = root.getChild(0);
+
+    if (firstChild instanceof AllAltContext) {
+      return new UriInfoImpl().setKind(UriInfoKind.all);
+    } else if (firstChild instanceof CrossjoinAltContext) {
+      // TODO read ODIs behind crossjoin
+      return new UriInfoImpl().setKind(UriInfoKind.crossjoin);
+    } else if (firstChild instanceof PathSegmentsAltContext) {
+      return readPathSegments((PathSegmentsAltContext) firstChild);
+    }
+    return null;
+  }
+
+  private UriInfoImpl readPathSegments(final PathSegmentsAltContext pathSegmentsAlt) {
+    PathSegmentsContext firstChild = (PathSegmentsContext) pathSegmentsAlt.getChild(0);
+
+    UriInfoImpl uriInfo = new UriInfoImpl();
+
+    readFirstPathSegment(uriInfo, firstChild.ps.get(0));
+
+    for (int i = 1; i < firstChild.ps.size(); i++) {
+
+    }
+
+    return null;
+  }
+
+  private void readFirstPathSegment(final UriInfoImpl uriInfo, final PathSegmentContext ctx) {
+    /*
+     * if (ctx.ns != null) {//TODO implement
+     * // Error: First pathsegment can not be qualified. Allowed is entityset|function...
+     * }
+     */
+
+    /*
+     * if (ctx.odi == null) {//TODO implement
+     * // Error: First pathsegment must contain an odata identifier
+     * }
+     */
+
+    // get element "odataIdentifier" from EDM
+    EdmNamed edmObject = null;// entityContainer.getElement(odataIdentifier);
+
+    if (edmObject instanceof EdmEntitySet) {
+
+      // is EdmEntitySet
+
+      EdmEntitySet entityset = (EdmEntitySet) edmObject;
+      UriPathInfoEntitySetImpl pathInfo = new UriPathInfoEntitySetImpl();
+      pathInfo.setKind(UriPathInfoKind.entitySet);
+      pathInfo.setEntityContainer(entityContainer);
+
+      pathInfo.setTargetEntityset(entityset);
+      pathInfo.setTargetType(entityset.getEntityType());
+      pathInfo.setCollection(true);
+
+      // TODO check if kp may have been collected into fp
+      /*
+       * if (ctx.kp != null) {
+       * //pathInfo.setKeyPredicates(readkeypredicates(ctx.kp, entityset.getEntityType()));
+       * pathInfo.setCollection(false);
+       * }
+       */
+      uriInfo.addUriPathInfo(pathInfo);
+      return;
+    } else if (edmObject instanceof EdmSingleton) {
+
+      // is EdmSingleton
+
+      EdmSingleton singleton = (EdmSingleton) edmObject;
+      UriPathInfoSigletonImpl pathInfo = new UriPathInfoSigletonImpl(); // TODO change to UriPathInfoImplEntitySet
+      pathInfo.setKind(UriPathInfoKind.singleton);
+      pathInfo.setEntityContainer(entityContainer);
+      pathInfo.setTargetType(singleton.getEntityType());
+      // pathInfo.targetType = singleton.getEntityType();
+      pathInfo.setCollection(false);
+
+      uriInfo.addUriPathInfo(pathInfo);
+      return;
+    } else if (edmObject instanceof EdmActionImport) {
+
+      // is EdmActionImport
+
+      UriPathInfoActionImportImpl pathInfo = new UriPathInfoActionImportImpl();
+      pathInfo.setKind(UriPathInfoKind.actionImport);
+
+      uriInfo.addUriPathInfo(pathInfo);
+      return;
+
+    } else if (edmObject instanceof EdmFunctionImport) {
+
+      // is EdmFunctionImport
+
+      UriPathInfoImplFunctionImport pathInfo = new UriPathInfoImplFunctionImport();
+      pathInfo.setKind(UriPathInfoKind.functioncall);
+
+      /*
+       * if (ctx.fp != null) {
+       * pathInfo.setFunctionParameter(readFunctionParameters(uriInfo, ctx.fp));
+       * }
+       */
+      /*
+       * if (ctx.kp != null) {
+       * pathInfo.setKeyPredicates(readkeypredicates(ctx.kp, fi.getReturnedEntitySet().getEntityType()));
+       * }
+       */
+
+      uriInfo.addUriPathInfo(pathInfo);
+      return;
+    }
+
+  }
+
+  private OdataRelativeUriContext parseUri(final String uri) {
+
+    ANTLRInputStream input = new ANTLRInputStream(uri);
+
+    // UriLexer lexer = new UriLexer(input);
+    UriLexer lexer = new UriLexer(input);
+
+    CommonTokenStream tokens = new CommonTokenStream(lexer);
+    UriParserParser parser = new UriParserParser(tokens);
+
+    // parser.addErrorListener(new ErrorHandler());
+    // if (stage == 1) {
+    // //see https://github.com/antlr/antlr4/issues/192
+    // parser.setErrorHandler(new BailErrorStrategy());
+    // parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+    // } else {
+    parser.setErrorHandler(new DefaultErrorStrategy());
+    parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+    // }
+
+    // parser.d
+    return parser.odataRelativeUri();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java
new file mode 100644
index 0000000..23dede3
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri;
+
+public class UriPathInfoActionImportImpl extends UriPathInfoImpl {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
new file mode 100644
index 0000000..8d80e1e
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.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.odata4.producer.core.uri;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.producer.api.uri.KeyPredicate;
+
+public class UriPathInfoEntitySetImpl extends UriPathInfoImpl {
+
+  private EdmEntitySet targetEntityset;
+
+  private List<KeyPredicate> keyPredicates;
+
+  public EdmEntitySet getTargetEntityset() {
+    return targetEntityset;
+  }
+
+  // TODO add to Interface UriPathInfoEntitySet
+  public void setTargetEntityset(final EdmEntitySet targetEntityset) {
+    this.targetEntityset = targetEntityset;
+  }
+
+  public List<KeyPredicate> getKeyPredicates() {
+    return keyPredicates;
+  }
+
+  public void setKeyPredicates(final List<KeyPredicate> keyPredicates) {
+    this.keyPredicates = keyPredicates;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
new file mode 100644
index 0000000..4a2636d
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfo;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+//import org.apache.olingo.api.commons.InlineCount;
+//import org.apache.olingo.api.uri.NavigationPropertySegment;
+//import org.apache.olingo.api.uri.NavigationSegment;
+//import org.apache.olingo.api.uri.SelectItem;
+//import org.apache.olingo.api.uri.expression.FilterExpression;
+//import org.apache.olingo.api.uri.expression.OrderByExpression;
+
+/**
+ *  
+ */
+public class UriPathInfoImpl implements UriPathInfo {
+  private UriPathInfoKind kind;
+  private EdmEntityContainer entityContainer;
+  private boolean isCollection;
+  private EdmEntityType targetType;
+
+  @Override
+  public EdmEntityContainer getEntityContainer() {
+    return entityContainer;
+  }
+
+  public void setEntityContainer(final EdmEntityContainer entityContainer) {
+    this.entityContainer = entityContainer;
+  }
+
+  @Override
+  public UriPathInfoKind getKind() {
+    return kind;
+  }
+
+  public void setKind(final UriPathInfoKind kind) {
+    this.kind = kind;
+  }
+
+  @Override
+  public boolean isCollection() {
+    return isCollection;
+  }
+
+  public void setCollection(final boolean isCollection) {
+    this.isCollection = isCollection;
+  }
+
+  public EdmEntityType getTargetType() {
+    return targetType;
+  }
+
+  public void setTargetType(final EdmEntityType targetType) {
+    this.targetType = targetType;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.java
new file mode 100644
index 0000000..c25b1f6
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.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.odata4.producer.core.uri;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.producer.api.uri.KeyPredicate;
+
+public class UriPathInfoImplFunctionImport extends UriPathInfoImpl {
+
+  // TODO change to proper Type
+  private Object functionParameter;
+  private List<KeyPredicate> keyPredicates;
+
+  public Object getFunctionParameter() {
+    return functionParameter;
+  }
+
+  public void setFunctionParameter(final Object functionParameter) {
+    this.functionParameter = functionParameter;
+  }
+
+  public List<KeyPredicate> getKeyPredicates() {
+    return keyPredicates;
+  }
+
+  public void setKeyPredicates(final List<KeyPredicate> keyPredicates) {
+    this.keyPredicates = keyPredicates;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java
new file mode 100644
index 0000000..3311a47
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri;
+
+public class UriPathInfoSigletonImpl extends UriPathInfoImpl {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.java
new file mode 100644
index 0000000..aeca706
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/antlr/ParserException.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.odata4.producer.core.uri.antlr;
+
+public class ParserException extends Exception {
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  public ParserException() {
+    super();
+  }
+
+  public ParserException(final String msg) {
+    super(msg);
+  }
+
+  public ParserException(final String msg, final Throwable e) {
+    super(msg, e);
+  }
+
+  public ParserException(final Throwable e) {
+    super(e);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/ErrorHandler.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/ErrorHandler.java
deleted file mode 100644
index e6b0208..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/ErrorHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.producer.core.uri;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.antlr.v4.runtime.BaseErrorListener;
-import org.antlr.v4.runtime.Parser;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.apache.olingo.producer.core.uri.antlr.UriLexer;
-
-
-public class ErrorHandler<T> extends BaseErrorListener {
-  @Override
-  public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
-      final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
-    System.err.println("-");
-    // check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
-    List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
-    Collections.reverse(stack);
-    System.err.println("rule stack: " + stack);
-    if (e != null && e.getOffendingToken() != null) {
-
-      // String lexerTokenName =TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
-      String lexerTokenName = "";
-      try {
-        //lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
-        lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
-      } catch (ArrayIndexOutOfBoundsException es) {
-        lexerTokenName = "token error";
-      }
-      System.err.println("line " + line + ":" + charPositionInLine + " at " +
-          offendingSymbol + "/" + lexerTokenName + ": " + msg);
-    } else {
-      System.err.println("line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/KeyPredicateImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/KeyPredicateImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/KeyPredicateImpl.java
deleted file mode 100644
index c5209fd..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/KeyPredicateImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.producer.core.uri;
-
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.producer.api.uri.KeyPredicate;
-
-/**
- *  
- */
-public class KeyPredicateImpl implements KeyPredicate {
-
-  public KeyPredicateImpl(final String literal, final EdmProperty property) {
-    super();
-    this.literal = literal;
-    this.property = property;
-  }
-
-  private String literal;
-  private EdmProperty property;
-
-  @Override
-  public String getLiteral() {
-    return literal;
-  }
-
-  public void setValue(final String value) {
-    literal = value;
-  }
-
-  @Override
-  public EdmProperty getProperty() {
-    return property;
-  }
-
-  public void setProperty(final EdmProperty property) {
-    this.property = property;
-  }
-
-  @Override
-  public String toString() {
-    return "KeyPredicate: literal=" + literal + ", propertyName=" + property;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriInfoImpl.java
deleted file mode 100644
index 129af4d..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriInfoImpl.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.producer.core.uri;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.producer.api.uri.UriInfo;
-import org.apache.olingo.producer.api.uri.UriInfoBatch;
-import org.apache.olingo.producer.api.uri.UriInfoKind;
-import org.apache.olingo.producer.api.uri.UriPathInfo;
-
-public class UriInfoImpl implements UriInfo, UriInfoBatch {
-  private UriInfoKind kind;
-  private List<UriPathInfo> uriPathInfos = new ArrayList<UriPathInfo>();
-
-  public UriInfoKind getKind() {
-    return kind;
-  }
-
-  public UriInfoImpl setKind(UriInfoKind kind) {
-    this.kind = kind;
-    return this;
-  }
-
-  public void addUriPathInfo(UriPathInfo uriPathInfo) {
-    uriPathInfos.add(uriPathInfo);
-  }
-  
-  /*
-  private Edm edm = null;
-  private List<UriPathInfoImpl> pathInfos = new ArrayList<UriPathInfoImpl>();
-
-  public Edm getEdm() {
-    return edm;
-  }
-
-  public void addUriPathInfo(final UriPathInfoImpl uriPathInfoImpl) {
-    pathInfos.add(uriPathInfoImpl);
-  }
-
-  public UriPathInfoImpl getLastUriPathInfo() {
-    if (!pathInfos.isEmpty()) {
-      return pathInfos.get(pathInfos.size() - 1);
-    } else {
-      return null;
-    }
-  }*/
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriParserImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriParserImpl.java
deleted file mode 100644
index d81d0fd..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/producer/core/uri/UriParserImpl.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.producer.core.uri;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.CommonTokenStream;
-import org.antlr.v4.runtime.DefaultErrorStrategy;
-import org.antlr.v4.runtime.atn.PredictionMode;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmNamed;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.producer.api.uri.KeyPredicate;
-import org.apache.olingo.producer.api.uri.UriInfoKind;
-import org.apache.olingo.producer.api.uri.UriPathInfoKind;
-import org.apache.olingo.producer.core.uri.antlr.UriLexer;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.AllAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.BatchAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.CrossjoinAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.EntityAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.MetadataAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.OdataRelativeUriContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentsAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentsContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.ResourcePathAltContext;
-
-public class UriParserImpl {
-
-
-  private EdmEntityContainer entityContainer = null;
-
-  public UriInfoImpl readUri(final String uri, final Edm edm) {
-    entityContainer = edm.getEntityContainer(null);// "RefScenario","Container1"
-
-    UriInfoImpl ret = new UriInfoImpl();
-    OdataRelativeUriContext root = parseUri(uri);
-
-    ret = readODataRelativeUri(root);
-    return ret;
-  }
-
-  UriInfoImpl readODataRelativeUri(OdataRelativeUriContext root) {
-    int i = root.getChildCount();
-
-    if (root instanceof BatchAltContext) {
-      return new UriInfoImpl().setKind(UriInfoKind.batch);
-
-    } else if (root instanceof EntityAltContext) {
-      // TODO implement
-    } else if (root instanceof MetadataAltContext) {
-      // TODO implement
-    } else if (root instanceof ResourcePathAltContext) {
-
-      return readResourcePath(root);
-
-    }
-
-    return null;
-  }
-
-  private UriInfoImpl readResourcePath(OdataRelativeUriContext root) {
-    ParseTree firstChild = root.getChild(0);
-
-    if (firstChild instanceof AllAltContext) {
-      return new UriInfoImpl().setKind(UriInfoKind.all);
-    } else if (firstChild instanceof CrossjoinAltContext) {
-      // TODO read ODIs behind crossjoin
-      return new UriInfoImpl().setKind(UriInfoKind.crossjoin);
-    } else if (firstChild instanceof PathSegmentsAltContext) {
-      return readPathSegments((PathSegmentsAltContext) firstChild);
-    }
-    return null;
-  }
-
-  private UriInfoImpl readPathSegments(PathSegmentsAltContext pathSegmentsAlt) {
-    PathSegmentsContext firstChild = (PathSegmentsContext) pathSegmentsAlt.getChild(0);
-
-    UriInfoImpl uriInfo = new UriInfoImpl();
-
-    readFirstPathSegment(uriInfo, firstChild.ps.get(0));
-
-    for (int i = 1; i < firstChild.ps.size(); i++) {
-
-    }
-
-    return null;
-  }
-
-  private void readFirstPathSegment(UriInfoImpl uriInfo, PathSegmentContext ctx) {
-    /*if (ctx.ns != null) {//TODO implement
-      // Error: First pathsegment can not be qualified. Allowed is entityset|function...
-    }*/
-
-    /*if (ctx.odi == null) {//TODO implement
-      // Error: First pathsegment must contain an odata identifier
-    }*/
-
-    
-    String odataIdentifier = ""; //TODO ctx.odi.getText();
-
-    // get element "odataIdentifier" from EDM
-    EdmNamed edmObject = null;// entityContainer.getElement(odataIdentifier);
-
-    if (edmObject instanceof EdmEntitySet) {
-
-      // is EdmEntitySet
-
-      EdmEntitySet entityset = (EdmEntitySet) edmObject;
-      UriPathInfoEntitySetImpl pathInfo = new UriPathInfoEntitySetImpl();
-      pathInfo.setKind(UriPathInfoKind.entitySet);
-      pathInfo.setEntityContainer(entityContainer);
-
-      pathInfo.setTargetEntityset(entityset);
-      pathInfo.setTargetType(entityset.getEntityType());
-      pathInfo.setCollection(true);
-
-      // TODO check if kp may have been collected into fp
-      /*if (ctx.kp != null) {
-        //pathInfo.setKeyPredicates(readkeypredicates(ctx.kp, entityset.getEntityType()));
-        pathInfo.setCollection(false);
-      }*/
-      uriInfo.addUriPathInfo(pathInfo);
-      return;
-    } else if (edmObject instanceof EdmSingleton) {
-
-      // is EdmSingleton
-
-      EdmSingleton singleton = (EdmSingleton) edmObject;
-      UriPathInfoSigletonImpl pathInfo = new UriPathInfoSigletonImpl(); // TODO change to UriPathInfoImplEntitySet
-      pathInfo.setKind(UriPathInfoKind.singleton);
-      pathInfo.setEntityContainer(entityContainer);
-      pathInfo.setTargetType(singleton.getEntityType());
-      // pathInfo.targetType = singleton.getEntityType();
-      pathInfo.setCollection(false);
-
-      uriInfo.addUriPathInfo(pathInfo);
-      return;
-    } else if (edmObject instanceof EdmActionImport) {
-
-      // is EdmActionImport
-
-      UriPathInfoActionImportImpl pathInfo = new UriPathInfoActionImportImpl();
-      pathInfo.setKind(UriPathInfoKind.actionImport);
-
-      uriInfo.addUriPathInfo(pathInfo);
-      return;
-
-    } else if (edmObject instanceof EdmFunctionImport) {
-
-      // is EdmFunctionImport
-
-      EdmFunctionImport fi = (EdmFunctionImport) edmObject;
-      UriPathInfoImplFunctionImport pathInfo = new UriPathInfoImplFunctionImport();
-      pathInfo.setKind(UriPathInfoKind.functioncall);
-
-      /*if (ctx.fp != null) {
-        pathInfo.setFunctionParameter(readFunctionParameters(uriInfo, ctx.fp));
-      }*/
-      /*if (ctx.kp != null) {
-        pathInfo.setKeyPredicates(readkeypredicates(ctx.kp, fi.getReturnedEntitySet().getEntityType()));
-      }*/
-
-      uriInfo.addUriPathInfo(pathInfo);
-      return;
-    }
-
-  }
-
-  private Object readFunctionParameters(UriInfoImpl uriInfo/*, FunctionParametersContext fp*/) {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  private List<KeyPredicate> readkeypredicates(/*final KeypredicatesContext kp,*/ final EdmType edmType1) {
-/*
-    EdmEntityType edmType;
-    if (edmType1 instanceof EdmEntityType) {
-      edmType = (EdmEntityType) edmType1;
-    } else {
-      return null;// TODO better error
-    }
-*/
-    List<KeyPredicate> ret = new ArrayList<KeyPredicate>();
-/*
-    ParseTree child = kp.getChild(0);
-    if (child instanceof SimpleKeyContext) {
-      // it is a simple key without a name
-
-      if (edmType.getKeyPredicateNames().size() != 1) {
-        // Error Simple Key only allowed if there is only one keyproperty
-      }
-
-      String keyPredicateName = edmType.getKeyPredicateNames().get(0);
-      String keyPropertyName = edmType.getKeyPropertyRef(keyPredicateName).getKeyPropertyName();
-      EdmElement property = edmType.getProperty(keyPropertyName);
-      if (property == null) {
-        // error keyproperty not found
-      }
-
-      EdmType type = property.getType();
-      if (type.getKind() != EdmTypeKind.PRIMITIVE) {
-        // error property has wrong type
-      }
-
-      String keyLiteral = child.getText();
-      // TODO detect type of keyLiteral and compare with "type"
-
-      ret.add(new KeyPredicateImpl(keyLiteral, (EdmProperty) property));
-    } else if (child instanceof CompoundKeyContext) {
-      CompoundKeyContext compoundKey = (CompoundKeyContext) child;
-
-      for (KeyValuePairContext kvp : compoundKey.kvp) {
-        String keyPropertyName = kvp.odi.getText();
-        EdmElement property = edmType.getProperty(keyPropertyName);
-        if (property == null) {
-          // error keyproperty not found
-        }
-
-        String keyLiteral = kvp.val.getText();
-        // TODO detect type of keyLiteral and compare with "type"
-
-        KeyPredicate keyPredicate = new KeyPredicateImpl(keyLiteral, (EdmProperty) property);
-        ret.add(keyPredicate);
-      }
-
-    }
-*/
-    return ret;
-  }
-
-  private OdataRelativeUriContext parseUri(final String uri) {
-
-    ANTLRInputStream input = new ANTLRInputStream(uri);
-
-    //UriLexer lexer = new UriLexer(input);
-    UriLexer lexer = new UriLexer(input);
-
-    CommonTokenStream tokens = new CommonTokenStream(lexer);
-    UriParserParser parser = new UriParserParser(tokens);
-
-    // parser.addErrorListener(new ErrorHandler());
-    // if (stage == 1) {
-    // //see https://github.com/antlr/antlr4/issues/192
-    // parser.setErrorHandler(new BailErrorStrategy());
-    // parser.getInterpreter().setPredictionMode(PredictionMode.LL);
-    // } else {
-    parser.setErrorHandler(new DefaultErrorStrategy());
-    parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
-    // }
-
-    // parser.d
-    return parser.odataRelativeUri();
-  }
-}


Mime
View raw message