Repository: olingo-odata4
Updated Branches:
  refs/heads/master 6a5fc3548 -> 15e7718a0


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
index 4b30ddd..52b0103 100644
--- 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
+++ 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
@@ -20,7 +20,7 @@ package org.apache.olingo.commons.api.op;
 
 import java.io.InputStream;
 import java.io.Serializable;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Entry;
 import org.apache.olingo.commons.api.domain.ODataError;
 import org.apache.olingo.commons.api.data.Feed;
@@ -40,7 +40,7 @@ public interface CommonODataDeserializer extends Serializable 
{
    * @param format Atom or JSON
    * @return Feed instance.
    */
-  Container<Feed> toFeed(InputStream input, ODataPubFormat format);
+  ResWrap<Feed> toFeed(InputStream input, ODataPubFormat format);
 
   /**
    * Gets an entry object from the given InputStream.
@@ -49,7 +49,7 @@ public interface CommonODataDeserializer extends Serializable 
{
    * @param format Atom or JSON
    * @return Entry instance.
    */
-  Container<Entry> toEntry(InputStream input, ODataPubFormat format);
+  ResWrap<Entry> toEntry(InputStream input, ODataPubFormat format);
 
   /**
    * Gets a property object from the given InputStream.
@@ -58,7 +58,7 @@ public interface CommonODataDeserializer extends Serializable 
{
    * @param format XML or JSON
    * @return Property instance.
    */
-  Container<Property> toProperty(InputStream input, ODataFormat format);
+  ResWrap<Property> toProperty(InputStream input, ODataFormat format);
 
   /**
    * Gets the ODataError object represented by the given InputStream.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
 
b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
new file mode 100644
index 0000000..df7e649
--- /dev/null
+++ 
b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.commons.api.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.net.URI;
+import org.junit.Test;
+
+public class ContextURLTest {
+
+  @Test
+  public void collectionOfEntities() {
+    ContextURL contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers";));
+
+    assertEquals(URI.create("http://host/service/";), 
contextURL.getServiceRoot());
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+
+    contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#Orders(4711)/Items"));
+
+    assertEquals("Orders", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertEquals("Items", contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void entity() {
+    ContextURL contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$entity";));
+
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+
+    contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#Orders(4711)/Items/$entity"));
+
+    assertEquals("Orders", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertEquals("Items", contextURL.getNavOrPropertyPath());
+
+    // v3    
+    contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#Products/@Element";));
+
+    assertEquals("Products", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void singleton() {
+    ContextURL contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#Contoso";));
+
+    assertEquals("Contoso", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void collectionOfDerivedEntities() {
+    final ContextURL contextURL = ContextURL.getInstance(
+            
URI.create("http://host/service/$metadata#Customers/Model.VipCustomer";));
+
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void derivedEntity() {
+    final ContextURL contextURL = ContextURL.getInstance(
+            
URI.create("http://host/service/$metadata#Customers/Model.VipCustomer/$entity";));
+
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void collectionOfProjectedEntities() {
+    final ContextURL contextURL = ContextURL.getInstance(
+            
URI.create("http://host/service/$metadata#Customers(Address,Orders)"));
+
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertEquals("Address,Orders", contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void projectedEntity() {
+    ContextURL contextURL = ContextURL.getInstance(
+            
URI.create("http://host/service/$metadata#Customers(Name,Rating)/$entity"));
+
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertEquals("Name,Rating", contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+
+    contextURL = ContextURL.getInstance(
+            
URI.create("http://host/service/$metadata#Customers(Name,Address/Country)"));
+
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertEquals("Name,Address/Country", contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void collectionOfProjectedExpandedEntities() {
+    final ContextURL contextURL = ContextURL.getInstance(
+            URI.create("http://host/service/$metadata#Employees/";
+                    + 
"Sales.Manager(DirectReports,DirectReports+(FirstName,LastName))"));
+
+    assertEquals("Employees", contextURL.getEntitySetOrSingletonOrType());
+    assertEquals("Sales.Manager", contextURL.getDerivedEntity());
+    assertEquals("DirectReports,DirectReports+(FirstName,LastName)", 
contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void propertyValue() {
+    final ContextURL contextURL = ContextURL.getInstance(
+            
URI.create("http://host/service/$metadata#Customers(1)/Addresses"));
+
+    assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertEquals("Addresses", contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void CollectionOfComplexOrPrimitiveTypes() {
+    final ContextURL contextURL = ContextURL.getInstance(
+            
URI.create("http://host/service/$metadata#Collection(Edm.String)"));
+
+    assertEquals("Collection(Edm.String)", 
contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+
+  @Test
+  public void complexOrPrimitiveType() {
+    ContextURL contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#Edm.String";));
+
+    assertEquals("Edm.String", contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+
+    contextURL = 
ContextURL.getInstance(URI.create("http://host/service/$metadata#ODataDemo.Address";));
+
+    assertEquals("ODataDemo.Address", 
contextURL.getEntitySetOrSingletonOrType());
+    assertNull(contextURL.getDerivedEntity());
+    assertNull(contextURL.getSelectList());
+    assertNull(contextURL.getNavOrPropertyPath());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 7eaf669..97be4eb 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import java.io.IOException;
+import java.util.AbstractMap.SimpleEntry;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
@@ -32,7 +33,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
 import org.apache.olingo.commons.api.data.CollectionValue;
 import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Linked;
 import org.apache.olingo.commons.api.data.Value;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
@@ -41,7 +42,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
-abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<Container<T>> {
+abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<ResWrap<T>> {
 
   private JSONGeoValueDeserializer geoDeserializer;
 
@@ -66,9 +67,9 @@ abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<Cont
       if (inline instanceof ObjectNode) {
         link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
 
-        
link.setInlineEntry(inline.traverse(codec).<Container<JSONEntryImpl>>readValueAs(
+        
link.setInlineEntry(inline.traverse(codec).<ResWrap<JSONEntryImpl>>readValueAs(
                 new TypeReference<JSONEntryImpl>() {
-                }).getObject());
+                }).getPayload());
       }
 
       if (inline instanceof ArrayNode) {
@@ -77,9 +78,9 @@ abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<Cont
         final JSONFeedImpl feed = new JSONFeedImpl();
         final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
         while (entries.hasNext()) {
-          
feed.getEntries().add(entries.next().traverse(codec).<Container<JSONEntryImpl>>readValuesAs(
+          
feed.getEntries().add(entries.next().traverse(codec).<ResWrap<JSONEntryImpl>>readValuesAs(
                   new TypeReference<JSONEntryImpl>() {
-                  }).next().getObject());
+                  }).next().getPayload());
         }
 
         link.setInlineFeed(feed);
@@ -144,8 +145,9 @@ abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<Cont
 
         toRemove.add(setInline(field.getKey(), suffix, tree, codec, link));
       } else if (field.getValue().isArray()) {
-        for (Iterator<JsonNode> itor = field.getValue().elements(); 
itor.hasNext();) {
+        for (final Iterator<JsonNode> itor = field.getValue().elements(); 
itor.hasNext();) {
           final JsonNode node = itor.next();
+
           final LinkImpl link = new LinkImpl();
           link.setTitle(getTitle(field));
           
link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL)
 + getTitle(field));
@@ -159,42 +161,46 @@ abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<Cont
     }
   }
 
-  protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
-    EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
-
-    if (node.isShort()) {
-      result = EdmPrimitiveTypeKind.Int16;
-    } else if (node.isIntegralNumber()) {
-      result = EdmPrimitiveTypeKind.Int32;
-    } else if (node.isLong()) {
-      result = EdmPrimitiveTypeKind.Int64;
-    } else if (node.isBigDecimal()) {
-      result = EdmPrimitiveTypeKind.Decimal;
-    } else if (node.isBoolean()) {
-      result = EdmPrimitiveTypeKind.Boolean;
-    } else if (node.isFloat()) {
-      result = EdmPrimitiveTypeKind.Single;
-    } else if (node.isDouble()) {
-      result = EdmPrimitiveTypeKind.Double;
-    }
-
-    return result;
-  }
-
-  private ODataPropertyType guessPropertyType(final JsonNode node) {
-    final ODataPropertyType type;
+  private Map.Entry<ODataPropertyType, EdmTypeInfo> guessPropertyType(final 
JsonNode node) {
+    ODataPropertyType type;
+    EdmTypeInfo typeInfo = null;
 
     if (node.isValueNode() || node.isNull()) {
       type = ODataPropertyType.PRIMITIVE;
+
+      EdmPrimitiveTypeKind kind = EdmPrimitiveTypeKind.String;
+      if (node.isShort()) {
+        kind = EdmPrimitiveTypeKind.Int16;
+      } else if (node.isIntegralNumber()) {
+        kind = EdmPrimitiveTypeKind.Int32;
+      } else if (node.isLong()) {
+        kind = EdmPrimitiveTypeKind.Int64;
+      } else if (node.isBigDecimal()) {
+        kind = EdmPrimitiveTypeKind.Decimal;
+      } else if (node.isBoolean()) {
+        kind = EdmPrimitiveTypeKind.Boolean;
+      } else if (node.isFloat()) {
+        kind = EdmPrimitiveTypeKind.Single;
+      } else if (node.isDouble()) {
+        kind = EdmPrimitiveTypeKind.Double;
+      }
+      typeInfo = new EdmTypeInfo.Builder().
+              
setTypeExpression(kind.getFullQualifiedName().toString()).build();
     } else if (node.isArray()) {
       type = ODataPropertyType.COLLECTION;
     } else if (node.isObject()) {
-      type = ODataPropertyType.COMPLEX;
+      if (node.has(Constants.ATTR_TYPE) && node.has(Constants.JSON_CRS)) {
+        type = ODataPropertyType.PRIMITIVE;
+        typeInfo = new EdmTypeInfo.Builder().
+                setTypeExpression("Edm.Geography" + 
node.get(Constants.ATTR_TYPE).asText()).build();
+      } else {
+        type = ODataPropertyType.COMPLEX;
+      }
     } else {
       type = ODataPropertyType.EMPTY;
     }
 
-    return type;
+    return new SimpleEntry<ODataPropertyType, EdmTypeInfo>(type, typeInfo);
   }
 
   private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) 
{
@@ -280,12 +286,17 @@ abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<Cont
   protected void value(final JSONPropertyImpl property, final JsonNode node, 
final ObjectCodec codec)
           throws IOException {
 
-    final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
+    EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
             ? null
             : new 
EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
 
+    final Map.Entry<ODataPropertyType, EdmTypeInfo> guessed = 
guessPropertyType(node);
+    if (typeInfo == null) {
+      typeInfo = guessed.getValue();
+    }
+
     final ODataPropertyType propType = typeInfo == null
-            ? guessPropertyType(node)
+            ? guessed.getKey()
             : typeInfo.isCollection()
             ? ODataPropertyType.COLLECTION
             : typeInfo.isPrimitiveType()
@@ -312,8 +323,8 @@ abstract class AbstractJsonDeserializer<T> extends 
ODataJacksonDeserializer<Cont
         break;
 
       case PRIMITIVE:
-        if (property.getType() == null) {
-          
property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
+        if (property.getType() == null && typeInfo != null) {
+          property.setType(typeInfo.getFullQualifiedName().toString());
         }
         property.setValue(fromPrimitive(node, typeInfo));
         break;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index 2a15ddc..72d8d76 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.commons.core.data;
 
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import java.io.InputStream;
 import java.net.URI;
 import java.text.ParseException;
@@ -291,7 +291,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
     return property;
   }
 
-  private Container<AtomPropertyImpl> property(final InputStream input) throws 
XMLStreamException {
+  private ResWrap<AtomPropertyImpl> property(final InputStream input) throws 
XMLStreamException {
     final XMLEventReader reader = getReader(input);
     final StartElement start = skipBeforeFirstStartElement(reader);
     return getContainer(start, property(reader, start));
@@ -366,7 +366,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
     }
   }
 
-  private Container<XMLLinkCollectionImpl> linkCollection(final InputStream 
input) throws XMLStreamException {
+  private ResWrap<XMLLinkCollectionImpl> linkCollection(final InputStream 
input) throws XMLStreamException {
     final XMLEventReader reader = getReader(input);
     final StartElement start = skipBeforeFirstStartElement(reader);
     return getContainer(start, linkCollection(reader, start));
@@ -552,7 +552,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
     return entry;
   }
 
-  private Container<AtomEntryImpl> entry(final InputStream input) throws 
XMLStreamException {
+  private ResWrap<AtomEntryImpl> entry(final InputStream input) throws 
XMLStreamException {
     final XMLEventReader reader = getReader(input);
     final StartElement start = skipBeforeFirstStartElement(reader);
     return getContainer(start, entry(reader, start));
@@ -622,7 +622,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
     return feed;
   }
 
-  private Container<AtomFeedImpl> feed(final InputStream input) throws 
XMLStreamException {
+  private ResWrap<AtomFeedImpl> feed(final InputStream input) throws 
XMLStreamException {
     final XMLEventReader reader = getReader(input);
     final StartElement start = skipBeforeFirstStartElement(reader);
     return getContainer(start, feed(reader, start));
@@ -678,36 +678,36 @@ public class AtomDeserializer extends AbstractAtomDealer {
     return error;
   }
 
-  private Container<XMLODataErrorImpl> error(final InputStream input) throws 
XMLStreamException {
+  private ResWrap<XMLODataErrorImpl> error(final InputStream input) throws 
XMLStreamException {
     final XMLEventReader reader = getReader(input);
     final StartElement start = skipBeforeFirstStartElement(reader);
     return getContainer(start, error(reader, start));
   }
 
-  private <T> Container<T> getContainer(final StartElement start, final T 
object) {
+  private <T> ResWrap<T> getContainer(final StartElement start, final T 
object) {
     final Attribute context = start.getAttributeByName(contextQName);
     final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
 
-    return new Container<T>(
+    return new ResWrap<T>(
             context == null ? null : URI.create(context.getValue()),
             metadataETag == null ? null : metadataETag.getValue(),
             object);
   }
 
   @SuppressWarnings("unchecked")
-  public <T, V extends T> Container<T> read(final InputStream input, final 
Class<V> reference)
+  public <T, V extends T> ResWrap<T> read(final InputStream input, final 
Class<V> reference)
           throws XMLStreamException {
 
     if (XMLODataErrorImpl.class.equals(reference)) {
-      return (Container<T>) error(input);
+      return (ResWrap<T>) error(input);
     } else if (AtomFeedImpl.class.equals(reference)) {
-      return (Container<T>) feed(input);
+      return (ResWrap<T>) feed(input);
     } else if (AtomEntryImpl.class.equals(reference)) {
-      return (Container<T>) entry(input);
+      return (ResWrap<T>) entry(input);
     } else if (AtomPropertyImpl.class.equals(reference)) {
-      return (Container<T>) property(input);
+      return (ResWrap<T>) property(input);
     } else if (XMLLinkCollectionImpl.class.equals(reference)) {
-      return (Container<T>) linkCollection(input);
+      return (ResWrap<T>) linkCollection(input);
     }
     return null;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
index 6b87469..aba3d16 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -28,7 +28,7 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
 import org.apache.olingo.commons.api.data.CollectionValue;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Entry;
 import org.apache.olingo.commons.api.data.Feed;
 import org.apache.olingo.commons.api.data.Link;
@@ -291,11 +291,11 @@ public class AtomSerializer extends AbstractAtomDealer {
     writer.writeAttribute(Constants.ATOM_ATTR_ID, entry.getId());
   }
 
-  private void entryRef(final XMLStreamWriter writer, final Container<Entry> 
container) throws XMLStreamException {
+  private void entryRef(final XMLStreamWriter writer, final ResWrap<Entry> 
container) throws XMLStreamException {
     writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF);
     writer.writeNamespace(StringUtils.EMPTY, 
version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
     addContextInfo(writer, container);
-    writer.writeAttribute(Constants.ATOM_ATTR_ID, 
container.getObject().getId());
+    writer.writeAttribute(Constants.ATOM_ATTR_ID, 
container.getPayload().getId());
   }
 
   private void entry(final Writer outWriter, final Entry entry) throws 
XMLStreamException {
@@ -317,8 +317,8 @@ public class AtomSerializer extends AbstractAtomDealer {
     writer.flush();
   }
 
-  private void entry(final Writer outWriter, final Container<Entry> container) 
throws XMLStreamException {
-    final Entry entry = container.getObject();
+  private void entry(final Writer outWriter, final ResWrap<Entry> container) 
throws XMLStreamException {
+    final Entry entry = container.getPayload();
 
     final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
 
@@ -394,14 +394,14 @@ public class AtomSerializer extends AbstractAtomDealer {
     writer.flush();
   }
 
-  private void feed(final Writer outWriter, final Container<Feed> feed) throws 
XMLStreamException {
+  private void feed(final Writer outWriter, final ResWrap<Feed> feed) throws 
XMLStreamException {
     final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
 
     startDocument(writer, Constants.ATOM_ELEM_FEED);
 
     addContextInfo(writer, feed);
 
-    feed(writer, feed.getObject());
+    feed(writer, feed.getPayload());
 
     writer.writeEndElement();
     writer.writeEndDocument();
@@ -439,13 +439,13 @@ public class AtomSerializer extends AbstractAtomDealer {
   }
 
   @SuppressWarnings("unchecked")
-  public <T> void write(final Writer writer, final Container<T> container) 
throws XMLStreamException {
-    final T obj = container == null ? null : container.getObject();
+  public <T> void write(final Writer writer, final ResWrap<T> container) 
throws XMLStreamException {
+    final T obj = container == null ? null : container.getPayload();
 
     if (obj instanceof Feed) {
-      this.feed(writer, (Container<Feed>) container);
+      this.feed(writer, (ResWrap<Feed>) container);
     } else if (obj instanceof Entry) {
-      entry(writer, (Container<Entry>) container);
+      entry(writer, (ResWrap<Entry>) container);
     } else if (obj instanceof Property) {
       property(writer, (Property) obj);
     } else if (obj instanceof Link) {
@@ -454,21 +454,21 @@ public class AtomSerializer extends AbstractAtomDealer {
   }
 
   private <T> void addContextInfo(
-          final XMLStreamWriter writer, final Container<T> container) throws 
XMLStreamException {
+          final XMLStreamWriter writer, final ResWrap<T> container) throws 
XMLStreamException {
 
     if (container.getContextURL() != null) {
-      final String base = 
StringUtils.substringBefore(container.getContextURL().toASCIIString(), 
Constants.METADATA);
-      if (container.getObject() instanceof AtomFeedImpl) {
-        ((AtomFeedImpl) container.getObject()).setBaseURI(base);
+      String base = container.getContextURL().getServiceRoot().toASCIIString();
+      if (container.getPayload() instanceof AtomFeedImpl) {
+        ((AtomFeedImpl) container.getPayload()).setBaseURI(base);
       }
-      if (container.getObject() instanceof AtomEntryImpl) {
-        ((AtomEntryImpl) container.getObject()).setBaseURI(base);
+      if (container.getPayload() instanceof AtomEntryImpl) {
+        ((AtomEntryImpl) container.getPayload()).setBaseURI(base);
       }
 
       writer.writeAttribute(
               version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
               Constants.CONTEXT,
-              container.getContextURL().toASCIIString());
+              container.getContextURL().getURI().toASCIIString());
     }
 
     if (StringUtils.isNotBlank(container.getMetadataETag())) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index 3493648..dce4b74 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -32,7 +32,7 @@ import java.util.Map;
 import java.util.Set;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
 import org.apache.olingo.commons.api.domain.ODataOperation;
@@ -47,7 +47,7 @@ import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 public class JSONEntryDeserializer extends 
AbstractJsonDeserializer<JSONEntryImpl> {
 
   @Override
-  protected Container<JSONEntryImpl> doDeserialize(final JsonParser parser, 
final DeserializationContext ctxt)
+  protected ResWrap<JSONEntryImpl> doDeserialize(final JsonParser parser, 
final DeserializationContext ctxt)
           throws IOException, JsonProcessingException {
 
     final ObjectNode tree = parser.getCodec().readTree(parser);
@@ -195,6 +195,6 @@ public class JSONEntryDeserializer extends 
AbstractJsonDeserializer<JSONEntryImp
       }
     }
 
-    return new Container<JSONEntryImpl>(contextURL, metadataETag, entry);
+    return new ResWrap<JSONEntryImpl>(contextURL, metadataETag, entry);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
index b7dcf8d..a5c2c33 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
@@ -25,7 +25,7 @@ import java.io.IOException;
 import java.net.URI;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Entry;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.data.Property;
@@ -41,15 +41,16 @@ public class JSONEntrySerializer extends 
AbstractJsonSerializer<JSONEntryImpl> {
   @Override
   protected void doSerialize(final JSONEntryImpl entry, final JsonGenerator 
jgen, final SerializerProvider provider)
           throws IOException, JsonProcessingException {
-    doContainerSerialize(new Container<JSONEntryImpl>(null, null, entry), 
jgen, provider);
+
+    doContainerSerialize(new ResWrap<JSONEntryImpl>((URI) null, null, entry), 
jgen, provider);
   }
 
   @Override
   protected void doContainerSerialize(
-          final Container<JSONEntryImpl> container, final JsonGenerator jgen, 
final SerializerProvider provider)
+          final ResWrap<JSONEntryImpl> container, final JsonGenerator jgen, 
final SerializerProvider provider)
           throws IOException, JsonProcessingException {
 
-    final Entry entry = container.getObject();
+    final Entry entry = container.getPayload();
 
     jgen.writeStartObject();
 
@@ -57,7 +58,7 @@ public class JSONEntrySerializer extends 
AbstractJsonSerializer<JSONEntryImpl> {
       if (container.getContextURL() != null) {
         jgen.writeStringField(version.compareTo(ODataServiceVersion.V40) >= 0
                 ? Constants.JSON_CONTEXT : Constants.JSON_METADATA,
-                container.getContextURL().toASCIIString());
+                container.getContextURL().getURI().toASCIIString());
       }
       if (version.compareTo(ODataServiceVersion.V40) >= 0 && 
StringUtils.isNotBlank(container.getMetadataETag())) {
         jgen.writeStringField(Constants.JSON_METADATA_ETAG, 
container.getMetadataETag());

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
index 238e56b..a9f80c4 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
@@ -28,7 +28,7 @@ import java.io.IOException;
 import java.net.URI;
 import java.util.Iterator;
 import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 
 /**
  * Reads JSON string into a feed.
@@ -38,7 +38,7 @@ import org.apache.olingo.commons.api.data.Container;
 public class JSONFeedDeserializer extends 
AbstractJsonDeserializer<JSONFeedImpl> {
 
   @Override
-  protected Container<JSONFeedImpl> doDeserialize(final JsonParser parser, 
final DeserializationContext ctxt)
+  protected ResWrap<JSONFeedImpl> doDeserialize(final JsonParser parser, final 
DeserializationContext ctxt)
           throws IOException, JsonProcessingException {
 
     final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -79,12 +79,12 @@ public class JSONFeedDeserializer extends 
AbstractJsonDeserializer<JSONFeedImpl>
     if (tree.hasNonNull(Constants.VALUE)) {
       for (final Iterator<JsonNode> itor = 
tree.get(Constants.VALUE).iterator(); itor.hasNext();) {
         feed.getEntries().add(
-                
itor.next().traverse(parser.getCodec()).<Container<JSONEntryImpl>>readValueAs(
+                
itor.next().traverse(parser.getCodec()).<ResWrap<JSONEntryImpl>>readValueAs(
                         new TypeReference<JSONEntryImpl>() {
-                        }).getObject());
+                        }).getPayload());
       }
     }
 
-    return new Container<JSONFeedImpl>(contextURL, metadataETag, feed);
+    return new ResWrap<JSONFeedImpl>(contextURL, metadataETag, feed);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
index 6a4728d..457b34c 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
@@ -22,9 +22,10 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.SerializerProvider;
 import java.io.IOException;
+import java.net.URI;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Entry;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 
@@ -34,15 +35,16 @@ public class JSONFeedSerializer extends 
AbstractJsonSerializer<JSONFeedImpl> {
   protected void doSerialize(
           final JSONFeedImpl feed, final JsonGenerator jgen, final 
SerializerProvider provider)
           throws IOException, JsonProcessingException {
-    doContainerSerialize(new Container<JSONFeedImpl>(null, null, feed), jgen, 
provider);
+    
+    doContainerSerialize(new ResWrap<JSONFeedImpl>((URI) null, null, feed), 
jgen, provider);
   }
 
   @Override
   protected void doContainerSerialize(
-          final Container<JSONFeedImpl> container, final JsonGenerator jgen, 
final SerializerProvider provider)
+          final ResWrap<JSONFeedImpl> container, final JsonGenerator jgen, 
final SerializerProvider provider)
           throws IOException, JsonProcessingException {
 
-    final JSONFeedImpl feed = container.getObject();
+    final JSONFeedImpl feed = container.getPayload();
 
     jgen.writeStartObject();
 
@@ -50,7 +52,7 @@ public class JSONFeedSerializer extends 
AbstractJsonSerializer<JSONFeedImpl> {
       if (container.getContextURL() != null) {
         jgen.writeStringField(version.compareTo(ODataServiceVersion.V40) >= 0
                 ? Constants.JSON_CONTEXT : Constants.JSON_METADATA,
-                container.getContextURL().toASCIIString());
+                container.getContextURL().getURI().toASCIIString());
       }
 
       if (version.compareTo(ODataServiceVersion.V40) >= 0 && 
StringUtils.isNotBlank(container.getMetadataETag())) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
index de3ffa1..43ee06c 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
@@ -24,13 +24,14 @@ import 
com.fasterxml.jackson.databind.DeserializationContext;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import java.io.IOException;
+import java.net.URI;
 import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 
 public class JSONODataErrorDeserializer extends 
AbstractJsonDeserializer<JSONODataErrorImpl> {
 
   @Override
-  protected Container<JSONODataErrorImpl> doDeserialize(final JsonParser 
parser, final DeserializationContext ctxt)
+  protected ResWrap<JSONODataErrorImpl> doDeserialize(final JsonParser parser, 
final DeserializationContext ctxt)
           throws IOException, JsonProcessingException {
 
     final JSONODataErrorImpl error = new JSONODataErrorImpl();
@@ -55,6 +56,6 @@ public class JSONODataErrorDeserializer extends 
AbstractJsonDeserializer<JSONODa
       }
     }
 
-    return new Container<JSONODataErrorImpl>(null, null, error);
+    return new ResWrap<JSONODataErrorImpl>((URI) null, null, error);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 6d8f0e2..74ae1d4 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -26,7 +26,7 @@ import java.io.IOException;
 import java.net.URI;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
 /**
@@ -37,7 +37,7 @@ import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 public class JSONPropertyDeserializer extends 
AbstractJsonDeserializer<JSONPropertyImpl> {
 
   @Override
-  protected Container<JSONPropertyImpl> doDeserialize(final JsonParser parser, 
final DeserializationContext ctxt)
+  protected ResWrap<JSONPropertyImpl> doDeserialize(final JsonParser parser, 
final DeserializationContext ctxt)
           throws IOException, JsonProcessingException {
 
     final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -78,6 +78,6 @@ public class JSONPropertyDeserializer extends 
AbstractJsonDeserializer<JSONPrope
       value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : 
tree, parser.getCodec());
     }
 
-    return new Container<JSONPropertyImpl>(contextURL, metadataETag, property);
+    return new ResWrap<JSONPropertyImpl>(contextURL, metadataETag, property);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
index 4f20e69..74e8cf0 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
@@ -22,9 +22,10 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.SerializerProvider;
 import java.io.IOException;
+import java.net.URI;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
@@ -39,22 +40,23 @@ public class JSONPropertySerializer extends 
AbstractJsonSerializer<JSONPropertyI
   @Override
   protected void doSerialize(final JSONPropertyImpl property, final 
JsonGenerator jgen,
           final SerializerProvider provider) throws IOException, 
JsonProcessingException {
-    doContainerSerialize(new Container<JSONPropertyImpl>(null, null, 
property), jgen, provider);
+    
+    doContainerSerialize(new ResWrap<JSONPropertyImpl>((URI) null, null, 
property), jgen, provider);
   }
 
   @Override
   protected void doContainerSerialize(
-          final Container<JSONPropertyImpl> container, final JsonGenerator 
jgen, final SerializerProvider provider)
+          final ResWrap<JSONPropertyImpl> container, final JsonGenerator jgen, 
final SerializerProvider provider)
           throws IOException, JsonProcessingException {
 
-    final Property property = container.getObject();
+    final Property property = container.getPayload();
 
     jgen.writeStartObject();
 
     if (serverMode && container.getContextURL() != null) {
       jgen.writeStringField(version.compareTo(ODataServiceVersion.V40) >= 0
               ? Constants.JSON_CONTEXT : Constants.JSON_METADATA,
-              container.getContextURL().toASCIIString());
+              container.getContextURL().getURI().toASCIIString());
     }
 
     if (StringUtils.isNotBlank(property.getType())) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
index 1e331d4..944fb51 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonSerializer.java
@@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.JsonSerializer;
 import com.fasterxml.jackson.databind.SerializerProvider;
 
 import java.io.IOException;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 
@@ -37,7 +37,7 @@ public abstract class ODataJacksonSerializer<T> extends 
JsonSerializer<T> {
   protected abstract void doSerialize(T value, JsonGenerator jgen, 
SerializerProvider provider)
           throws IOException, JsonProcessingException;
 
-  protected abstract void doContainerSerialize(Container<T> value, 
JsonGenerator jgen, SerializerProvider provider)
+  protected abstract void doContainerSerialize(ResWrap<T> value, JsonGenerator 
jgen, SerializerProvider provider)
           throws IOException, JsonProcessingException;
 
   @Override
@@ -48,8 +48,8 @@ public abstract class ODataJacksonSerializer<T> extends 
JsonSerializer<T> {
     version = (ODataServiceVersion) 
provider.getAttribute(ODataServiceVersion.class);
     serverMode = (Boolean) provider.getAttribute(Boolean.class);
 
-    if (value instanceof Container) {
-      doContainerSerialize((Container) value, jgen, provider);
+    if (value instanceof ResWrap) {
+      doContainerSerialize((ResWrap) value, jgen, provider);
     } else {
       doSerialize(value, jgen, provider);
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
index 0d97ba6..e14879e 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
@@ -39,7 +39,7 @@ public abstract class AbstractEdmNavigationProperty extends 
EdmElementImpl imple
   protected abstract FullQualifiedName getTypeFQN();
 
   @Override
-  public EdmType getType() {
+  public EdmEntityType getType() {
     if (typeImpl == null) {
       typeImpl = edm.getEntityType(getTypeFQN());
       if (typeImpl == null) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index ceb6b7e..29eed4a 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -21,6 +21,7 @@ package org.apache.olingo.commons.core.op;
 import com.fasterxml.jackson.core.type.TypeReference;
 import java.io.InputStream;
 import java.lang.reflect.Type;
+import java.net.URI;
 import org.apache.olingo.commons.api.data.Entry;
 import org.apache.olingo.commons.api.domain.ODataError;
 import org.apache.olingo.commons.api.data.Feed;
@@ -30,7 +31,7 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.api.op.CommonODataDeserializer;
 import org.apache.olingo.commons.core.data.AtomDeserializer;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.core.data.AtomEntryImpl;
 import org.apache.olingo.commons.core.data.AtomFeedImpl;
 import org.apache.olingo.commons.core.data.AtomPropertyImpl;
@@ -53,21 +54,21 @@ public abstract class AbstractODataDeserializer extends 
AbstractJacksonTool impl
   }
 
   @Override
-  public Container<Feed> toFeed(final InputStream input, final ODataPubFormat 
format) {
+  public ResWrap<Feed> toFeed(final InputStream input, final ODataPubFormat 
format) {
     return format == ODataPubFormat.ATOM
             ? this.<Feed, AtomFeedImpl>atom(input, AtomFeedImpl.class)
             : this.<Feed, JSONFeedImpl>json(input, JSONFeedImpl.class);
   }
 
   @Override
-  public Container<Entry> toEntry(final InputStream input, final 
ODataPubFormat format) {
+  public ResWrap<Entry> toEntry(final InputStream input, final ODataPubFormat 
format) {
     return format == ODataPubFormat.ATOM
             ? this.<Entry, AtomEntryImpl>atom(input, AtomEntryImpl.class)
             : this.<Entry, JSONEntryImpl>json(input, JSONEntryImpl.class);
   }
 
   @Override
-  public Container<Property> toProperty(final InputStream input, final 
ODataFormat format) {
+  public ResWrap<Property> toProperty(final InputStream input, final 
ODataFormat format) {
     return format == ODataFormat.XML
             ? this.<Property, AtomPropertyImpl>atom(input, 
AtomPropertyImpl.class)
             : this.<Property, JSONPropertyImpl>json(input, 
JSONPropertyImpl.class);
@@ -76,14 +77,14 @@ public abstract class AbstractODataDeserializer extends 
AbstractJacksonTool impl
   @Override
   public ODataError toError(final InputStream input, final boolean isXML) {
     return isXML
-            ? this.<ODataError, XMLODataErrorImpl>atom(input, 
XMLODataErrorImpl.class).getObject()
-            : this.<ODataError, JSONODataErrorImpl>json(input, 
JSONODataErrorImpl.class).getObject();
+            ? this.<ODataError, XMLODataErrorImpl>atom(input, 
XMLODataErrorImpl.class).getPayload()
+            : this.<ODataError, JSONODataErrorImpl>json(input, 
JSONODataErrorImpl.class).getPayload();
   }
 
   /*
    * ------------------ Protected methods ------------------
    */
-  protected <T, V extends T> Container<T> atom(final InputStream input, final 
Class<V> reference) {
+  protected <T, V extends T> ResWrap<T> atom(final InputStream input, final 
Class<V> reference) {
     try {
       return atomDeserializer.<T, V>read(input, reference);
     } catch (Exception e) {
@@ -92,7 +93,7 @@ public abstract class AbstractODataDeserializer extends 
AbstractJacksonTool impl
   }
 
   @SuppressWarnings("unchecked")
-  protected <T, V extends T> Container<T> xml(final InputStream input, final 
Class<V> reference) {
+  protected <T, V extends T> ResWrap<T> xml(final InputStream input, final 
Class<V> reference) {
     try {
       final T obj = getXmlMapper().readValue(input, new TypeReference<V>() {
         @Override
@@ -101,14 +102,14 @@ public abstract class AbstractODataDeserializer extends 
AbstractJacksonTool impl
         }
       });
 
-      return obj instanceof Container ? (Container<T>) obj : new 
Container<T>(null, null, obj);
+      return obj instanceof ResWrap ? (ResWrap<T>) obj : new ResWrap<T>((URI) 
null, null, obj);
     } catch (Exception e) {
       throw new IllegalArgumentException("While deserializing " + 
reference.getName(), e);
     }
   }
 
   @SuppressWarnings("unchecked")
-  protected <T, V extends T> Container<T> json(final InputStream input, final 
Class<V> reference) {
+  protected <T, V extends T> ResWrap<T> json(final InputStream input, final 
Class<V> reference) {
     try {
       final T obj = getObjectMapper().readValue(input, new TypeReference<V>() {
         @Override
@@ -117,7 +118,7 @@ public abstract class AbstractODataDeserializer extends 
AbstractJacksonTool impl
         }
       });
 
-      return obj instanceof Container ? (Container<T>) obj : new 
Container<T>(null, null, obj);
+      return obj instanceof ResWrap ? (ResWrap<T>) obj : new ResWrap<T>((URI) 
null, null, obj);
     } catch (Exception e) {
       throw new IllegalArgumentException("While deserializing " + 
reference.getName(), e);
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
index 4c7e0cb..b5d17de 100644
--- 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
+++ 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
@@ -32,6 +32,7 @@ import 
org.apache.olingo.server.api.edm.provider.ReferentialConstraint;
 public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
 
   private final NavigationProperty navigationProperty;
+
   private List<EdmReferentialConstraint> referentialConstraints;
 
   public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty 
navigationProperty) {
@@ -55,6 +56,11 @@ public class EdmNavigationPropertyImpl extends 
AbstractEdmNavigationProperty {
   }
 
   @Override
+  public Boolean containsTarget() {
+    return navigationProperty.isContainsTarget();
+  }
+
+  @Override
   protected String internatGetPartner() {
     return navigationProperty.getPartner();
   }
@@ -80,7 +86,7 @@ public class EdmNavigationPropertyImpl extends 
AbstractEdmNavigationProperty {
       if (providerConstraints != null) {
         for (ReferentialConstraint constraint : providerConstraints) {
           referentialConstraints.add(new 
EdmReferentialConstraintImpl(constraint.getProperty(), constraint
-              .getReferencedProperty()));
+                  .getReferencedProperty()));
         }
       }
     }

Reply via email to