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:23 UTC

[04/17] [OLINGO-168] metadata serialization

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
new file mode 100644
index 0000000..3bf8a7a
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
@@ -0,0 +1,327 @@
+/*
+ * 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.utils;
+
+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/serializer/xml/MetadataDocumentXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
new file mode 100644
index 0000000..b7f6015
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
@@ -0,0 +1,414 @@
+/*
+ * 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.xml;
+
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmParameter;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.EdmType;
+
+public class MetadataDocumentXmlSerializer {
+
+  private final Edm edm;
+
+  private final static String EDMX = "Edmx";
+  private final static String PREFIX_EDMX = "edmx";
+  private final static String NS_EDMX = "http://docs.oasis-open.org/odata/ns/edmx";
+
+  private final static String NS_EDM = "http://docs.oasis-open.org/odata/ns/edm";
+
+  public MetadataDocumentXmlSerializer(final Edm edm) {
+    this.edm = edm;
+  }
+
+  public void writeMetadataDocument(final XMLStreamWriter writer) throws XMLStreamException {
+    writer.writeStartDocument();
+    writer.setPrefix(PREFIX_EDMX, NS_EDMX);
+    writer.setDefaultNamespace(NS_EDMX);
+    writer.writeStartElement(PREFIX_EDMX, EDMX, NS_EDMX);
+    writer.writeAttribute("Version", "4.0");
+    writer.writeNamespace(PREFIX_EDMX, NS_EDMX);
+
+    appendReference(writer);
+    appendDataServices(writer);
+
+    writer.writeEndDocument();
+
+  }
+
+  private void appendDataServices(final XMLStreamWriter writer) throws XMLStreamException {
+    writer.setDefaultNamespace(NS_EDM);
+//    writer.writeStartElement(PREFIX_EDM, "DataServices", NS_EDMX);
+    writer.writeStartElement(NS_EDMX, "DataServices");
+    for (EdmSchema schema : edm.getSchemas()) {
+      appendSchema(writer, schema);
+    }
+    writer.writeEndElement();
+  }
+
+  private void appendSchema(final XMLStreamWriter writer, final EdmSchema schema) throws XMLStreamException {
+    writer.writeStartElement(NS_EDM, "Schema");
+    writer.writeDefaultNamespace(NS_EDM);
+    writer.writeAttribute("Namespace", schema.getNamespace());
+    writer.writeAttribute("Alias", schema.getAlias());
+
+    // EnumTypes
+    appendEnumTypes(writer, schema.getEnumTypes());
+
+    // EntityTypes
+    appendEntityTypes(writer, schema.getEntityTypes());
+
+    // ComplexTypes
+    appendComplexTypes(writer, schema.getComplexTypes());
+
+    // TypeDefinitions
+    // TODO: TypeDefinitions
+
+    // Actions
+    appendActions(writer, schema.getActions());
+
+    // Functions
+    appendFunctions(writer, schema.getFunctions());
+
+    // EntityContainer
+    appendEntityContainer(writer, schema.getEntityContainer());
+
+    writer.writeEndElement();
+  }
+
+  private void appendEntityContainer(final XMLStreamWriter writer, final EdmEntityContainer container)
+      throws XMLStreamException {
+    if (container != null) {
+      writer.writeStartElement("EntityContainer");
+
+      writer.writeAttribute("Name", container.getName());
+      // TODO: extends attribute
+
+      // EntitySets
+      appendEntitySets(writer, container.getEntitySets());
+
+      // Singletons
+      appendSingletons(writer, container.getSingletons());
+
+      // ActionImports
+      appendActionImports(writer, container.getActionImports());
+
+      // FunctionImports
+      appendFunctionImports(writer, container.getFunctionImports(), container.getNamespace());
+
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendFunctionImports(final XMLStreamWriter writer, final List<EdmFunctionImport> functionImports,
+      final String containerNamespace) throws XMLStreamException {
+    for (EdmFunctionImport functionImport : functionImports) {
+      writer.writeStartElement("FunctionImport");
+      writer.writeAttribute("Name", functionImport.getName());
+      writer.writeAttribute("Function", functionImport.getFunctionFqn().getFullQualifiedNameAsString());
+      EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet();
+      if (returnedEntitySet != null) {
+        writer.writeAttribute("EntitySet", containerNamespace + "." + returnedEntitySet.getName());
+      }
+      writer.writeAttribute("IncludeInServiceDocument", "" + functionImport.isIncludeInServiceDocument());
+
+      // TODO: Annotations
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendActionImports(final XMLStreamWriter writer, final List<EdmActionImport> actionImports)
+      throws XMLStreamException {
+    for (EdmActionImport actionImport : actionImports) {
+      writer.writeStartElement("ActionImport");
+      writer.writeAttribute("Name", actionImport.getName());
+      writer.writeAttribute("Action", getFullQualifiedName(actionImport.getAction(), false));
+      // TODO: Annotations
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendSingletons(final XMLStreamWriter writer, final List<EdmSingleton> singletons)
+      throws XMLStreamException {
+    // TODO: Merge with entity set method
+    for (EdmSingleton singleton : singletons) {
+      writer.writeStartElement("Singleton");
+      writer.writeAttribute("Name", singleton.getName());
+      writer.writeAttribute("EntityType", getFullQualifiedName(singleton.getEntityType(), false));
+
+      // TODO: NavigationProperty Bindigs at edm api level
+
+      // TODO: Annotations
+      writer.writeEndElement();
+    }
+
+  }
+
+  private void appendEntitySets(final XMLStreamWriter writer, final List<EdmEntitySet> entitySets)
+      throws XMLStreamException {
+    for (EdmEntitySet entitySet : entitySets) {
+      writer.writeStartElement("EntitySet");
+      writer.writeAttribute("Name", entitySet.getName());
+      writer.writeAttribute("EntityType", getFullQualifiedName(entitySet.getEntityType(), false));
+
+      // TODO: NavigationProperty Bindigs at edm api level
+
+      // TODO: Annotations
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendFunctions(final XMLStreamWriter writer, final List<EdmFunction> functions)
+      throws XMLStreamException {
+    for (EdmFunction function : functions) {
+      writer.writeStartElement("Function");
+      writer.writeAttribute("Name", function.getName());
+      writer.writeAttribute("IsBound", "" + function.isBound());
+      writer.writeAttribute("IsComposable", "" + function.isComposable());
+
+      // TODO: move to separate method like for actions
+      for (String parameterName : function.getParameterNames()) {
+        EdmParameter parameter = function.getParameter(parameterName);
+        writer.writeEmptyElement("Parameter");
+        writer.writeAttribute("Name", parameterName);
+        writer.writeAttribute("Type", getFullQualifiedName(parameter.getType(), parameter.isCollection()));
+        // TODO: Parameter facets
+      }
+
+      EdmReturnType returnType = function.getReturnType();
+      if (returnType != null) {
+        writer.writeEmptyElement("ReturnType");
+        writer.writeAttribute("Type", getFullQualifiedName(returnType.getType(), returnType.isCollection()));
+        // TODO: Return type facets
+      }
+
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendActions(final XMLStreamWriter writer, final List<EdmAction> actions) throws XMLStreamException {
+    for (EdmAction action : actions) {
+      writer.writeStartElement("Action");
+      writer.writeAttribute("Name", action.getName());
+      writer.writeAttribute("IsBound", "" + action.isBound());
+
+      for (String parameterName : action.getParameterNames()) {
+        EdmParameter parameter = action.getParameter(parameterName);
+        writer.writeEmptyElement("Parameter");
+        writer.writeAttribute("Name", parameterName);
+        writer.writeAttribute("Type", getFullQualifiedName(parameter.getType(), parameter.isCollection()));
+        // TODO: Parameter facets
+      }
+
+      EdmReturnType returnType = action.getReturnType();
+      if (returnType != null) {
+        writer.writeEmptyElement("ReturnType");
+        writer.writeAttribute("Type", getFullQualifiedName(returnType.getType(), returnType.isCollection()));
+        // TODO: Return type facets
+      }
+
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendComplexTypes(final XMLStreamWriter writer, final List<EdmComplexType> complexTypes)
+      throws XMLStreamException {
+    for (EdmComplexType complexType : complexTypes) {
+      writer.writeStartElement("ComplexType");
+      writer.writeAttribute("Name", complexType.getName());
+
+      if (complexType.getBaseType() != null) {
+        writer.writeAttribute("BaseType", getFullQualifiedName(complexType.getBaseType(), false));
+      }
+
+      appendProperties(writer, complexType);
+
+      appendNavigationProperties(writer, complexType);
+
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendEntityTypes(final XMLStreamWriter writer, final List<EdmEntityType> entityTypes)
+      throws XMLStreamException {
+    for (EdmEntityType entityType : entityTypes) {
+      writer.writeStartElement("EntityType");
+      writer.writeAttribute("Name", entityType.getName());
+
+      if (entityType.hasStream()) {
+        writer.writeAttribute("HasStream", "" + entityType.hasStream());
+      }
+
+      if (entityType.getBaseType() != null) {
+        writer.writeAttribute("BaseType", getFullQualifiedName(entityType.getBaseType(), false));
+      }
+
+      appendKey(writer, entityType);
+
+      appendProperties(writer, entityType);
+
+      appendNavigationProperties(writer, entityType);
+
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendNavigationProperties(final XMLStreamWriter writer, final EdmStructuredType type)
+      throws XMLStreamException {
+    List<String> navigationPropertyNames = type.getNavigationPropertyNames();
+    if (type.getBaseType() != null) {
+      navigationPropertyNames.removeAll(type.getBaseType().getNavigationPropertyNames());
+    }
+    for (String navigationPropertyName : navigationPropertyNames) {
+      EdmNavigationProperty navigationProperty = type.getNavigationProperty(navigationPropertyName);
+
+      writer.writeEmptyElement("NavigationProperty");
+      writer.writeAttribute("Name", navigationPropertyName);
+      writer.writeAttribute("Type", getFullQualifiedName(navigationProperty.getType(), navigationProperty
+          .isCollection()));
+      if (navigationProperty.isNullable() != null) {
+        writer.writeAttribute("Nullable", "" + navigationProperty.isNullable());
+      }
+
+      if (navigationProperty.getPartner() != null) {
+        EdmNavigationProperty partner = navigationProperty.getPartner();
+        writer.writeAttribute("Partner", partner.getName());
+      }
+    }
+  }
+
+  private void appendProperties(final XMLStreamWriter writer, final EdmStructuredType type) throws XMLStreamException {
+    List<String> propertyNames = type.getPropertyNames();
+    if (type.getBaseType() != null) {
+      propertyNames.removeAll(type.getBaseType().getPropertyNames());
+    }
+    for (String propertyName : propertyNames) {
+      EdmProperty property = type.getStructuralProperty(propertyName);
+      writer.writeEmptyElement("Property");
+      writer.writeAttribute("Name", propertyName);
+      writer.writeAttribute("Type", getFullQualifiedName(property.getType(), property.isCollection()));
+
+      // Facets
+      if (property.isNullable() != null) {
+        writer.writeAttribute("Nullable", "" + property.isNullable());
+      }
+
+      if (property.isUnicode() != null) {
+        writer.writeAttribute("Unicode", "" + property.isUnicode());
+      }
+
+      if (property.getDefaultValue() != null) {
+        writer.writeAttribute("DefaultValue", property.getDefaultValue());
+      }
+
+      if (property.getMaxLength() != null) {
+        writer.writeAttribute("MaxLength", "" + property.getMaxLength());
+      }
+
+      if (property.getPrecision() != null) {
+        writer.writeAttribute("Precision", "" + property.getPrecision());
+      }
+
+      if (property.getScale() != null) {
+        writer.writeAttribute("Scale", "" + property.getScale());
+      }
+    }
+  }
+
+  private void appendKey(final XMLStreamWriter writer, final EdmEntityType entityType) throws XMLStreamException {
+    List<EdmKeyPropertyRef> keyPropertyRefs = entityType.getKeyPropertyRefs();
+    if (keyPropertyRefs != null && !keyPropertyRefs.isEmpty()) {
+      writer.writeStartElement("Key");
+      for (EdmKeyPropertyRef keyRef : keyPropertyRefs) {
+        writer.writeEmptyElement("PropertyRef");
+        String keyName = null;
+        if (keyRef.getPath() != null) {
+          keyName = keyRef.getPath() + "/" + keyRef.getKeyPropertyName();
+        } else {
+          keyName = keyRef.getKeyPropertyName();
+        }
+        writer.writeAttribute("Name", keyName);
+
+        if (keyRef.getAlias() != null) {
+          writer.writeAttribute("Alias", keyRef.getAlias());
+        }
+      }
+      writer.writeEndElement();
+    }
+  }
+
+  private void appendEnumTypes(final XMLStreamWriter writer, final List<EdmEnumType> enumTypes)
+      throws XMLStreamException {
+    for (EdmEnumType enumType : enumTypes) {
+      writer.writeStartElement("EnumType");
+      writer.writeAttribute("Name", enumType.getName());
+      writer.writeAttribute("isFlags", "" + enumType.isFlags());
+      writer.writeAttribute("UnderlyingType", getFullQualifiedName(enumType.getUnderlyingType(), false));
+
+      for (String memberName : enumType.getMemberNames()) {
+        writer.writeEmptyElement("Member");
+        writer.writeAttribute("Name", memberName);
+        writer.writeAttribute("Value", enumType.getMember(memberName).getValue());
+      }
+
+      writer.writeEndElement();
+    }
+  }
+
+  private String getFullQualifiedName(final EdmType type, final boolean isCollection) {
+    if (isCollection) {
+      return "Collection(" + type.getNamespace() + "." + type.getName() + ")";
+    } else {
+      return type.getNamespace() + "." + type.getName();
+    }
+  }
+
+  private void appendReference(final XMLStreamWriter writer) throws XMLStreamException {
+    writer.writeStartElement(NS_EDMX, "Reference");
+    // TODO: Where is this value comming from?
+    writer.writeAttribute("Uri", "http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml");
+    writer.writeEmptyElement(NS_EDMX, "Include");
+    // TODO: Where is this value comming from?
+    writer.writeAttribute("Namespace", "Org.OData.Core.V1");
+    // TODO: Where is this value comming from?
+    writer.writeAttribute("Alias", "Core");
+    writer.writeEndElement();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
index a04b55f..eedefce 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.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.
  */
