olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [20/21] [OLINGO-317] Rename and move of some packages and classes
Date Fri, 13 Jun 2014 10:58:40 GMT
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 1165042..7ce5788 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -36,8 +36,8 @@ import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 
 /**
  * This class implements an OData update request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index 5f9014d..d23c642 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -36,8 +36,8 @@ import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 
 /**
  * This class implements an OData update entity property request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkCreateRequestImpl.java
index 293908a..2f43812 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkCreateRequestImpl.java
@@ -34,7 +34,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons
 import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
+import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 
 /**
  * This class implements an insert link OData request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkUpdateRequestImpl.java
index 5392ac6..59172ec 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v3/ODataLinkUpdateRequestImpl.java
@@ -34,7 +34,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons
 import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
+import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 
 /**
  * This class implements an update link OData request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
index 7fcaa65..b6b476e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
@@ -47,8 +47,8 @@ import org.apache.olingo.commons.api.domain.ODataInvokeResult;
 import org.apache.olingo.commons.api.domain.ODataValue;
 import org.apache.olingo.commons.api.format.ODataFormat;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 
 /**
  * This class implements an OData invoke operation request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
index cecbcd1..f75333e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
@@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 
 /**
  * This class implements an OData retrieve query request returning a single entity.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index 6e7df50..8013cfd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 
 /**
  * This class implements an OData EntitySet query request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index c409d99..3d0b64f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataProperty
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.apache.olingo.client.api.http.HttpClientException;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Property;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
index b2632b7..070f59f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
@@ -33,7 +33,7 @@ import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 
 /**
  * This class implements a generic OData request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
index cd11e91..6014b5b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
@@ -29,7 +29,7 @@ import org.apache.olingo.client.api.data.ServiceDocument;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.ODataServiceDocument;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 
 /**
  * This class implements an OData service document request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
index 8c5ef8c..0761aff 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/ODataLinkCollectionRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkC
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.apache.olingo.client.api.http.HttpClientException;
 import org.apache.olingo.client.core.communication.request.retrieve.AbstractODataRetrieveRequest;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java
index 41708b9..d817dc4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/ODataDeltaRequestImpl.java
@@ -33,7 +33,7 @@ import org.apache.olingo.commons.api.data.Delta;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.v4.ODataDelta;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 
 public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDelta, ODataPubFormat>
     implements ODataDeltaRequest {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
index d669129..7089a7e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
@@ -34,7 +34,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 
 /**
  * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
index 87a6fdb..154d699 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -34,7 +34,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 
 /**
  * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
index 1bf5c4d..fc9b27e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.data.ServiceDocument;
 import org.apache.olingo.commons.api.Constants;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.core.data.JsonDeserializer;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.core.serialization.JsonDeserializer;
 
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.core.JsonParser;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
index 22d5dc8..ee67b5e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
@@ -26,8 +26,8 @@ import org.apache.olingo.client.api.data.ServiceDocument;
 import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.core.data.JsonDeserializer;
+import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.core.serialization.JsonDeserializer;
 
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonToken;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
deleted file mode 100644
index 1327e43..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ /dev/null
@@ -1,528 +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.client.core.op;
-
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.Iterator;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.op.CommonODataBinder;
-import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Valuable;
-import org.apache.olingo.commons.api.data.Value;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataLinked;
-import org.apache.olingo.commons.api.domain.ODataOperation;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
-import org.apache.olingo.commons.core.data.CollectionValueImpl;
-import org.apache.olingo.commons.core.data.ComplexValueImpl;
-import org.apache.olingo.commons.core.data.EntityImpl;
-import org.apache.olingo.commons.core.data.EntitySetImpl;
-import org.apache.olingo.commons.core.data.GeospatialValueImpl;
-import org.apache.olingo.commons.core.data.LinkImpl;
-import org.apache.olingo.commons.core.data.NullValueImpl;
-import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractODataBinder implements CommonODataBinder {
-
-  /**
-   * Logger.
-   */
-  protected final Logger LOG = LoggerFactory.getLogger(AbstractODataBinder.class);
-
-  protected final CommonODataClient<?> client;
-
-  protected AbstractODataBinder(final CommonODataClient<?> client) {
-    this.client = client;
-  }
-
-  @Override
-  public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
-    final ODataServiceDocument serviceDocument = new ODataServiceDocument();
-
-    for (ServiceDocumentItem entitySet : resource.getEntitySets()) {
-      serviceDocument.getEntitySets().
-          put(entitySet.getName(), URIUtils.getURI(resource.getBaseURI(), entitySet.getUrl()));
-    }
-
-    return serviceDocument;
-  }
-
-  @Override
-  public EntitySet getEntitySet(final CommonODataEntitySet odataEntitySet) {
-    final EntitySet entitySet = new EntitySetImpl();
-
-    entitySet.setCount(odataEntitySet.getCount());
-
-    final URI next = odataEntitySet.getNext();
-    if (next != null) {
-      entitySet.setNext(next);
-    }
-
-    for (CommonODataEntity entity : odataEntitySet.getEntities()) {
-      entitySet.getEntities().add(getEntity(entity));
-    }
-
-    return entitySet;
-  }
-
-  protected void links(final ODataLinked odataLinked, final Linked linked) {
-    // -------------------------------------------------------------
-    // Append navigation links (handling inline entity / entity set as well)
-    // -------------------------------------------------------------
-    // handle navigation links
-    for (ODataLink link : odataLinked.getNavigationLinks()) {
-      // append link 
-      LOG.debug("Append navigation link\n{}", link);
-      linked.getNavigationLinks().add(getLink(link));
-    }
-    // -------------------------------------------------------------
-
-    // -------------------------------------------------------------
-    // Append association links
-    // -------------------------------------------------------------
-    for (ODataLink link : odataLinked.getAssociationLinks()) {
-      LOG.debug("Append association link\n{}", link);
-      linked.getAssociationLinks().add(getLink(link));
-    }
-    // -------------------------------------------------------------
-  }
-
-  @Override
-  public Entity getEntity(final CommonODataEntity odataEntity) {
-    final Entity entity = new EntityImpl();
-
-    entity.setType(odataEntity.getTypeName() == null ? null : odataEntity.getTypeName().toString());
-
-    // -------------------------------------------------------------
-    // Add edit and self link
-    // -------------------------------------------------------------
-    final URI odataEditLink = odataEntity.getEditLink();
-    if (odataEditLink != null) {
-      final LinkImpl editLink = new LinkImpl();
-      editLink.setTitle(entity.getType());
-      editLink.setHref(odataEditLink.toASCIIString());
-      editLink.setRel(Constants.EDIT_LINK_REL);
-      entity.setEditLink(editLink);
-    }
-
-    if (odataEntity.isReadOnly()) {
-      final LinkImpl selfLink = new LinkImpl();
-      selfLink.setTitle(entity.getType());
-      selfLink.setHref(odataEntity.getLink().toASCIIString());
-      selfLink.setRel(Constants.SELF_LINK_REL);
-      entity.setSelfLink(selfLink);
-    }
-    // -------------------------------------------------------------
-
-    links(odataEntity, entity);
-
-    // -------------------------------------------------------------
-    // Append edit-media links
-    // -------------------------------------------------------------
-    for (ODataLink link : odataEntity.getMediaEditLinks()) {
-      LOG.debug("Append edit-media link\n{}", link);
-      entity.getMediaEditLinks().add(getLink(link));
-    }
-    // -------------------------------------------------------------
-
-    if (odataEntity.isMediaEntity()) {
-      entity.setMediaContentSource(odataEntity.getMediaContentSource());
-      entity.setMediaContentType(odataEntity.getMediaContentType());
-      entity.setMediaETag(odataEntity.getMediaETag());
-    }
-
-    for (CommonODataProperty property : odataEntity.getProperties()) {
-      entity.getProperties().add(getProperty(property));
-    }
-
-    return entity;
-  }
-
-  @Override
-  public Link getLink(final ODataLink link) {
-    final Link linkResource = new LinkImpl();
-    linkResource.setRel(link.getRel());
-    linkResource.setTitle(link.getName());
-    linkResource.setHref(link.getLink() == null ? null : link.getLink().toASCIIString());
-    linkResource.setType(link.getType().toString());
-    linkResource.setMediaETag(link.getMediaETag());
-
-    if (link instanceof ODataInlineEntity) {
-      // append inline entity
-      final CommonODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
-      LOG.debug("Append in-line entity\n{}", inlineEntity);
-
-      linkResource.setInlineEntity(getEntity(inlineEntity));
-    } else if (link instanceof ODataInlineEntitySet) {
-      // append inline entity set
-      final CommonODataEntitySet InlineEntitySet = ((ODataInlineEntitySet) link).getEntitySet();
-      LOG.debug("Append in-line entity set\n{}", InlineEntitySet);
-
-      linkResource.setInlineEntitySet(getEntitySet(InlineEntitySet));
-    }
-
-    return linkResource;
-  }
-
-  protected Value getValue(final ODataValue value) {
-    Value valueResource = null;
-
-    if (value == null) {
-      valueResource = new NullValueImpl();
-    } else if (value.isPrimitive()) {
-      valueResource = value.asPrimitive().getTypeKind().isGeospatial()
-          ? new GeospatialValueImpl((Geospatial) value.asPrimitive().toValue())
-          : new PrimitiveValueImpl(value.asPrimitive().toString());
-    } else if (value.isComplex()) {
-      final ODataComplexValue<? extends CommonODataProperty> _value = value.asComplex();
-      valueResource = new ComplexValueImpl();
-
-      for (final Iterator<? extends CommonODataProperty> itor = _value.iterator(); itor.hasNext();) {
-        valueResource.asComplex().get().add(getProperty(itor.next()));
-      }
-    } else if (value.isCollection()) {
-      final ODataCollectionValue<? extends ODataValue> _value = value.asCollection();
-      valueResource = new CollectionValueImpl();
-
-      for (final Iterator<? extends ODataValue> itor = _value.iterator(); itor.hasNext();) {
-        valueResource.asCollection().get().add(getValue(itor.next()));
-      }
-    }
-
-    return valueResource;
-  }
-
-  protected abstract boolean add(CommonODataEntitySet entitySet, CommonODataEntity entity);
-
-  @Override
-  public CommonODataEntitySet getODataEntitySet(final ResWrap<EntitySet> resource) {
-    if (LOG.isDebugEnabled()) {
-      final StringWriter writer = new StringWriter();
-      try {
-        client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
-      } catch (final ODataSerializerException e) {}
-      writer.flush();
-      LOG.debug("EntitySet -> ODataEntitySet:\n{}", writer.toString());
-    }
-
-    final URI base = resource.getContextURL() == null
-        ? resource.getPayload().getBaseURI() : resource.getContextURL().getServiceRoot();
-
-    final URI next = resource.getPayload().getNext();
-
-    final CommonODataEntitySet entitySet = next == null
-        ? client.getObjectFactory().newEntitySet()
-        : client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString()));
-
-    if (resource.getPayload().getCount() != null) {
-      entitySet.setCount(resource.getPayload().getCount());
-    }
-
-    for (Entity entityResource : resource.getPayload().getEntities()) {
-      add(entitySet, getODataEntity(
-          new ResWrap<Entity>(resource.getContextURL(), resource.getMetadataETag(), entityResource)));
-    }
-
-    return entitySet;
-  }
-
-  protected void odataNavigationLinks(final EdmType edmType,
-      final Linked linked, final ODataLinked odataLinked, final String metadataETag, final URI base) {
-
-    for (Link link : linked.getNavigationLinks()) {
-      final Entity inlineEntity = link.getInlineEntity();
-      final EntitySet inlineEntitySet = link.getInlineEntitySet();
-
-      if (inlineEntity == null && inlineEntitySet == null) {
-        ODataLinkType linkType = null;
-        if (edmType instanceof EdmStructuredType) {
-          final EdmNavigationProperty navProp = ((EdmStructuredType) edmType).getNavigationProperty(link.getTitle());
-          if (navProp != null) {
-            linkType = navProp.isCollection()
-                ? ODataLinkType.ENTITY_SET_NAVIGATION
-                : ODataLinkType.ENTITY_NAVIGATION;
-          }
-        }
-        if (linkType == null) {
-          linkType = link.getType() == null
-              ? ODataLinkType.ENTITY_NAVIGATION
-              : ODataLinkType.fromString(client.getServiceVersion(), link.getRel(), link.getType());
-        }
-
-        odataLinked.addLink(linkType == ODataLinkType.ENTITY_NAVIGATION
-            ? client.getObjectFactory().
-                newEntityNavigationLink(link.getTitle(), URIUtils.getURI(base, link.getHref()))
-            : client.getObjectFactory().
-                newEntitySetNavigationLink(link.getTitle(), URIUtils.getURI(base, link.getHref())));
-      } else if (inlineEntity != null) {
-        odataLinked.addLink(new ODataInlineEntity(client.getServiceVersion(),
-            URIUtils.getURI(base, link.getHref()), ODataLinkType.ENTITY_NAVIGATION, link.getTitle(),
-            getODataEntity(new ResWrap<Entity>(
-                inlineEntity.getBaseURI() == null ? base : inlineEntity.getBaseURI(),
-                metadataETag,
-                inlineEntity))));
-      } else {
-        odataLinked.addLink(new ODataInlineEntitySet(client.getServiceVersion(),
-            URIUtils.getURI(base, link.getHref()), ODataLinkType.ENTITY_SET_NAVIGATION, link.getTitle(),
-            getODataEntitySet(new ResWrap<EntitySet>(
-                inlineEntitySet.getBaseURI() == null ? base : inlineEntitySet.getBaseURI(),
-                metadataETag,
-                inlineEntitySet))));
-      }
-    }
-  }
-
-  /**
-   * Infer type name from various sources of information including Edm and context URL, if available.
-   *
-   * @param contextURL context URL
-   * @param metadataETag metadata ETag
-   * @return Edm type information
-   */
-  private EdmType findType(final ContextURL contextURL, final String metadataETag) {
-    EdmType type = null;
-
-    if (client instanceof EdmEnabledODataClient && contextURL != null) {
-      final Edm edm = ((EdmEnabledODataClient) client).getEdm(metadataETag);
-
-      if (contextURL.getDerivedEntity() == null) {
-        for (EdmSchema schema : edm.getSchemas()) {
-          final EdmEntityContainer container = schema.getEntityContainer();
-          if (container != null) {
-            EdmBindingTarget bindingTarget = container.getEntitySet(contextURL.getEntitySetOrSingletonOrType());
-            if (bindingTarget == null) {
-              bindingTarget = container.getSingleton(contextURL.getEntitySetOrSingletonOrType());
-            }
-            if (bindingTarget != null) {
-              if (contextURL.getNavOrPropertyPath() == null) {
-                type = bindingTarget.getEntityType();
-              } else {
-                final EdmNavigationProperty navProp = bindingTarget.getEntityType().
-                    getNavigationProperty(contextURL.getNavOrPropertyPath());
-
-                type = navProp == null
-                    ? bindingTarget.getEntityType()
-                    : navProp.getType();
-              }
-            }
-          }
-        }
-        if (type == null) {
-          type = new EdmTypeInfo.Builder().setEdm(edm).
-              setTypeExpression(contextURL.getEntitySetOrSingletonOrType()).build().getType();
-        }
-      } else {
-        type = edm.getEntityType(new FullQualifiedName(contextURL.getDerivedEntity()));
-      }
-    }
-
-    return type;
-  }
-
-  @Override
-  public CommonODataEntity getODataEntity(final ResWrap<Entity> resource) {
-    if (LOG.isDebugEnabled()) {
-      final StringWriter writer = new StringWriter();
-      try {
-        client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
-      } catch (final ODataSerializerException e) {}
-      writer.flush();
-      LOG.debug("EntityResource -> ODataEntity:\n{}", writer.toString());
-    }
-
-    final URI base = resource.getContextURL() == null
-        ? resource.getPayload().getBaseURI() : resource.getContextURL().getServiceRoot();
-
-    final EdmType edmType = findType(resource.getContextURL(), resource.getMetadataETag());
-    FullQualifiedName typeName = null;
-    if (resource.getPayload().getType() == null) {
-      if (edmType != null) {
-        typeName = edmType.getFullQualifiedName();
-      }
-    } else {
-      typeName = new FullQualifiedName(resource.getPayload().getType());
-    }
-
-    final CommonODataEntity entity = resource.getPayload().getSelfLink() == null
-        ? client.getObjectFactory().newEntity(typeName)
-        : client.getObjectFactory().newEntity(typeName,
-            URIUtils.getURI(base, resource.getPayload().getSelfLink().getHref()));
-
-    if (StringUtils.isNotBlank(resource.getPayload().getETag())) {
-      entity.setETag(resource.getPayload().getETag());
-    }
-
-    if (resource.getPayload().getEditLink() != null) {
-      entity.setEditLink(URIUtils.getURI(base, resource.getPayload().getEditLink().getHref()));
-    }
-
-    for (Link link : resource.getPayload().getAssociationLinks()) {
-      entity.addLink(client.getObjectFactory().
-          newAssociationLink(link.getTitle(), URIUtils.getURI(base, link.getHref())));
-    }
-
-    odataNavigationLinks(edmType, resource.getPayload(), entity, resource.getMetadataETag(), base);
-
-    for (Link link : resource.getPayload().getMediaEditLinks()) {
-      entity.addLink(client.getObjectFactory().
-          newMediaEditLink(link.getTitle(), URIUtils.getURI(base, link.getHref())));
-    }
-
-    for (ODataOperation operation : resource.getPayload().getOperations()) {
-      operation.setTarget(URIUtils.getURI(base, operation.getTarget()));
-      entity.getOperations().add(operation);
-    }
-
-    if (resource.getPayload().isMediaEntity()) {
-      entity.setMediaEntity(true);
-      entity.setMediaContentSource(URIUtils.getURI(base, resource.getPayload().getMediaContentSource()));
-      entity.setMediaContentType(resource.getPayload().getMediaContentType());
-      entity.setMediaETag(resource.getPayload().getMediaETag());
-    }
-
-    for (Property property : resource.getPayload().getProperties()) {
-      EdmType propertyType = null;
-      if (edmType instanceof EdmEntityType) {
-        final EdmElement edmProperty = ((EdmEntityType) edmType).getProperty(property.getName());
-        if (edmProperty != null) {
-          propertyType = edmProperty.getType();
-        }
-      }
-      add(entity, getODataProperty(propertyType, property));
-    }
-
-    return entity;
-  }
-
-  protected EdmTypeInfo buildTypeInfo(final ContextURL contextURL, final String metadataETag,
-      final String propertyName, final String propertyType) {
-
-    FullQualifiedName typeName = null;
-    final EdmType type = findType(contextURL, metadataETag);
-    if (type instanceof EdmStructuredType) {
-      final EdmProperty edmProperty = ((EdmStructuredType) type).getStructuralProperty(propertyName);
-      if (edmProperty != null) {
-        typeName = edmProperty.getType().getFullQualifiedName();
-      }
-    }
-    if (typeName == null && type != null) {
-      typeName = type.getFullQualifiedName();
-    }
-
-    return buildTypeInfo(typeName, propertyType);
-  }
-
-  protected EdmTypeInfo buildTypeInfo(final FullQualifiedName typeName, final String propertyType) {
-    EdmTypeInfo typeInfo = null;
-    if (typeName == null) {
-      if (propertyType != null) {
-        typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
-      }
-    } else {
-      if (propertyType == null || propertyType.equals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString())) {
-        typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
-      } else {
-        typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
-      }
-    }
-    return typeInfo;
-  }
-
-  protected abstract CommonODataProperty getODataProperty(EdmType type, Property resource);
-
-  protected ODataValue getODataValue(final FullQualifiedName type,
-      final Valuable valuable, final ContextURL contextURL, final String metadataETag) {
-
-    ODataValue value = null;
-    if (valuable.getValue().isGeospatial()) {
-      value = client.getObjectFactory().newPrimitiveValueBuilder().
-          setValue(valuable.getValue().asGeospatial().get()).
-          setType(type == null
-              || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(type)
-              || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(type)
-              ? valuable.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
-              : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
-    } else if (valuable.getValue().isPrimitive()) {
-      value = client.getObjectFactory().newPrimitiveValueBuilder().
-          setText(valuable.getValue().asPrimitive().get()).
-          setType(type == null || !EdmPrimitiveType.EDM_NAMESPACE.equals(type.getNamespace())
-              ? null
-              : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
-    } else if (valuable.getValue().isComplex()) {
-      value = client.getObjectFactory().newComplexValue(type == null ? null : type.toString());
-
-      for (Property property : valuable.getValue().asComplex().get()) {
-        value.asComplex().add(getODataProperty(new ResWrap<Property>(contextURL, metadataETag, property)));
-      }
-    } else if (valuable.getValue().isCollection()) {
-      value = client.getObjectFactory().newCollectionValue(type == null ? null : "Collection(" + type.toString() + ")");
-
-      for (Value _value : valuable.getValue().asCollection().get()) {
-        final Property fake = new PropertyImpl();
-        fake.setValue(_value);
-        value.asCollection().add(getODataValue(type, fake, contextURL, metadataETag));
-      }
-    }
-
-    return value;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
deleted file mode 100644
index 1b60736..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ /dev/null
@@ -1,159 +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.client.core.op;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.op.CommonODataReader;
-import org.apache.olingo.client.core.edm.EdmClientImpl;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractODataReader implements CommonODataReader {
-
-  /**
-   * Logger.
-   */
-  protected static final Logger LOG = LoggerFactory.getLogger(AbstractODataReader.class);
-
-  protected final CommonODataClient<?> client;
-
-  protected AbstractODataReader(final CommonODataClient<?> client) {
-    this.client = client;
-  }
-
-  @Override
-  public Edm readMetadata(final InputStream input) {
-    return readMetadata(client.getDeserializer(ODataFormat.XML).toMetadata(input).getSchemaByNsOrAlias());
-  }
-
-  @Override
-  public Edm readMetadata(final Map<String, Schema> xmlSchemas) {
-    return new EdmClientImpl(client.getServiceVersion(), xmlSchemas);
-  }
-
-  @Override
-  public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format)
-      throws ODataDeserializerException {
-    return client.getBinder().getODataServiceDocument(
-            client.getDeserializer(format).toServiceDocument(input).getPayload());
-  }
-
-  @Override
-  public ODataError readError(final InputStream inputStream, final ODataFormat format )
-      throws ODataDeserializerException {
-    return client.getDeserializer(format).toError(inputStream);
-  }
-
-  @Override
-  public <T> ResWrap<T> read(final InputStream src, final String format, final Class<T> reference)
-      throws ODataDeserializerException {
-    ResWrap<T> res;
-
-    try {
-      if (ODataEntitySetIterator.class.isAssignableFrom(reference)) {
-        res = new ResWrap<T>(
-                (URI) null,
-                null,
-                reference.cast(new ODataEntitySetIterator<CommonODataEntitySet, CommonODataEntity>(
-                                client, src, ODataPubFormat.fromString(format))));
-      } else if (CommonODataEntitySet.class.isAssignableFrom(reference)) {
-        final ResWrap<EntitySet> resource = client.getDeserializer(ODataPubFormat.fromString(format))
-            .toEntitySet(src);
-        res = new ResWrap<T>(
-                resource.getContextURL(),
-                resource.getMetadataETag(),
-                reference.cast(client.getBinder().getODataEntitySet(resource)));
-      } else if (CommonODataEntity.class.isAssignableFrom(reference)) {
-        final ResWrap<Entity> container = client.getDeserializer(ODataPubFormat.fromString(format)).toEntity(src);
-        res = new ResWrap<T>(
-                container.getContextURL(),
-                container.getMetadataETag(),
-                reference.cast(client.getBinder().getODataEntity(container)));
-      } else if (CommonODataProperty.class.isAssignableFrom(reference)) {
-        final ResWrap<Property> container = client.getDeserializer(ODataFormat.fromString(format)).toProperty(src);
-        res = new ResWrap<T>(
-                container.getContextURL(),
-                container.getMetadataETag(),
-                reference.cast(client.getBinder().getODataProperty(container)));
-      } else if (ODataValue.class.isAssignableFrom(reference)) {
-        res = new ResWrap<T>(
-                (URI) null,
-                null,
-                reference.cast(client.getObjectFactory().newPrimitiveValueBuilder().
-                        setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
-                                ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
-                        setText(IOUtils.toString(src)).
-                        build()));
-      } else if (XMLMetadata.class.isAssignableFrom(reference)) {
-        res = new ResWrap<T>(
-                (URI) null,
-                null,
-                reference.cast(readMetadata(src)));
-      } else if (ODataServiceDocument.class.isAssignableFrom(reference)) {
-        final ResWrap<ServiceDocument> resource =
-                client.getDeserializer(ODataFormat.fromString(format)).toServiceDocument(src);
-        res = new ResWrap<T>(
-                resource.getContextURL(),
-                resource.getMetadataETag(),
-                reference.cast(client.getBinder().getODataServiceDocument(resource.getPayload())));
-      } else if (ODataError.class.isAssignableFrom(reference)) {
-        res = new ResWrap<T>(
-                (URI) null,
-                null,
-                reference.cast(readError(src, ODataFormat.fromString(format))));
-      } else {
-        throw new IllegalArgumentException("Invalid reference type " + reference);
-      }
-    } catch (Exception e) {
-      LOG.warn("Cast error", e);
-      res = null;
-    } finally {
-      if (!ODataEntitySetIterator.class.isAssignableFrom(reference)) {
-        IOUtils.closeQuietly(src);
-      }
-    }
-
-    return res;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
deleted file mode 100644
index 71fe85d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
+++ /dev/null
@@ -1,111 +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.client.core.op;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.op.ODataWriter;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
-
-public class ODataWriterImpl implements ODataWriter {
-
-  protected final CommonODataClient<?> client;
-
-  public ODataWriterImpl(final CommonODataClient<?> client) {
-    this.client = client;
-  }
-
-  @Override
-  public InputStream writeEntities(final Collection<CommonODataEntity> entities, final ODataPubFormat format)
-      throws ODataSerializerException {
-    ByteArrayOutputStream output = new ByteArrayOutputStream();
-    OutputStreamWriter writer;
-    try {
-      writer = new OutputStreamWriter(output, Constants.UTF8);
-    } catch (final UnsupportedEncodingException e) {
-      writer = null;
-    }
-    try {
-      for (CommonODataEntity entity : entities) {
-        client.getSerializer(format).write(writer, client.getBinder().getEntity(entity));
-      }
-
-      return new ByteArrayInputStream(output.toByteArray());
-    } finally {
-      IOUtils.closeQuietly(output);
-    }
-  }
-
-  @Override
-  public InputStream writeEntity(final CommonODataEntity entity, final ODataPubFormat format)
-      throws ODataSerializerException {
-    return writeEntities(Collections.<CommonODataEntity>singleton(entity), format);
-  }
-
-  @Override
-  public InputStream writeProperty(final CommonODataProperty property, final ODataFormat format)
-      throws ODataSerializerException {
-    final ByteArrayOutputStream output = new ByteArrayOutputStream();
-    OutputStreamWriter writer;
-    try {
-      writer = new OutputStreamWriter(output, Constants.UTF8);
-    } catch (final UnsupportedEncodingException e) {
-      writer = null;
-    }
-    try {
-      client.getSerializer(format).write(writer, client.getBinder().getProperty(property));
-
-      return new ByteArrayInputStream(output.toByteArray());
-    } finally {
-      IOUtils.closeQuietly(output);
-    }
-  }
-
-  @Override
-  public InputStream writeLink(final ODataLink link, final ODataFormat format) throws ODataSerializerException {
-    final ByteArrayOutputStream output = new ByteArrayOutputStream();
-    OutputStreamWriter writer;
-    try {
-      writer = new OutputStreamWriter(output, Constants.UTF8);
-    } catch (final UnsupportedEncodingException e) {
-      writer = null;
-    }
-    try {
-      client.getSerializer(format).write(writer, client.getBinder().getLink(link));
-
-      return new ByteArrayInputStream(output.toByteArray());
-    } finally {
-      IOUtils.closeQuietly(output);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
deleted file mode 100644
index 932a766..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ /dev/null
@@ -1,117 +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.client.core.op.impl.v3;
-
-import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
-import org.apache.olingo.client.api.op.v3.ODataBinder;
-import org.apache.olingo.client.core.op.AbstractODataBinder;
-import org.apache.olingo.client.core.v3.ODataClientImpl;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.v3.LinkCollection;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.v3.ODataEntity;
-import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.v3.ODataProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.commons.core.domain.v3.ODataPropertyImpl;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
-
-  public ODataBinderImpl(final ODataClientImpl client) {
-    super(client);
-  }
-
-  @Override
-  public void add(final ODataComplexValue<CommonODataProperty> complex, final CommonODataProperty property) {
-    complex.add(property);
-  }
-
-  @Override
-  public boolean add(final CommonODataEntity entity, final CommonODataProperty property) {
-    return ((ODataEntity) entity).getProperties().add((ODataProperty) property);
-  }
-
-  @Override
-  protected boolean add(final CommonODataEntitySet entitySet, final CommonODataEntity entity) {
-    return ((ODataEntitySet) entitySet).getEntities().add((ODataEntity) entity);
-  }
-
-  @Override
-  public Property getProperty(final CommonODataProperty property) {
-    final Property propertyResource = new PropertyImpl();
-    propertyResource.setName(property.getName());
-    propertyResource.setValue(getValue(property.getValue()));
-
-    if (property.hasPrimitiveValue()) {
-      propertyResource.setType(property.getPrimitiveValue().getTypeName());
-    } else if (property.hasComplexValue()) {
-      propertyResource.setType(((ODataProperty) property).getComplexValue().getTypeName());
-    } else if (property.hasCollectionValue()) {
-      propertyResource.setType(((ODataProperty) property).getCollectionValue().getTypeName());
-    }
-
-    return propertyResource;
-  }
-
-  @Override
-  public ODataEntitySet getODataEntitySet(final ResWrap<EntitySet> resource) {
-    return (ODataEntitySet) super.getODataEntitySet(resource);
-  }
-
-  @Override
-  public ODataEntity getODataEntity(final ResWrap<Entity> resource) {
-    return (ODataEntity) super.getODataEntity(resource);
-  }
-
-  @Override
-  public ODataProperty getODataProperty(final ResWrap<Property> property) {
-    final EdmTypeInfo typeInfo = buildTypeInfo(property.getContextURL(), property.getMetadataETag(),
-            property.getPayload().getName(), property.getPayload().getType());
-
-    return new ODataPropertyImpl(property.getPayload().getName(),
-            getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(),
-                    property.getPayload(), property.getContextURL(), property.getMetadataETag()));
-  }
-
-  @Override
-  protected ODataProperty getODataProperty(final EdmType type, final Property resource) {
-    final EdmTypeInfo typeInfo = buildTypeInfo(type == null ? null : type.getFullQualifiedName(), resource.getType());
-
-    return new ODataPropertyImpl(resource.getName(),
-            getODataValue(typeInfo == null
-                    ? null
-                    : typeInfo.getFullQualifiedName(),
-                    resource, null, null));
-  }
-
-  @Override
-  public ODataLinkCollection getLinkCollection(final LinkCollection linkCollection) {
-    final ODataLinkCollection collection = new ODataLinkCollection(linkCollection.getNext());
-    collection.setLinks(linkCollection.getLinks());
-    return collection;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
deleted file mode 100644
index 348d524..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ /dev/null
@@ -1,77 +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.client.core.op.impl.v3;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.api.op.v3.ODataDeserializer;
-import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
-import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
-import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
-import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.v3.LinkCollection;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.Format;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.core.data.AtomDeserializer;
-import org.apache.olingo.commons.core.data.JSONLinkCollectionDeserializer;
-import org.apache.olingo.commons.core.op.AbstractODataDeserializer;
-
-public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
-
-  private final Format format;
-
-  public ODataDeserializerImpl(final ODataServiceVersion version, final boolean serverMode, final Format format) {
-    super(version, serverMode, format);
-    this.format = format;
-  }
-
-  @Override
-  public XMLMetadata toMetadata(final InputStream input) {
-    try {
-      return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
-    } catch (Exception e) {
-      throw new IllegalArgumentException("Could not parse as Edmx document", e);
-    }
-  }
-
-  @Override
-  public ResWrap<ServiceDocument> toServiceDocument(final InputStream input) throws ODataDeserializerException {
-    return format == ODataFormat.XML ?
-        new XMLServiceDocumentDeserializer(version, false).toServiceDocument(input) :
-        new JSONServiceDocumentDeserializer(version, false).toServiceDocument(input);
-  }
-
-  @Override
-  public ResWrap<LinkCollection> toLinkCollection(final InputStream input) throws ODataDeserializerException {
-    try {
-      return format == ODataFormat.XML ?
-          new AtomDeserializer(version).linkCollection(input) :
-          new JSONLinkCollectionDeserializer(version, false).toLinkCollection(input);
-    } catch (final XMLStreamException e) {
-      throw new ODataDeserializerException(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
deleted file mode 100644
index 16a897d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ /dev/null
@@ -1,83 +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.client.core.op.impl.v3;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.client.api.op.v3.ODataReader;
-import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.core.op.AbstractODataReader;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.v3.LinkCollection;
-import org.apache.olingo.commons.api.domain.v3.ODataEntity;
-import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.v3.ODataProperty;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-
-public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
-
-  public ODataReaderImpl(final ODataClient client) {
-    super(client);
-  }
-
-  @Override
-  public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format)
-      throws ODataDeserializerException {
-    return ((ODataClient) client).getBinder().getODataEntitySet(client.getDeserializer(format).toEntitySet(input));
-  }
-
-  @Override
-  public ODataEntity readEntity(final InputStream input, final ODataPubFormat format)
-      throws ODataDeserializerException {
-    return ((ODataClient) client).getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
-  }
-
-  @Override
-  public ODataProperty readProperty(final InputStream input, final ODataFormat format)
-      throws ODataDeserializerException {
-    return ((ODataClient) client).getBinder().getODataProperty(client.getDeserializer(format).toProperty(input));
-  }
-
-  @Override
-  public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format)
-      throws ODataDeserializerException {
-    return ((ODataClient) client).getBinder().getLinkCollection(
-            ((ODataClient) client).getDeserializer(format).toLinkCollection(input).getPayload());
-  }
-
-  @Override
-  @SuppressWarnings("unchecked")
-  public <T> ResWrap<T> read(final InputStream src, final String format, final Class<T> reference)
-      throws ODataDeserializerException {
-    if (ODataLinkCollection.class.isAssignableFrom(reference)) {
-      final ResWrap<LinkCollection> container =
-              ((ODataClient) client).getDeserializer(ODataFormat.fromString(format)).toLinkCollection(src);
-
-      return new ResWrap<T>(
-              container.getContextURL(),
-              container.getMetadataETag(),
-              (T) ((ODataClient) client).getBinder().getLinkCollection(container.getPayload()));
-    } else {
-      return super.read(src, format, reference);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
deleted file mode 100644
index 9151b74..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ /dev/null
@@ -1,405 +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.client.core.op.impl.v4;
-
-import java.net.URI;
-
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.op.v4.ODataBinder;
-import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
-import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.core.op.AbstractODataBinder;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.data.Annotatable;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.DeletedEntity;
-import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.data.DeltaLink;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Valuable;
-import org.apache.olingo.commons.api.data.Value;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLinked;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.domain.v4.ODataAnnotatable;
-import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
-import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity.Reason;
-import org.apache.olingo.commons.api.domain.v4.ODataDelta;
-import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
-import org.apache.olingo.commons.api.domain.v4.ODataEntity;
-import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.v4.ODataLink;
-import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
-import org.apache.olingo.commons.api.domain.v4.ODataProperty;
-import org.apache.olingo.commons.api.domain.v4.ODataValuable;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.data.AnnotationImpl;
-import org.apache.olingo.commons.core.data.EnumValueImpl;
-import org.apache.olingo.commons.core.data.LinkedComplexValueImpl;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataAnnotationImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataDeletedEntityImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataDeltaLinkImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
-
-  public ODataBinderImpl(final ODataClient client) {
-    super(client);
-  }
-
-  @Override
-  public void add(final ODataComplexValue<CommonODataProperty> complex, final CommonODataProperty property) {
-    complex.add(property);
-  }
-
-  @Override
-  public boolean add(final CommonODataEntity entity, final CommonODataProperty property) {
-    return ((ODataEntity) entity).getProperties().add((ODataProperty) property);
-  }
-
-  @Override
-  protected boolean add(final CommonODataEntitySet entitySet, final CommonODataEntity entity) {
-    return ((ODataEntitySet) entitySet).getEntities().add((ODataEntity) entity);
-  }
-
-  @Override
-  public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
-    final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
-
-    for (ServiceDocumentItem functionImport : resource.getFunctionImports()) {
-      serviceDocument.getFunctionImports().put(
-              functionImport.getName() == null ? functionImport.getUrl() : functionImport.getName(),
-              URIUtils.getURI(resource.getBaseURI(), functionImport.getUrl()));
-    }
-    for (ServiceDocumentItem singleton : resource.getSingletons()) {
-      serviceDocument.getSingletons().put(
-              singleton.getName() == null ? singleton.getUrl() : singleton.getName(),
-              URIUtils.getURI(resource.getBaseURI(), singleton.getUrl()));
-    }
-    for (ServiceDocumentItem sdoc : resource.getRelatedServiceDocuments()) {
-      serviceDocument.getRelatedServiceDocuments().put(
-              sdoc.getName() == null ? sdoc.getUrl() : sdoc.getName(),
-              URIUtils.getURI(resource.getBaseURI(), sdoc.getUrl()));
-    }
-
-    return serviceDocument;
-  }
-
-  private void updateValuable(final Valuable propertyResource, final ODataValuable odataValuable) {
-
-    propertyResource.setValue(getValue(odataValuable.getValue()));
-
-    if (odataValuable.hasPrimitiveValue()) {
-      propertyResource.setType(odataValuable.getPrimitiveValue().getTypeName());
-    } else if (odataValuable.hasEnumValue()) {
-      propertyResource.setType(odataValuable.getEnumValue().getTypeName());
-    } else if (odataValuable.hasComplexValue()) {
-      propertyResource.setType(odataValuable.getComplexValue().getTypeName());
-    } else if (odataValuable.hasCollectionValue()) {
-      propertyResource.setType(odataValuable.getCollectionValue().getTypeName());
-    }
-  }
-
-  private void annotations(final ODataAnnotatable odataAnnotatable, final Annotatable annotatable) {
-
-    for (ODataAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) {
-      final Annotation annotation = new AnnotationImpl();
-
-      annotation.setTerm(odataAnnotation.getTerm());
-      annotation.setType(odataAnnotation.getValue().getTypeName());
-      updateValuable(annotation, odataAnnotation);
-
-      annotatable.getAnnotations().add(annotation);
-    }
-  }
-
-  @Override
-  public EntitySet getEntitySet(final CommonODataEntitySet odataEntitySet) {
-    final EntitySet entitySet = super.getEntitySet(odataEntitySet);
-    entitySet.setDeltaLink(((ODataEntitySet) odataEntitySet).getDeltaLink());
-    annotations((ODataEntitySet) odataEntitySet, entitySet);
-    return entitySet;
-  }
-
-  @Override
-  protected void links(final ODataLinked odataLinked, final Linked linked) {
-    super.links(odataLinked, linked);
-
-    for (Link link : linked.getNavigationLinks()) {
-      final org.apache.olingo.commons.api.domain.ODataLink odataLink = odataLinked.getNavigationLink(link.getTitle());
-      if (!(odataLink instanceof ODataInlineEntity) && !(odataLink instanceof ODataInlineEntitySet)) {
-        annotations((ODataLink) odataLink, link);
-      }
-    }
-  }
-
-  @Override
-  public Entity getEntity(final CommonODataEntity odataEntity) {
-    final Entity entity = super.getEntity(odataEntity);
-    entity.setId(((ODataEntity) odataEntity).getId());
-    annotations((ODataEntity) odataEntity, entity);
-    return entity;
-  }
-
-  @Override
-  public Property getProperty(final CommonODataProperty property) {
-    final ODataProperty _property = (ODataProperty) property;
-
-    final Property propertyResource = new PropertyImpl();
-    propertyResource.setName(_property.getName());
-    updateValuable(propertyResource, _property);
-    annotations(_property, propertyResource);
-
-    return propertyResource;
-  }
-
-  @Override
-  protected Value getValue(final ODataValue value) {
-    Value valueResource;
-    if (value instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
-            && ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).isEnum()) {
-
-      valueResource = new EnumValueImpl(
-              ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asEnum().getValue());
-    } else {
-      valueResource = super.getValue(value);
-
-      if (value instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
-              && ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).isLinkedComplex()) {
-
-        final LinkedComplexValue lcValueResource = new LinkedComplexValueImpl();
-        lcValueResource.get().addAll(valueResource.asComplex().get());
-
-        final ODataLinkedComplexValue linked =
-                ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asLinkedComplex();
-        annotations(linked, lcValueResource);
-        links(linked, lcValueResource);
-
-        valueResource = lcValueResource;
-      }
-    }
-    return valueResource;
-  }
-
-  private void odataAnnotations(final Annotatable annotatable, final ODataAnnotatable odataAnnotatable) {
-    for (Annotation annotation : annotatable.getAnnotations()) {
-      FullQualifiedName fqn = null;
-      if (client instanceof EdmEnabledODataClient) {
-        final EdmTerm term = ((EdmEnabledODataClient) client).getEdm(null).
-                getTerm(new FullQualifiedName(annotation.getTerm()));
-        if (term != null) {
-          fqn = term.getType().getFullQualifiedName();
-        }
-      }
-
-      if (fqn == null && annotation.getType() != null) {
-        final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build();
-        if (typeInfo.isPrimitiveType()) {
-          fqn = typeInfo.getPrimitiveTypeKind().getFullQualifiedName();
-        }
-      }
-
-      final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(),
-              (org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(fqn, annotation, null, null));
-      odataAnnotatable.getAnnotations().add(odataAnnotation);
-    }
-  }
-
-  @Override
-  public ODataEntitySet getODataEntitySet(final ResWrap<EntitySet> resource) {
-    final ODataEntitySet entitySet = (ODataEntitySet) super.getODataEntitySet(resource);
-
-    if (resource.getPayload().getDeltaLink() != null) {
-      final URI base = resource.getContextURL() == null
-              ? resource.getPayload().getBaseURI() : resource.getContextURL().getServiceRoot();
-      entitySet.setDeltaLink(URIUtils.getURI(base, resource.getPayload().getDeltaLink()));
-    }
-    odataAnnotations(resource.getPayload(), entitySet);
-
-    return entitySet;
-  }
-
-  @Override
-  protected void odataNavigationLinks(final EdmType edmType,
-          final Linked linked, final ODataLinked odataLinked, final String metadataETag, final URI base) {
-
-    super.odataNavigationLinks(edmType, linked, odataLinked, metadataETag, base);
-    for (org.apache.olingo.commons.api.domain.ODataLink link : odataLinked.getNavigationLinks()) {
-      if (!(link instanceof ODataInlineEntity) && !(link instanceof ODataInlineEntitySet)) {
-        odataAnnotations(linked.getNavigationLink(link.getName()), (ODataAnnotatable) link);
-      }
-    }
-  }
-
-  @Override
-  public ODataEntity getODataEntity(final ResWrap<Entity> resource) {
-    final ODataEntity entity = (ODataEntity) super.getODataEntity(resource);
-
-    entity.setId(resource.getPayload().getId());
-    odataAnnotations(resource.getPayload(), entity);
-
-    return entity;
-  }
-
-  @Override
-  public ODataProperty getODataProperty(final ResWrap<Property> resource) {
-    final Property payload = resource.getPayload();
-    final EdmTypeInfo typeInfo = buildTypeInfo(resource.getContextURL(), resource.getMetadataETag(),
-        payload.getName(), payload.getType());
-
-    final ODataProperty property = new ODataPropertyImpl(payload.getName(),
-        getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(),
-            payload, resource.getContextURL(), resource.getMetadataETag()));
-    odataAnnotations(payload, property);
-
-    return property;
-  }
-
-  @Override
-  protected ODataProperty getODataProperty(final EdmType type, final Property resource) {
-    final EdmTypeInfo typeInfo = buildTypeInfo(type == null ? null : type.getFullQualifiedName(), resource.getType());
-
-    final ODataProperty property = new ODataPropertyImpl(resource.getName(),
-            getODataValue(typeInfo == null
-                    ? null
-                    : typeInfo.getFullQualifiedName(),
-                    resource, null, null));
-    odataAnnotations(resource, property);
-
-    return property;
-  }
-
-  @Override
-  protected ODataValue getODataValue(final FullQualifiedName type,
-          final Valuable valuable, final ContextURL contextURL, final String metadataETag) {
-
-    // fixes enum values treated as primitive when no type information is available
-    if (client instanceof EdmEnabledODataClient && type != null) {
-      final EdmEnumType edmType = ((EdmEnabledODataClient) client).getEdm(metadataETag).getEnumType(type);
-      if (valuable.getValue().isPrimitive() && edmType != null) {
-        valuable.setValue(new EnumValueImpl(valuable.getValue().asPrimitive().get()));
-      }
-    }
-
-    ODataValue value;
-    if (valuable.getValue().isEnum()) {
-      value = ((ODataClient) client).getObjectFactory().newEnumValue(type == null ? null : type.toString(),
-              valuable.getValue().asEnum().get());
-    } else if (valuable.getValue().isLinkedComplex()) {
-      final ODataLinkedComplexValue lcValue =
-              ((ODataClient) client).getObjectFactory().newLinkedComplexValue(type == null ? null : type.toString());
-
-      for (Property property : valuable.getValue().asLinkedComplex().get()) {
-        lcValue.add(getODataProperty(new ResWrap<Property>(contextURL, metadataETag, property)));
-      }
-
-      EdmComplexType edmType = null;
-      if (client instanceof EdmEnabledODataClient && type != null) {
-        edmType = ((EdmEnabledODataClient) client).getEdm(metadataETag).getComplexType(type);
-      }
-
-      odataNavigationLinks(edmType, valuable.getValue().asLinkedComplex(), lcValue, metadataETag,
-              contextURL == null ? null : contextURL.getURI());
-      odataAnnotations(valuable.getValue().asLinkedComplex(), lcValue);
-
-      value = lcValue;
-    } else {
-      value = super.getODataValue(type, valuable, contextURL, metadataETag);
-    }
-
-    return value;
-  }
-
-  @Override
-  public ODataDelta getODataDelta(final ResWrap<Delta> resource) {
-    final URI base = resource.getContextURL() == null
-            ? resource.getPayload().getBaseURI() : resource.getContextURL().getServiceRoot();
-
-    final URI next = resource.getPayload().getNext();
-
-    final ODataDelta delta = next == null
-            ? ((ODataClient) client).getObjectFactory().newDelta()
-            : ((ODataClient) client).getObjectFactory().newDelta(URIUtils.getURI(base, next.toASCIIString()));
-
-    if (resource.getPayload().getCount() != null) {
-      delta.setCount(resource.getPayload().getCount());
-    }
-
-    if (resource.getPayload().getDeltaLink() != null) {
-      delta.setDeltaLink(URIUtils.getURI(base, resource.getPayload().getDeltaLink()));
-    }
-
-    for (Entity entityResource : resource.getPayload().getEntities()) {
-      add(delta, getODataEntity(
-              new ResWrap<Entity>(resource.getContextURL(), resource.getMetadataETag(), entityResource)));
-    }
-    for (DeletedEntity deletedEntity : resource.getPayload().getDeletedEntities()) {
-      final ODataDeletedEntityImpl impl = new ODataDeletedEntityImpl();
-      impl.setId(URIUtils.getURI(base, deletedEntity.getId()));
-      impl.setReason(Reason.valueOf(deletedEntity.getReason().name()));
-
-      delta.getDeletedEntities().add(impl);
-    }
-
-    odataAnnotations(resource.getPayload(), delta);
-
-    for (DeltaLink link : resource.getPayload().getAddedLinks()) {
-      final ODataDeltaLink impl = new ODataDeltaLinkImpl();
-      impl.setRelationship(link.getRelationship());
-      impl.setSource(URIUtils.getURI(base, link.getSource()));
-      impl.setTarget(URIUtils.getURI(base, link.getTarget()));
-
-      odataAnnotations(link, impl);
-
-      delta.getAddedLinks().add(impl);
-    }
-    for (DeltaLink link : resource.getPayload().getDeletedLinks()) {
-      final ODataDeltaLink impl = new ODataDeltaLinkImpl();
-      impl.setRelationship(link.getRelationship());
-      impl.setSource(URIUtils.getURI(base, link.getSource()));
-      impl.setTarget(URIUtils.getURI(base, link.getTarget()));
-
-      odataAnnotations(link, impl);
-
-      delta.getDeletedLinks().add(impl);
-    }
-
-    return delta;
-  }
-}


Mime
View raw message