You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/06/24 06:57:41 UTC

[16/23] [OLINGO-317] Rename and move of some packages and classes

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
deleted file mode 100644
index 465250a..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ /dev/null
@@ -1,104 +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.commons.core.data;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Parse JSON string into <tt>Property</tt>.
- */
-public class JSONPropertyDeserializer extends JsonDeserializer {
-
-  public JSONPropertyDeserializer(final ODataServiceVersion version, final boolean serverMode) {
-    super(version, serverMode);
-  }
-
-  protected ResWrap<Property> doDeserialize(final JsonParser parser) throws IOException {
-
-    final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
-    final String metadataETag;
-    final URI contextURL;
-    final PropertyImpl property = new PropertyImpl();
-
-    if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
-      metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
-      tree.remove(Constants.JSON_METADATA_ETAG);
-    } else {
-      metadataETag = null;
-    }
-
-    if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
-      contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
-      property.setName(StringUtils.substringAfterLast(contextURL.toASCIIString(), "/"));
-      tree.remove(Constants.JSON_CONTEXT);
-    } else if (tree.hasNonNull(Constants.JSON_METADATA)) {
-      contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
-      property.setType(new EdmTypeInfo.Builder().
-              setTypeExpression(StringUtils.substringAfterLast(contextURL.toASCIIString(), "#")).build().internal());
-      tree.remove(Constants.JSON_METADATA);
-    } else {
-      contextURL = null;
-    }
-
-    if (tree.has(jsonType)) {
-      property.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(jsonType).textValue()).build().internal());
-      tree.remove(jsonType);
-    }
-
-    if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
-      property.setValue(new NullValueImpl());
-      tree.remove(Constants.JSON_NULL);
-    }
-
-    if (property.getValue() == null) {
-      value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree, parser.getCodec());
-      tree.remove(Constants.VALUE);
-    }
-
-    // any remaining entry is supposed to be an annotation or is ignored
-    for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
-      final Map.Entry<String, JsonNode> field = itor.next();
-      if (field.getKey().charAt(0) == '@') {
-        final Annotation annotation = new AnnotationImpl();
-        annotation.setTerm(field.getKey().substring(1));
-
-        value(annotation, field.getValue(), parser.getCodec());
-        property.getAnnotations().add(annotation);
-      }
-    }
-
-    return new ResWrap<Property>(contextURL, metadataETag, property);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
deleted file mode 100644
index 1a82a3b..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
+++ /dev/null
@@ -1,90 +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.commons.core.data;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-/**
- * Writes out JSON string from <tt>PropertyImpl</tt>.
- */
-public class JSONPropertySerializer extends JsonSerializer {
-
-  public JSONPropertySerializer(final ODataServiceVersion version, final boolean serverMode) {
-    super(version, serverMode);
-  }
-
-  protected void doSerialize(final Property property, final JsonGenerator jgen) throws IOException {
-    doContainerSerialize(new ResWrap<Property>((URI) null, null, property), jgen);
-  }
-
-  protected void doContainerSerialize(final ResWrap<Property> container, final JsonGenerator jgen)
-          throws IOException {
-
-    final Property property = container.getPayload();
-
-    jgen.writeStartObject();
-
-    if (serverMode && container.getContextURL() != null) {
-      jgen.writeStringField(version.compareTo(ODataServiceVersion.V40) >= 0
-              ? Constants.JSON_CONTEXT : Constants.JSON_METADATA,
-              container.getContextURL().getURI().toASCIIString());
-    }
-
-    if (StringUtils.isNotBlank(property.getType())) {
-      jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_TYPE),
-              new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build().external(version));
-    }
-
-    for (Annotation annotation : property.getAnnotations()) {
-      valuable(jgen, annotation, "@" + annotation.getTerm());
-    }
-
-    if (property.getValue().isNull()) {
-      jgen.writeBooleanField(Constants.JSON_NULL, true);
-    } else if (property.getValue().isPrimitive()) {
-      final EdmTypeInfo typeInfo = property.getType() == null
-              ? null
-              : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
-
-      jgen.writeFieldName(Constants.VALUE);
-      primitiveValue(jgen, typeInfo, property.getValue().asPrimitive());
-    } else if (property.getValue().isEnum()) {
-      jgen.writeStringField(Constants.VALUE, property.getValue().asEnum().get());
-    } else if (property.getValue().isGeospatial() || property.getValue().isCollection()) {
-      valuable(jgen, property, Constants.VALUE);
-    } else if (property.getValue().isComplex()) {
-      for (Property cproperty : property.getValue().asComplex().get()) {
-        valuable(jgen, cproperty, cproperty.getName());
-      }
-    }
-
-    jgen.writeEndObject();
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonDeserializer.java
deleted file mode 100755
index 0ecd7f3..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonDeserializer.java
+++ /dev/null
@@ -1,463 +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.commons.core.data;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotatable;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.CollectionValue;
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-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.ODataError;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataPropertyType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.op.ODataDeserializer;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JsonDeserializer implements ODataDeserializer {
-
-  protected final Pattern CUSTOM_ANNOTATION = Pattern.compile("(.+)@(.+)\\.(.+)");
-  protected final ODataServiceVersion version;
-  protected final boolean serverMode;
-
-  protected String jsonType;
-  protected String jsonId;
-  protected String jsonETag;
-  protected String jsonReadLink;
-  protected String jsonEditLink;
-  protected String jsonMediaEditLink;
-  protected String jsonMediaReadLink;
-  protected String jsonMediaContentType;
-  protected String jsonMediaETag;
-  protected String jsonAssociationLink;
-  protected String jsonNavigationLink;
-  protected String jsonCount;
-  protected String jsonNextLink;
-  protected String jsonDeltaLink;
-  protected String jsonError;
-
-  private JSONGeoValueDeserializer geoDeserializer;
-
-  private JsonParser parser;
-
-  public JsonDeserializer(final ODataServiceVersion version, final boolean serverMode) {
-    this.version = version;
-    this.serverMode = serverMode;
-
-    jsonType = version.getJSONMap().get(ODataServiceVersion.JSON_TYPE);
-    jsonId = version.getJSONMap().get(ODataServiceVersion.JSON_ID);
-    jsonETag = version.getJSONMap().get(ODataServiceVersion.JSON_ETAG);
-    jsonReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_READ_LINK);
-    jsonEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK);
-    jsonMediaReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK);
-    jsonMediaEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK);
-    jsonMediaContentType = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE);
-    jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG);
-    jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
-    jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
-    jsonCount = version.getJSONMap().get(ODataServiceVersion.JSON_COUNT);
-    jsonNextLink = version.getJSONMap().get(ODataServiceVersion.JSON_NEXT_LINK);
-    jsonDeltaLink = version.getJSONMap().get(ODataServiceVersion.JSON_DELTA_LINK);
-    jsonError = version.getJSONMap().get(ODataServiceVersion.JSON_ERROR);
-}
-
-  private JSONGeoValueDeserializer getGeoDeserializer() {
-    if (geoDeserializer == null) {
-      geoDeserializer = new JSONGeoValueDeserializer(version);
-    }
-    return geoDeserializer;
-  }
-
-  protected String getJSONAnnotation(final String string) {
-    return StringUtils.prependIfMissing(string, "@");
-  }
-
-  protected String getTitle(final Map.Entry<String, JsonNode> entry) {
-    return entry.getKey().substring(0, entry.getKey().indexOf('@'));
-  }
-
-  protected String setInline(final String name, final String suffix, final JsonNode tree,
-      final ObjectCodec codec, final LinkImpl link) throws IOException {
-
-    final String entityNamePrefix = name.substring(0, name.indexOf(suffix));
-    if (tree.has(entityNamePrefix)) {
-      final JsonNode inline = tree.path(entityNamePrefix);
-      JSONEntityDeserializer entityDeserializer = new JSONEntityDeserializer(version, serverMode);
-
-      if (inline instanceof ObjectNode) {
-        link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
-        link.setInlineEntity(entityDeserializer.doDeserialize(inline.traverse(codec)).getPayload());
-
-      } else if (inline instanceof ArrayNode) {
-        link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
-
-        EntitySet entitySet = new EntitySetImpl();
-        Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
-        while (entries.hasNext()) {
-          entitySet.getEntities().add(
-              entityDeserializer.doDeserialize(entries.next().traverse(codec)).getPayload());
-        }
-
-        link.setInlineEntitySet(entitySet);
-      }
-    }
-    return entityNamePrefix;
-  }
-
-  protected void links(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
-      final JsonNode tree, final ObjectCodec codec) throws IOException {
-    if (serverMode) {
-      serverLinks(field, linked, toRemove, tree, codec);
-    } else {
-      clientLinks(field, linked, toRemove, tree, codec);
-    }
-  }
-
-  private void clientLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
-      final JsonNode tree, final ObjectCodec codec) throws IOException {
-
-    if (field.getKey().endsWith(jsonNavigationLink)) {
-      final LinkImpl link = new LinkImpl();
-      link.setTitle(getTitle(field));
-      link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
-
-      if (field.getValue().isValueNode()) {
-        link.setHref(field.getValue().textValue());
-        link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
-      }
-
-      linked.getNavigationLinks().add(link);
-
-      toRemove.add(field.getKey());
-      toRemove.add(setInline(field.getKey(), jsonNavigationLink, tree, codec, link));
-    } else if (field.getKey().endsWith(jsonAssociationLink)) {
-      final LinkImpl link = new LinkImpl();
-      link.setTitle(getTitle(field));
-      link.setRel(version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL) + getTitle(field));
-      link.setHref(field.getValue().textValue());
-      link.setType(ODataLinkType.ASSOCIATION.toString());
-      linked.getAssociationLinks().add(link);
-
-      toRemove.add(field.getKey());
-    }
-  }
-
-  private void serverLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
-      final JsonNode tree, final ObjectCodec codec) throws IOException {
-
-    if (field.getKey().endsWith(Constants.JSON_BIND_LINK_SUFFIX)
-        || field.getKey().endsWith(jsonNavigationLink)) {
-
-      if (field.getValue().isValueNode()) {
-        final String suffix = field.getKey().replaceAll("^.*@", "@");
-
-        final LinkImpl link = new LinkImpl();
-        link.setTitle(getTitle(field));
-        link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
-        link.setHref(field.getValue().textValue());
-        link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
-        linked.getNavigationLinks().add(link);
-
-        toRemove.add(setInline(field.getKey(), suffix, tree, codec, link));
-      } else if (field.getValue().isArray()) {
-        for (final Iterator<JsonNode> itor = field.getValue().elements(); itor.hasNext();) {
-          final JsonNode node = itor.next();
-
-          final LinkImpl link = new LinkImpl();
-          link.setTitle(getTitle(field));
-          link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
-          link.setHref(node.asText());
-          link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
-          linked.getNavigationLinks().add(link);
-          toRemove.add(setInline(field.getKey(), Constants.JSON_BIND_LINK_SUFFIX, tree, codec, link));
-        }
-      }
-      toRemove.add(field.getKey());
-    }
-  }
-
-  private Map.Entry<ODataPropertyType, EdmTypeInfo> guessPropertyType(final JsonNode node) {
-    ODataPropertyType type;
-    EdmTypeInfo typeInfo = null;
-
-    if (node.isValueNode() || node.isNull()) {
-      type = ODataPropertyType.PRIMITIVE;
-
-      EdmPrimitiveTypeKind kind = EdmPrimitiveTypeKind.String;
-      if (node.isShort()) {
-        kind = EdmPrimitiveTypeKind.Int16;
-      } else if (node.isInt()) {
-        kind = EdmPrimitiveTypeKind.Int32;
-      } else if (node.isLong()) {
-        kind = EdmPrimitiveTypeKind.Int64;
-      } else if (node.isBoolean()) {
-        kind = EdmPrimitiveTypeKind.Boolean;
-      } else if (node.isFloat()) {
-        kind = EdmPrimitiveTypeKind.Single;
-      } else if (node.isDouble()) {
-        kind = EdmPrimitiveTypeKind.Double;
-      } else if (node.isBigDecimal()) {
-        kind = EdmPrimitiveTypeKind.Decimal;
-      }
-      typeInfo = new EdmTypeInfo.Builder().setTypeExpression(kind.getFullQualifiedName().toString()).build();
-    } else if (node.isArray()) {
-      type = ODataPropertyType.COLLECTION;
-    } else if (node.isObject()) {
-      if (node.has(Constants.ATTR_TYPE)) {
-        type = ODataPropertyType.PRIMITIVE;
-        typeInfo = new EdmTypeInfo.Builder().
-            setTypeExpression("Edm.Geography" + node.get(Constants.ATTR_TYPE).asText()).build();
-      } else {
-        type = ODataPropertyType.COMPLEX;
-      }
-    } else {
-      type = ODataPropertyType.EMPTY;
-    }
-
-    return new SimpleEntry<ODataPropertyType, EdmTypeInfo>(type, typeInfo);
-  }
-
-  protected void populate(final Annotatable annotatable, final List<Property> properties,
-      final ObjectNode tree, final ObjectCodec codec) throws IOException {
-
-    String type = null;
-    Annotation annotation = null;
-    for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
-      final Map.Entry<String, JsonNode> field = itor.next();
-      final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey());
-
-      if (field.getKey().charAt(0) == '@') {
-        final Annotation entityAnnot = new AnnotationImpl();
-        entityAnnot.setTerm(field.getKey().substring(1));
-
-        value(entityAnnot, field.getValue(), codec);
-        if (annotatable != null) {
-          annotatable.getAnnotations().add(entityAnnot);
-        }
-      } else if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) {
-        type = field.getValue().asText();
-      } else if (annotation == null && customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) {
-        annotation = new AnnotationImpl();
-        annotation.setTerm(customAnnotation.group(2) + "." + customAnnotation.group(3));
-        value(annotation, field.getValue(), codec);
-      } else {
-        final PropertyImpl property = new PropertyImpl();
-        property.setName(field.getKey());
-        property.setType(type == null
-            ? null
-            : new EdmTypeInfo.Builder().setTypeExpression(type).build().internal());
-        type = null;
-
-        value(property, field.getValue(), codec);
-        properties.add(property);
-
-        if (annotation != null) {
-          property.getAnnotations().add(annotation);
-          annotation = null;
-        }
-      }
-    }
-  }
-
-  private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
-    final Value value;
-
-    if (node.isNull()) {
-      value = new NullValueImpl();
-    } else {
-      if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
-        value = new GeospatialValueImpl(getGeoDeserializer().deserialize(node, typeInfo));
-      } else {
-        value = new PrimitiveValueImpl(node.asText());
-      }
-    }
-
-    return value;
-  }
-
-  private ComplexValue fromComplex(final ObjectNode node, final ObjectCodec codec) throws IOException {
-    final ComplexValue value = version.compareTo(ODataServiceVersion.V40) < 0
-        ? new ComplexValueImpl()
-        : new LinkedComplexValueImpl();
-
-    if (value.isLinkedComplex()) {
-      final Set<String> toRemove = new HashSet<String>();
-      for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
-        final Map.Entry<String, JsonNode> field = itor.next();
-
-        links(field, value.asLinkedComplex(), toRemove, node, codec);
-      }
-      node.remove(toRemove);
-    }
-
-    populate(value.asLinkedComplex(), value.get(), node, codec);
-
-    return value;
-  }
-
-  private CollectionValue fromCollection(final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo,
-      final ObjectCodec codec) throws IOException {
-
-    final CollectionValueImpl value = new CollectionValueImpl();
-
-    final EdmTypeInfo type = typeInfo == null
-        ? null
-        : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
-
-    while (nodeItor.hasNext()) {
-      final JsonNode child = nodeItor.next();
-
-      if (child.isValueNode()) {
-        if (typeInfo == null || typeInfo.isPrimitiveType()) {
-          value.get().add(fromPrimitive(child, type));
-        } else {
-          value.get().add(new EnumValueImpl(child.asText()));
-        }
-      } else if (child.isContainerNode()) {
-        if (child.has(jsonType)) {
-          ((ObjectNode) child).remove(jsonType);
-        }
-        value.get().add(fromComplex((ObjectNode) child, codec));
-      }
-    }
-
-    return value;
-  }
-
-  protected void value(final Valuable valuable, final JsonNode node, final ObjectCodec codec)
-      throws IOException {
-
-    EdmTypeInfo typeInfo = StringUtils.isBlank(valuable.getType())
-        ? null
-        : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build();
-
-    final Map.Entry<ODataPropertyType, EdmTypeInfo> guessed = guessPropertyType(node);
-    if (typeInfo == null) {
-      typeInfo = guessed.getValue();
-    }
-
-    final ODataPropertyType propType = typeInfo == null
-        ? guessed.getKey()
-        : typeInfo.isCollection()
-            ? ODataPropertyType.COLLECTION
-            : typeInfo.isPrimitiveType()
-                ? ODataPropertyType.PRIMITIVE
-                : node.isValueNode()
-                    ? ODataPropertyType.ENUM
-                    : ODataPropertyType.COMPLEX;
-
-    switch (propType) {
-    case COLLECTION:
-      valuable.setValue(fromCollection(node.elements(), typeInfo, codec));
-      break;
-
-    case COMPLEX:
-      if (node.has(jsonType)) {
-        valuable.setType(node.get(jsonType).asText());
-        ((ObjectNode) node).remove(jsonType);
-      }
-      valuable.setValue(fromComplex((ObjectNode) node, codec));
-      break;
-
-    case ENUM:
-      valuable.setValue(new EnumValueImpl(node.asText()));
-      break;
-
-    case PRIMITIVE:
-      if (valuable.getType() == null && typeInfo != null) {
-        valuable.setType(typeInfo.getFullQualifiedName().toString());
-      }
-      valuable.setValue(fromPrimitive(node, typeInfo));
-      break;
-
-    case EMPTY:
-    default:
-      valuable.setValue(new PrimitiveValueImpl(StringUtils.EMPTY));
-    }
-  }
-
-  @Override
-  public ResWrap<EntitySet> toEntitySet(InputStream input) throws ODataDeserializerException {
-    try {
-      parser = new JsonFactory(new ObjectMapper()).createParser(input);
-      return new JSONEntitySetDeserializer(version, serverMode).doDeserialize(parser);
-    } catch (final IOException e) {
-      throw new ODataDeserializerException(e);
-    }
-  }
-
-  @Override
-  public ResWrap<Entity> toEntity(InputStream input) throws ODataDeserializerException {
-    try {
-      parser = new JsonFactory(new ObjectMapper()).createParser(input);
-      return new JSONEntityDeserializer(version, serverMode).doDeserialize(parser);
-    } catch (final IOException e) {
-      throw new ODataDeserializerException(e);
-    }
-  }
-
-  @Override
-  public ResWrap<Property> toProperty(InputStream input) throws ODataDeserializerException {
-    try {
-      parser = new JsonFactory(new ObjectMapper()).createParser(input);
-      return new JSONPropertyDeserializer(version, serverMode).doDeserialize(parser);
-    } catch (final IOException e) {
-      throw new ODataDeserializerException(e);
-    }
-  }
-
-  @Override
-  public ODataError toError(InputStream input) throws ODataDeserializerException {
-    try {
-      parser = new JsonFactory(new ObjectMapper()).createParser(input);
-      return new JSONODataErrorDeserializer(version, serverMode).doDeserialize(parser);
-    } catch (final IOException e) {
-      throw new ODataDeserializerException(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonSerializer.java
deleted file mode 100755
index bf1c19e..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JsonSerializer.java
+++ /dev/null
@@ -1,315 +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.commons.core.data;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.math.NumberUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotatable;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.CollectionValue;
-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.PrimitiveValue;
-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.ODataLinkType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.op.ODataSerializer;
-import org.apache.olingo.commons.api.op.ODataSerializerException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonGenerator;
-
-public class JsonSerializer implements ODataSerializer {
-
-  protected ODataServiceVersion version;
-  protected boolean serverMode;
-
-  private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
-    EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
-    EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
-    EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64,
-    EdmPrimitiveTypeKind.Decimal
-  };
-
-  private final JSONGeoValueSerializer geoSerializer = new JSONGeoValueSerializer();
-
-  public JsonSerializer(final ODataServiceVersion version, final boolean serverMode) {
-    this.version = version;
-    this.serverMode = serverMode;
-  }
-
-  @Override
-  public <T> void write(Writer writer, T obj) throws ODataSerializerException {
-    try {
-      JsonGenerator json = new JsonFactory().createGenerator(writer);
-      if (obj instanceof EntitySet) {
-        new JSONEntitySetSerializer(version, serverMode).doSerialize((EntitySet) obj, json);
-      } else if (obj instanceof Entity) {
-        new JSONEntitySerializer(version, serverMode).doSerialize((Entity) obj, json);
-      } else if (obj instanceof Property) {
-        new JSONPropertySerializer(version, serverMode).doSerialize((Property) obj, json);
-      } else if (obj instanceof Link) {
-        link((Link) obj, json);
-      }
-      json.flush();
-    } catch (final IOException e) {
-      throw new ODataSerializerException(e);
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public <T> void write(Writer writer, ResWrap<T> container) throws ODataSerializerException {
-    final T obj = container == null ? null : container.getPayload();
-
-    try {
-      JsonGenerator json = new JsonFactory().createGenerator(writer);
-      if (obj instanceof EntitySet) {
-        new JSONEntitySetSerializer(version, serverMode).doContainerSerialize((ResWrap<EntitySet>) container, json);
-      } else if (obj instanceof Entity) {
-        new JSONEntitySerializer(version, serverMode).doContainerSerialize((ResWrap<Entity>) container, json);
-      } else if (obj instanceof Property) {
-        new JSONPropertySerializer(version, serverMode).doContainerSerialize((ResWrap<Property>) container, json);
-      } else if (obj instanceof Link) {
-        link((Link) obj, json);
-      }
-      json.flush();
-    } catch (final IOException e) {
-      throw new ODataSerializerException(e);
-    }
-  }
-
-  protected void link(final Link link, JsonGenerator jgen) throws IOException {
-    jgen.writeStartObject();
-    jgen.writeStringField(Constants.JSON_URL, link.getHref());
-    jgen.writeEndObject();
-  }
-
-  protected void links(final Linked linked, final JsonGenerator jgen) throws IOException {
-    if (serverMode) {
-      serverLinks(linked, jgen);
-    } else {
-      clientLinks(linked, jgen);
-    }
-  }
-
-  protected void clientLinks(final Linked linked, final JsonGenerator jgen) throws IOException {
-    final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
-    for (Link link : linked.getNavigationLinks()) {
-      for (Annotation annotation : link.getAnnotations()) {
-        valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm());
-      }
-
-      ODataLinkType type = null;
-      try {
-        type = ODataLinkType.fromString(version, 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);
-        }
-        if (StringUtils.isNotBlank(link.getHref())) {
-          uris.add(link.getHref());
-        }
-      } else {
-        if (StringUtils.isNotBlank(link.getHref())) {
-          jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
-        }
-      }
-
-      if (link.getInlineEntity() != null) {
-        jgen.writeFieldName(link.getTitle());
-        new JSONEntitySerializer(version, serverMode).doSerialize(link.getInlineEntity(), jgen);
-      } else if (link.getInlineEntitySet() != null) {
-        jgen.writeArrayFieldStart(link.getTitle());
-        JSONEntitySerializer entitySerializer = new JSONEntitySerializer(version, serverMode);
-        for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
-          entitySerializer.doSerialize(subEntry, jgen);
-        }
-        jgen.writeEndArray();
-      }
-    }
-    for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
-      if (!entitySetLink.getValue().isEmpty()) {
-        jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
-        for (String uri : entitySetLink.getValue()) {
-          jgen.writeString(uri);
-        }
-        jgen.writeEndArray();
-      }
-    }
-  }
-
-  protected void serverLinks(final Linked linked, final JsonGenerator jgen) throws IOException {
-    if (linked instanceof Entity) {
-      for (Link link : ((Entity) linked).getMediaEditLinks()) {
-        if (StringUtils.isNotBlank(link.getHref())) {
-          jgen.writeStringField(
-                  link.getTitle() + StringUtils.prependIfMissing(
-                          version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK), "@"),
-                  link.getHref());
-        }
-      }
-    }
-
-    for (Link link : linked.getAssociationLinks()) {
-      if (StringUtils.isNotBlank(link.getHref())) {
-        jgen.writeStringField(
-                link.getTitle() + version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK),
-                link.getHref());
-      }
-    }
-
-    for (Link link : linked.getNavigationLinks()) {
-      for (Annotation annotation : link.getAnnotations()) {
-        valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm());
-      }
-
-      if (StringUtils.isNotBlank(link.getHref())) {
-        jgen.writeStringField(
-                link.getTitle() + version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK),
-                link.getHref());
-      }
-
-      if (link.getInlineEntity() != null) {
-        jgen.writeFieldName(link.getTitle());
-        new JSONEntitySerializer(version, serverMode).doSerialize(link.getInlineEntity(), jgen);
-      } else if (link.getInlineEntitySet() != null) {
-        jgen.writeArrayFieldStart(link.getTitle());
-        JSONEntitySerializer entitySerializer = new JSONEntitySerializer(version, serverMode);
-        for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
-          entitySerializer.doSerialize(subEntry, jgen);
-        }
-        jgen.writeEndArray();
-      }
-    }
-  }
-
-  private void collection(final JsonGenerator jgen, final String itemType, final CollectionValue value)
-          throws IOException {
-
-    jgen.writeStartArray();
-    for (Value item : value.get()) {
-      value(jgen, itemType, item);
-    }
-    jgen.writeEndArray();
-  }
-
-  protected void primitiveValue(final JsonGenerator jgen, final EdmTypeInfo typeInfo, final PrimitiveValue value)
-          throws IOException {
-
-    final boolean isNumber = typeInfo == null
-            ? NumberUtils.isNumber(value.get())
-            : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind());
-    final boolean isBoolean = typeInfo == null
-            ? (value.get().equalsIgnoreCase(Boolean.TRUE.toString())
-            || value.get().equalsIgnoreCase(Boolean.FALSE.toString()))
-            : typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean;
-
-    if (isNumber) {
-      jgen.writeNumber(value.get());
-    } else if (isBoolean) {
-      jgen.writeBoolean(BooleanUtils.toBoolean(value.get()));
-    } else {
-      jgen.writeString(value.get());
-    }
-  }
-
-  private void value(final JsonGenerator jgen, final String type, final Value value) throws IOException {
-    final EdmTypeInfo typeInfo = type == null
-            ? null
-            : new EdmTypeInfo.Builder().setTypeExpression(type).build();
-
-    if (value == null || value.isNull()) {
-      jgen.writeNull();
-    } else if (value.isPrimitive()) {
-      primitiveValue(jgen, typeInfo, value.asPrimitive());
-    } else if (value.isEnum()) {
-      jgen.writeString(value.asEnum().get());
-    } else if (value.isGeospatial()) {
-      jgen.writeStartObject();
-      geoSerializer.serialize(jgen, value.asGeospatial().get());
-      jgen.writeEndObject();
-    } else if (value.isCollection()) {
-      collection(jgen, typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(), value.asCollection());
-    } else if (value.isComplex()) {
-      jgen.writeStartObject();
-
-      if (typeInfo != null) {
-        jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_TYPE), typeInfo.external(version));
-      }
-
-      for (Property property : value.asComplex().get()) {
-        valuable(jgen, property, property.getName());
-      }
-      if (value.isLinkedComplex()) {
-        links(value.asLinkedComplex(), jgen);
-      }
-
-      jgen.writeEndObject();
-    }
-  }
-
-  protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException {
-    if (!Constants.VALUE.equals(name) && !(valuable instanceof Annotation) && !valuable.getValue().isComplex()) {
-      String type = valuable.getType();
-      if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) {
-        type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();
-      }
-      if (StringUtils.isNotBlank(type)) {
-        jgen.writeFieldName(
-                name + StringUtils.prependIfMissing(version.getJSONMap().get(ODataServiceVersion.JSON_TYPE), "@"));
-        jgen.writeString(new EdmTypeInfo.Builder().setTypeExpression(type).build().external(version));
-      }
-    }
-
-    if (valuable instanceof Annotatable) {
-      for (Annotation annotation : ((Annotatable) valuable).getAnnotations()) {
-        valuable(jgen, annotation, name + "@" + annotation.getTerm());
-      }
-    }
-
-    jgen.writeFieldName(name);
-    value(jgen, valuable.getType(), valuable.getValue());
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
deleted file mode 100644
index 548d79d..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.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 org.apache.olingo.commons.core.op;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-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.domain.ODataError;
-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.format.ODataPubFormat;
-import org.apache.olingo.commons.api.op.ODataDeserializer;
-import org.apache.olingo.commons.api.op.ODataDeserializerException;
-import org.apache.olingo.commons.core.data.AtomDeserializer;
-import org.apache.olingo.commons.core.data.JsonDeserializer;
-
-import com.fasterxml.aalto.stax.InputFactoryImpl;
-import com.fasterxml.aalto.stax.OutputFactoryImpl;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.InjectableValues;
-import com.fasterxml.jackson.databind.deser.DeserializationProblemHandler;
-import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
-import com.fasterxml.jackson.dataformat.xml.XmlFactory;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-
-public abstract class AbstractODataDeserializer {
-
-  protected final ODataServiceVersion version;
-  protected final ODataDeserializer deserializer;
-
-  public AbstractODataDeserializer(final ODataServiceVersion version, final boolean serverMode, final Format format) {
-    this.version = version;
-    if (format == ODataFormat.XML || format == ODataPubFormat.ATOM) {
-      deserializer = new AtomDeserializer(version);
-    } else {
-      deserializer = new JsonDeserializer(version, serverMode);
-    }
-  }
-
-  public ResWrap<EntitySet> toEntitySet(final InputStream input) throws ODataDeserializerException {
-    return deserializer.toEntitySet(input);
-  }
-
-  public ResWrap<Entity> toEntity(final InputStream input) throws ODataDeserializerException {
-    return deserializer.toEntity(input);
-  }
-
-  public ResWrap<Property> toProperty(final InputStream input) throws ODataDeserializerException {
-    return deserializer.toProperty(input);
-  }
-
-  public ODataError toError(final InputStream input) throws ODataDeserializerException {
-    return deserializer.toError(input);
-  }
-
-  protected XmlMapper getXmlMapper() {
-    final XmlMapper xmlMapper = new XmlMapper(
-        new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
-
-    xmlMapper.setInjectableValues(new InjectableValues.Std().
-        addValue(ODataServiceVersion.class, version).
-        addValue(Boolean.class, Boolean.FALSE));
-
-    xmlMapper.addHandler(new DeserializationProblemHandler() {
-      @Override
-      public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
-          final com.fasterxml.jackson.databind.JsonDeserializer<?> deserializer,
-          final Object beanOrClass, final String propertyName)
-          throws IOException, JsonProcessingException {
-
-        // skip any unknown property
-        ctxt.getParser().skipChildren();
-        return true;
-      }
-    });
-    return xmlMapper;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b15439ff/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/InjectableSerializerProvider.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/InjectableSerializerProvider.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/InjectableSerializerProvider.java
deleted file mode 100644
index 1fed74a..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/InjectableSerializerProvider.java
+++ /dev/null
@@ -1,42 +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.commons.core.op;
-
-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/b15439ff/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AbstractAtomDealer.java
new file mode 100644
index 0000000..5bf98d3
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AbstractAtomDealer.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.serialization;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+abstract class AbstractAtomDealer {
+
+  protected static final String TYPE_TEXT = "text";
+
+  protected final ODataServiceVersion version;
+
+  protected final QName etagQName;
+
+  protected final QName metadataEtagQName;
+
+  protected final QName inlineQName;
+
+  protected final QName actionQName;
+
+  protected final QName propertiesQName;
+
+  protected final QName typeQName;
+
+  protected final QName nullQName;
+
+  protected final QName elementQName;
+
+  protected final QName countQName;
+
+  protected final QName uriQName;
+
+  protected final QName nextQName;
+
+  protected final QName annotationQName;
+
+  protected final QName contextQName;
+
+  protected final QName entryRefQName;
+
+  protected final QName propertyValueQName;
+
+  protected final QName deletedEntryQName;
+
+  protected final QName reasonQName;
+
+  protected final QName linkQName;
+
+  protected final QName deletedLinkQName;
+
+  protected final QName errorCodeQName;
+
+  protected final QName errorMessageQName;
+
+  protected final QName errorTargetQName;
+
+  public AbstractAtomDealer(final ODataServiceVersion version) {
+    this.version = version;
+
+    this.etagQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_ETAG);
+    this.metadataEtagQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_METADATAETAG);
+    this.inlineQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_INLINE);
+    this.actionQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ACTION);
+    this.propertiesQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
+    this.typeQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_TYPE);
+    this.nullQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_NULL);
+    this.elementQName = version.compareTo(ODataServiceVersion.V40) < 0
+            ? new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT)
+            : new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_ELEMENT);
+    this.countQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_COUNT);
+    this.uriQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_URI);
+    this.nextQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.NEXT_LINK_REL);
+    this.annotationQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ANNOTATION);
+    this.contextQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.CONTEXT);
+    this.entryRefQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ENTRY_REF);
+    this.propertyValueQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.VALUE);
+
+    this.deletedEntryQName = new QName(Constants.NS_ATOM_TOMBSTONE, Constants.ATOM_ELEM_DELETED_ENTRY);
+    this.reasonQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_REASON);
+    this.linkQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_LINK);
+    this.deletedLinkQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_DELETED_LINK);
+
+    this.errorCodeQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_CODE);
+    this.errorMessageQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_MESSAGE);
+    this.errorTargetQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_TARGET);
+  }
+
+  protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
+    writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
+    writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
+    writer.writeNamespace(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+    writer.writeNamespace(
+            Constants.PREFIX_DATASERVICES, version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+    writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML);
+    writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS);
+  }
+}