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/04/02 09:33:24 UTC

[05/17] git commit: [OLINGO-168] metadata serialization

[OLINGO-168] metadata serialization


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6fdfc458
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6fdfc458
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6fdfc458

Branch: refs/heads/master
Commit: 6fdfc458b1a51bcc380b7a843b4f7e1cb37f4c09
Parents: 21aa475
Author: Christian Amend <ch...@apache.org>
Authored: Thu Mar 20 14:13:14 2014 +0100
Committer: Christian Amend <ch...@apache.org>
Committed: Mon Mar 24 13:11:43 2014 +0100

----------------------------------------------------------------------
 .../olingo/commons/api/edm/EdmEnumType.java     |   5 +
 .../commons/core/edm/AbstractEdmEnumType.java   |   5 +
 .../apache/olingo/server/api/ODataFormat.java   |  23 --
 .../olingo/server/api/ODataSerializer.java      |  31 --
 .../apache/olingo/server/api/ODataServer.java   |   2 +
 .../server/api/serializer/ODataFormat.java      |  23 ++
 .../server/api/serializer/ODataSerializer.java  |  33 ++
 .../olingo/server/core/CircleStreamBuffer.java  | 327 ---------------
 .../olingo/server/core/ODataJsonSerializer.java | 147 -------
 .../olingo/server/core/ODataSerializerImpl.java |  38 --
 .../olingo/server/core/ODataServerImpl.java     |  10 +-
 .../server/core/edm/provider/EdmActionImpl.java |  16 +-
 .../core/edm/provider/EdmActionImportImpl.java  |  16 +-
 .../core/edm/provider/EdmBindingTargetImpl.java |  20 +-
 .../core/edm/provider/EdmComplexTypeImpl.java   |  20 +-
 .../edm/provider/EdmEntityContainerImpl.java    |   8 +-
 .../core/edm/provider/EdmEntitySetImpl.java     |  16 +-
 .../core/edm/provider/EdmEntityTypeImpl.java    |  22 +-
 .../core/edm/provider/EdmEnumTypeImpl.java      |  22 +-
 .../core/edm/provider/EdmFunctionImpl.java      |  16 +-
 .../edm/provider/EdmKeyPropertyRefImpl.java     |  16 +-
 .../edm/provider/EdmNavigationPropertyImpl.java |  16 +-
 .../edm/provider/EdmOperationImportImpl.java    |   2 +-
 .../core/edm/provider/EdmParameterImpl.java     |  16 +-
 .../core/edm/provider/EdmPropertyImpl.java      |  16 +-
 .../core/edm/provider/EdmReturnTypeImpl.java    |  16 +-
 .../server/core/edm/provider/EdmSchemaImpl.java |   2 +-
 .../edm/provider/EdmServiceMetadataImpl.java    |  18 +-
 .../core/edm/provider/EdmSingletonImpl.java     |  16 +-
 .../provider/EdmStructuredTypeHelperImpl.java   |  16 +-
 .../core/serializer/ODataJsonSerializer.java    |  87 ++++
 .../core/serializer/ODataXmlSerializerImpl.java |  76 ++++
 .../json/ServiceDocumentJsonSerializer.java     | 103 +++++
 .../serializer/utils/CircleStreamBuffer.java    | 327 +++++++++++++++
 .../xml/MetadataDocumentXmlSerializer.java      | 414 +++++++++++++++++++
 .../olingo/server/core/uri/UriInfoImpl.java     |  22 +-
 .../server/core/uri/UriParameterImpl.java       |  16 +-
 .../server/core/uri/UriResourceActionImpl.java  |  16 +-
 .../uri/UriResourceComplexPropertyImpl.java     |  16 +-
 .../server/core/uri/UriResourceCountImpl.java   |  16 +-
 .../core/uri/UriResourceEntitySetImpl.java      |  16 +-
 .../core/uri/UriResourceFunctionImpl.java       |  16 +-
 .../olingo/server/core/uri/UriResourceImpl.java |  16 +-
 .../server/core/uri/UriResourceItImpl.java      |  16 +-
 .../core/uri/UriResourceLambdaAllImpl.java      |  16 +-
 .../core/uri/UriResourceLambdaAnyImpl.java      |  16 +-
 .../core/uri/UriResourceLambdaVarImpl.java      |  16 +-
 .../uri/UriResourceNavigationPropertyImpl.java  |  16 +-
 .../uri/UriResourcePrimitivePropertyImpl.java   |  16 +-
 .../server/core/uri/UriResourceRefImpl.java     |  16 +-
 .../server/core/uri/UriResourceRootImpl.java    |  16 +-
 .../core/uri/UriResourceSingletonImpl.java      |  16 +-
 .../uri/UriResourceStartingTypeFilterImpl.java  |  16 +-
 .../server/core/uri/UriResourceTypedImpl.java   |  16 +-
 .../server/core/uri/UriResourceValueImpl.java   |  16 +-
 .../core/uri/UriResourceWithKeysImpl.java       |  16 +-
 .../olingo/server/core/uri/parser/Parser.java   |   1 -
 .../olingo/server/core/uri/parser/RawUri.java   |  16 +-
 .../server/core/uri/parser/UriContext.java      |  37 +-
 .../core/uri/parser/UriParseTreeVisitor.java    |  65 ++-
 .../core/uri/parser/UriParserException.java     |  16 +-
 .../uri/parser/UriParserSemanticException.java  |  16 +-
 .../uri/parser/UriParserSyntaxException.java    |  16 +-
 .../uri/queryoption/AliasQueryOptionImpl.java   |  16 +-
 .../core/uri/queryoption/CountOptionImpl.java   |  16 +-
 .../uri/queryoption/CustomQueryOptionImpl.java  |  16 +-
 .../core/uri/queryoption/ExpandItemImpl.java    |  29 +-
 .../core/uri/queryoption/ExpandOptionImpl.java  |  16 +-
 .../core/uri/queryoption/FilterOptionImpl.java  |  16 +-
 .../core/uri/queryoption/FormatOptionImpl.java  |  16 +-
 .../core/uri/queryoption/IdOptionImpl.java      |  16 +-
 .../core/uri/queryoption/LevelsOptionImpl.java  |  16 +-
 .../core/uri/queryoption/OrderByItemImpl.java   |  16 +-
 .../core/uri/queryoption/OrderByOptionImpl.java |  16 +-
 .../core/uri/queryoption/QueryOptionImpl.java   |  16 +-
 .../core/uri/queryoption/SearchOptionImpl.java  |  16 +-
 .../core/uri/queryoption/SelectItemImpl.java    |  28 +-
 .../core/uri/queryoption/SelectOptionImpl.java  |  16 +-
 .../core/uri/queryoption/SkipOptionImpl.java    |  16 +-
 .../uri/queryoption/SkipTokenOptionImpl.java    |  16 +-
 .../uri/queryoption/SystemQueryOptionImpl.java  |  18 +-
 .../core/uri/queryoption/TopOptionImpl.java     |  17 +-
 .../uri/queryoption/expression/AliasImpl.java   |  16 +-
 .../uri/queryoption/expression/BinaryImpl.java  |  16 +-
 .../queryoption/expression/EnumerationImpl.java |  16 +-
 .../queryoption/expression/ExpressionImpl.java  |  16 +-
 .../queryoption/expression/LambdaRefImpl.java   |  16 +-
 .../uri/queryoption/expression/LiteralImpl.java |  16 +-
 .../uri/queryoption/expression/MemberImpl.java  |  28 +-
 .../uri/queryoption/expression/MethodImpl.java  |  16 +-
 .../queryoption/expression/TypeLiteralImpl.java |  16 +-
 .../uri/queryoption/expression/UnaryImpl.java   |  16 +-
 .../olingo/server/core/ServiceDocumentTest.java | 133 ------
 .../core/edm/provider/EdmActionImplTest.java    |  18 +-
 .../edm/provider/EdmActionImportImplTest.java   |   2 -
 .../edm/provider/EdmComplexTypeImplTest.java    |  18 +-
 .../provider/EdmEntityContainerImplTest.java    | 100 +++--
 .../core/edm/provider/EdmEntitySetImplTest.java |  19 +-
 .../edm/provider/EdmEntityTypeImplTest.java     |  18 +-
 .../server/core/edm/provider/EdmEnumTest.java   |  18 +-
 .../core/edm/provider/EdmFunctionImplTest.java  |  18 +-
 .../edm/provider/EdmFunctionImportImplTest.java |  19 +-
 .../edm/provider/EdmKeyPropertyRefImplTest.java |  17 +-
 .../core/edm/provider/EdmMemberImplTest.java    |  20 +-
 .../core/edm/provider/EdmNamedImplTest.java     |  16 +-
 .../provider/EdmNavigationPropertyImplTest.java |  18 +-
 .../core/edm/provider/EdmParameterImplTest.java |  18 +-
 .../core/edm/provider/EdmPropertyImplTest.java  |  18 +-
 .../EdmProviderImplOverloadingTest.java         |  17 +-
 .../core/edm/provider/EdmProviderImplTest.java  |  17 +-
 .../edm/provider/EdmReturnTypeImplTest.java     |  18 +-
 .../core/edm/provider/EdmSchemaImplTest.java    |  33 +-
 .../provider/EdmServiceMetadataImplTest.java    |  17 +-
 .../core/edm/provider/EdmSingletonImplTest.java |  19 +-
 .../edm/provider/EdmTypeDefinitionImplTest.java |  18 +-
 .../core/edm/provider/EdmTypeImplTest.java      |  16 +-
 .../serializer/json/ServiceDocumentTest.java    | 133 ++++++
 .../serializer/xml/MetadataDocumentTest.java    |  58 +++
 .../server/core/testutil/EdmTechProvider.java   | 242 ++++++++++-
 .../core/testutil/EdmTechTestProvider.java      |  16 +-
 .../server/core/testutil/StringUtils.java       |   4 +-
 .../olingo/server/core/uri/RawUriTest.java      |  26 +-
 .../olingo/server/core/uri/UriInfoImplTest.java |  19 +-
 .../server/core/uri/UriResourceImplTest.java    |  41 +-
 .../olingo/server/core/uri/antlr/TestLexer.java |  25 +-
 .../core/uri/antlr/TestUriParserImpl.java       |  26 +-
 .../core/uri/queryoption/QueryOptionTest.java   |  34 +-
 .../queryoption/expression/ExpressionTest.java  |  26 +-
 .../core/uri/testutil/ExpandValidator.java      |  30 +-
 .../core/uri/testutil/FilterTreeToText.java     |  16 +-
 .../core/uri/testutil/FilterValidator.java      |  22 +-
 .../core/uri/testutil/ParseTreeToText.java      |  16 +-
 .../core/uri/testutil/ParserValidator.java      |  16 +-
 .../core/uri/testutil/ParserWithLogging.java    |  16 +-
 .../core/uri/testutil/ResourceValidator.java    |  51 +--
 .../core/uri/testutil/TestErrorLogger.java      |  16 +-
 .../core/uri/testutil/TokenValidator.java       |  16 +-
 .../core/uri/testutil/UriLexerWithTrace.java    |  16 +-
 .../server/core/uri/testutil/UriValidator.java  |  27 +-
 .../server/core/uri/testutil/Validator.java     |  16 +-
 140 files changed, 2594 insertions(+), 1893 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
