You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/23 12:58:37 UTC

[42/59] [abbrv] [partial] Removing /ODataJClient: merge complete

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataReader.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataReader.java
deleted file mode 100644
index a388716..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import com.msopentech.odatajclient.engine.data.ODataEntitySet;
-import com.msopentech.odatajclient.engine.data.ODataEntitySetIterator;
-import com.msopentech.odatajclient.engine.data.ODataError;
-import com.msopentech.odatajclient.engine.data.ODataLinkCollection;
-import com.msopentech.odatajclient.engine.data.ODataProperty;
-import com.msopentech.odatajclient.engine.data.ODataReader;
-import com.msopentech.odatajclient.engine.data.ODataServiceDocument;
-import com.msopentech.odatajclient.engine.data.ODataValue;
-import com.msopentech.odatajclient.engine.data.ResourceFactory;
-import com.msopentech.odatajclient.engine.metadata.AbstractEdmMetadata;
-import com.msopentech.odatajclient.engine.metadata.edm.EdmSimpleType;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-import com.msopentech.odatajclient.engine.format.ODataFormat;
-import com.msopentech.odatajclient.engine.format.ODataValueFormat;
-import com.msopentech.odatajclient.engine.utils.ODataConstants;
-import java.io.InputStream;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public abstract class AbstractODataReader implements ODataReader {
-
-    private static final long serialVersionUID = -1988865870981207079L;
-
-    /**
-     * Logger.
-     */
-    protected static final Logger LOG = LoggerFactory.getLogger(AbstractODataReader.class);
-
-    protected final ODataClient client;
-
-    protected AbstractODataReader(final ODataClient client) {
-        this.client = client;
-    }
-
-    @Override
-    public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
-        return client.getBinder().getODataEntitySet(
-                client.getDeserializer().toFeed(input, ResourceFactory.feedClassForFormat(format)));
-    }
-
-    @Override
-    public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
-        return client.getBinder().getODataEntity(
-                client.getDeserializer().toEntry(input, ResourceFactory.entryClassForFormat(format)));
-    }
-
-    @Override
-    public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
-        final Element property = client.getDeserializer().toPropertyDOM(input, format);
-
-        // The ODataProperty object is used either for actual entity properties and for invoke result (when return type
-        // is neither an entity nor a collection of entities).
-        // Such formats are mostly the same except for collections: an entity property looks like
-        //     <aproperty m:type="Collection(AType)">
-        //       <element>....</element>
-        //     </aproperty>
-        //
-        // while an invoke result with returnType="Collection(AnotherType)" looks like
-        //     <functionImportName>
-        //       <element m:type="AnotherType">...</element>
-        //     <functionImportName>
-        //
-        // The code below is meant for "normalizing" the latter into
-        //     <functionImportName m:type="Collection(AnotherType)">
-        //       <element m:type="AnotherType">...</element>
-        //     <functionImportName>
-        final String type = property.getAttribute(ODataConstants.ATTR_M_TYPE);
-        final NodeList elements = property.getElementsByTagName(ODataConstants.ELEM_ELEMENT);
-        if (StringUtils.isBlank(type) && elements != null && elements.getLength() > 0) {
-            final Node elementType = elements.item(0).getAttributes().getNamedItem(ODataConstants.ATTR_M_TYPE);
-            if (elementType != null) {
-                property.setAttribute(ODataConstants.ATTR_M_TYPE, "Collection(" + elementType.getTextContent() + ")");
-            }
-        }
-
-        return client.getBinder().getProperty(property);
-    }
-
-    @Override
-    public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
-        return client.getBinder().getLinkCollection(
-                client.getDeserializer().toLinkCollection(input, format));
-    }
-
-    @Override
-    public ODataError readError(final InputStream inputStream, final boolean isXML) {
-        return client.getDeserializer().toODataError(inputStream, isXML);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public <T> T read(final InputStream src, final String format, final Class<T> reference) {
-        Object res;
-
-        try {
-            if (ODataEntitySetIterator.class.isAssignableFrom(reference)) {
-                res = new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format));
-            } else if (ODataEntitySet.class.isAssignableFrom(reference)) {
-                res = readEntitySet(src, ODataPubFormat.fromString(format));
-            } else if (ODataEntity.class.isAssignableFrom(reference)) {
-                res = readEntity(src, ODataPubFormat.fromString(format));
-            } else if (ODataProperty.class.isAssignableFrom(reference)) {
-                res = readProperty(src, ODataFormat.fromString(format));
-            } else if (ODataLinkCollection.class.isAssignableFrom(reference)) {
-                res = readLinks(src, ODataFormat.fromString(format));
-            } else if (ODataValue.class.isAssignableFrom(reference)) {
-                res = client.getPrimitiveValueBuilder().
-                        setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
-                                ? EdmSimpleType.String : EdmSimpleType.Stream).
-                        setText(IOUtils.toString(src)).
-                        build();
-            } else if (AbstractEdmMetadata.class.isAssignableFrom(reference)) {
-                res = readMetadata(src);
-            } else if (ODataServiceDocument.class.isAssignableFrom(reference)) {
-                res = readServiceDocument(src, ODataFormat.fromString(format));
-            } else if (ODataError.class.isAssignableFrom(reference)) {
-                res = readError(src, !format.toString().contains("json"));
-            } 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 (T) res;
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataSerializer.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataSerializer.java
deleted file mode 100644
index 23556ed..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataSerializer.java
+++ /dev/null
@@ -1,179 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.data.Entry;
-import com.msopentech.odatajclient.engine.data.Feed;
-import com.msopentech.odatajclient.engine.data.ODataLink;
-import com.msopentech.odatajclient.engine.data.ODataSerializer;
-import com.msopentech.odatajclient.engine.data.impl.v3.AtomEntry;
-import com.msopentech.odatajclient.engine.data.impl.v3.AtomFeed;
-import com.msopentech.odatajclient.engine.data.impl.v3.AtomSerializer;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONFeed;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONProperty;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONEntry;
-import com.msopentech.odatajclient.engine.format.ODataFormat;
-import com.msopentech.odatajclient.engine.utils.ODataConstants;
-import com.msopentech.odatajclient.engine.utils.ODataVersion;
-import com.msopentech.odatajclient.engine.utils.XMLUtils;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import javax.xml.parsers.DocumentBuilder;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public abstract class AbstractODataSerializer extends AbstractJacksonTool implements ODataSerializer {
-
-    private static final long serialVersionUID = -357777648541325363L;
-
-    private final AtomSerializer atomSerializer;
-
-    public AbstractODataSerializer(final ODataClient client) {
-        super(client);
-        this.atomSerializer = new AtomSerializer(client);
-    }
-
-    @Override
-    public <T extends Feed> void feed(final T obj, final OutputStream out) {
-        feed(obj, new OutputStreamWriter(out));
-    }
-
-    @Override
-    public <T extends Feed> void feed(final T obj, final Writer writer) {
-        if (obj instanceof AtomFeed) {
-            atom((AtomFeed) obj, writer);
-        } else {
-            json((JSONFeed) obj, writer);
-        }
-    }
-
-    @Override
-    public <T extends Entry> void entry(final T obj, final OutputStream out) {
-        entry(obj, new OutputStreamWriter(out));
-    }
-
-    @Override
-    public <T extends Entry> void entry(final T obj, final Writer writer) {
-        if (obj instanceof AtomEntry) {
-            atom((AtomEntry) obj, writer);
-        } else {
-            json((JSONEntry) obj, writer);
-        }
-    }
-
-    @Override
-    public void property(final Element element, final ODataFormat format, final OutputStream out) {
-        property(element, format, new OutputStreamWriter(out));
-    }
-
-    @Override
-    public void property(final Element element, final ODataFormat format, final Writer writer) {
-        if (format == ODataFormat.XML) {
-            dom(element, writer);
-        } else {
-            json(element, writer);
-        }
-    }
-
-    @Override
-    public void link(final ODataLink link, final ODataFormat format, final OutputStream out) {
-        link(link, format, new OutputStreamWriter(out));
-    }
-
-    @Override
-    public void link(final ODataLink link, final ODataFormat format, final Writer writer) {
-        if (format == ODataFormat.XML) {
-            xmlLink(link, writer);
-        } else {
-            jsonLink(link, writer);
-        }
-    }
-
-    @Override
-    public void dom(final Node content, final OutputStream out) {
-        dom(content, new OutputStreamWriter(out));
-    }
-
-    @Override
-    public void dom(final Node content, final Writer writer) {
-        XMLUtils.PARSER.serialize(content, writer);
-    }
-
-    /*
-     * ------------------ Protected methods ------------------
-     */
-    protected <T extends AbstractPayloadObject> void atom(final T obj, final Writer writer) {
-        try {
-            dom(atomSerializer.serialize(obj), writer);
-        } catch (Exception e) {
-            throw new IllegalArgumentException("While serializing Atom object", e);
-        }
-    }
-
-    protected <T extends AbstractPayloadObject> void json(final T obj, final Writer writer) {
-        try {
-            getObjectMapper().writeValue(writer, obj);
-        } catch (IOException e) {
-            throw new IllegalArgumentException("While serializing JSON object", e);
-        }
-    }
-
-    protected void json(final Element element, final Writer writer) {
-        try {
-            final JSONProperty property = new JSONProperty();
-            property.setContent(element);
-            getObjectMapper().writeValue(writer, property);
-        } catch (IOException e) {
-            throw new IllegalArgumentException("While serializing JSON property", e);
-        }
-    }
-
-    protected void xmlLink(final ODataLink link, final Writer writer) {
-        try {
-            final DocumentBuilder builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
-            final Document doc = builder.newDocument();
-            final Element uri = doc.createElementNS(
-                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_DATASERVICES),
-                    ODataConstants.ELEM_URI);
-            uri.appendChild(doc.createTextNode(link.getLink().toASCIIString()));
-
-            dom(uri, writer);
-        } catch (Exception e) {
-            throw new IllegalArgumentException("While serializing XML link", e);
-        }
-    }
-
-    protected void jsonLink(final ODataLink link, final Writer writer) {
-        final ObjectMapper mapper = getObjectMapper();
-        final ObjectNode uri = mapper.createObjectNode();
-        uri.put(ODataConstants.JSON_URL, link.getLink().toASCIIString());
-
-        try {
-            mapper.writeValue(writer, uri);
-        } catch (Exception e) {
-            throw new IllegalArgumentException("While serializing JSON link", e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataWriter.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataWriter.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataWriter.java
deleted file mode 100644
index 8343d15..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractODataWriter.java
+++ /dev/null
@@ -1,101 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import com.msopentech.odatajclient.engine.data.ODataLink;
-import com.msopentech.odatajclient.engine.data.ODataProperty;
-import com.msopentech.odatajclient.engine.data.ODataWriter;
-import com.msopentech.odatajclient.engine.data.ResourceFactory;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-import com.msopentech.odatajclient.engine.format.ODataFormat;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Collections;
-import org.apache.commons.io.IOUtils;
-
-public abstract class AbstractODataWriter implements ODataWriter {
-
-    private static final long serialVersionUID = 3265794768412314485L;
-
-    protected final ODataClient client;
-
-    protected AbstractODataWriter(final ODataClient client) {
-        this.client = client;
-    }
-
-    @Override
-    public InputStream writeEntities(final Collection<ODataEntity> entities, final ODataPubFormat format) {
-        return writeEntities(entities, format, true);
-    }
-
-    @Override
-    public InputStream writeEntities(
-            final Collection<ODataEntity> entities, final ODataPubFormat format, final boolean outputType) {
-
-        final ByteArrayOutputStream output = new ByteArrayOutputStream();
-        try {
-            for (ODataEntity entity : entities) {
-                client.getSerializer().entry(client.getBinder().
-                        getEntry(entity, ResourceFactory.entryClassForFormat(format), outputType), output);
-            }
-
-            return new ByteArrayInputStream(output.toByteArray());
-        } finally {
-            IOUtils.closeQuietly(output);
-        }
-    }
-
-    @Override
-    public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format) {
-        return writeEntity(entity, format, true);
-    }
-
-    @Override
-    public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format, final boolean outputType) {
-        return writeEntities(Collections.<ODataEntity>singleton(entity), format, outputType);
-    }
-
-    @Override
-    public InputStream writeProperty(final ODataProperty property, final ODataFormat format) {
-        final ByteArrayOutputStream output = new ByteArrayOutputStream();
-        try {
-            client.getSerializer().property(client.getBinder().toDOMElement(property), format, output);
-
-            return new ByteArrayInputStream(output.toByteArray());
-        } finally {
-            IOUtils.closeQuietly(output);
-        }
-    }
-
-    @Override
-    public InputStream writeLink(final ODataLink link, final ODataFormat format) {
-        final ByteArrayOutputStream output = new ByteArrayOutputStream();
-        try {
-            client.getSerializer().link(link, format, output);
-
-            return new ByteArrayInputStream(output.toByteArray());
-        } finally {
-            IOUtils.closeQuietly(output);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractPayloadObject.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractPayloadObject.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractPayloadObject.java
deleted file mode 100644
index e414cbd..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractPayloadObject.java
+++ /dev/null
@@ -1,57 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import java.io.Serializable;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-/**
- * Abstract representation of a payload (Atom, JSON) object.
- */
-public abstract class AbstractPayloadObject implements Serializable {
-
-    private static final long serialVersionUID = 1634654241914156675L;
-
-    /**
-     * {@inheritDoc }
-     */
-    @Override
-    public boolean equals(final Object obj) {
-        return EqualsBuilder.reflectionEquals(this, obj);
-    }
-
-    /**
-     * {@inheritDoc }
-     */
-    @Override
-    public int hashCode() {
-        return HashCodeBuilder.reflectionHashCode(this);
-    }
-
-    /**
-     * {@inheritDoc }
-     */
-    @Override
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractServiceDocument.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractServiceDocument.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractServiceDocument.java
deleted file mode 100644
index ebf247f..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/AbstractServiceDocument.java
+++ /dev/null
@@ -1,147 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.msopentech.odatajclient.engine.data.ServiceDocumentElement;
-import com.msopentech.odatajclient.engine.data.ServiceDocument;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-public abstract class AbstractServiceDocument implements ServiceDocument {
-
-    private String title;
-
-    @JsonProperty("value")
-    private final List<ServiceDocumentElement> entitySets = new ArrayList<ServiceDocumentElement>();
-
-    @Override
-    public String getMetadataContext() {
-        return null;
-    }
-
-    @Override
-    public String getMetadataETag() {
-        return null;
-    }
-
-    @Override
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(final String title) {
-        this.title = title;
-    }
-
-    protected ServiceDocumentElement getByName(final List<ServiceDocumentElement> elements, final String name) {
-        ServiceDocumentElement result = null;
-        for (ServiceDocumentElement element : elements) {
-            if (name.equals(element.getName())) {
-                result = element;
-            }
-        }
-        return result;
-    }
-
-    protected ServiceDocumentElement getByTitle(final List<ServiceDocumentElement> elements, final String title) {
-        ServiceDocumentElement result = null;
-        for (ServiceDocumentElement element : elements) {
-            if (title.equals(element.getTitle())) {
-                result = element;
-            }
-        }
-        return result;
-    }
-
-    @Override
-    public List<ServiceDocumentElement> getEntitySets() {
-        return entitySets;
-    }
-
-    @Override
-    public ServiceDocumentElement getEntitySetByName(final String name) {
-        return getByName(getEntitySets(), name);
-    }
-
-    @Override
-    public ServiceDocumentElement getEntitySetByTitle(final String title) {
-        return getByTitle(getEntitySets(), title);
-    }
-
-    @Override
-    public List<ServiceDocumentElement> getFunctionImports() {
-        return Collections.<ServiceDocumentElement>emptyList();
-    }
-
-    @Override
-    public ServiceDocumentElement getFunctionImportByName(final String name) {
-        return getByName(getFunctionImports(), name);
-    }
-
-    @Override
-    public ServiceDocumentElement getFunctionImportByTitle(final String title) {
-        return getByTitle(getFunctionImports(), title);
-    }
-
-    @Override
-    public List<ServiceDocumentElement> getSingletons() {
-        return Collections.<ServiceDocumentElement>emptyList();
-    }
-
-    @Override
-    public ServiceDocumentElement getSingletonByName(final String name) {
-        return getByName(getSingletons(), name);
-    }
-
-    @Override
-    public ServiceDocumentElement getSingletonByTitle(final String title) {
-        return getByTitle(getSingletons(), title);
-    }
-
-    @Override
-    public List<ServiceDocumentElement> getRelatedServiceDocuments() {
-        return Collections.<ServiceDocumentElement>emptyList();
-    }
-
-    @Override
-    public ServiceDocumentElement getRelatedServiceDocumentByTitle(final String title) {
-        return getByTitle(getRelatedServiceDocuments(), title);
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        return EqualsBuilder.reflectionEquals(this, obj);
-    }
-
-    @Override
-    public int hashCode() {
-        return HashCodeBuilder.reflectionHashCode(this);
-    }
-
-    @Override
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/GeospatialJSONHandler.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/GeospatialJSONHandler.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/GeospatialJSONHandler.java
deleted file mode 100644
index c39e5d8..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/GeospatialJSONHandler.java
+++ /dev/null
@@ -1,411 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.metadata.edm.EdmSimpleType;
-import com.msopentech.odatajclient.engine.metadata.edm.geospatial.Geospatial;
-import com.msopentech.odatajclient.engine.utils.ODataConstants;
-import com.msopentech.odatajclient.engine.utils.ODataVersion;
-import com.msopentech.odatajclient.engine.utils.XMLUtils;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.parsers.DocumentBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-final class GeospatialJSONHandler {
-
-    /**
-     * Logger.
-     */
-    private static final Logger LOG = LoggerFactory.getLogger(GeospatialJSONHandler.class);
-
-    private GeospatialJSONHandler() {
-        // Empty private constructor for static utility classes
-    }
-
-    private static Element deserializePoint(final Document document, final Iterator<JsonNode> itor) {
-        final Element point = document.createElementNS(ODataConstants.NS_GML, ODataConstants.ELEM_POINT);
-
-        final Element ppos = document.createElementNS(ODataConstants.NS_GML, ODataConstants.ELEM_POS);
-        point.appendChild(ppos);
-        if (itor.hasNext()) {
-            ppos.appendChild(document.createTextNode(itor.next().asText() + " " + itor.next().asText()));
-        }
-
-        return point;
-    }
-
-    private static void appendPoses(final Element parent, final Document document, final Iterator<JsonNode> itor) {
-        while (itor.hasNext()) {
-            final Iterator<JsonNode> lineItor = itor.next().elements();
-            final Element pos = document.createElementNS(ODataConstants.NS_GML, ODataConstants.ELEM_POS);
-            parent.appendChild(pos);
-            pos.appendChild(document.createTextNode(lineItor.next().asText() + " " + lineItor.next().asText()));
-        }
-    }
-
-    private static Element deserializeLineString(final Document document, final Iterator<JsonNode> itor) {
-        final Element lineString = document.createElementNS(ODataConstants.NS_GML, ODataConstants.ELEM_LINESTRING);
-        if (!itor.hasNext()) {
-            lineString.appendChild(document.createElementNS(ODataConstants.NS_GML, ODataConstants.ELEM_POSLIST));
-        }
-
-        appendPoses(lineString, document, itor);
-
-        return lineString;
-    }
-
-    private static Element deserializePolygon(final Document document, final Iterator<JsonNode> itor) {
-        final Element polygon = document.createElementNS(ODataConstants.NS_GML, ODataConstants.ELEM_POLYGON);
-
-        if (itor.hasNext()) {
-            final Iterator<JsonNode> extItor = itor.next().elements();
-            final Element exterior = document.createElementNS(
-                    ODataConstants.NS_GML, ODataConstants.ELEM_POLYGON_EXTERIOR);
-            polygon.appendChild(exterior);
-            final Element extLR = document.createElementNS(
-                    ODataConstants.NS_GML, ODataConstants.ELEM_POLYGON_LINEARRING);
-            exterior.appendChild(extLR);
-
-            appendPoses(extLR, document, extItor);
-        }
-
-        if (itor.hasNext()) {
-            final Iterator<JsonNode> intItor = itor.next().elements();
-            final Element interior = document.createElementNS(
-                    ODataConstants.NS_GML, ODataConstants.ELEM_POLYGON_INTERIOR);
-            polygon.appendChild(interior);
-            final Element intLR = document.createElementNS(
-                    ODataConstants.NS_GML, ODataConstants.ELEM_POLYGON_LINEARRING);
-            interior.appendChild(intLR);
-
-            appendPoses(intLR, document, intItor);
-        }
-
-        return polygon;
-    }
-
-    public static void deserialize(final JsonNode node, final Element parent, final String type) {
-        final Iterator<JsonNode> cooItor = node.has(ODataConstants.JSON_COORDINATES)
-                ? node.get(ODataConstants.JSON_COORDINATES).elements()
-                : Collections.<JsonNode>emptyList().iterator();
-
-        Element root = null;
-        final EdmSimpleType edmSimpleType = EdmSimpleType.fromValue(type);
-        switch (edmSimpleType) {
-            case GeographyPoint:
-            case GeometryPoint:
-                root = deserializePoint(parent.getOwnerDocument(), cooItor);
-                break;
-
-            case GeographyMultiPoint:
-            case GeometryMultiPoint:
-                root = parent.getOwnerDocument().createElementNS(ODataConstants.NS_GML, ODataConstants.ELEM_MULTIPOINT);
-                if (cooItor.hasNext()) {
-                    final Element pointMembers = parent.getOwnerDocument().createElementNS(
-                            ODataConstants.NS_GML, ODataConstants.ELEM_POINTMEMBERS);
-                    root.appendChild(pointMembers);
-                    while (cooItor.hasNext()) {
-                        final Iterator<JsonNode> mpItor = cooItor.next().elements();
-                        pointMembers.appendChild(deserializePoint(parent.getOwnerDocument(), mpItor));
-                    }
-                }
-                break;
-
-            case GeographyLineString:
-            case GeometryLineString:
-                root = deserializeLineString(parent.getOwnerDocument(), cooItor);
-                break;
-
-            case GeographyMultiLineString:
-            case GeometryMultiLineString:
-                root = parent.getOwnerDocument().createElementNS(
-                        ODataConstants.NS_GML, ODataConstants.ELEM_MULTILINESTRING);
-                if (cooItor.hasNext()) {
-                    final Element lineStringMembers = parent.getOwnerDocument().createElementNS(
-                            ODataConstants.NS_GML, ODataConstants.ELEM_LINESTRINGMEMBERS);
-                    root.appendChild(lineStringMembers);
-                    while (cooItor.hasNext()) {
-                        final Iterator<JsonNode> mlsItor = cooItor.next().elements();
-                        lineStringMembers.appendChild(deserializeLineString(parent.getOwnerDocument(), mlsItor));
-                    }
-                }
-                break;
-
-            case GeographyPolygon:
-            case GeometryPolygon:
-                root = deserializePolygon(parent.getOwnerDocument(), cooItor);
-                break;
-
-            case GeographyMultiPolygon:
-            case GeometryMultiPolygon:
-                root = parent.getOwnerDocument().createElementNS(
-                        ODataConstants.NS_GML, ODataConstants.ELEM_MULTIPOLYGON);
-                if (cooItor.hasNext()) {
-                    final Element surfaceMembers = parent.getOwnerDocument().createElementNS(
-                            ODataConstants.NS_GML, ODataConstants.ELEM_SURFACEMEMBERS);
-                    root.appendChild(surfaceMembers);
-                    while (cooItor.hasNext()) {
-                        final Iterator<JsonNode> mpItor = cooItor.next().elements();
-                        surfaceMembers.appendChild(deserializePolygon(parent.getOwnerDocument(), mpItor));
-                    }
-                }
-                break;
-
-            case GeographyCollection:
-            case GeometryCollection:
-                root = parent.getOwnerDocument().createElementNS(
-                        ODataConstants.NS_GML, ODataConstants.ELEM_GEOCOLLECTION);
-                if (node.has(ODataConstants.JSON_GEOMETRIES)) {
-                    final Iterator<JsonNode> geoItor = node.get(ODataConstants.JSON_GEOMETRIES).elements();
-                    if (geoItor.hasNext()) {
-                        final Element geometryMembers = parent.getOwnerDocument().createElementNS(
-                                ODataConstants.NS_GML, ODataConstants.ELEM_GEOMEMBERS);
-                        root.appendChild(geometryMembers);
-
-                        while (geoItor.hasNext()) {
-                            final JsonNode geo = geoItor.next();
-                            final String collItemType = geo.get(ODataConstants.ATTR_TYPE).asText();
-                            final String callAsType;
-                            if (EdmSimpleType.GeographyCollection.name().equals(collItemType)
-                                    || EdmSimpleType.GeometryCollection.name().equals(collItemType)) {
-
-                                callAsType = collItemType;
-                            } else {
-                                callAsType =
-                                        (edmSimpleType == EdmSimpleType.GeographyCollection ? "Geography" : "Geometry")
-                                        + collItemType;
-                            }
-
-                            deserialize(geo, geometryMembers, EdmSimpleType.namespace() + "." + callAsType);
-                        }
-                    }
-                }
-                break;
-
-            default:
-        }
-
-        if (root != null) {
-            parent.appendChild(root);
-            if (node.has(ODataConstants.JSON_CRS)) {
-                root.setAttribute(ODataConstants.ATTR_SRSNAME,
-                        ODataConstants.JSON_GIS_URLPREFIX
-                        + node.get(ODataConstants.JSON_CRS).get(ODataConstants.PROPERTIES).get(ODataConstants.NAME).
-                        asText().split(":")[1]);
-            }
-        }
-    }
-
-    private static void serializeCrs(final JsonGenerator jgen, final Node node) throws IOException {
-        if (node.getAttributes().getNamedItem(ODataConstants.ATTR_SRSNAME) != null) {
-            final String srsName = node.getAttributes().getNamedItem(ODataConstants.ATTR_SRSNAME).getTextContent();
-            final int prefIdx = srsName.indexOf(ODataConstants.JSON_GIS_URLPREFIX);
-            final String crsValue = srsName.substring(prefIdx + ODataConstants.JSON_GIS_URLPREFIX.length());
-
-            jgen.writeObjectFieldStart(ODataConstants.JSON_CRS);
-            jgen.writeStringField(ODataConstants.ATTR_TYPE, ODataConstants.NAME);
-            jgen.writeObjectFieldStart(ODataConstants.PROPERTIES);
-            jgen.writeStringField(ODataConstants.NAME, "EPSG:" + crsValue);
-            jgen.writeEndObject();
-            jgen.writeEndObject();
-        }
-    }
-
-    private static void serializePoint(final JsonGenerator jgen, final Node node) throws IOException {
-        for (String coord : node.getTextContent().split(" ")) {
-            jgen.writeNumber(coord);
-        }
-    }
-
-    private static void serializeLineString(final JsonGenerator jgen, final Element node) throws IOException {
-        for (Element element : XMLUtils.getChildElements(node, ODataConstants.ELEM_POS)) {
-            jgen.writeStartArray();
-            serializePoint(jgen, element);
-            jgen.writeEndArray();
-        }
-    }
-
-    private static void serializePolygon(final JsonGenerator jgen, final Element node) throws IOException {
-        for (Element exterior : XMLUtils.getChildElements(node, ODataConstants.ELEM_POLYGON_EXTERIOR)) {
-            jgen.writeStartArray();
-            serializeLineString(jgen,
-                    XMLUtils.getChildElements(exterior, ODataConstants.ELEM_POLYGON_LINEARRING).get(0));
-            jgen.writeEndArray();
-
-        }
-        for (Element interior : XMLUtils.getChildElements(node, ODataConstants.ELEM_POLYGON_INTERIOR)) {
-            jgen.writeStartArray();
-            serializeLineString(jgen,
-                    XMLUtils.getChildElements(interior, ODataConstants.ELEM_POLYGON_LINEARRING).get(0));
-            jgen.writeEndArray();
-
-        }
-    }
-
-    public static void serialize(final ODataClient client,
-            final JsonGenerator jgen, final Element node, final String type) throws IOException {
-
-        final EdmSimpleType edmSimpleType = EdmSimpleType.fromValue(type);
-
-        if (edmSimpleType.equals(EdmSimpleType.GeographyCollection)
-                || edmSimpleType.equals(EdmSimpleType.GeometryCollection)) {
-
-            jgen.writeStringField(ODataConstants.ATTR_TYPE, EdmSimpleType.GeometryCollection.name());
-        } else {
-            final int yIdx = edmSimpleType.name().indexOf('y');
-            final String itemType = edmSimpleType.name().substring(yIdx + 1);
-            jgen.writeStringField(ODataConstants.ATTR_TYPE, itemType);
-        }
-
-        Element root = null;
-        switch (edmSimpleType) {
-            case GeographyPoint:
-            case GeometryPoint:
-                root = XMLUtils.getChildElements(node, ODataConstants.ELEM_POINT).get(0);
-
-                jgen.writeArrayFieldStart(ODataConstants.JSON_COORDINATES);
-                serializePoint(jgen, XMLUtils.getChildElements(root, ODataConstants.ELEM_POS).get(0));
-                jgen.writeEndArray();
-                break;
-
-            case GeographyMultiPoint:
-            case GeometryMultiPoint:
-                root = XMLUtils.getChildElements(node, ODataConstants.ELEM_MULTIPOINT).get(0);
-
-                jgen.writeArrayFieldStart(ODataConstants.JSON_COORDINATES);
-
-                final List<Element> pMembs = XMLUtils.getChildElements(root, ODataConstants.ELEM_POINTMEMBERS);
-                if (pMembs != null && !pMembs.isEmpty()) {
-                    for (Element point : XMLUtils.getChildElements(pMembs.get(0), ODataConstants.ELEM_POINT)) {
-                        jgen.writeStartArray();
-                        serializePoint(jgen, XMLUtils.getChildElements(point, ODataConstants.ELEM_POS).get(0));
-                        jgen.writeEndArray();
-                    }
-                }
-
-                jgen.writeEndArray();
-                break;
-
-            case GeographyLineString:
-            case GeometryLineString:
-                root = XMLUtils.getChildElements(node, ODataConstants.ELEM_LINESTRING).get(0);
-
-                jgen.writeArrayFieldStart(ODataConstants.JSON_COORDINATES);
-                serializeLineString(jgen, root);
-                jgen.writeEndArray();
-                break;
-
-            case GeographyMultiLineString:
-            case GeometryMultiLineString:
-                root = XMLUtils.getChildElements(node, ODataConstants.ELEM_MULTILINESTRING).get(0);
-
-                jgen.writeArrayFieldStart(ODataConstants.JSON_COORDINATES);
-
-                final List<Element> lMembs = XMLUtils.getChildElements(root, ODataConstants.ELEM_LINESTRINGMEMBERS);
-                if (lMembs != null && !lMembs.isEmpty()) {
-                    for (Element lineStr : XMLUtils.getChildElements(lMembs.get(0), ODataConstants.ELEM_LINESTRING)) {
-                        jgen.writeStartArray();
-                        serializeLineString(jgen, lineStr);
-                        jgen.writeEndArray();
-                    }
-                }
-
-                jgen.writeEndArray();
-                break;
-
-            case GeographyPolygon:
-            case GeometryPolygon:
-                root = XMLUtils.getChildElements(node, ODataConstants.ELEM_POLYGON).get(0);
-
-                jgen.writeArrayFieldStart(ODataConstants.JSON_COORDINATES);
-                serializePolygon(jgen, root);
-                jgen.writeEndArray();
-                break;
-
-            case GeographyMultiPolygon:
-            case GeometryMultiPolygon:
-                root = XMLUtils.getChildElements(node, ODataConstants.ELEM_MULTIPOLYGON).get(0);
-
-                jgen.writeArrayFieldStart(ODataConstants.JSON_COORDINATES);
-
-                final List<Element> mpMembs = XMLUtils.getChildElements(root, ODataConstants.ELEM_SURFACEMEMBERS);
-                if (mpMembs != null & !mpMembs.isEmpty()) {
-                    for (Element pol : XMLUtils.getChildElements(mpMembs.get(0), ODataConstants.ELEM_POLYGON)) {
-                        jgen.writeStartArray();
-                        serializePolygon(jgen, pol);
-                        jgen.writeEndArray();
-                    }
-                }
-
-                jgen.writeEndArray();
-                break;
-
-            case GeographyCollection:
-            case GeometryCollection:
-                root = XMLUtils.getChildElements(node, ODataConstants.ELEM_GEOCOLLECTION).get(0);
-
-                final List<Element> cMembs = XMLUtils.getChildElements(root, ODataConstants.ELEM_GEOMEMBERS);
-                if (cMembs != null && !cMembs.isEmpty()) {
-                    jgen.writeArrayFieldStart(ODataConstants.JSON_GEOMETRIES);
-
-                    for (Node geom : XMLUtils.getChildNodes(cMembs.get(0), Node.ELEMENT_NODE)) {
-                        try {
-                            final DocumentBuilder builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
-                            final Document doc = builder.newDocument();
-
-                            final Element fakeParent = doc.createElementNS(
-                                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_DATASERVICES),
-                                    ODataConstants.PREFIX_DATASERVICES + "fake");
-                            fakeParent.appendChild(doc.importNode(geom, true));
-
-                            final EdmSimpleType callAsType = XMLUtils.simpleTypeForNode(
-                                    edmSimpleType == EdmSimpleType.GeographyCollection
-                                    ? Geospatial.Dimension.GEOGRAPHY : Geospatial.Dimension.GEOMETRY,
-                                    geom);
-
-                            jgen.writeStartObject();
-                            serialize(client, jgen, fakeParent, callAsType.toString());
-                            jgen.writeEndObject();
-                        } catch (Exception e) {
-                            LOG.warn("While serializing {}", XMLUtils.getSimpleName(geom), e);
-                        }
-                    }
-
-                    jgen.writeEndArray();
-                }
-                break;
-
-            default:
-        }
-
-        if (root != null) {
-            serializeCrs(jgen, root);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/InjectableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/InjectableSerializerProvider.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/InjectableSerializerProvider.java
deleted file mode 100644
index 88d95a9..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/InjectableSerializerProvider.java
+++ /dev/null
@@ -1,43 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.fasterxml.jackson.databind.SerializationConfig;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
-import com.fasterxml.jackson.databind.ser.SerializerFactory;
-
-public class InjectableSerializerProvider extends DefaultSerializerProvider {
-
-    private static final long serialVersionUID = 3432260063063739646L;
-
-    public InjectableSerializerProvider(
-            final SerializerProvider src, final SerializationConfig config, final SerializerFactory factory) {
-
-        super(src, config, factory);
-    }
-
-    @Override
-    public InjectableSerializerProvider createInstance(
-            final SerializationConfig config, final SerializerFactory factory) {
-
-        return this;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONDOMTreeUtils.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONDOMTreeUtils.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONDOMTreeUtils.java
deleted file mode 100644
index 3355e59..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONDOMTreeUtils.java
+++ /dev/null
@@ -1,259 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.msopentech.odatajclient.engine.data.impl.GeospatialJSONHandler;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.msopentech.odatajclient.engine.client.ODataClient;
-import com.msopentech.odatajclient.engine.data.ODataPrimitiveValue;
-import com.msopentech.odatajclient.engine.metadata.edm.EdmSimpleType;
-import com.msopentech.odatajclient.engine.utils.ODataConstants;
-import com.msopentech.odatajclient.engine.utils.ODataVersion;
-import com.msopentech.odatajclient.engine.utils.XMLUtils;
-import java.io.IOException;
-import java.util.Iterator;
-import org.apache.commons.lang3.StringUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * DOM tree utilities class for JSON.
- */
-final class JSONDOMTreeUtils {
-
-    private JSONDOMTreeUtils() {
-        // Empty private constructor for static utility classes
-    }
-
-    /**
-     * Recursively builds DOM content out of JSON subtree rooted at given node.
-     *
-     * @param client OData client.
-     * @param document root of the DOM document being built
-     * @param parent parent of the nodes being generated during this step
-     * @param node JSON node to be used as source for DOM elements
-     */
-    public static void buildSubtree(final ODataClient client, final Element parent, final JsonNode node) {
-        final Iterator<String> fieldNameItor = node.fieldNames();
-        final Iterator<JsonNode> nodeItor = node.elements();
-        while (nodeItor.hasNext()) {
-            final JsonNode child = nodeItor.next();
-            final String name = fieldNameItor.hasNext() ? fieldNameItor.next() : "";
-
-            // no name? array item
-            if (name.isEmpty()) {
-                final Element element = parent.getOwnerDocument().createElementNS(
-                        client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_DATASERVICES),
-                        ODataConstants.PREFIX_DATASERVICES + ODataConstants.ELEM_ELEMENT);
-                parent.appendChild(element);
-
-                if (child.isValueNode()) {
-                    if (child.isNull()) {
-                        element.setAttributeNS(
-                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                ODataConstants.ATTR_NULL, Boolean.toString(true));
-                    } else {
-                        element.appendChild(parent.getOwnerDocument().createTextNode(child.asText()));
-                    }
-                }
-
-                if (child.isContainerNode()) {
-                    buildSubtree(client, element, child);
-                }
-            } else if (!name.contains("@") && !ODataConstants.JSON_TYPE.equals(name)) {
-                final Element property = parent.getOwnerDocument().createElementNS(
-                        client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_DATASERVICES),
-                        ODataConstants.PREFIX_DATASERVICES + name);
-                parent.appendChild(property);
-
-                boolean typeSet = false;
-                if (node.hasNonNull(name + "@" + ODataConstants.JSON_TYPE)) {
-                    property.setAttributeNS(
-                            client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                            ODataConstants.ATTR_M_TYPE,
-                            node.get(name + "@" + ODataConstants.JSON_TYPE).textValue());
-                    typeSet = true;
-                }
-
-                if (child.isNull()) {
-                    property.setAttributeNS(client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                            ODataConstants.ATTR_NULL, Boolean.toString(true));
-                } else if (child.isValueNode()) {
-                    if (!typeSet) {
-                        if (child.isInt()) {
-                            property.setAttributeNS(
-                                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                    ODataConstants.ATTR_M_TYPE, EdmSimpleType.Int32.toString());
-                        }
-                        if (child.isLong()) {
-                            property.setAttributeNS(
-                                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                    ODataConstants.ATTR_M_TYPE, EdmSimpleType.Int64.toString());
-                        }
-                        if (child.isBigDecimal()) {
-                            property.setAttributeNS(
-                                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                    ODataConstants.ATTR_M_TYPE, EdmSimpleType.Decimal.toString());
-                        }
-                        if (child.isDouble()) {
-                            property.setAttributeNS(
-                                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                    ODataConstants.ATTR_M_TYPE, EdmSimpleType.Double.toString());
-                        }
-                        if (child.isBoolean()) {
-                            property.setAttributeNS(
-                                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                    ODataConstants.ATTR_M_TYPE, EdmSimpleType.Boolean.toString());
-                        }
-                        if (child.isTextual()) {
-                            property.setAttributeNS(
-                                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                    ODataConstants.ATTR_M_TYPE, EdmSimpleType.String.toString());
-                        }
-                    }
-
-                    property.appendChild(parent.getOwnerDocument().createTextNode(child.asText()));
-                } else if (child.isContainerNode()) {
-                    if (!typeSet && child.hasNonNull(ODataConstants.JSON_TYPE)) {
-                        property.
-                                setAttributeNS(client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                                        ODataConstants.ATTR_M_TYPE,
-                                        child.get(ODataConstants.JSON_TYPE).textValue());
-                    }
-
-                    final String type = property.getAttribute(ODataConstants.ATTR_M_TYPE);
-                    if (StringUtils.isNotBlank(type) && EdmSimpleType.isGeospatial(type)) {
-                        if (EdmSimpleType.Geography.toString().equals(type)
-                                || EdmSimpleType.Geometry.toString().equals(type)) {
-
-                            final String geoType = child.get(ODataConstants.ATTR_TYPE).textValue();
-                            property.setAttributeNS(client.getWorkingVersion().getNamespaceMap().get(
-                                    ODataVersion.NS_METADATA), ODataConstants.ATTR_M_TYPE,
-                                    geoType.startsWith("Geo")
-                                    ? EdmSimpleType.namespace() + "." + geoType
-                                    : type + geoType);
-                        }
-
-                        if (child.has(ODataConstants.JSON_COORDINATES) || child.has(ODataConstants.JSON_GEOMETRIES)) {
-                            GeospatialJSONHandler.deserialize(
-                                    child, property, property.getAttribute(ODataConstants.ATTR_M_TYPE));
-                        }
-                    } else {
-                        buildSubtree(client, property, child);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Serializes DOM content as JSON.
-     *
-     * @param client OData client.
-     * @param jgen JSON generator.
-     * @param content content.
-     * @throws IOException in case of write error.
-     */
-    public static void writeSubtree(final ODataClient client, final JsonGenerator jgen, final Node content)
-            throws IOException {
-
-        writeSubtree(client, jgen, content, false);
-    }
-
-    /**
-     * Serializes DOM content as JSON.
-     *
-     * @param client OData client.
-     * @param jgen JSON generator.
-     * @param content content.
-     * @param propType whether to output type information in the way needed for property values or not.
-     * @throws IOException in case of write error.
-     */
-    public static void writeSubtree(
-            final ODataClient client, final JsonGenerator jgen, final Node content, final boolean propType)
-            throws IOException {
-
-        for (Node child : XMLUtils.getChildNodes(content, Node.ELEMENT_NODE)) {
-            final String childName = XMLUtils.getSimpleName(child);
-
-            final Node typeAttr = child.getAttributes().getNamedItem(ODataConstants.ATTR_M_TYPE);
-            if (typeAttr != null && EdmSimpleType.isGeospatial(typeAttr.getTextContent())) {
-                jgen.writeStringField(propType ? ODataConstants.JSON_TYPE : childName + "@" + ODataConstants.JSON_TYPE,
-                        typeAttr.getTextContent());
-
-                jgen.writeObjectFieldStart(childName);
-                GeospatialJSONHandler.serialize(client, jgen, (Element) child, typeAttr.getTextContent());
-                jgen.writeEndObject();
-            } else if (XMLUtils.hasOnlyTextChildNodes(child)) {
-                if (child.hasChildNodes()) {
-                    final String out;
-                    if (typeAttr == null) {
-                        out = child.getChildNodes().item(0).getNodeValue();
-                    } else {
-                        final EdmSimpleType type = EdmSimpleType.fromValue(typeAttr.getTextContent());
-                        final ODataPrimitiveValue value = client.getPrimitiveValueBuilder().setType(type).
-                                setText(child.getChildNodes().item(0).getNodeValue()).build();
-                        out = value.toString();
-
-                        jgen.writeStringField(childName + "@" + ODataConstants.JSON_TYPE, type.toString());
-                    }
-                    jgen.writeStringField(childName, out);
-                } else {
-                    if (child.getAttributes().getNamedItem(ODataConstants.ATTR_NULL) == null) {
-                        if (typeAttr != null && EdmSimpleType.String.toString().equals(typeAttr.getTextContent())) {
-                            jgen.writeStringField(childName + "@" + ODataConstants.JSON_TYPE, typeAttr.getTextContent());
-                            jgen.writeStringField(childName, StringUtils.EMPTY);
-                        } else {
-                            jgen.writeArrayFieldStart(childName);
-                            jgen.writeEndArray();
-                        }
-                    } else {
-                        jgen.writeNullField(childName);
-                    }
-                }
-            } else {
-                if (XMLUtils.hasElementsChildNode(child)) {
-                    jgen.writeArrayFieldStart(childName);
-
-                    for (Node nephew : XMLUtils.getChildNodes(child, Node.ELEMENT_NODE)) {
-                        if (XMLUtils.hasOnlyTextChildNodes(nephew)) {
-                            jgen.writeString(nephew.getChildNodes().item(0).getNodeValue());
-                        } else {
-                            jgen.writeStartObject();
-                            writeSubtree(client, jgen, nephew);
-                            jgen.writeEndObject();
-                        }
-                    }
-
-                    jgen.writeEndArray();
-                } else {
-                    jgen.writeObjectFieldStart(childName);
-                    if (typeAttr != null) {
-                        jgen.writeStringField(ODataConstants.JSON_TYPE, typeAttr.getTextContent());
-                    }
-
-                    writeSubtree(client, jgen, child);
-
-                    jgen.writeEndObject();
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntryDeserializer.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntryDeserializer.java
deleted file mode 100644
index 7735d62..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntryDeserializer.java
+++ /dev/null
@@ -1,248 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.msopentech.odatajclient.engine.data.impl.JSONDOMTreeUtils;
-import com.msopentech.odatajclient.engine.data.impl.AbstractJSONEntry;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.msopentech.odatajclient.engine.data.ODataLinkType;
-import com.msopentech.odatajclient.engine.data.ODataOperation;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONFeed;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONLink;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONEntry;
-import com.msopentech.odatajclient.engine.utils.ODataConstants;
-import com.msopentech.odatajclient.engine.utils.ODataVersion;
-import com.msopentech.odatajclient.engine.utils.XMLUtils;
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Parse JSON string into <tt>JSONV3Entry</tt> or <tt>JSONV4Entry</tt>.
- * If metadata information is available, the corresponding entry fields and content will be populated.
- *
- * @see JSONEntry
- * @see JSONV4Entry
- */
-public class JSONEntryDeserializer extends ODataJacksonDeserializer<AbstractJSONEntry> {
-
-    private String getTitle(final Map.Entry<String, JsonNode> entry) {
-        return entry.getKey().substring(0, entry.getKey().indexOf('@'));
-    }
-
-    private String setInline(final String name, final String suffix, final ObjectNode tree,
-            final ObjectCodec codec, final JSONLink link) throws IOException {
-
-        final String entryNamePrefix = name.substring(0, name.indexOf(suffix));
-        if (tree.has(entryNamePrefix)) {
-            final JsonNode inline = tree.path(entryNamePrefix);
-
-            if (inline instanceof ObjectNode) {
-                final JsonParser inlineParser = inline.traverse();
-                inlineParser.setCodec(codec);
-                link.setInlineEntry(inlineParser.readValuesAs(JSONEntry.class).next());
-            }
-
-            if (inline instanceof ArrayNode) {
-                final JSONFeed feed = new JSONFeed();
-                final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
-                while (entries.hasNext()) {
-                    final JsonParser inlineParser = entries.next().traverse();
-                    inlineParser.setCodec(codec);
-                    feed.addEntry(inlineParser.readValuesAs(JSONEntry.class).next());
-                }
-
-                link.setInlineFeed(feed);
-            }
-        }
-        return entryNamePrefix;
-    }
-
-    @Override
-    protected AbstractJSONEntry doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
-            throws IOException, JsonProcessingException {
-
-        final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
-        if (tree.has(ODataConstants.JSON_VALUE) && tree.get(ODataConstants.JSON_VALUE).isArray()) {
-            throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
-        }
-
-        final boolean isMediaEntry =
-                tree.hasNonNull(ODataConstants.JSON_MEDIAREAD_LINK)
-                && tree.hasNonNull(ODataConstants.JSON_MEDIA_CONTENT_TYPE);
-
-        final JSONEntry entry = new JSONEntry();
-
-        if (tree.hasNonNull(ODataConstants.JSON_METADATA)) {
-            entry.setMetadata(URI.create(tree.get(ODataConstants.JSON_METADATA).textValue()));
-            tree.remove(ODataConstants.JSON_METADATA);
-        }
-
-        if (tree.hasNonNull(ODataConstants.JSON_MEDIA_ETAG)) {
-            entry.setMediaETag(tree.get(ODataConstants.JSON_MEDIA_ETAG).textValue());
-            tree.remove(ODataConstants.JSON_MEDIA_ETAG);
-        }
-
-        if (tree.hasNonNull(ODataConstants.JSON_ETAG)) {
-            entry.setETag(tree.get(ODataConstants.JSON_ETAG).textValue());
-            tree.remove(ODataConstants.JSON_ETAG);
-        }
-
-        if (tree.hasNonNull(ODataConstants.JSON_TYPE)) {
-            entry.setType(tree.get(ODataConstants.JSON_TYPE).textValue());
-            tree.remove(ODataConstants.JSON_TYPE);
-        }
-
-        if (tree.hasNonNull(ODataConstants.JSON_ID)) {
-            entry.setId(tree.get(ODataConstants.JSON_ID).textValue());
-            tree.remove(ODataConstants.JSON_ID);
-        }
-
-        if (tree.hasNonNull(ODataConstants.JSON_READ_LINK)) {
-            final JSONLink link = new JSONLink();
-            link.setRel(ODataConstants.SELF_LINK_REL);
-            link.setHref(tree.get(ODataConstants.JSON_READ_LINK).textValue());
-            entry.setSelfLink(link);
-
-            tree.remove(ODataConstants.JSON_READ_LINK);
-        }
-
-        if (tree.hasNonNull(ODataConstants.JSON_EDIT_LINK)) {
-            final JSONLink link = new JSONLink();
-            link.setRel(ODataConstants.EDIT_LINK_REL);
-            link.setHref(tree.get(ODataConstants.JSON_EDIT_LINK).textValue());
-            entry.setEditLink(link);
-
-            tree.remove(ODataConstants.JSON_EDIT_LINK);
-        }
-
-        if (tree.hasNonNull(ODataConstants.JSON_MEDIAREAD_LINK)) {
-            entry.setMediaContentSource(tree.get(ODataConstants.JSON_MEDIAREAD_LINK).textValue());
-            tree.remove(ODataConstants.JSON_MEDIAREAD_LINK);
-        }
-        if (tree.hasNonNull(ODataConstants.JSON_MEDIAEDIT_LINK)) {
-            final JSONLink link = new JSONLink();
-            link.setHref(tree.get(ODataConstants.JSON_MEDIAEDIT_LINK).textValue());
-            entry.addMediaEditLink(link);
-
-            tree.remove(ODataConstants.JSON_MEDIAEDIT_LINK);
-        }
-        if (tree.hasNonNull(ODataConstants.JSON_MEDIA_CONTENT_TYPE)) {
-            entry.setMediaContentType(tree.get(ODataConstants.JSON_MEDIA_CONTENT_TYPE).textValue());
-            tree.remove(ODataConstants.JSON_MEDIA_CONTENT_TYPE);
-        }
-
-        final Set<String> toRemove = new HashSet<String>();
-        final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields();
-        while (itor.hasNext()) {
-            final Map.Entry<String, JsonNode> field = itor.next();
-
-            if (field.getKey().endsWith(ODataConstants.JSON_NAVIGATION_LINK_SUFFIX)) {
-                final JSONLink link = new JSONLink();
-                link.setTitle(getTitle(field));
-                link.setRel(client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NAVIGATION_LINK_REL)
-                        + getTitle(field));
-                if (field.getValue().isValueNode()) {
-                    link.setHref(field.getValue().textValue());
-                    link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
-                }
-                // NOTE: this should be expected to happen, but it isn't - at least up to OData 4.0
-                /* if (field.getValue().isArray()) {
-                 * link.setHref(field.getValue().asText());
-                 * link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
-                 * } */
-                entry.addNavigationLink(link);
-
-                toRemove.add(field.getKey());
-                toRemove.add(setInline(field.getKey(),
-                        ODataConstants.JSON_NAVIGATION_LINK_SUFFIX, tree, parser.getCodec(), link));
-            } else if (field.getKey().endsWith(ODataConstants.JSON_ASSOCIATION_LINK_SUFFIX)) {
-                final JSONLink link = new JSONLink();
-                link.setTitle(getTitle(field));
-                link.setRel(client.getWorkingVersion().getNamespaceMap().get(ODataVersion.ASSOCIATION_LINK_REL)
-                        + getTitle(field));
-                link.setHref(field.getValue().textValue());
-                link.setType(ODataLinkType.ASSOCIATION.toString());
-                entry.addAssociationLink(link);
-
-                toRemove.add(field.getKey());
-            } else if (field.getKey().endsWith(ODataConstants.JSON_MEDIAEDIT_LINK_SUFFIX)) {
-                final JSONLink link = new JSONLink();
-                link.setTitle(getTitle(field));
-                link.setRel(client.getWorkingVersion().getNamespaceMap().get(ODataVersion.MEDIA_EDIT_LINK_REL)
-                        + getTitle(field));
-                link.setHref(field.getValue().textValue());
-                link.setType(ODataLinkType.MEDIA_EDIT.toString());
-                entry.addMediaEditLink(link);
-
-                toRemove.add(field.getKey());
-                toRemove.add(setInline(field.getKey(),
-                        ODataConstants.JSON_MEDIAEDIT_LINK_SUFFIX, tree, parser.getCodec(), link));
-            } else if (field.getKey().charAt(0) == '#') {
-                final ODataOperation operation = new ODataOperation();
-                operation.setMetadataAnchor(field.getKey());
-
-                final ObjectNode opNode = (ObjectNode) tree.get(field.getKey());
-                operation.setTitle(opNode.get(ODataConstants.ATTR_TITLE).asText());
-                operation.setTarget(URI.create(opNode.get(ODataConstants.ATTR_TARGET).asText()));
-
-                entry.addOperation(operation);
-
-                toRemove.add(field.getKey());
-            }
-        }
-        tree.remove(toRemove);
-
-        try {
-            final DocumentBuilder builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
-            final Document document = builder.newDocument();
-
-            final Element properties = document.createElementNS(
-                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
-                    ODataConstants.ELEM_PROPERTIES);
-
-            JSONDOMTreeUtils.buildSubtree(client, properties, tree);
-
-            if (isMediaEntry) {
-                entry.setMediaEntryProperties(properties);
-            } else {
-                entry.setContent(properties);
-            }
-        } catch (ParserConfigurationException e) {
-            throw new JsonParseException("Cannot build entry content", parser.getCurrentLocation(), e);
-        }
-
-        return entry;
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntrySerializer.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntrySerializer.java
deleted file mode 100644
index 1b00a22..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONEntrySerializer.java
+++ /dev/null
@@ -1,133 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.msopentech.odatajclient.engine.data.ODataLinkType;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONLink;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONEntry;
-import com.msopentech.odatajclient.engine.utils.ODataConstants;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * Writes out JSON string from <tt>JSONV3Entry</tt> and <tt>JSONV4Entry</tt>.
- *
- * @see JSONEntry
- * @see JSONV4Entry
- */
-public class JSONEntrySerializer extends ODataJacksonSerializer<AbstractJSONEntry> {
-
-    @Override
-    protected void doSerialize(
-            final AbstractJSONEntry entry, final JsonGenerator jgen, final SerializerProvider provider)
-            throws IOException, JsonProcessingException {
-
-        jgen.writeStartObject();
-
-        if (entry.getMetadata() != null) {
-            jgen.writeStringField(ODataConstants.JSON_METADATA, entry.getMetadata().toASCIIString());
-        }
-        if (StringUtils.isNotBlank(entry.getType())) {
-            jgen.writeStringField(ODataConstants.JSON_TYPE, entry.getType());
-        }
-        if (entry.getId() != null) {
-            jgen.writeStringField(ODataConstants.JSON_ID, entry.getId());
-        }
-
-        if (entry.getSelfLink() != null) {
-            jgen.writeStringField(ODataConstants.JSON_READ_LINK, entry.getSelfLink().getHref());
-        }
-
-        if (entry.getEditLink() != null) {
-            jgen.writeStringField(ODataConstants.JSON_EDIT_LINK, entry.getEditLink().getHref());
-        }
-
-        if (entry.getMediaContentSource() != null) {
-            jgen.writeStringField(ODataConstants.JSON_MEDIAREAD_LINK, entry.getMediaContentSource());
-        }
-        if (entry.getMediaContentType() != null) {
-            jgen.writeStringField(ODataConstants.JSON_MEDIA_CONTENT_TYPE, entry.getMediaContentType());
-        }
-
-        final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
-
-        for (JSONLink link : entry.getNavigationLinks()) {
-            if (link.getInlineEntry() != null) {
-                jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
-            } else if (link.getInlineFeed() != null) {
-                jgen.writeObjectField(link.getTitle(), link.getInlineFeed());
-            } else {
-                ODataLinkType type = null;
-                try {
-                    type = ODataLinkType.fromString(client, link.getRel(), link.getType());
-                } catch (IllegalArgumentException e) {
-                    // ignore   
-                }
-
-                if (type == ODataLinkType.ENTITY_SET_NAVIGATION) {
-                    final List<String> uris;
-                    if (entitySetLinks.containsKey(link.getTitle())) {
-                        uris = entitySetLinks.get(link.getTitle());
-                    } else {
-                        uris = new ArrayList<String>();
-                        entitySetLinks.put(link.getTitle(), uris);
-                    }
-                    uris.add(link.getHref());
-                } else {
-                    jgen.writeStringField(link.getTitle() + ODataConstants.JSON_BIND_LINK_SUFFIX, link.getHref());
-                }
-            }
-        }
-        for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
-            jgen.writeArrayFieldStart(entitySetLink.getKey() + ODataConstants.JSON_BIND_LINK_SUFFIX);
-            for (String uri : entitySetLink.getValue()) {
-                jgen.writeString(uri);
-            }
-            jgen.writeEndArray();
-        }
-
-        for (JSONLink link : entry.getMediaEditLinks()) {
-            if (link.getTitle() == null) {
-                jgen.writeStringField(ODataConstants.JSON_MEDIAEDIT_LINK, link.getHref());
-            }
-
-            if (link.getInlineEntry() != null) {
-                jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
-            }
-            if (link.getInlineFeed() != null) {
-                jgen.writeObjectField(link.getTitle(), link.getInlineFeed());
-            }
-        }
-
-        if (entry.getMediaEntryProperties() == null) {
-            JSONDOMTreeUtils.writeSubtree(client, jgen, entry.getContent());
-        } else {
-            JSONDOMTreeUtils.writeSubtree(client, jgen, entry.getMediaEntryProperties());
-        }
-
-        jgen.writeEndObject();
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONPropertyDeserializer.java b/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONPropertyDeserializer.java
deleted file mode 100644
index 48f9b1c..0000000
--- a/ODataJClient/engine/src/main/java/com/msopentech/odatajclient/engine/data/impl/JSONPropertyDeserializer.java
+++ /dev/null
@@ -1,124 +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 com.msopentech.odatajclient.engine.data.impl;
-
-import com.msopentech.odatajclient.engine.data.impl.JSONDOMTreeUtils;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.msopentech.odatajclient.engine.data.impl.v3.JSONProperty;
-import com.msopentech.odatajclient.engine.metadata.edm.EdmSimpleType;
-import com.msopentech.odatajclient.engine.utils.ODataConstants;
-import com.msopentech.odatajclient.engine.utils.XMLUtils;
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.lang3.StringUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Parse JSON string into <tt>JSONProperty</tt>.
- *
- * @see JSONProperty
- */
-public class JSONPropertyDeserializer extends ODataJacksonDeserializer<JSONProperty> {
-
-    @Override
-    protected JSONProperty doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
-            throws IOException, JsonProcessingException {
-
-        final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
-        final JSONProperty property = new JSONProperty();
-
-        if (tree.hasNonNull(ODataConstants.JSON_METADATA)) {
-            property.setMetadata(URI.create(tree.get(ODataConstants.JSON_METADATA).textValue()));
-            tree.remove(ODataConstants.JSON_METADATA);
-        }
-
-        try {
-            final DocumentBuilder builder = XMLUtils.DOC_BUILDER_FACTORY.newDocumentBuilder();
-            final Document document = builder.newDocument();
-
-            Element content = document.createElement(ODataConstants.ELEM_PROPERTY);
-
-            if (property.getMetadata() != null) {
-                final String metadataURI = property.getMetadata().toASCIIString();
-                final int dashIdx = metadataURI.lastIndexOf('#');
-                if (dashIdx != -1) {
-                    content.setAttribute(ODataConstants.ATTR_M_TYPE, metadataURI.substring(dashIdx + 1));
-                }
-            }
-
-            JsonNode subtree = null;
-            if (tree.has(ODataConstants.JSON_VALUE)) {
-                if (tree.has(ODataConstants.JSON_TYPE)
-                        && StringUtils.isBlank(content.getAttribute(ODataConstants.ATTR_M_TYPE))) {
-
-                    content.setAttribute(ODataConstants.ATTR_M_TYPE, tree.get(ODataConstants.JSON_TYPE).asText());
-                }
-
-                final JsonNode value = tree.get(ODataConstants.JSON_VALUE);
-                if (value.isValueNode()) {
-                    content.appendChild(document.createTextNode(value.asText()));
-                } else if (EdmSimpleType.isGeospatial(content.getAttribute(ODataConstants.ATTR_M_TYPE))) {
-                    subtree = tree.objectNode();
-                    ((ObjectNode) subtree).put(ODataConstants.JSON_VALUE, tree.get(ODataConstants.JSON_VALUE));
-                    if (StringUtils.isNotBlank(content.getAttribute(ODataConstants.ATTR_M_TYPE))) {
-                        ((ObjectNode) subtree).put(
-                                ODataConstants.JSON_VALUE + "@" + ODataConstants.JSON_TYPE,
-                                content.getAttribute(ODataConstants.ATTR_M_TYPE));
-                    }
-                } else {
-                    subtree = tree.get(ODataConstants.JSON_VALUE);
-                }
-            } else {
-                subtree = tree;
-            }
-
-            if (subtree != null) {
-                JSONDOMTreeUtils.buildSubtree(client, content, subtree);
-            }
-
-            final List<Node> children = XMLUtils.getChildNodes(content, Node.ELEMENT_NODE);
-            if (children.size() == 1) {
-                final Element value = (Element) children.iterator().next();
-                if (ODataConstants.JSON_VALUE.equals(XMLUtils.getSimpleName(value))) {
-                    if (StringUtils.isNotBlank(content.getAttribute(ODataConstants.ATTR_M_TYPE))) {
-                        value.setAttribute(ODataConstants.ATTR_M_TYPE, content.getAttribute(ODataConstants.ATTR_M_TYPE));
-                    }
-                    content = value;
-                }
-            }
-
-            property.setContent(content);
-        } catch (ParserConfigurationException e) {
-            throw new JsonParseException("Cannot build property", parser.getCurrentLocation(), e);
-        }
-
-        return property;
-    }
-}