@@ -289,8 +289,8 @@ public class UriInfoImpl implements UriInfo {
     return this;
   }
 
-  public void removeResourcePart(int index) {
-    this.pathParts.remove(index);
-    
+  public void removeResourcePart(final int index) {
+    pathParts.remove(index);
+
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java
index b267a02..f195dd9 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.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/uri/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java
index d14b7df..8196d03 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.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/uri/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java
index d912d7a..f7a8502 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.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/uri/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java
index 3e673f3..14f43ec 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.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/uri/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java
index 032b43e..bf6d47b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.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/uri/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java
index abb8079..6f23d23 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.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/uri/UriResourceImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java
index e43d30d..9fbcbd0 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.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/uri/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java
index 94810bd..b28ddf8 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.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/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
index a5b81af..db30530 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.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/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
index 65b6a69..bcd5b97 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.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/uri/UriResourceLambdaVarImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java
index 062525a..f71fe04 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.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/uri/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java
index a95228c..3da7aef 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.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/uri/UriResourcePrimitivePropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java
index 88600b3..d599b9b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.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/uri/UriResourceRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java
index d4abf66..a0cdc3e 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.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/uri/UriResourceRootImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java
index 60df6b9..0db0a01 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.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/uri/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java
index 5854708..cc9c606 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.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/uri/UriResourceStartingTypeFilterImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java
index 6efe6a3..152f44c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.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/uri/UriResourceTypedImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java
index b7029fc..d5f01ea 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.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/uri/UriResourceValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java
index d366a90..7611ecb 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.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/uri/UriResourceWithKeysImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java
index f8827fa..22ec7a3 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.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/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index e6a2256..7d9b0d1 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -54,7 +54,6 @@ import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.SkipOptionImpl;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java
index b7500a8..42e0a0f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.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/uri/parser/UriContext.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
index 4460760..ebdcbe3 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.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.
  */
@@ -22,10 +22,6 @@ import java.util.Stack;
 
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
 import org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
 import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
 import org.apache.olingo.server.core.uri.queryoption.SelectItemImpl;
@@ -49,15 +45,24 @@ public class UriContext {
    */
   public Stack<TypeInformation> contextTypes;
   /**
-   * Set within method {@link #visitExpandItem(ExpandPathContext ctx)} and {@link #visitExpandPathExtension(final
+   * Set within method
+   * {@link #visitExpandItem(org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathContext ctx)} and {@link
+   * #visitExpandPathExtension(final
    * ExpandPathExtensionContext ctx)} to allow nodes
-   * deeper in the expand tree at {@link #visitExpandPathExtension(ExpandPathExtensionContext ctx)} appending path
+   * deeper in the expand tree at
+   * {@link #visitExpandPathExtension(
+   * org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext ctx)}
+   * appending path
    * segments to the currently processed {@link ExpandItemImpl}.
    */
   public ExpandItemImpl contextExpandItemPath;
   /**
-   * Set within method {@link #visitSelectItem(SelectItemContext ctx)} to allow nodes
-   * deeper in the expand tree at {@link #visitSelectSegment(SelectSegmentContext ctx)} appending path segments to the
+   * Set within method
+   * {@link #visitSelectItem(org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext ctx)} to allow
+   * nodes
+   * deeper in the expand tree at
+   * {@link #visitSelectSegment(org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext ctx)}
+   * appending path segments to the
    * currently processed {@link SelectItemImpl}.
    */
   public SelectItemImpl contextSelectItem;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
index b3e5d69..38ddf9a 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.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.
  */
@@ -23,7 +23,6 @@ import java.util.List;
 
 import org.antlr.v4.runtime.misc.ParseCancellationException;
 import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNodeImpl;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmAction;
 import org.apache.olingo.commons.api.edm.EdmActionImport;
@@ -70,7 +69,6 @@ import org.apache.olingo.server.core.uri.UriResourceValueImpl;
 import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
 import org.apache.olingo.server.core.uri.antlr.UriLexer;
 import org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AliasAndValueContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllEOFContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAddContext;
@@ -128,7 +126,6 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.NamespaceContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.NaninfinityContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.NullruleContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.Number_in_jsonContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
@@ -157,14 +154,11 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.TopContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.UnaryContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.server.core.uri.queryoption.AliasQueryOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
 import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.OrderByItemImpl;
 import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
@@ -208,8 +202,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       this.isCollection = isCollection;
     }
 
-    public TypeInformation() {
-    }
+    public TypeInformation() {}
   }
 
   public UriContext context = null;
@@ -687,26 +680,26 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     return ret;
   }
 
