You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/01/07 15:18:17 UTC

[3/3] git commit: [OLINGO-83] Separate 'webref' to 'ref' and 'web' module

[OLINGO-83] Separate 'webref' to 'ref' and 'web' module


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/a42ace7b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/a42ace7b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/a42ace7b

Branch: refs/heads/master
Commit: a42ace7ba3b0dda5977b745d0a99ea8f13392bc2
Parents: cb9ba5d
Author: Michael Bolz <mi...@apache.org>
Authored: Tue Jan 7 14:25:25 2014 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Tue Jan 7 15:14:15 2014 +0100

----------------------------------------------------------------------
 .../annotation-processor-ref/pom.xml            |  68 ++
 .../ref/AnnotationRefServiceFactory.java        | 215 +++++
 .../processor/ref/model/Building.java           |  97 ++
 .../annotation/processor/ref/model/City.java    |  61 ++
 .../processor/ref/model/Employee.java           | 192 ++++
 .../processor/ref/model/Location.java           |  60 ++
 .../annotation/processor/ref/model/Manager.java |  43 +
 .../ref/model/ModelSharedConstants.java         |  25 +
 .../annotation/processor/ref/model/Photo.java   | 128 +++
 .../annotation/processor/ref/model/RefBase.java |  78 ++
 .../processor/ref/model/ResourceHelper.java     |  96 ++
 .../annotation/processor/ref/model/Room.java    |  88 ++
 .../annotation/processor/ref/model/Team.java    |  73 ++
 .../src/main/version/version.html               |  27 +
 .../processor/ref/AbstractRefTest.java          | 195 ++++
 .../processor/ref/AbstractRefXmlTest.java       |  89 ++
 .../processor/ref/ServiceJsonTest.java          |  87 ++
 .../processor/ref/ServiceXmlTest.java           | 123 +++
 .../annotation-processor-web/pom.xml            | 110 +++
 .../src/main/resources/META-INF/LICENSE         | 908 +++++++++++++++++++
 .../src/main/resources/log4j.xml                |  41 +
 .../src/main/version/version.html               |  27 +
 .../src/main/webapp/WEB-INF/web.xml             |  48 +
 .../src/main/webapp/index.jsp                   | 116 +++
 .../annotation-processor-webref/pom.xml         | 126 ---
 .../ref/AnnotationRefServiceFactory.java        | 215 -----
 .../processor/ref/model/Building.java           |  97 --
 .../annotation/processor/ref/model/City.java    |  61 --
 .../processor/ref/model/Employee.java           | 192 ----
 .../processor/ref/model/Location.java           |  60 --
 .../annotation/processor/ref/model/Manager.java |  43 -
 .../ref/model/ModelSharedConstants.java         |  25 -
 .../annotation/processor/ref/model/Photo.java   | 128 ---
 .../annotation/processor/ref/model/RefBase.java |  78 --
 .../processor/ref/model/ResourceHelper.java     |  96 --
 .../annotation/processor/ref/model/Room.java    |  88 --
 .../annotation/processor/ref/model/Team.java    |  73 --
 .../src/main/resources/log4j.xml                |  39 -
 .../src/main/version/version.html               |  27 -
 .../src/main/webapp/WEB-INF/web.xml             |  48 -
 .../src/main/webapp/index.jsp                   | 116 ---
 .../processor/ref/AbstractRefTest.java          | 195 ----
 .../processor/ref/AbstractRefXmlTest.java       |  89 --
 .../processor/ref/ServiceJsonTest.java          |  87 --
 .../processor/ref/ServiceXmlTest.java           | 123 ---
 odata2-annotation-processor/pom.xml             |   3 +-
 46 files changed, 2997 insertions(+), 2007 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/pom.xml b/odata2-annotation-processor/annotation-processor-ref/pom.xml
