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 2013/11/12 06:35:07 UTC
[37/40] Poc for ListsDs and Processor
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumerTest.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumerTest.java
index c588b30..3d7b89d 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumerTest.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/processor/json/JsonConsumerTest.java
@@ -15,11 +15,11 @@
*/
package org.apache.olingo.odata2.core.annotation.processor.json;
-import org.apache.olingo.odata2.core.annotation.processor.json.JsonConsumer;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Map;
+
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/pom.xml b/odata2-edm-annotation/edm-annotation-webref/pom.xml
index 89ae0b4..cfc7f92 100644
--- a/odata2-edm-annotation/edm-annotation-webref/pom.xml
+++ b/odata2-edm-annotation/edm-annotation-webref/pom.xml
@@ -89,6 +89,13 @@ the License. -->
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-ref-incubating</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.1</version>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
index 5dca34d..59a8eb8 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
@@ -45,13 +45,6 @@ public class Building {
to = @NavigationEnd(role = "r_Room", type="Room", multiplicity = EdmMultiplicity.MANY))
private List<Room> rooms = new ArrayList<Room>();
- public Building() { }
-
- public Building(final int id, final String name) {
- this.id = id;
- setName(name);
- }
-
public String getId() {
return Integer.toString(id);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
index 02a1530..76c4474 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
@@ -36,7 +36,7 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
public class Employee {
private static int counter = 1;
@EdmKey
- @EdmProperty(name="EmployeeId", type = EdmSimpleTypeKind.Int32)
+ @EdmProperty(name="EmployeeId", type = EdmSimpleTypeKind.String)
private int employeeId;
@EdmProperty(name="EmployeeName")
private String employeeName;
@@ -55,11 +55,6 @@ public class Employee {
@EdmProperty(name="Location")
private Location location;
- public Employee(final int employeeId, final String name) {
- this.employeeId = employeeId;
- setEmployeeName(name);
- }
-
public String getId() {
return Integer.toString(employeeId);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
index e3b2631..135753b 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
@@ -35,10 +35,6 @@ public class Manager extends Employee {
to = @NavigationEnd(role = "r_Employees", type = "Employee"))
private List<Employee> employees = new ArrayList<Employee>();
- public Manager(final int id, final String name) {
- super(id, name);
- }
-
public List<Employee> getEmployees() {
return employees;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
index 7fab9bc..fd266ce 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
@@ -50,11 +50,6 @@ public class Photo {
@EdmMediaResourceContent
private byte[] image = ResourceHelper.generateImage();
- public Photo(final String name, final String type) {
- this.name = name;
- this.type = type;
- }
-
public String getName() {
return name;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/RefBase.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/RefBase.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/RefBase.java
index 82d9812..fef6317 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/RefBase.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/RefBase.java
@@ -34,11 +34,6 @@ public abstract class RefBase {
@EdmKey
protected int id;
- public RefBase(int id, String name) {
- this.name = name;
- this.id = id;
- }
-
public String getName() {
return name;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
index 28373b9..c2e68fa 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
@@ -45,10 +45,6 @@ public class Room extends RefBase {
to = @NavigationEnd(role = "r_Employees", type = "Employee", multiplicity = EdmMultiplicity.MANY))
private List<Employee> employees = new ArrayList<Employee>();
- public Room(final int id, final String name) {
- super(id, name);
- }
-
public void setSeats(final int seats) {
this.seats = seats;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
index 2bf6701..d851428 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
@@ -40,14 +40,6 @@ public class Team extends RefBase {
to = @NavigationEnd(role = "r_Employees", type = "Employee", multiplicity = EdmMultiplicity.MANY))
private List<Employee> employees = new ArrayList<Employee>();
- public Team() {
- super(-1, null);
- }
-
- public Team(final int id, final String name) {
- super(id, name);
- }
-
public Boolean isScrumTeam() {
return isScrumTeam;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/BuildingDs.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/BuildingDs.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/BuildingDs.java
deleted file mode 100644
index 282bb4f..0000000
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/BuildingDs.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2013 The Apache Software Foundation.
- *
- * Licensed 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.ref.annotation.model.ds;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityCreate;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityDataSource;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityDelete;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntitySetRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityUpdate;
-import org.apache.olingo.odata2.ref.annotation.model.Building;
-
-/**
- *
- */
-@EntityDataSource(name="BuildingDataSource", entityType = Building.class)
-public class BuildingDs {
-
- private static int idCounter = 1;
- private final static Map<Integer, Building> id2Building = new HashMap<Integer, Building>();
-
- @EntityRead
- public Building read(String id) {
- return id2Building.get(Integer.valueOf(id));
- }
-
- @EntitySetRead
- public Collection<Building> read() {
- return id2Building.values();
- }
-
- @EntityCreate
- @EntityUpdate
- public Building createOrUpdate(Building building) {
- Building b = id2Building.get(Integer.valueOf(building.getId()));
- if(b != null) {
- b.setName(building.getName());
- } else {
- final int id = idCounter++;
- b = new Building(id, building.getName());
- id2Building.put(Integer.valueOf(id), b);
- }
- return b;
- }
-
- @EntityDelete
- public Building delete(String id) {
- return id2Building.remove(Integer.valueOf(id));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/PhotoDs.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/PhotoDs.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/PhotoDs.java
deleted file mode 100644
index 660f59c..0000000
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/PhotoDs.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2013 The Apache Software Foundation.
- *
- * Licensed 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.ref.annotation.model.ds;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityCreate;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityDataSource;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntitySetRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityUpdate;
-import org.apache.olingo.odata2.ref.annotation.model.Photo;
-
-/**
- *
- */
-@EntityDataSource(entityType = Photo.class)
-public class PhotoDs {
- private static final Map<String, Photo> photoDb = new HashMap<String, Photo>();
-
- private String createPhotoId(Photo p) {
- if(p == null) {
- return null;
- }
- return p.getName() + "-" + p.getType();
- }
-
- @EntityCreate
- @EntityUpdate
- public Photo storePhoto(Photo photo) {
- Photo p = new Photo(photo.getName(), photo.getType());
- p.setImageUri(photo.getImageUri());
- p.setImageType(photo.getImageType());
-
- photoDb.put(createPhotoId(p), p);
-
- return p;
- }
-
- @EntityRead
- public Photo loadPhoto(String name) {
- return photoDb.get(createPhotoId(new Photo(name, "PNG")));
- }
-
- @EntitySetRead
- public Collection<Photo> loadAllPhotos() {
- return photoDb.values();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/TeamDs.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/TeamDs.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/TeamDs.java
deleted file mode 100644
index 9426c7b..0000000
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/ds/TeamDs.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2013 The Apache Software Foundation.
- *
- * Licensed 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.ref.annotation.model.ds;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityDataSource;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityCreate;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntitySetRead;
-import org.apache.olingo.odata2.api.annotation.edm.ds.EntityUpdate;
-import org.apache.olingo.odata2.ref.annotation.model.Team;
-
-/**
- *
- */
-@EntityDataSource(name="TeamDataSource", entityType = Team.class)
-public class TeamDs {
-
- private static int idCounter = 1;
- private static final Map<Integer, Team> id2Team = new HashMap<Integer, Team>();
-
- @EntityRead
- public Team readTeam(String id) {
- return id2Team.get(Integer.valueOf(id));
- }
-
- @EntitySetRead
- public Collection<Team> readAllTeams() {
- return id2Team.values();
- }
-
- @EntityCreate
- public Team writeTeam(Team team) {
- final int id = idCounter++;
- team.setId(id);
- id2Team.put(Integer.valueOf(id), team);
-
- return team;
- }
-
- @EntityUpdate
- public Team update(Team team) {
- Team t = id2Team.get(Integer.valueOf(team.getId()));
- if(t != null) {
- t.setName(team.getName());
- t.setScrumTeam(team.isScrumTeam());
- }
- return team;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/AnnotationPocServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/AnnotationPocServiceFactory.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/AnnotationPocServiceFactory.java
new file mode 100644
index 0000000..2617df0
--- /dev/null
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/AnnotationPocServiceFactory.java
@@ -0,0 +1,161 @@
+/**
+ * *****************************************************************************
+ * 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.ref.annotation.processor;
+
+import org.apache.olingo.odata2.core.annotation.ds.AnnotationValueAccess;
+import org.apache.olingo.odata2.core.annotation.ds.AnnotationInMemoryDs;
+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.apache.olingo.odata2.core.annotation.ds.DataStore;
+import org.apache.olingo.odata2.core.annotation.edm.AnnotationEdmProvider;
+import org.apache.olingo.odata2.core.annotation.processor.ListsProcessor;
+import org.apache.olingo.odata2.ref.annotation.model.Building;
+import org.apache.olingo.odata2.ref.annotation.model.Photo;
+import org.apache.olingo.odata2.ref.annotation.model.Room;
+import org.apache.olingo.odata2.ref.annotation.model.Team;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class AnnotationPocServiceFactory extends ODataServiceFactory {
+
+ private static boolean isInitialized = false;
+
+ @Override
+ public ODataService createService(final ODataContext context) throws ODataException {
+
+ String modelPackage = "org.apache.olingo.odata2.ref.annotation.model";
+ AnnotationEdmProvider annotationEdmProvider = new AnnotationEdmProvider(modelPackage);
+ AnnotationInMemoryDs annotationScenarioDs = new AnnotationInMemoryDs(modelPackage);
+ AnnotationValueAccess annotationValueAccess = new AnnotationValueAccess();
+
+ if (!isInitialized) {
+ initializeSampleData(annotationScenarioDs);
+ isInitialized = true;
+ }
+
+ // Edm via Annotations and ListProcessor via AnnotationDS with AnnotationsValueAccess
+ return createODataSingleProcessorService(annotationEdmProvider,
+ new ListsProcessor(annotationScenarioDs, annotationValueAccess));
+ }
+
+ @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
+ */
+
+ /**
+ *
+ */
+ private final class ScenarioDebugCallback implements ODataDebugCallback {
+
+ @Override
+ public boolean isDebugEnabled() {
+ return true;
+ }
+ }
+
+ 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 void initializeSampleData(AnnotationInMemoryDs dataSource) {
+ DataStore<Team> teamDs = dataSource.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 = dataSource.getDataStore(Building.class);
+ buildingsDs.create(createBuilding("Red Building"));
+ buildingsDs.create(createBuilding("Green Building"));
+ buildingsDs.create(createBuilding("Blue Building"));
+ buildingsDs.create(createBuilding("Yellow Building"));
+
+ DataStore<Photo> photoDs = dataSource.getDataStore(Photo.class);
+ photoDs.create(createPhoto("Small picture"));
+ photoDs.create(createPhoto("Medium picture"));
+ photoDs.create(createPhoto("Big picture"));
+
+ DataStore<Room> roomDs = dataSource.getDataStore(Room.class);
+ roomDs.create(createRoom("Tiny room", 5, 1));
+ roomDs.create(createRoom("Small room", 20, 1));
+ roomDs.create(createRoom("Big room", 40, 1));
+ roomDs.create(createRoom("Huge room", 120, 1));
+ }
+
+ private Team createTeam(String teamName, boolean isScrumTeam) {
+ Team team = new Team();
+ team.setName(teamName);
+ team.setScrumTeam(isScrumTeam);
+ return team;
+ }
+
+ private Building createBuilding(String buildingName) {
+ Building b = new Building();
+ b.setName(buildingName);
+ return b;
+ }
+
+ private Photo createPhoto(String name) {
+ Photo p = new Photo();
+ p.setName(name);
+ p.setType("PNG");
+ p.setImageType("image/png");
+ p.setImageUri("http://localhost/image/" + name);
+ return p;
+ }
+
+ private Room createRoom(String name, int seats, int version) {
+ Room r = new Room();
+ r.setName(name);
+ r.setSeats(seats);
+ r.setVersion(version);
+ return r;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioErrorCallback.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioErrorCallback.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioErrorCallback.java
deleted file mode 100644
index 45a4f81..0000000
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioErrorCallback.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.ref.annotation.processor;
-
-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.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;
-
-/**
- * Callback for handling errors by logging internal server errors additionally.
- *
- */
-public class ScenarioErrorCallback implements ODataErrorCallback {
-
- private static 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);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioServiceFactory.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioServiceFactory.java
deleted file mode 100644
index d04f6f4..0000000
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/processor/ScenarioServiceFactory.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.ref.annotation.processor;
-
-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.exception.ODataException;
-import org.apache.olingo.odata2.api.processor.ODataContext;
-import org.apache.olingo.odata2.core.annotation.edm.AnnotationEdmProvider;
-import org.apache.olingo.odata2.core.annotation.processor.AnnotationProcessor;
-import org.apache.olingo.odata2.ref.annotation.model.Building;
-import org.apache.olingo.odata2.ref.annotation.model.Photo;
-import org.apache.olingo.odata2.ref.annotation.model.Team;
-import org.apache.olingo.odata2.ref.annotation.model.ds.BuildingDs;
-import org.apache.olingo.odata2.ref.annotation.model.ds.PhotoDs;
-import org.apache.olingo.odata2.ref.annotation.model.ds.TeamDs;
-
-/**
- *
- */
-public class ScenarioServiceFactory extends ODataServiceFactory {
-
- private static boolean isInitialized = false;
-
- @Override
- public ODataService createService(final ODataContext context) throws ODataException {
- if(!isInitialized) {
- initializeSampleData();
- isInitialized = true;
- }
-
- return createODataSingleProcessorService(
- new AnnotationEdmProvider("org.apache.olingo.odata2.ref.annotation.model"),
- new AnnotationProcessor(context, "org.apache.olingo.odata2.ref.annotation.model"));
- }
-
- @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));
- }
-
- private final class ScenarioDebugCallback implements ODataDebugCallback {
-
- @Override
- public boolean isDebugEnabled() {
- return true;
- }
- }
-
-
- private void initializeSampleData() {
- TeamDs teamDs = new TeamDs();
- teamDs.writeTeam(createTeam("Team Alpha", true));
- teamDs.writeTeam(createTeam("Team Beta", false));
- teamDs.writeTeam(createTeam("Team Gamma", false));
- teamDs.writeTeam(createTeam("Team Omega", true));
- teamDs.writeTeam(createTeam("Team Zeta", true));
-
- BuildingDs buildingsDs = new BuildingDs();
- buildingsDs.createOrUpdate(createBuilding("Red Building"));
- buildingsDs.createOrUpdate(createBuilding("Green Building"));
- buildingsDs.createOrUpdate(createBuilding("Blue Building"));
-
- PhotoDs photoDs = new PhotoDs();
- photoDs.storePhoto(createPhoto("Small picture"));
- photoDs.storePhoto(createPhoto("Medium picture"));
- photoDs.storePhoto(createPhoto("Big picture"));
- }
-
- private Team createTeam(String teamName, boolean isScrumTeam) {
- Team team = new Team();
- team.setName(teamName);
- team.setScrumTeam(isScrumTeam);
- return team;
- }
-
- private Building createBuilding(String buildingName) {
- Building b = new Building();
- b.setName(buildingName);
- return b;
- }
-
- private Photo createPhoto(String name) {
- Photo p = new Photo(name, "PNG");
- p.setImageType("image/png");
- p.setImageUri("http://localhost/image/" + name);
- return p;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/pom.xml b/odata2-lib/odata-annotation/pom.xml
index 269c062..689e49e 100644
--- a/odata2-lib/odata-annotation/pom.xml
+++ b/odata2-lib/odata-annotation/pom.xml
@@ -1,34 +1,34 @@
<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
+<!-- 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
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata2-lib-incubating</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-odata2-api-annotation-incubating</artifactId>
- <name>${project.artifactId}</name>
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-lib-incubating</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>olingo-odata2-api-annotation-incubating</artifactId>
+ <name>${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-api-incubating</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java
new file mode 100644
index 0000000..adec2d7
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface EdmComplexEntity {
+ String name() default "";
+ String namespace();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java
new file mode 100644
index 0000000..ed5d802
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface EdmEntityType {
+ String name() default "";
+ String namespace();
+ /* If set this entity is exposed as entity set with given name. If not set theire will be no entity set generated. */
+ String entitySetName() default "";
+ String container() default "";
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java
new file mode 100644
index 0000000..4ea2bd5
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface EdmFacets {
+ int maxLength() default 0;
+ int scale() default -1;
+ int precision() default 0;
+ boolean nullable() default false;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmKey.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmKey.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmKey.java
new file mode 100644
index 0000000..48db91f
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmKey.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface EdmKey {
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceContent.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceContent.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceContent.java
new file mode 100644
index 0000000..80e9cd8
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceContent.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface EdmMediaResourceContent {
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceMimeType.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceMimeType.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceMimeType.java
new file mode 100644
index 0000000..d255ff4
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceMimeType.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface EdmMediaResourceMimeType {
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceSource.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceSource.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceSource.java
new file mode 100644
index 0000000..78e72b5
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmMediaResourceSource.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface EdmMediaResourceSource {
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java
new file mode 100644
index 0000000..cf898df
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface EdmNavigationProperty {
+ String name();
+ String relationship();
+
+ //
+ NavigationEnd from() default @NavigationEnd;
+ NavigationEnd to() default @NavigationEnd;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java
new file mode 100644
index 0000000..66c5282
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface EdmProperty {
+ EdmSimpleTypeKind type() default EdmSimpleTypeKind.Null;
+ String name() default "";
+ /* only for complex property */
+ String namespace() default "";
+ EdmFacets facets() default @EdmFacets;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java
new file mode 100644
index 0000000..2ce5ef1
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface NavigationEnd {
+ String role() default "";
+ String type() default "";
+
+ EdmMultiplicity multiplicity() default EdmMultiplicity.ONE;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
index 84b8ed1..e9e2153 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
@@ -39,12 +39,12 @@ import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
import org.apache.olingo.odata2.api.commons.ODataHttpMethod;
import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
+import org.apache.olingo.odata2.core.annotation.ds.BeanPropertyAccess;
+import org.apache.olingo.odata2.core.annotation.processor.ListsProcessor;
import org.apache.olingo.odata2.core.processor.ODataSingleProcessorService;
import org.apache.olingo.odata2.ref.edm.ScenarioEdmProvider;
import org.apache.olingo.odata2.ref.model.DataContainer;
import org.apache.olingo.odata2.ref.model.Photo;
-import org.apache.olingo.odata2.ref.processor.ListsProcessor;
-import org.apache.olingo.odata2.ref.processor.BeanPropertyAccess;
import org.apache.olingo.odata2.ref.processor.ScenarioDataSource;
import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
import org.apache.olingo.odata2.testutil.helper.StringHelper;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
index 50a9b47..eec1f42 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
@@ -30,9 +30,9 @@ import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.olingo.odata2.api.commons.HttpContentType;
import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.core.annotation.processor.ListsProcessor;
import org.apache.olingo.odata2.ref.model.DataContainer;
import org.apache.olingo.odata2.ref.model.Photo;
-import org.apache.olingo.odata2.ref.processor.ListsProcessor;
import org.apache.olingo.odata2.ref.processor.ScenarioDataSource;
import org.custommonkey.xmlunit.XMLAssert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/contentnegotiation/AbstractContentNegotiationTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/contentnegotiation/AbstractContentNegotiationTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/contentnegotiation/AbstractContentNegotiationTest.java
index edfbd27..265fc28 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/contentnegotiation/AbstractContentNegotiationTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/contentnegotiation/AbstractContentNegotiationTest.java
@@ -49,13 +49,13 @@ import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
import org.apache.olingo.odata2.api.exception.ODataException;
import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
+import org.apache.olingo.odata2.core.annotation.ds.BeanPropertyAccess;
+import org.apache.olingo.odata2.core.annotation.processor.ListsProcessor;
import org.apache.olingo.odata2.core.commons.ContentType;
import org.apache.olingo.odata2.core.processor.ODataSingleProcessorService;
import org.apache.olingo.odata2.core.uri.UriType;
import org.apache.olingo.odata2.ref.edm.ScenarioEdmProvider;
import org.apache.olingo.odata2.ref.model.DataContainer;
-import org.apache.olingo.odata2.ref.processor.BeanPropertyAccess;
-import org.apache.olingo.odata2.ref.processor.ListsProcessor;
import org.apache.olingo.odata2.ref.processor.ScenarioDataSource;
import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
import org.apache.olingo.odata2.testutil.helper.StringHelper;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-ref/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/pom.xml b/odata2-lib/odata-ref/pom.xml
index fbf419f..7b71a66 100644
--- a/odata2-lib/odata-ref/pom.xml
+++ b/odata2-lib/odata-ref/pom.xml
@@ -91,6 +91,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-edm-annotation-core-incubating</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/BeanPropertyAccess.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/BeanPropertyAccess.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/BeanPropertyAccess.java
deleted file mode 100644
index a621eb7..0000000
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/BeanPropertyAccess.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.ref.processor;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmMapping;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.api.exception.ODataHttpException;
-import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
-
-/**
- * Data access.
- */
-public class BeanPropertyAccess implements ValueAccess {
-
- @Override
- public <T> Object getPropertyValue(final T data, final EdmProperty property) throws ODataException {
- return getValue(data, getGetterMethodName(property));
- }
-
- @Override
- public <T, V> void setPropertyValue(T data, final EdmProperty property, final V value) throws ODataException {
- final String methodName = getSetterMethodName(getGetterMethodName(property));
- if (methodName != null) {
- setValue(data, methodName, value);
- }
- }
-
- @Override
- public <T> Class<?> getPropertyType(final T data, final EdmProperty property) throws ODataException {
- return getType(data, getGetterMethodName(property));
- }
-
- @Override
- public <T> Object getMappingValue(final T data, final EdmMapping mapping) throws ODataException {
- if (mapping != null && mapping.getMimeType() != null) {
- return getValue(data, mapping.getMimeType());
- }
- return null;
- }
-
- @Override
- public <T, V> void setMappingValue(T data, final EdmMapping mapping, final V value) throws ODataException {
- if (mapping != null && mapping.getMimeType() != null) {
- setValue(data, getSetterMethodName(mapping.getMimeType()), value);
- }
- }
-
- private String getGetterMethodName(final EdmProperty property) throws EdmException {
- final String prefix = isBooleanProperty(property) ? "is" : "get";
- final String defaultMethodName = prefix + property.getName();
- return property.getMapping() == null || property.getMapping().getInternalName() == null ?
- defaultMethodName : property.getMapping().getInternalName();
- }
-
- private boolean isBooleanProperty(final EdmProperty property) throws EdmException {
- return property.isSimple()
- && property.getType() == EdmSimpleTypeKind.Boolean.getEdmSimpleTypeInstance();
- }
-
- private String getSetterMethodName(final String getterMethodName) {
- return getterMethodName.contains(".") ?
- null : getterMethodName.replaceFirst("^is", "set").replaceFirst("^get", "set");
- }
-
- private <T> Object getValue(final T data, final String methodName) throws ODataNotFoundException {
- Object dataObject = data;
-
- for (final String method : methodName.split("\\.", -1)) {
- if (dataObject != null) {
- try {
- dataObject = dataObject.getClass().getMethod(method).invoke(dataObject);
- } catch (SecurityException e) {
- throw new ODataNotFoundException(ODataHttpException.COMMON, e);
- } catch (NoSuchMethodException e) {
- throw new ODataNotFoundException(ODataHttpException.COMMON, e);
- } catch (IllegalArgumentException e) {
- throw new ODataNotFoundException(ODataHttpException.COMMON, e);
- } catch (IllegalAccessException e) {
- throw new ODataNotFoundException(ODataHttpException.COMMON, e);
- } catch (InvocationTargetException e) {
- throw new ODataNotFoundException(ODataHttpException.COMMON, e);
- }
- }
- }
-
- return dataObject;
- }
-
- private <T, V> void setValue(final T data, final String methodName, final V value)
- throws ODataNotFoundException {
- try {
- boolean found = false;
- for (final Method method : Arrays.asList(data.getClass().getMethods())) {
- if (method.getName().equals(methodName)) {
- found = true;
- final Class<?> type = method.getParameterTypes()[0];
- if (value == null) {
- if (type.equals(byte.class) || type.equals(short.class) || type.equals(int.class)
- || type.equals(long.class) || type.equals(char.class)) {
- method.invoke(data, 0);
- } else if (type.equals(float.class) || type.equals(double.class)) {
- method.invoke(data, 0.0);
- } else if (type.equals(boolean.class)) {
- method.invoke(data, false);
- } else {
- method.invoke(data, value);
- }
- } else {
- method.invoke(data, value);
- }
- break;
- }
- }
- if (!found) {
- throw new ODataNotFoundException(null);
- }
- } catch (SecurityException e) {
- throw new ODataNotFoundException(null, e);
- } catch (IllegalArgumentException e) {
- throw new ODataNotFoundException(null, e);
- } catch (IllegalAccessException e) {
- throw new ODataNotFoundException(null, e);
- } catch (InvocationTargetException e) {
- throw new ODataNotFoundException(null, e);
- }
- }
-
- private <T> Class<?> getType(final T data, final String methodName) throws ODataNotFoundException {
- if (data == null) {
- throw new ODataNotFoundException(ODataHttpException.COMMON);
- }
-
- Class<?> type = data.getClass();
- for (final String method : methodName.split("\\.", -1)) {
- try {
- type = type.getMethod(method).getReturnType();
- if (type.isPrimitive()) {
- if (type == boolean.class) {
- type = Boolean.class;
- } else if (type == byte.class) {
- type = Byte.class;
- } else if (type == short.class) {
- type = Short.class;
- } else if (type == int.class) {
- type = Integer.class;
- } else if (type == long.class) {
- type = Long.class;
- } else if (type == float.class) {
- type = Float.class;
- } else if (type == double.class) {
- type = Double.class;
- }
- }
- } catch (final SecurityException e) {
- throw new ODataNotFoundException(ODataHttpException.COMMON, e);
- } catch (final NoSuchMethodException e) {
- throw new ODataNotFoundException(ODataHttpException.COMMON, e);
- }
- }
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d83070de/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsDataSource.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsDataSource.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsDataSource.java
deleted file mode 100644
index 3e24bee..0000000
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsDataSource.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.ref.processor;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.odata2.api.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
-import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
-import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
-
-/**
- * <p>This interface is intended to make it easier to implement an OData
- * service in cases where all data for each entity set can be provided as a {@link List} of objects from which all
- * properties described in the
- * Entity Data Model can be retrieved and set.</p>
- * <p>By obeying these restrictions, data-source implementations get the
- * following advantages:
- * <ul>
- * <li>All system query options can be handled centrally.</li>
- * <li>Following navigation paths must only be done step by step.</li>
- * </ul>
- * </p>
- *
- */
-public interface ListsDataSource {
-
- /**
- * Retrieves the whole data list for the specified entity set.
- * @param entitySet the requested {@link EdmEntitySet}
- * @return the requested data list
- */
- List<?> readData(EdmEntitySet entitySet) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
- ODataApplicationException;
-
- /**
- * Retrieves a single data object for the specified entity set and key.
- * @param entitySet the requested {@link EdmEntitySet}
- * @param keys the entity key as map of key names to key values
- * @return the requested data object
- */
- Object readData(EdmEntitySet entitySet, Map<String, Object> keys) throws ODataNotImplementedException,
- ODataNotFoundException, EdmException, ODataApplicationException;
-
- /**
- * <p>Retrieves data for the specified function import and key.</p>
- * <p>This method is called also for function imports that have defined in
- * their metadata an other HTTP method than <code>GET</code>.</p>
- * @param function the requested {@link EdmFunctionImport}
- * @param parameters the parameters of the function import
- * as map of parameter names to parameter values
- * @param keys the key of the returned entity set, as map of key names to key values,
- * if the return type of the function import is a collection of entities
- * (optional)
- * @return the requested data object, either a list or a single object;
- * if the function import's return type is of type <code>Binary</code>,
- * the returned object(s) must be of type {@link BinaryData}
- */
- Object readData(EdmFunctionImport function, Map<String, Object> parameters, Map<String, Object> keys)
- throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException;
-
- /**
- * <p>Retrieves related data for the specified source data, entity set, and key.</p>
- * <p>If the underlying association of the EDM is specified to have target
- * multiplicity '*' and no target key is given, this method returns a list of
- * related data, otherwise it returns a single data object.</p>
- * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
- * @param sourceData the data object of the source entity
- * @param targetEntitySet the requested target {@link EdmEntitySet}
- * @param targetKeys the key of the target entity as map of key names to key values
- * (optional)
- * @return the requested releated data object, either a list or a single object
- */
- Object readRelatedData(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
- Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
- ODataApplicationException;
-
- /**
- * Retrieves the binary data and the MIME type for the media resource
- * associated to the specified media-link entry.
- * @param entitySet the {@link EdmEntitySet} of the media-link entry
- * @param mediaLinkEntryData the data object of the media-link entry
- * @return the binary data and the MIME type of the media resource
- */
- BinaryData readBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData) throws ODataNotImplementedException,
- ODataNotFoundException, EdmException, ODataApplicationException;
-
- /**
- * <p>Creates and returns a new instance of the requested data-object type.</p>
- * <p>This instance must not be part of the corresponding list and should
- * have empty content, apart from the key and other mandatory properties.
- * However, intermediate objects to access complex properties must not be
- * <code>null</code>.</p>
- * @param entitySet the {@link EdmEntitySet} the object must correspond to
- * @return the new data object
- */
- Object newDataObject(EdmEntitySet entitySet) throws ODataNotImplementedException, EdmException,
- ODataApplicationException;
-
- /**
- * Writes the binary data for the media resource associated to the
- * specified media-link entry.
- * @param entitySet the {@link EdmEntitySet} of the media-link entry
- * @param mediaLinkEntryData the data object of the media-link entry
- * @param binaryData the binary data of the media resource along with
- * the MIME type of the binary data
- */
- void writeBinaryData(EdmEntitySet entitySet, Object mediaLinkEntryData, BinaryData binaryData)
- throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException;
-
- /**
- * Deletes a single data object identified by the specified entity set and key.
- * @param entitySet the {@link EdmEntitySet} of the entity to be deleted
- * @param keys the entity key as map of key names to key values
- */
- void deleteData(EdmEntitySet entitySet, Map<String, Object> keys) throws ODataNotImplementedException,
- ODataNotFoundException, EdmException, ODataApplicationException;
-
- /**
- * <p>Inserts an instance into the entity list of the specified entity set.</p>
- * <p>If {@link #newDataObject} has not set the key and other mandatory
- * properties already, this method must set them before inserting the
- * instance into the list.</p>
- * @param entitySet the {@link EdmEntitySet} the object must correspond to
- * @param data the data object of the new entity
- */
- void createData(EdmEntitySet entitySet, Object data) throws ODataNotImplementedException, EdmException,
- ODataApplicationException;
-
- /**
- * Deletes the relation from the specified source data to a target entity
- * specified by entity set and key.
- * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
- * @param sourceData the data object of the source entity
- * @param targetEntitySet the {@link EdmEntitySet} of the target entity
- * @param targetKeys the key of the target entity as map of key names to key values
- * (optional)
- */
- void deleteRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
- Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
- ODataApplicationException;
-
- /**
- * Writes a relation from the specified source data to a target entity
- * specified by entity set and key.
- * @param sourceEntitySet the {@link EdmEntitySet} of the source entity
- * @param sourceData the data object of the source entity
- * @param targetEntitySet the {@link EdmEntitySet} of the relation target
- * @param targetKeys the key of the target entity as map of key names to key values
- */
- void writeRelation(EdmEntitySet sourceEntitySet, Object sourceData, EdmEntitySet targetEntitySet,
- Map<String, Object> targetKeys) throws ODataNotImplementedException, ODataNotFoundException, EdmException,
- ODataApplicationException;
-
- /**
- * Container to store binary data (as byte array) and the associated MIME type.
- */
- public class BinaryData {
- private final byte[] data;
- private final String mimeType;
-
- public BinaryData(final byte[] data, final String mimeType) {
- this.data = data;
- this.mimeType = mimeType;
- }
-
- public byte[] getData() {
- return data;
- }
-
- public String getMimeType() {
- return mimeType;
- }
-
- @Override
- public String toString() {
- return "data=" + Arrays.toString(data) + ", mimeType=" + mimeType;
- }
- }
-}