-  private EdmType removeUriResourceStartingTypeFilterImpl(UriInfoImpl uriInfoImplpath) {
+  private EdmType removeUriResourceStartingTypeFilterImpl(final UriInfoImpl uriInfoImplpath) {
 
     List<UriResource> segments = uriInfoImplpath.getUriResourceParts();
     if (segments.size() == 0) {
       return null;
     }
-    
+
     UriResource segment = segments.get(0);
     if (segment instanceof UriResourceStartingTypeFilterImpl) {
       UriResourceStartingTypeFilterImpl startingTypeFilter = (UriResourceStartingTypeFilterImpl) segment;
-      
+
       EdmType type = null;
-      if (startingTypeFilter.getTypeFilterOnEntry()!= null) {
-         type =startingTypeFilter.getTypeFilterOnEntry();
-      } else if (startingTypeFilter.getTypeFilterOnCollection()!= null) {
-        type =startingTypeFilter.getTypeFilterOnCollection();
+      if (startingTypeFilter.getTypeFilterOnEntry() != null) {
+        type = startingTypeFilter.getTypeFilterOnEntry();
+      } else if (startingTypeFilter.getTypeFilterOnCollection() != null) {
+        type = startingTypeFilter.getTypeFilterOnCollection();
       } else {
-        type =startingTypeFilter.getType();
+        type = startingTypeFilter.getType();
       }
-      
+
       uriInfoImplpath.removeResourcePart(0);
       return type;
     }
@@ -1141,9 +1134,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     super.visitExpandPath(ctx);
 
-    EdmType startType = this.removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
+    EdmType startType = removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
     expandItem.setResourcePath(context.contextUriInfo);
-    if ( startType != null) {
+    if (startType != null) {
       expandItem.setTypeFilter(startType);
     }
 
@@ -1308,11 +1301,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     if (text.equals("max")) {
       levels.setMax();
-    } else    {
+    } else {
       levels.setValue(Integer.parseInt(text));
     }
     levels.setText(text);
-    
 
     return levels;
 
@@ -1557,7 +1549,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   }
 
   @Override
-  public Object visitNaninfinity(NaninfinityContext ctx) {
+  public Object visitNaninfinity(final NaninfinityContext ctx) {
     return new LiteralImpl().setType(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance()).setText(ctx.getText());
   }
 
@@ -1808,8 +1800,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       } else {
         UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
         UriResource last = uriInfo.getLastResourcePart();
-        
-        prevType = getTypeInformation( last).type;
+
+        prevType = getTypeInformation(last).type;
         if (prevType == null) {
           throw wrap(new UriParserSemanticException("prev segement not typed"));
         }
@@ -1840,7 +1832,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
             uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
             uriInfo.addResourcePart(simple);
 
-            EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+            EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
             if (startType != null) {
               context.contextSelectItem.setTypeFilter(startType);
             }
@@ -1860,7 +1852,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
             uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
             uriInfo.addResourcePart(complex);
 
-            EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+            EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
             if (startType != null) {
               context.contextSelectItem.setTypeFilter(startType);
             }
@@ -1895,7 +1887,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
               UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
               uriInfo.addResourcePart(resourcePart);
 
-              EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+              EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
               if (startType != null) {
                 context.contextSelectItem.setTypeFilter(startType);
               }
@@ -1914,7 +1906,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
               UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
               uriInfo.addResourcePart(resourcePart);
 
-              EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+              EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
               if (startType != null) {
                 context.contextSelectItem.setTypeFilter(startType);
               }
@@ -2096,7 +2088,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
         .addParameter((ExpressionImpl) ctx.vE1.accept(this));
   }
 
-
   @Override
   public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
     return new MethodImpl()

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6fdfc458/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java
index 6bc7ba9..adb5d01 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.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/uri/parser/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
index c24a194..1dd952b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.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/uri/parser/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java
index 9ef9abe..da7f62c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.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/uri/queryoption/AliasQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java
index d61259a..fd971a2 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.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.
  */