new file mode 100644
index 0000000..cbb25aa
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>olingo-odata2-annotation-processor-ref-incubating</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>olingo-odata2-annotation-processor-incubating</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <properties>
+    <version.slf4j>1.7.1</version.slf4j>
+  </properties>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-api-incubating</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-core-incubating</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-annotation-processor-api-incubating</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-annotation-processor-core-incubating</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-testutil-incubating</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>${version.slf4j}</version>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java
new file mode 100644
index 0000000..ccaca81
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java
@@ -0,0 +1,215 @@
+/**
+ * *****************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import java.util.Calendar;
+
+import org.apache.olingo.odata2.annotation.processor.api.AnnotationServiceFactory;
+import org.apache.olingo.odata2.annotation.processor.core.datasource.DataStore;
+import org.apache.olingo.odata2.annotation.processor.core.datasource.DataStore.DataStoreException;
+import org.apache.olingo.odata2.annotation.processor.ref.model.Building;
+import org.apache.olingo.odata2.annotation.processor.ref.model.Employee;
+import org.apache.olingo.odata2.annotation.processor.ref.model.Location;
+import org.apache.olingo.odata2.annotation.processor.ref.model.Manager;
+import org.apache.olingo.odata2.annotation.processor.ref.model.Photo;
+import org.apache.olingo.odata2.annotation.processor.ref.model.ResourceHelper;
+import org.apache.olingo.odata2.annotation.processor.ref.model.Room;
+import org.apache.olingo.odata2.annotation.processor.ref.model.Team;
+import org.apache.olingo.odata2.api.ODataCallback;
+import org.apache.olingo.odata2.api.ODataDebugCallback;
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.ODataServiceFactory;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataContext;
+import org.apache.olingo.odata2.api.processor.ODataErrorCallback;
+import org.apache.olingo.odata2.api.processor.ODataErrorContext;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ODataServiceFactory implemantion based on ListProcessor
+ * in combination with Annotation-Support-Classes for EdmProvider, DataSource and ValueAccess.
+ */
+public class AnnotationRefServiceFactory extends ODataServiceFactory {
+
+  /**
+   * Instance holder for all annotation relevant instances which should be used as singleton
+   * instances within the ODataApplication (ODataService)
+   */
+  private static class AnnotationInstances {
+    final static String MODEL_PACKAGE = "org.apache.olingo.odata2.annotation.processor.ref.model";
+
+    final static ODataService ANNOTATION_ODATA_SERVICE;
+    
+    static {
+      try {
+        ANNOTATION_ODATA_SERVICE = AnnotationServiceFactory.createAnnotationService(MODEL_PACKAGE);
+        initializeSampleData();
+      } catch (ODataApplicationException ex) {
+        throw new RuntimeException("Exception during sample data generation.", ex);
+      } catch (ODataException ex) {
+        throw new RuntimeException("Exception during data source initialization generation.", ex);
+      }
+    }
+  }
+
+  @Override
+  public ODataService createService(final ODataContext context) throws ODataException {
+    // Edm via Annotations and ListProcessor via AnnotationDS with AnnotationsValueAccess
+    return AnnotationInstances.ANNOTATION_ODATA_SERVICE;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T extends ODataCallback> T getCallback(final Class<? extends ODataCallback> callbackInterface) {
+    return (T) (callbackInterface.isAssignableFrom(ScenarioErrorCallback.class)
+        ? new ScenarioErrorCallback() : callbackInterface.isAssignableFrom(ODataDebugCallback.class)
+            ? new ScenarioDebugCallback() : super.getCallback(callbackInterface));
+  }
+
+  /*
+   * Helper classes and methods
+   */
+
+  /**
+   * Callback class to enable debugging.
+   */
+  private final class ScenarioDebugCallback implements ODataDebugCallback {
+
+    @Override
+    public boolean isDebugEnabled() {
+      return true;
+    }
+  }
+
+  /**
+   * Callback class for error handling.
+   */
+  private class ScenarioErrorCallback implements ODataErrorCallback {
+
+    private final Logger LOG = LoggerFactory.getLogger(ScenarioErrorCallback.class);
+
+    @Override
+    public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException {
+      if (context.getHttpStatus() == HttpStatusCodes.INTERNAL_SERVER_ERROR) {
+        LOG.error("Internal Server Error", context.getException());
+      }
+
+      return EntityProvider.writeErrorDocument(context);
+    }
+
+  }
+
+  private static <T> DataStore<T> getDataStore(Class<T> clz) throws DataStoreException {
+    return DataStore.createInMemory(clz, true);
+  }
+  
+  private static void initializeSampleData() throws ODataApplicationException {
+    DataStore<Team> teamDs = getDataStore(Team.class);
+    teamDs.create(createTeam("Team Alpha", true));
+    teamDs.create(createTeam("Team Beta", false));
+    teamDs.create(createTeam("Team Gamma", false));
+    teamDs.create(createTeam("Team Omega", true));
+    teamDs.create(createTeam("Team Zeta", true));
+
+    DataStore<Building> buildingsDs = getDataStore(Building.class);
+    Building redBuilding = createBuilding("Red Building");
+    buildingsDs.create(redBuilding);
+    Building greenBuilding = createBuilding("Green Building");
+    buildingsDs.create(greenBuilding);
+    Building blueBuilding = createBuilding("Blue Building");
+    buildingsDs.create(blueBuilding);
+    Building yellowBuilding = createBuilding("Yellow Building");
+    buildingsDs.create(yellowBuilding);
+
+    DataStore<Photo> photoDs = getDataStore(Photo.class);
+    photoDs.create(createPhoto("Small picture", ResourceHelper.Format.GIF));
+    photoDs.create(createPhoto("Medium picture", ResourceHelper.Format.PNG));
+    photoDs.create(createPhoto("Big picture", ResourceHelper.Format.JPEG));
+    photoDs.create(createPhoto("Huge picture", ResourceHelper.Format.BMP));
+
+    DataStore<Room> roomDs = getDataStore(Room.class);
+    roomDs.create(createRoom("Tiny red room", 5, 1, redBuilding));
+    roomDs.create(createRoom("Small red room", 20, 1, redBuilding));
+    roomDs.create(createRoom("Small green room", 20, 1, greenBuilding));
+    roomDs.create(createRoom("Big blue room", 40, 1, blueBuilding));
+    roomDs.create(createRoom("Huge blue room", 120, 1, blueBuilding));
+    roomDs.create(createRoom("Huge yellow room", 120, 1, yellowBuilding));
+
+    DataStore<Employee> employeeDataStore = getDataStore(Employee.class);
+    employeeDataStore.create(createEmployee("first Employee",
+        new Location("Norge", "8392", "Ä"), 42, null,
+        photoDs.read().iterator().next().getImage(), photoDs.read().iterator().next().getImageType(),
+        "http://localhost/image/first.png",
+        null, teamDs.read().iterator().next(), roomDs.read().iterator().next()));
+  }
+
+  private static Employee createEmployee(final String name,
+      final Location location, final int age, final Calendar date,
+      final byte[] image, final String imageType, final String imageUrl,
+      final Manager manager, final Team team, final Room room) {
+    Employee employee = new Employee();
+    employee.setEmployeeName(name);
+    employee.setLocation(location);
+    employee.setAge(age);
+    employee.setEntryDate(date);
+    employee.setImage(image);
+    employee.setImageType(imageType);
+    employee.setImageUri(imageUrl);
+    employee.setManager(manager);
+    employee.setTeam(team);
+    employee.setRoom(room);
+    return employee;
+  }
+
+  private static Team createTeam(final String teamName, final boolean isScrumTeam) {
+    Team team = new Team();
+    team.setName(teamName);
+    team.setScrumTeam(isScrumTeam);
+    return team;
+  }
+
+  private static Building createBuilding(final String buildingName) {
+    Building b = new Building();
+    b.setName(buildingName);
+    return b;
+  }
+
+  private static Photo createPhoto(final String name, final ResourceHelper.Format format) {
+    Photo p = new Photo();
+    p.setName(name);
+    p.setImageUri("http://localhost/image/" + name);
+    p.setType(format.name());
+    p.setImageType("image/" + format.name().toLowerCase());
+    p.setImage(ResourceHelper.generateImage(format));
+    return p;
+  }
+
+  private static Room createRoom(final String name, final int seats, final int version, final Building building) {
+    Room r = new Room();
+    r.setName(name);
+    r.setSeats(seats);
+    r.setVersion(version);
+    r.setBuilding(building);
+
+    building.addRoom(r);
+
+    return r;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Building.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Building.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Building.java
new file mode 100644
index 0000000..125c936
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Building.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty.Multiplicity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmType;
+
+/**
+ *  
+ */
+@EdmEntityType(name = "Building", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Buildings")
+public class Building {
+  @EdmKey
+  @EdmProperty(type = EdmType.INT32)
+  private int id;
+  @EdmProperty
+  private String name;
+  @EdmProperty(name = "Image", type = EdmType.BINARY)
+  private byte[] image;
+  @EdmNavigationProperty(name = "nb_Rooms", toType = Room.class,
+      association = "BuildingRooms", toMultiplicity = Multiplicity.MANY)
+  private List<Room> rooms = new ArrayList<Room>();
+
+  public String getId() {
+    return Integer.toString(id);
+  }
+
+  public void setName(final String name) {
+    this.name = name;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setImage(final byte[] byteArray) {
+    image = byteArray;
+  }
+
+  public byte[] getImage() {
+    if (image == null) {
+      return null;
+    } else {
+      return image.clone();
+    }
+  }
+
+  public void addRoom(final Room room) {
+    rooms.add(room);
+  }
+
+  public List<Room> getRooms() {
+    return rooms;
+  }
+
+  @Override
+  public int hashCode() {
+    return id;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return this == obj
+        || obj != null && getClass() == obj.getClass() && id == ((Building) obj).id;
+  }
+
+  @Override
+  public String toString() {
+    return "{\"Id\":\"" + id + "\",\"Name\":\"" + name + "\",\"Image\":\"" + Arrays.toString(image) + "\"}";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/City.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/City.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/City.java
new file mode 100644
index 0000000..7a72178
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/City.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+
+/**
+ *  
+ */
+@EdmComplexType(name = "c_City", namespace = ModelSharedConstants.NAMESPACE_1)
+public class City {
+
+  @EdmProperty
+  private String postalCode;
+  @EdmProperty
+  private String cityName;
+
+  public City(final String postalCode, final String name) {
+    this.postalCode = postalCode;
+    cityName = name;
+  }
+
+  public void setPostalCode(final String postalCode) {
+    this.postalCode = postalCode;
+  }
+
+  public String getPostalCode() {
+    return postalCode;
+  }
+
+  public void setCityName(final String cityName) {
+    this.cityName = cityName;
+  }
+
+  public String getCityName() {
+    return cityName;
+  }
+
+  @Override
+  public String toString() {
+    return String.format("%s, %s", cityName, postalCode);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Employee.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Employee.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Employee.java
new file mode 100644
index 0000000..98d57ca
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Employee.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import java.text.DateFormat;
+import java.util.Calendar;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmFacets;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceContent;
+import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceMimeType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmType;
+
+/**
+ *  
+ */
+@EdmEntityType(name = "Employee", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Employees")
+public class Employee {
+  @EdmKey
+  @EdmProperty(name = "EmployeeId", type = EdmType.STRING)
+  private String employeeId;
+  @EdmProperty(name = "EmployeeName")
+  private String employeeName;
+  @EdmProperty
+  private int age;
+  @EdmNavigationProperty(name = "ne_Manager", association = "ManagerEmployees")
+  private Manager manager;
+  @EdmNavigationProperty(name = "ne_Team", association = "TeamEmployees")
+  private Team team;
+  @EdmNavigationProperty(name = "ne_Room")
+  private Room room;
+  @EdmMediaResourceMimeType
+  private String imageType;
+  @EdmMediaResourceContent
+  private byte[] image;
+  @EdmProperty(name = "ImageUrl")
+  private String imageUrl;
+  @EdmProperty(name = "EntryDate", type = EdmType.DATE_TIME,
+      facets = @EdmFacets(nullable = true))
+  private Calendar entryDate;
+  @EdmProperty(name = "Location", facets = @EdmFacets(nullable = false))
+  private Location location;
+
+  public String getId() {
+    return employeeId;
+  }
+
+  public void setEmployeeName(final String employeeName) {
+    this.employeeName = employeeName;
+  }
+
+  public String getEmployeeName() {
+    return employeeName;
+  }
+
+  public void setAge(final int age) {
+    this.age = age;
+  }
+
+  public int getAge() {
+    return age;
+  }
+
+  public void setManager(final Manager manager) {
+    this.manager = manager;
+  }
+
+  public Manager getManager() {
+    return manager;
+  }
+
+  public void setTeam(final Team team) {
+    this.team = team;
+  }
+
+  public Team getTeam() {
+    return team;
+  }
+
+  public void setRoom(final Room room) {
+    this.room = room;
+  }
+
+  public Room getRoom() {
+    return room;
+  }
+
+  public void setImageUri(final String imageUri) {
+    imageUrl = imageUri;
+  }
+
+  public String getImageUri() {
+    return imageUrl;
+  }
+
+  public void setLocation(final Location location) {
+    this.location = location;
+  }
+
+  public Location getLocation() {
+    return location;
+  }
+
+  public void setEntryDate(final Calendar date) {
+    entryDate = date;
+  }
+
+  public Calendar getEntryDate() {
+    return entryDate;
+  }
+
+  public void setImageType(final String imageType) {
+    this.imageType = imageType;
+  }
+
+  public String getImageType() {
+    return imageType;
+  }
+
+  public void setImage(final byte[] image) {
+    this.image = image;
+  }
+
+  public void setImage(final String imageUrl) {
+    image = loadImage(imageUrl);
+  }
+
+  private static byte[] loadImage(final String imageUrl) {
+    return ResourceHelper.loadAsByte(imageUrl);
+  }
+
+  public byte[] getImage() {
+    if (image == null) {
+      return null;
+    }
+    return image.clone();
+  }
+
+  @Override
+  public int hashCode() {
+    if (employeeId == null) {
+      return 0;
+    }
+    return employeeId.hashCode();
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return this == obj
+        || obj != null && getClass() == obj.getClass() && employeeId == ((Employee) obj).employeeId;
+  }
+
+  @Override
+  public String toString() {
+    return "{\"EmployeeId\":\"" + employeeId + "\","
+        + "\"EmployeeName\":\"" + employeeName + "\","
+        + "\"ManagerId\":" + (manager == null ? "null" : "\"" + manager.getId() + "\"") + ","
+        + "\"RoomId\":" + (room == null ? "null" : "\"" + room.getId() + "\"") + ","
+        + "\"TeamId\":" + (team == null ? "null" : "\"" + team.getId() + "\"") + ","
+        + "\"Location\":"
+        + (location == null ? "null" :
+            "{\"City\":" + (location.getCity() == null ? "null" :
+                "{\"PostalCode\":\"" + location.getCity().getPostalCode() + "\","
+                    + "\"CityName\":\"" + location.getCity().getCityName() + "\"}") + ","
+                + "\"Country\":\"" + location.getCountry() + "\"}") + ","
+        + "\"Age\":" + age + ","
+        + "\"EntryDate\":"
+        + (entryDate == null ? "null" : "\"" + DateFormat.getInstance().format(entryDate.getTime()) + "\"") + ","
+        + "\"ImageUrl\":\"" + imageUrl + "\"}";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Location.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Location.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Location.java
new file mode 100644
index 0000000..b131f7e
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Location.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+
+/**
+ *  
+ */
+@EdmComplexType(name = "c_Location", namespace = ModelSharedConstants.NAMESPACE_1)
+public class Location {
+  @EdmProperty
+  private String country;
+  @EdmProperty
+  private City city;
+
+  public Location(final String country, final String postalCode, final String cityName) {
+    this.country = country;
+    city = new City(postalCode, cityName);
+  }
+
+  public void setCountry(final String country) {
+    this.country = country;
+  }
+
+  public String getCountry() {
+    return country;
+  }
+
+  public void setCity(final City city) {
+    this.city = city;
+  }
+
+  public City getCity() {
+    return city;
+  }
+
+  @Override
+  public String toString() {
+    return String.format("%s, %s", country, city.toString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Manager.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Manager.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Manager.java
new file mode 100644
index 0000000..136c476
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Manager.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty.Multiplicity;
+
+/**
+ *
+ */
+@EdmEntityType(name = "Manager", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Managers")
+public class Manager extends Employee {
+
+  @EdmNavigationProperty(name = "nm_Employees", association = "ManagerEmployees",
+      toMultiplicity = Multiplicity.MANY)
+  private List<Employee> employees = new ArrayList<Employee>();
+
+  public List<Employee> getEmployees() {
+    return employees;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ModelSharedConstants.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ModelSharedConstants.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ModelSharedConstants.java
new file mode 100644
index 0000000..05cb2db
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ModelSharedConstants.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+public interface ModelSharedConstants {
+
+  String NAMESPACE_1 = "RefScenario";
+  String CONTAINER_1 = "Container1";
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Photo.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Photo.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Photo.java
new file mode 100644
index 0000000..d0285ec
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Photo.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceContent;
+import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceMimeType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceSource;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmType;
+
+/**
+ *  
+ */
+@EdmEntityType(name = "Photo", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Photos")
+public class Photo {
+  @EdmKey
+  @EdmProperty
+  private String name;
+  @EdmKey
+  @EdmProperty
+  private String type;
+  @EdmProperty
+  @EdmMediaResourceMimeType
+  private String mimeType;
+  @EdmProperty
+  @EdmMediaResourceSource
+  private String imageUrl = "http://localhost/someResource.png";
+  @EdmProperty(type = EdmType.BINARY)
+  @EdmMediaResourceContent
+  private byte[] image = ResourceHelper.generateImage();
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(final String name) {
+    this.name = name;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(final String type) {
+    this.type = type;
+  }
+
+  public String getImageUri() {
+    return imageUrl;
+  }
+
+  public void setImageUri(final String uri) {
+    imageUrl = uri;
+  }
+
+  public byte[] getImage() {
+    return image.clone();
+  }
+
+  public void setImage(final byte[] image) {
+    this.image = image;
+  }
+
+  public String getImageType() {
+    return mimeType;
+  }
+
+  public void setImageType(final String imageType) {
+    mimeType = imageType;
+  }
+
+  @Override
+  public int hashCode() {
+    int hash = 5;
+    hash = 83 * hash + (name != null ? name.hashCode() : 0);
+    hash = 83 * hash + (type != null ? type.hashCode() : 0);
+    return hash;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    final Photo other = (Photo) obj;
+    if ((name == null) ? (other.name != null) : !name.equals(other.name)) {
+      return false;
+    }
+    if ((type == null) ? (other.type != null) : !type.equals(other.type)) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public String toString() {
+    return "{\"Name\":\"" + name + "\","
+        + "\"Type\":\"" + type + "\","
+        + "\"ImageUrl\":\"" + imageUrl + "\","
+        + "\"Image\":\"" + Arrays.toString(image) + "\","
+        + "\"MimeType\":\"" + mimeType + "\"";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/RefBase.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/RefBase.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/RefBase.java
new file mode 100644
index 0000000..d0d3edc
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/RefBase.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmType;
+
+/**
+ *
+ */
+@EdmEntityType(name = "Base", namespace = ModelSharedConstants.NAMESPACE_1)
+public abstract class RefBase {
+  @EdmProperty(name = "Name")
+  protected String name;
+  @EdmProperty(name = "Id", type = EdmType.STRING)
+  @EdmKey
+  protected String id;
+
+  public String getName() {
+    return name;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public void setName(final String name) {
+    this.name = name;
+  }
+
+  public void setId(final int id) {
+    this.id = String.valueOf(id);
+  }
+
+  @Override
+  public int hashCode() {
+    if (id == null) {
+      return -1;
+    }
+    return id.hashCode();
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    final RefBase other = (RefBase) obj;
+    if ((name == null) ? (other.name != null) : !name.equals(other.name)) {
+      return false;
+    }
+    if ((id == null) ? (other.id != null) : !id.equals(other.id)) {
+      return false;
+    }
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ResourceHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ResourceHelper.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ResourceHelper.java
new file mode 100644
index 0000000..7d64bc4
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/ResourceHelper.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.WritableRaster;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.imageio.ImageIO;
+
+/**
+ *
+ */
+public class ResourceHelper {
+
+  public static byte[] loadAsByte(final String resource) {
+    return load(resource, new byte[0]);
+  }
+
+  public static byte[] load(final String resource, final byte[] defaultResult) {
+    InputStream instream = null;
+    try {
+      instream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
+      if (instream == null) {
+        return defaultResult;
+      }
+      ByteArrayOutputStream stream = new ByteArrayOutputStream();
+      int b = 0;
+      while ((b = instream.read()) != -1) {
+        stream.write(b);
+      }
+
+      return stream.toByteArray();
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    } finally {
+      if (instream != null) {
+        try {
+          instream.close();
+        } catch (IOException ex) {}
+      }
+    }
+  }
+
+  public enum Format {
+    BMP, JPEG, PNG, GIF
+  };
+
+  public static byte[] generateImage() {
+    return generateImage(Format.PNG);
+  }
+
+  public static byte[] generateImage(final Format format) {
+    try {
+      int width = 320;
+      int height = 320;
+      BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_BINARY);
+      WritableRaster raster = image.getRaster();
+
+      int mod = format.ordinal() + 2;
+      for (int h = 0; h < height; h++) {
+        for (int w = 0; w < width; w++) {
+          if (((h / 32) + (w / 32)) % mod == 0) {
+            raster.setSample(w, h, 0, 0);
+          } else {
+            raster.setSample(w, h, 0, 1);
+          }
+        }
+      }
+
+      ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
+      ImageIO.write(image, format.name(), out);
+      return out.toByteArray();
+    } catch (IOException ex) {
+      return new byte[0];
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Room.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Room.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Room.java
new file mode 100644
index 0000000..78e7a2c
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Room.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+
+/**
+ *
+ */
+@EdmEntityType(name = "Room", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Rooms")
+public class Room extends RefBase {
+
+  @EdmProperty
+  private Integer seats;
+  @EdmProperty
+  private Integer version;
+  @EdmNavigationProperty(name = "nr_Building", association = "BuildingRooms")
+  private Building building;
+  @EdmNavigationProperty(name = "nr_Employees")
+  private List<Employee> employees = new ArrayList<Employee>();
+
+  public void setSeats(final int seats) {
+    this.seats = seats;
+  }
+
+  public int getSeats() {
+    return seats;
+  }
+
+  public void setVersion(final int version) {
+    this.version = version;
+  }
+
+  public int getVersion() {
+    return version;
+  }
+
+  public void setBuilding(final Building building) {
+    this.building = building;
+  }
+
+  public Building getBuilding() {
+    return building;
+  }
+
+  public List<Employee> getEmployees() {
+    return employees;
+  }
+
+  @Override
+  public int hashCode() {
+    return super.hashCode();
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return this == obj
+        || obj != null && getClass() == obj.getClass() && id == ((Room) obj).id;
+  }
+
+  @Override
+  public String toString() {
+    return "{\"Id\":\"" + id + "\",\"Name\":\"" + name + "\",\"Seats\":" + seats + ",\"Version\":" + version + "}";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Team.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Team.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Team.java
new file mode 100644
index 0000000..7f48f66
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/model/Team.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty.Multiplicity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmType;
+
+/**
+*  
+*/
+@EdmEntityType(name = "Team", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Teams")
+public class Team extends RefBase {
+  @EdmProperty(type = EdmType.BOOLEAN)
+  private Boolean isScrumTeam;
+  @EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees", toMultiplicity = Multiplicity.MANY)
+  private List<Employee> employees = new ArrayList<Employee>();
+
+  public Boolean isScrumTeam() {
+    return isScrumTeam;
+  }
+
+  public void setScrumTeam(final Boolean isScrumTeam) {
+    this.isScrumTeam = isScrumTeam;
+  }
+
+  public void addEmployee(final Employee e) {
+    employees.add(e);
+  }
+
+  public List<Employee> getEmployees() {
+    return employees;
+  }
+
+  @Override
+  public int hashCode() {
+    return super.hashCode();
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return this == obj
+        || obj != null && getClass() == obj.getClass() && id == ((Team) obj).id;
+  }
+
+  @Override
+  public String toString() {
+    return "{\"Id\":\"" + id + "\",\"Name\":\"" + name + "\",\"IsScrumTeam\":" + isScrumTeam + "}";
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/main/version/version.html
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/version/version.html b/odata2-annotation-processor/annotation-processor-ref/src/main/version/version.html
new file mode 100644
index 0000000..6d76d0b
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/version/version.html
@@ -0,0 +1,27 @@
+<!--
+
+ 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.
+
+-->
+
+<table border="1">
+<tr><td>name</td><td>${name}</td></tr>
+<tr><td>version</td><td>${version}</td></tr>
+<tr><td>timestamp</td><td>${timestamp}</td></tr>
+<tr><td>project.build.finalName</td><td>${project.build.finalName}</td></tr>
+</table>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java
new file mode 100644
index 0000000..6ddbff4
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPatch;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.entity.StringEntity;
+import org.apache.olingo.odata2.annotation.processor.api.AnnotationServiceFactory;
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.commons.ODataHttpMethod;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
+import org.apache.olingo.odata2.testutil.helper.StringHelper;
+
+/**
+ * Abstract base class for tests employing the reference scenario.
+ * 
+ */
+public class AbstractRefTest extends AbstractFitTest {
+
+  protected static final String IMAGE_JPEG = "image/jpeg";
+  protected static final String IMAGE_GIF = "image/gif";
+
+  final static String MODEL_PACKAGE = "org.apache.olingo.odata2.annotation.processor.ref.model";
+
+  @Override
+  protected ODataService createService() throws ODataException {
+    return AnnotationServiceFactory.createAnnotationService(MODEL_PACKAGE);
+  }
+
+  protected HttpResponse callUri(
+      final ODataHttpMethod httpMethod, final String uri,
+      final String additionalHeader, final String additionalHeaderValue,
+      final String requestBody, final String requestContentType,
+      final HttpStatusCodes expectedStatusCode) throws Exception {
+
+    HttpRequestBase request =
+        httpMethod == ODataHttpMethod.GET ? new HttpGet() :
+            httpMethod == ODataHttpMethod.DELETE ? new HttpDelete() :
+                httpMethod == ODataHttpMethod.POST ? new HttpPost() :
+                    httpMethod == ODataHttpMethod.PUT ? new HttpPut() : new HttpPatch();
+    request.setURI(URI.create(getEndpoint() + uri));
+    if (additionalHeader != null) {
+      request.addHeader(additionalHeader, additionalHeaderValue);
+    }
+    if (requestBody != null) {
+      ((HttpEntityEnclosingRequest) request).setEntity(new StringEntity(requestBody));
+      request.setHeader(HttpHeaders.CONTENT_TYPE, requestContentType);
+    }
+
+    final HttpResponse response = getHttpClient().execute(request);
+
+    assertNotNull(response);
+    assertEquals(expectedStatusCode.getStatusCode(), response.getStatusLine().getStatusCode());
+
+    if (expectedStatusCode == HttpStatusCodes.OK) {
+      assertNotNull(response.getEntity());
+      assertNotNull(response.getEntity().getContent());
+    } else if (expectedStatusCode == HttpStatusCodes.CREATED) {
+      assertNotNull(response.getEntity());
+      assertNotNull(response.getEntity().getContent());
+      assertNotNull(response.getFirstHeader(HttpHeaders.LOCATION));
+    } else if (expectedStatusCode == HttpStatusCodes.NO_CONTENT) {
+      assertTrue(response.getEntity() == null || response.getEntity().getContent() == null);
+    }
+
+    return response;
+  }
+
+  protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue,
+      final HttpStatusCodes expectedStatusCode) throws Exception {
+    return callUri(ODataHttpMethod.GET, uri, additionalHeader, additionalHeaderValue, null, null, expectedStatusCode);
+  }
+
+  protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue)
+      throws Exception {
+    return callUri(ODataHttpMethod.GET, uri, additionalHeader, additionalHeaderValue, null, null, HttpStatusCodes.OK);
+  }
+
+  protected HttpResponse callUri(final String uri, final HttpStatusCodes expectedStatusCode) throws Exception {
+    return callUri(uri, null, null, expectedStatusCode);
+  }
+
+  protected HttpResponse callUri(final String uri) throws Exception {
+    return callUri(uri, HttpStatusCodes.OK);
+  }
+
+  protected void checkUri(final String uri) throws Exception {
+    assertNotNull(getBody(callUri(uri)));
+  }
+
+  protected void badRequest(final String uri) throws Exception {
+    final HttpResponse response = callUri(uri, HttpStatusCodes.BAD_REQUEST);
+    assertNotNull(getBody(response));
+  }
+
+  protected void notFound(final String uri) throws Exception {
+    final HttpResponse response = callUri(uri, HttpStatusCodes.NOT_FOUND);
+    assertNotNull(getBody(response));
+  }
+
+  protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode)
+      throws Exception, AssertionError {
+    final HttpResponse response = callUri(ODataHttpMethod.DELETE, uri, null, null, null, null, expectedStatusCode);
+    if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
+      response.getEntity().getContent().close();
+    }
+  }
+
+  protected void deleteUriOk(final String uri) throws Exception {
+    deleteUri(uri, HttpStatusCodes.NO_CONTENT);
+  }
+
+  protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType,
+      final HttpStatusCodes expectedStatusCode) throws Exception {
+    return callUri(ODataHttpMethod.POST, uri, null, null, requestBody, requestContentType, expectedStatusCode);
+  }
+
+  protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType,
+      final String additionalHeader, final String additionalHeaderValue, final HttpStatusCodes expectedStatusCode)
+      throws Exception {
+    return callUri(ODataHttpMethod.POST, uri, additionalHeader, additionalHeaderValue, requestBody, requestContentType,
+        expectedStatusCode);
+  }
+
+  protected void putUri(final String uri,
+      final String requestBody, final String requestContentType,
+      final HttpStatusCodes expectedStatusCode) throws Exception {
+    final HttpResponse response =
+        callUri(ODataHttpMethod.PUT, uri, null, null, requestBody, requestContentType, expectedStatusCode);
+    if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
+      response.getEntity().getContent().close();
+    }
+  }
+
+  protected void putUri(final String uri, final String acceptHeader,
+      final String requestBody, final String requestContentType,
+      final HttpStatusCodes expectedStatusCode) throws Exception {
+    final HttpResponse response =
+        callUri(ODataHttpMethod.PUT, uri,
+            org.apache.olingo.odata2.api.commons.HttpHeaders.ACCEPT, acceptHeader, requestBody, requestContentType,
+            expectedStatusCode);
+    if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
+      response.getEntity().getContent().close();
+    }
+  }
+
+  protected String getBody(final HttpResponse response) throws Exception {
+    assertNotNull(response);
+    assertNotNull(response.getEntity());
+    assertNotNull(response.getEntity().getContent());
+    return StringHelper.inputStreamToString(response.getEntity().getContent());
+  }
+
+  protected void checkMediaType(final HttpResponse response, final String expectedMediaType) {
+    assertEquals(expectedMediaType, response.getFirstHeader(HttpHeaders.CONTENT_TYPE).getValue());
+  }
+
+  protected void checkEtag(final HttpResponse response, final String expectedEtag) {
+    assertNotNull(response.getFirstHeader(HttpHeaders.ETAG));
+    final String entityTag = response.getFirstHeader(HttpHeaders.ETAG).getValue();
+    assertNotNull(entityTag);
+    assertEquals(expectedEtag, entityTag);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java
new file mode 100644
index 0000000..aefd16b
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.custommonkey.xmlunit.SimpleNamespaceContext;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.custommonkey.xmlunit.exceptions.XpathException;
+import org.junit.Before;
+import org.xml.sax.SAXException;
+
+/**
+ * Abstract base class for tests employing the reference scenario reading or writing XML.
+ * 
+ */
+public class AbstractRefXmlTest extends AbstractRefTest {
+  @Before
+  public void setXmlNamespacePrefixes() {
+    Map<String, String> prefixMap = new HashMap<String, String>();
+    prefixMap.put(Edm.PREFIX_ATOM, Edm.NAMESPACE_ATOM_2005);
+    prefixMap.put(Edm.PREFIX_APP, Edm.NAMESPACE_APP_2007);
+    prefixMap.put(Edm.PREFIX_D, Edm.NAMESPACE_D_2007_08);
+    prefixMap.put(Edm.PREFIX_M, Edm.NAMESPACE_M_2007_08);
+    prefixMap.put(Edm.PREFIX_EDM, Edm.NAMESPACE_EDM_2008_09);
+    prefixMap.put(Edm.PREFIX_EDMX, Edm.NAMESPACE_EDMX_2007_06);
+    prefixMap.put(Edm.PREFIX_XML, Edm.NAMESPACE_XML_1998);
+    XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(prefixMap));
+  }
+
+  @Override
+  protected void badRequest(final String uri) throws Exception {
+    final HttpResponse response = callUri(uri, HttpStatusCodes.BAD_REQUEST);
+    validateXmlError(getBody(response));
+  }
+
+  @Override
+  protected void notFound(final String uri) throws Exception {
+    final HttpResponse response = callUri(uri, HttpStatusCodes.NOT_FOUND);
+    validateXmlError(getBody(response));
+  }
+
+  protected void validateXmlError(final String xml) throws XpathException, IOException, SAXException {
+    assertXpathExists("/m:error", xml);
+    assertXpathExists("/m:error/m:code", xml);
+    assertXpathExists("/m:error/m:message[@xml:lang=\"en\"]", xml);
+  }
+
+  protected String readFile(final String filename) throws IOException {
+    InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
+    if (in == null) {
+      throw new IOException("Requested file '" + filename + "' was not found.");
+    }
+
+    byte[] tmp = new byte[8192];
+    int count = in.read(tmp);
+    StringBuffer b = new StringBuffer();
+    while (count >= 0) {
+      b.append(new String(tmp, 0, count));
+      count = in.read(tmp);
+    }
+
+    return b.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
new file mode 100644
index 0000000..4813690
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.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.odata2.annotation.processor.ref;
+
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpContentType;
+import org.apache.olingo.odata2.api.commons.HttpHeaders;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.custommonkey.xmlunit.SimpleNamespaceContext;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Test;
+
+/**
+ * Tests employing the reference scenario reading the service document in JSON format.
+ * 
+ */
+public class ServiceJsonTest extends AbstractRefTest {
+  @Test
+  public void serviceDocumentDollarFormatJson() throws Exception {
+    final HttpResponse response = callUri("?$format=json");
+    // checkMediaType(response, HttpContentType.APPLICATION_JSON);
+    String body = getBody(response);
+
+    Assert.assertTrue(jsonDataResponseContains(body, "Buildings"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Employees"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Managers"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Photos"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Rooms"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Teams"));
+  }
+
+  private boolean jsonDataResponseContains(String content, String containingValue) {
+    return content.matches("\\{\"d\":\\{\"EntitySets\":\\[.*"
+        + containingValue + ".*\"\\]\\}\\}");
+  }
+  
+  @Test
+  public void serviceDocumentAcceptHeaderJson() throws Exception {
+    final HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
+    String body = getBody(response);
+
+    Assert.assertTrue(jsonDataResponseContains(body, "Buildings"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Employees"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Managers"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Photos"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Rooms"));
+    Assert.assertTrue(jsonDataResponseContains(body, "Teams"));
+  }
+
+  @Test
+  public void serviceDocumentAcceptHeaderInvalidCharset() throws Exception {
+    final HttpResponse response =
+        callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_XML + "; charset=iso-latin-1",
+            HttpStatusCodes.NOT_ACCEPTABLE);
+    final String body = getBody(response);
+    Map<String, String> prefixMap = new HashMap<String, String>();
+    prefixMap.put("a", Edm.NAMESPACE_M_2007_08);
+    XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(prefixMap));
+    assertXpathExists("/a:error", body);
+    assertXpathExists("/a:error/a:code", body);
+    assertXpathExists("/a:error/a:message", body);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
new file mode 100644
index 0000000..4d49883
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists;
+
+import java.io.IOException;
+
+import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpContentType;
+import org.apache.olingo.odata2.api.commons.HttpHeaders;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.custommonkey.xmlunit.exceptions.XpathException;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+/**
+ * Tests employing the reference scenario reading the service document in XML format
+ */
+public class ServiceXmlTest extends AbstractRefXmlTest {
+
+  @Test
+  public void serviceDocument() throws Exception {
+    final HttpResponse response = callUri("/");
+    checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
+    final String body = getBody(response);
+    
+    assertXpathEvaluatesTo("Employees", "/app:service/app:workspace/app:collection[@href=\"Employees\"]", body);
+    assertXpathEvaluatesTo("Teams", "/app:service/app:workspace/app:collection[@href=\"Teams\"]", body);
+    assertXpathEvaluatesTo("Rooms", "/app:service/app:workspace/app:collection[@href=\"Rooms\"]", body);
+    assertXpathEvaluatesTo("Managers", "/app:service/app:workspace/app:collection[@href=\"Managers\"]", body);
+    assertXpathEvaluatesTo("Buildings", "/app:service/app:workspace/app:collection[@href=\"Buildings\"]", body);
+    assertXpathEvaluatesTo("Photos", "/app:service/app:workspace/app:collection[@href=\"Photos\"]", body);
+
+    notFound("invalid.svc");
+  }
+
+  @Test
+  public void serviceDocumentDefault() throws Exception {
+    final HttpResponse response = callUri("");
+    checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
+    validateXmlServiceDocument(getBody(response));
+  }
+
+  @Test
+  public void serviceDocumentDollarFormatAtom() throws Exception {
+    HttpResponse response = callUri("?$format=atom");
+    checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
+    validateXmlServiceDocument(getBody(response));
+  }
+
+  @Test
+  public void serviceDocumentDollarFormatXml() throws Exception {
+    HttpResponse response = callUri("?$format=xml");
+    checkMediaType(response, HttpContentType.APPLICATION_XML_UTF8);
+    validateXmlServiceDocument(getBody(response));
+  }
+
+  @Test
+  public void serviceDocumentAcceptHeaderAtom() throws Exception {
+    final HttpResponse response =
+        callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_XML, HttpStatusCodes.NOT_ACCEPTABLE);
+    checkMediaType(response, HttpContentType.APPLICATION_XML);
+    validateXmlError(getBody(response));
+  }
+
+  @Test
+  public void serviceDocumentAcceptHeaderUtf8Atom() throws Exception {
+    final HttpResponse response =
+        callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_XML_UTF8, HttpStatusCodes.NOT_ACCEPTABLE);
+    checkMediaType(response, HttpContentType.APPLICATION_XML);
+    validateXmlError(getBody(response));
+  }
+
+  @Test
+  public void serviceDocumentAcceptHeaderXml() throws Exception {
+    HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_XML);
+    checkMediaType(response, HttpContentType.APPLICATION_XML_UTF8);
+    validateXmlServiceDocument(getBody(response));
+  }
+
+  @Test
+  public void serviceDocumentAcceptHeaderUtf8Xml() throws Exception {
+    HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_XML_UTF8);
+    checkMediaType(response, HttpContentType.APPLICATION_XML_UTF8);
+    validateXmlServiceDocument(getBody(response));
+  }
+
+  private void validateXmlServiceDocument(final String payload) throws IOException, SAXException, XpathException {
+    assertXpathExists("/app:service", payload);
+    assertXpathExists("/app:service/app:workspace", payload);
+    assertXpathExists("/app:service/app:workspace/atom:title", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Employees\"]", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Employees\"]/atom:title", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Teams\"]", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Teams\"]/atom:title", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Rooms\"]", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Rooms\"]/atom:title", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Managers\"]", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Managers\"]/atom:title", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Buildings\"]", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Buildings\"]/atom:title", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Photos\"]", payload);
+    assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Photos\"]/atom:title", payload);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a42ace7b/odata2-annotation-processor/annotation-processor-web/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-web/pom.xml b/odata2-annotation-processor/annotation-processor-web/pom.xml
new file mode 100644
index 0000000..5e774d2
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-web/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>olingo-odata2-annotation-processor-ref-web-incubating</artifactId>
+  <packaging>war</packaging>
+  <name>${project.artifactId}</name>
+
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>olingo-odata2-annotation-processor-incubating</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <properties>
+    <version.slf4j>1.7.1</version.slf4j>
+  </properties>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/version</directory>
+        <filtering>true</filtering>
+        <targetPath>../${project.build.finalName}/gen</targetPath>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+      <resource>
+        <directory>target/maven-shared-archive-resources</directory>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <groupId>com.sap.research</groupId>
+        <artifactId>nwcloud-maven-plugin</artifactId>
+        <version>1.0.0.RELEASE</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <!-- required because of auto detection of web facet 2.5 -->
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+      <version>${cxf.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-annotation-processor-ref-incubating</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-core-incubating</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>${version.slf4j}</version>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>dev</id>
+
+      <build>
+        <defaultGoal>cargo:run</defaultGoal>
+
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-maven2-plugin</artifactId>
+            <version>1.4.2</version>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>