index cca20d9..dc1806d 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
@@ -40,4 +40,9 @@ public interface EdmEnumType extends EdmPrimitiveType {
    * @return the {@link EdmPrimitiveType} this {@link EdmEnumType} is based upon
    */
   EdmPrimitiveType getUnderlyingType();
+
+  /**
+   * @return true if flags is set
+   */
+  boolean isFlags();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java
index 8fcf143..d6f4fd3 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java
@@ -202,5 +202,10 @@ public abstract class AbstractEdmEnumType extends EdmTypeImpl implements EdmEnum
       throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(literal)");
     }
   }
+  
+  @Override
+  public boolean isFlags() {
+    return isFlags;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataFormat.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataFormat.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataFormat.java
deleted file mode 100644
index f3d4bf3..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataFormat.java
+++ /dev/null
@@ -1,23 +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.server.api;
-
-public enum ODataFormat {
-  XML, JSON
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataSerializer.java
deleted file mode 100644
index a6cfe5d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataSerializer.java
+++ /dev/null
@@ -1,31 +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.server.api;
-
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.edm.Edm;
-
-public interface ODataSerializer {
-
-  InputStream metadata(Edm edm);
-
-  InputStream serviceDocument(Edm edm, String serviceRoot);
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java
index 83d20fa..7fce30b 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServer.java
@@ -19,6 +19,8 @@
 package org.apache.olingo.server.api;
 
 import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.server.api.serializer.ODataFormat;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
 
 
 public abstract class ODataServer {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataFormat.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataFormat.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataFormat.java
new file mode 100644
index 0000000..51425d8
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataFormat.java
@@ -0,0 +1,23 @@
+/*
+ * 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.server.api.serializer;
+
+public enum ODataFormat {
+  XML, JSON
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
new file mode 100644
index 0000000..e8a97d7
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
@@ -0,0 +1,33 @@
+/*
+ * 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.server.api.serializer;
+
+import java.io.InputStream;
+
+import org.apache.olingo.commons.api.edm.Edm;
+
+public interface ODataSerializer {
+  
+  public static final String DEFAULT_CHARSET = "UTF-8";
+
+  InputStream serviceDocument(Edm edm, String serviceRoot);
+  
+  InputStream metadataDocument(Edm edm);
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/CircleStreamBuffer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/CircleStreamBuffer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/CircleStreamBuffer.java
deleted file mode 100644
index 6784f87..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/CircleStreamBuffer.java
+++ /dev/null
@@ -1,327 +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.server.core;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.util.Queue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-/**
- * Circular stream buffer to write/read into/from one single buffer.
- * With support of {@link InputStream} and {@link OutputStream} access to buffered data.
- * 
- * 
- */
-public class CircleStreamBuffer {
-
-  private static final int NEW_BUFFER_RESIZE_FACTOR = 2;
-  private static final int READ_EOF = -1;
-  private static final int DEFAULT_CAPACITY = 8192;
-  private static final int MAX_CAPACITY = DEFAULT_CAPACITY * 32;
-
-  private int currentAllocateCapacity = DEFAULT_CAPACITY;
-
-  private boolean writeMode = true;
-  private boolean writeClosed = false;
-  private boolean readClosed = false;
-
-  private Queue<ByteBuffer> bufferQueue = new LinkedBlockingQueue<ByteBuffer>();
-  private ByteBuffer currentWriteBuffer;
-
-  private InternalInputStream inStream;
-  private InternalOutputStream outStream;
-
-  /**
-   * Creates a {@link CircleStreamBuffer} with default buffer size.
-   */
-  public CircleStreamBuffer() {
-    this(DEFAULT_CAPACITY);
-  }
-
-  /**
-   * Create a {@link CircleStreamBuffer} with given buffer size in bytes.
-   * 
-   * @param bufferSize
-   */
-  public CircleStreamBuffer(final int bufferSize) {
-    currentAllocateCapacity = bufferSize;
-    createNewWriteBuffer();
-    inStream = new InternalInputStream(this);
-    outStream = new InternalOutputStream(this);
-  }
-
-  /**
-   * Get {@link InputStream} for data read access.
-   * 
-   * @return the stream
-   */
-  public InputStream getInputStream() {
-    return inStream;
-  }
-
-  /**
-   * Get {@link OutputStream} for write data.
-   * 
-   * @return the stream
-   */
-  public OutputStream getOutputStream() {
-    return outStream;
-  }
-
-  // #############################################
-  // #
-  // # Common parts
-  // #
-  // #############################################
-
-  /**
-   * Closes the write (input) part of the {@link CircleStreamBuffer}.
-   * After this call the buffer can only be read out.
-   */
-  public void closeWrite() {
-    writeClosed = true;
-  }
-
-  /**
-   * Closes the read (output) part of the {@link CircleStreamBuffer}.
-   * After this call it is possible to write into the buffer (but can never be read out).
-   */
-  public void closeRead() {
-    readClosed = true;
-    // clear references to byte buffers
-    ByteBuffer buffer = bufferQueue.poll();
-    while (buffer != null) {
-      buffer.clear();
-      buffer = bufferQueue.poll();
-    }
-  }
-
-  /**
-   * Closes write and read part (and hence the complete buffer).
-   */
-  public void close() {
-    closeWrite();
-    closeRead();
-  }
-
-  private int remaining() throws IOException {
-    if (writeMode) {
-      return currentWriteBuffer.remaining();
-    } else {
-      ByteBuffer toRead = getReadBuffer();
-      if (toRead == null) {
-        return 0;
-      }
-      return toRead.remaining();
-    }
-  }
-
-  // #############################################
-  // #
-  // # Reading parts
-  // #
-  // #############################################
-
-  private ByteBuffer getReadBuffer() throws IOException {
-    if (readClosed) {
-      throw new IOException("Tried to read from closed stream.");
-    }
-
-    boolean next = false;
-    ByteBuffer tmp = null;
-    if (writeMode) {
-      writeMode = false;
-      next = true;
-    } else {
-      tmp = bufferQueue.peek();
-      if (tmp != null && !tmp.hasRemaining()) {
-        tmp = bufferQueue.poll();
-        next = true;
-      }
-    }
-
-    if (next) {
-      tmp = bufferQueue.peek();
-      if (tmp != null) {
-        tmp.flip();
-      }
-      tmp = getReadBuffer();
-    }
-
-    return tmp;
-  }
-
-  private int read(final byte[] b, final int off, final int len) throws IOException {
-    ByteBuffer readBuffer = getReadBuffer();
-    if (readBuffer == null) {
-      return READ_EOF;
-    }
-
-    int toReadLength = readBuffer.remaining();
-    if (len < toReadLength) {
-      toReadLength = len;
-    }
-    readBuffer.get(b, off, toReadLength);
-    return toReadLength;
-  }
-
-  private int read() throws IOException {
-    ByteBuffer readBuffer = getReadBuffer();
-    if (readBuffer == null) {
-      return READ_EOF;
-    }
-
-    return readBuffer.get();
-  }
-
-  // #############################################
-  // #
-  // # Writing parts
-  // #
-  // #############################################
-
-  private void write(final byte[] data, final int off, final int len) throws IOException {
-    ByteBuffer writeBuffer = getWriteBuffer(len);
-    writeBuffer.put(data, off, len);
-  }
-
-  private ByteBuffer getWriteBuffer(final int size) throws IOException {
-    if (writeClosed) {
-      throw new IOException("Tried to write into closed stream.");
-    }
-
-    if (writeMode) {
-      if (remaining() < size) {
-        createNewWriteBuffer(size);
-      }
-    } else {
-      writeMode = true;
-      createNewWriteBuffer();
-    }
-
-    return currentWriteBuffer;
-  }
-
-  private void write(final int b) throws IOException {
-    ByteBuffer writeBuffer = getWriteBuffer(1);
-    writeBuffer.put((byte) b);
-  }
-
-  private void createNewWriteBuffer() {
-    createNewWriteBuffer(currentAllocateCapacity);
-  }
-
-  /**
-   * Creates a new buffer (per {@link #allocateBuffer(int)}) with the requested capacity as minimum capacity, add the
-   * new allocated
-   * buffer to the {@link #bufferQueue} and set it as {@link #currentWriteBuffer}.
-   * 
-   * @param requestedCapacity minimum capacity for new allocated buffer
-   */
-  private void createNewWriteBuffer(final int requestedCapacity) {
-    ByteBuffer b = allocateBuffer(requestedCapacity);
-    bufferQueue.add(b);
-    currentWriteBuffer = b;
-  }
-
-  /**
-   * 
-   * @param requestedCapacity
-   * @return the buffer
-   */
-  private ByteBuffer allocateBuffer(final int requestedCapacity) {
-    int allocateCapacity = requestedCapacity;
-    if (allocateCapacity < currentAllocateCapacity) {
-      allocateCapacity = currentAllocateCapacity * NEW_BUFFER_RESIZE_FACTOR;
-    }
-    if (allocateCapacity > MAX_CAPACITY) {
-      allocateCapacity = MAX_CAPACITY;
-    }
-    // update current
-    currentAllocateCapacity = allocateCapacity;
-    return ByteBuffer.allocate(allocateCapacity);
-  }
-
-  // #############################################
-  // #
-  // # Inner classes (streams)
-  // #
-  // #############################################
-
-  /**
-   * 
-   */
-  private static class InternalInputStream extends InputStream {
-
-    private final CircleStreamBuffer inBuffer;
-
-    public InternalInputStream(final CircleStreamBuffer csBuffer) {
-      inBuffer = csBuffer;
-    }
-
-    @Override
-    public int available() throws IOException {
-      return inBuffer.remaining();
-    }
-
-    @Override
-    public int read() throws IOException {
-      return inBuffer.read();
-    }
-
-    @Override
-    public int read(final byte[] b, final int off, final int len) throws IOException {
-      return inBuffer.read(b, off, len);
-    }
-
-    @Override
-    public void close() throws IOException {
-      inBuffer.closeRead();
-    }
-  }
-
-  /**
-   * 
-   */
-  private static class InternalOutputStream extends OutputStream {
-    private final CircleStreamBuffer outBuffer;
-
-    public InternalOutputStream(final CircleStreamBuffer csBuffer) {
-      outBuffer = csBuffer;
-    }
-
-    @Override
-    public void write(final int b) throws IOException {
-      outBuffer.write(b);
-    }
-
-    @Override
-    public void write(final byte[] b, final int off, final int len) throws IOException {
-      outBuffer.write(b, off, len);
-    }
-
-    @Override
-    public void close() throws IOException {
-      outBuffer.closeWrite();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataJsonSerializer.java
deleted file mode 100644
index 57a0d84..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataJsonSerializer.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 org.apache.olingo.server.core;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.server.api.ODataSerializer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
-
-public class ODataJsonSerializer implements ODataSerializer {
-
-  private static final Logger log = LoggerFactory.getLogger(ODataJsonSerializer.class);
-
-  private static final String DEFAULT_CHARSET = "UTF-8";
-
-  public static final String ODATA_CONTEXT = "@odata.context";
-  public static final String METADATA = "$metadata";
-  public static final String VALUE = "value";
-  public static final String NAME = "name";
-  public static final String URL = "url";
-  public static final String KIND = "kind";
-
-  public static final String FUNCTION_IMPORT = "FunctionImport";
-  public static final String SINGLETON = "Singleton";
-  public static final String SERVICE_DOCUMENT = "ServiceDocument";
-
-  @Override
-  public InputStream metadata(Edm edm) {
-    throw new ODataRuntimeException("Metadata in JSON format not supported!");
-  }
-
-  @Override
-  public InputStream serviceDocument(Edm edm, String serviceRoot) {
-    CircleStreamBuffer buffer;
-    BufferedWriter writer;
-    JsonFactory factory;
-    JsonGenerator gen = null;
-
-    try {
-      buffer = new CircleStreamBuffer();
-      writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET));
-      factory = new JsonFactory();
-      gen = factory.createGenerator(writer);
-
-      gen.setPrettyPrinter(new DefaultPrettyPrinter());
-
-      gen.writeStartObject();
-
-      Object metadataUri = serviceRoot + "/" + METADATA;
-      gen.writeObjectField(ODATA_CONTEXT, metadataUri);
-      gen.writeArrayFieldStart(VALUE);
-
-      writeEntitySets(gen, edm);
-      writeFunctionImports(gen, edm);
-      writeSingletons(gen, edm);
-
-      gen.close();
-
-//      writer.flush();
-//      buffer.closeWrite();
-
-      return buffer.getInputStream();
-
-    } catch (Exception e) {
-      log.error(e.getMessage(), e);
-      throw new ODataRuntimeException(e);
-    } finally {
-      if (gen != null) {
-        try {
-          gen.close();
-        } catch (IOException e) {
-          throw new ODataRuntimeException(e);
-        }
-      }
-    }
-  }
-
-  private void writeEntitySets(JsonGenerator gen, Edm edm) throws JsonGenerationException, IOException {
-    EdmEntityContainer container = edm.getEntityContainer(null);
-
-    for (EdmEntitySet edmEntitySet : container.getEntitySets()) {
-      if (edmEntitySet.isIncludeInServiceDocument()) {
-        gen.writeStartObject();
-        gen.writeObjectField(NAME, edmEntitySet.getName());
-        gen.writeObjectField(URL, edmEntitySet.getName());
-        gen.writeEndObject();
-      }
-    }
-  }
-
-  private void writeFunctionImports(JsonGenerator gen, Edm edm) throws JsonGenerationException, IOException {
-    EdmEntityContainer container = edm.getEntityContainer(null);
-
-    for (EdmFunctionImport edmFunctionImport : container.getFunctionImports()) {
-      if (edmFunctionImport.isIncludeInServiceDocument()) {
-        gen.writeStartObject();
-        gen.writeObjectField(NAME, edmFunctionImport.getName());
-        gen.writeObjectField(URL, edmFunctionImport.getName());
-        gen.writeObjectField(KIND, FUNCTION_IMPORT);
-        gen.writeEndObject();
-      }
-    }
-  }
-
-  private void writeSingletons(JsonGenerator gen, Edm edm) throws JsonGenerationException, IOException {
-    EdmEntityContainer container = edm.getEntityContainer(null);
-
-    for (EdmSingleton edmSingleton : container.getSingletons()) {
-      gen.writeStartObject();
-      gen.writeObjectField(NAME, edmSingleton.getName());
-      gen.writeObjectField(URL, edmSingleton.getName());
-      gen.writeObjectField(KIND, SINGLETON);
-      gen.writeEndObject();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataSerializerImpl.java
deleted file mode 100644
index 3950e0c..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataSerializerImpl.java
+++ /dev/null
@@ -1,38 +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.server.core;
-
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.server.api.ODataSerializer;
-
-public class ODataSerializerImpl implements ODataSerializer {
-
-  @Override
-  public InputStream metadata(Edm edm) {
-       return null;
-  }
-
-  @Override
-  public InputStream serviceDocument(Edm edm, String serviceRoot) {
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java
index a634b2e..7beb90d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataServerImpl.java
@@ -19,21 +19,23 @@
 package org.apache.olingo.server.core;
 
 import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.server.api.ODataFormat;
-import org.apache.olingo.server.api.ODataSerializer;
 import org.apache.olingo.server.api.ODataServer;
+import org.apache.olingo.server.api.serializer.ODataFormat;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.core.serializer.ODataJsonSerializer;
+import org.apache.olingo.server.core.serializer.ODataXmlSerializerImpl;
 
 public class ODataServerImpl extends ODataServer {
 
   @Override
-  public ODataSerializer getSerializer(ODataFormat format) {
+  public ODataSerializer getSerializer(final ODataFormat format) {
     ODataSerializer serializer;
     switch (format) {
     case JSON:
       serializer = new ODataJsonSerializer();
       break;
     case XML:
-      serializer = new ODataSerializerImpl();
+      serializer = new ODataXmlSerializerImpl();
       break;
     default:
       throw new ODataRuntimeException("Unsupported format: " + format);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java
index 511890b..e96e165 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java
index 991d348..36eabb3 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
index 9cbfa68..c1aacb1 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -46,8 +46,8 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
     final List<NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
     if (navigationPropertyBindings != null) {
       boolean found = false;
-      for (final Iterator<NavigationPropertyBinding> itor = navigationPropertyBindings.iterator();
-              itor.hasNext() && !found;) {
+      for (final Iterator<NavigationPropertyBinding> itor = navigationPropertyBindings.iterator(); itor.hasNext()
+          && !found;) {
 
         final NavigationPropertyBinding binding = itor.next();
         if (binding.getPath().equals(path)) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
index 281bb6f..c818c58 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -33,7 +33,7 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
   private final EdmStructuredTypeHelper helper;
 
   public static EdmComplexTypeImpl getInstance(
-          final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
+      final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
 
     final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, name, complexType);
     instance.baseType = instance.buildBaseType(complexType.getBaseType());
@@ -43,7 +43,7 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
 
   private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
     super(edm, name, complexType.getBaseType());
-    this.helper = new EdmStructuredTypeHelperImpl(edm, complexType);
+    helper = new EdmStructuredTypeHelperImpl(edm, complexType);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
index 4199e08..7c81980 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
@@ -49,11 +49,11 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
     this.provider = provider;
   }
 
-  public EdmEntityContainerImpl(Edm edm, EdmProvider provider, FullQualifiedName containerFQN,
-      EntityContainer entityContainer) {
+  public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
+      final EntityContainer entityContainer) {
     super(edm, containerFQN);
     this.provider = provider;
-    this.container = entityContainer;
+    container = entityContainer;
   }
 
   @Override
@@ -186,7 +186,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
         container = provider.getEntityContainer();
         if (container == null) {
           // TODO: Should we throw an exception here?
-          container = new EntityContainer().setName(this.getName());
+          container = new EntityContainer().setName(getName());
         }
       } catch (ODataException e) {
         throw new EdmException(e);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java
index 492095b..6805117 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
index 8bb8c2d..774af98 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -38,14 +38,14 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
   private final EdmStructuredTypeHelper helper;
 
   public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name,
-          final EntityType entityType) {
+      final EntityType entityType) {
 
     final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, name, entityType);
     instance.baseType = instance.buildBaseType(entityType.getBaseType());
 
     if (instance.baseType == null) {
       instance.entityBaseType = null;
-      
+
       final List<PropertyRef> key = entityType.getKey();
       if (key != null) {
         final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>();
@@ -64,7 +64,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
   private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
     super(edm, name, entityType.getBaseType(), entityType.hasStream());
 
-    this.helper = new EdmStructuredTypeHelperImpl(edm, entityType);
+    helper = new EdmStructuredTypeHelperImpl(edm, entityType);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
index faceb0e..f5fa71f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -39,10 +39,10 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
     super(edm, enumName, enumType.isFlags());
 
     if (enumType.getUnderlyingType() == null) {
-      this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+      underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
     } else {
-      this.underlyingType = EdmPrimitiveTypeKind.valueOf(
-              enumType.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
+      underlyingType = EdmPrimitiveTypeKind.valueOf(
+          enumType.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
       // TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java
index c03bbea..f23e0a8 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java
index 3b7cc0f..0660ac0 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
index 58c0258..7f570da 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java
index f2badd7..afb6d96 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java
@@ -25,7 +25,7 @@ import org.apache.olingo.server.api.edm.provider.OperationImport;
 
 public abstract class EdmOperationImportImpl extends AbstractEdmOperationImport {
 
-  public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container, 
+  public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container,
       final OperationImport operationImport) {
     super(edm, container, operationImport.getName(), operationImport.getEntitySet());
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java
index d47b870..ce46b9e 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java
index 20cafdf..2fb4944 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java
index 37ad8bd..c810ba7 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
index af98a41..34d34b4 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
@@ -46,7 +46,7 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
   private final Edm edm;
   private final EdmProvider provider;
 
-  public EdmSchemaImpl(Edm edm, EdmProvider provider, Schema schema) {
+  public EdmSchemaImpl(final Edm edm, final EdmProvider provider, final Schema schema) {
     super(schema.getNamespace(), schema.getAlias());
     this.edm = edm;
     this.provider = provider;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java
index 42ed8ee..ed6c799 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmServiceMetadataImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -175,7 +175,7 @@ public class EdmServiceMetadataImpl implements EdmServiceMetadata {
             if (functionImports != null) {
               for (FunctionImport functionImport : functionImports) {
                 functionImportInfos.add(
-                        new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName()));
+                    new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName()));
               }
             }
           }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java
index 3ad9d13..6f9bb78 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java
@@ -1,18 +1,18 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
index d2ded33..cc12769 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
@@ -1,18 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -64,7 +64,7 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
       if (structuredType.getNavigationProperties() != null) {
         for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
           navigationProperties.put(navigationProperty.getName(),
-                  new EdmNavigationPropertyImpl(edm, navigationProperty));
+              new EdmNavigationPropertyImpl(edm, navigationProperty));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataJsonSerializer.java
new file mode 100644
index 0000000..333d5b7
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataJsonSerializer.java
@@ -0,0 +1,87 @@
+/*
+ * 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.server.core.serializer;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+
+import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.core.serializer.json.ServiceDocumentJsonSerializer;
+import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
+
+public class ODataJsonSerializer implements ODataSerializer {
+
+  private static final Logger log = LoggerFactory.getLogger(ODataJsonSerializer.class);
+
+  @Override
+  public InputStream serviceDocument(final Edm edm, final String serviceRoot) {
+    CircleStreamBuffer buffer;
+    BufferedWriter writer;
+    JsonFactory factory;
+    JsonGenerator gen = null;
+
+    // TODO: move stream initialization into separate method
+    try {
+      buffer = new CircleStreamBuffer();
+      writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET));
+      factory = new JsonFactory();
+
+      gen = factory.createGenerator(writer);
+      gen.setPrettyPrinter(new DefaultPrettyPrinter());
+
+      ServiceDocumentJsonSerializer serializer = new ServiceDocumentJsonSerializer(edm, serviceRoot);
+      serializer.writeServiceDocument(gen);
+
+      gen.close();
+
+      // TODO: Check correct stream handling
+      // writer.flush();
+      // buffer.closeWrite();
+
+      return buffer.getInputStream();
+
+    } catch (Exception e) {
+      log.error(e.getMessage(), e);
+      throw new ODataRuntimeException(e);
+    } finally {
+      if (gen != null) {
+        try {
+          gen.close();
+        } catch (IOException e) {
+          throw new ODataRuntimeException(e);
+        }
+      }
+    }
+  }
+
+  @Override
+  public InputStream metadataDocument(final Edm edm) {
+    throw new ODataRuntimeException("Metadata in JSON format not supported!");
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java
new file mode 100644
index 0000000..4790446
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java
@@ -0,0 +1,76 @@
+/*
+ * 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.server.core.serializer;
+
+import java.io.BufferedWriter;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
+import org.apache.olingo.server.core.serializer.xml.MetadataDocumentXmlSerializer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ODataXmlSerializerImpl implements ODataSerializer {
+
+  private static final Logger log = LoggerFactory.getLogger(ODataXmlSerializerImpl.class);
+
+  @Override
+  public InputStream serviceDocument(final Edm edm, final String serviceRoot) {
+    throw new ODataRuntimeException("Service Document not implemented for XML format");
+  }
+
+  @Override
+  public InputStream metadataDocument(final Edm edm) {
+    CircleStreamBuffer buffer;
+    BufferedWriter writer;
+    XMLStreamWriter xmlStreamWriter = null;
+
+    // TODO: move stream initialization into separate method
+    try {
+      buffer = new CircleStreamBuffer();
+      writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET));
+      xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
+      MetadataDocumentXmlSerializer serializer = new MetadataDocumentXmlSerializer(edm);
+      serializer.writeMetadataDocument(xmlStreamWriter);
+      xmlStreamWriter.close();
+
+      return buffer.getInputStream();
+    } catch (Exception e) {
+      log.error(e.getMessage(), e);
+      throw new ODataRuntimeException(e);
+    } finally {
+      if (xmlStreamWriter != null) {
+        try {
+          xmlStreamWriter.close();
+        } catch (XMLStreamException e) {
+          throw new ODataRuntimeException(e);
+        }
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
new file mode 100644
index 0000000..00d853d
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
@@ -0,0 +1,103 @@
+/*
+ * 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.server.core.serializer.json;
+
+import java.io.IOException;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonGenerator;
+
+public class ServiceDocumentJsonSerializer {
+  public static final String ODATA_CONTEXT = "@odata.context";
+  public static final String METADATA = "$metadata";
+  public static final String VALUE = "value";
+  public static final String NAME = "name";
+  public static final String URL = "url";
+  public static final String KIND = "kind";
+
+  public static final String FUNCTION_IMPORT = "FunctionImport";
+  public static final String SINGLETON = "Singleton";
+  public static final String SERVICE_DOCUMENT = "ServiceDocument";
+
+  private final Edm edm;
+  private final String serviceRoot;
+
+  public ServiceDocumentJsonSerializer(final Edm edm, final String serviceRoot) {
+    this.edm = edm;
+    this.serviceRoot = serviceRoot;
+  }
+
+  public void writeServiceDocument(final JsonGenerator gen) throws JsonGenerationException, IOException {
+    gen.writeStartObject();
+
+    Object metadataUri = serviceRoot + "/" + METADATA;
+    gen.writeObjectField(ODATA_CONTEXT, metadataUri);
+    gen.writeArrayFieldStart(VALUE);
+
+    writeEntitySets(gen, edm);
+    writeFunctionImports(gen, edm);
+    writeSingletons(gen, edm);
+  }
+
+  private void writeEntitySets(final JsonGenerator gen, final Edm edm) throws JsonGenerationException, IOException {
+    EdmEntityContainer container = edm.getEntityContainer(null);
+
+    for (EdmEntitySet edmEntitySet : container.getEntitySets()) {
+      if (edmEntitySet.isIncludeInServiceDocument()) {
+        gen.writeStartObject();
+        gen.writeObjectField(NAME, edmEntitySet.getName());
+        gen.writeObjectField(URL, edmEntitySet.getName());
+        gen.writeEndObject();
+      }
+    }
+  }
+
+  private void writeFunctionImports(final JsonGenerator gen, final Edm edm) throws JsonGenerationException, 
+  IOException {
+    EdmEntityContainer container = edm.getEntityContainer(null);
+
+    for (EdmFunctionImport edmFunctionImport : container.getFunctionImports()) {
+      if (edmFunctionImport.isIncludeInServiceDocument()) {
+        gen.writeStartObject();
+        gen.writeObjectField(NAME, edmFunctionImport.getName());
+        gen.writeObjectField(URL, edmFunctionImport.getName());
+        gen.writeObjectField(KIND, FUNCTION_IMPORT);
+        gen.writeEndObject();
+      }
+    }
+  }
+
+  private void writeSingletons(final JsonGenerator gen, final Edm edm) throws JsonGenerationException, IOException {
+    EdmEntityContainer container = edm.getEntityContainer(null);
+
+    for (EdmSingleton edmSingleton : container.getSingletons()) {
+      gen.writeStartObject();
+      gen.writeObjectField(NAME, edmSingleton.getName());
+      gen.writeObjectField(URL, edmSingleton.getName());
+      gen.writeObjectField(KIND, SINGLETON);
+      gen.writeEndObject();
+    }
+  }
+}