You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/09/03 15:39:28 UTC
[3/4] olingo-odata4 git commit: [OLINGO-713] Switched tutorials to
release snapshot. Started to create a merged version of all tutorials
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p0_all/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p0_all/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p0_all/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..21de52a
--- /dev/null
+++ b/samples/tutorials/p0_all/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <!-- Register the HttpServlet implementation -->
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class>myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!--
+ Our OData service can be invoked at
+ http://localhost:8080/DemoService/DemoService.svc
+ -->
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p0_all/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/samples/tutorials/p0_all/src/main/webapp/index.jsp b/samples/tutorials/p0_all/src/main/webapp/index.jsp
new file mode 100644
index 0000000..c0fe23e
--- /dev/null
+++ b/samples/tutorials/p0_all/src/main/webapp/index.jsp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service</a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p1_read/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p1_read/pom.xml b/samples/tutorials/p1_read/pom.xml
index 7f212c5..cad1b0c 100755
--- a/samples/tutorials/p1_read/pom.xml
+++ b/samples/tutorials/p1_read/pom.xml
@@ -25,7 +25,7 @@
<groupId>my.group.id</groupId>
<artifactId>DemoService-Read</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>4.0.0</version>
<name>${project.artifactId}-Webapp</name>
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-beta-03</odata.version>
+ <odata.version>4.0.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
@@ -75,5 +75,11 @@
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.11</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
index dd46e86..614738a 100755
--- a/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
+++ b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
@@ -58,7 +57,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
@Override
- public List<CsdlSchema> getSchemas() throws ODataException {
+ public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
@@ -81,7 +80,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
@Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
// this method is called for one of the EntityTypes that are configured in the Schema
if(entityTypeName.equals(ET_PRODUCT_FQN)){
@@ -108,7 +107,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
if(entityContainer.equals(CONTAINER)){
if(entitySetName.equals(ES_PRODUCTS_NAME)){
@@ -124,7 +123,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
+ public CsdlEntityContainer getEntityContainer() {
// create EntitySets
List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
@@ -139,7 +138,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
// This method is invoked when displaying the service document at e.g. http://localhost:8080/DemoService/DemoService.svc
if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
index e82a3ca..4e4567b 100755
--- a/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
+++ b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -28,7 +28,6 @@ import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -78,9 +77,8 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
EntityCollection entitySet = getData(edmEntitySet);
// 3rd: create a serializer based on the requested format (json)
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
-
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
+
// 4th: Now serialize the content: transform from the EntitySet object to InputStream
EdmEntityType edmEntityType = edmEntitySet.getEntityType();
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p2_readep/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p2_readep/pom.xml b/samples/tutorials/p2_readep/pom.xml
index 9a47d1c..a6beac0 100755
--- a/samples/tutorials/p2_readep/pom.xml
+++ b/samples/tutorials/p2_readep/pom.xml
@@ -1,31 +1,15 @@
<?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/maven-v4_0_0.xsd">
+<!-- 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my.group.id</groupId>
<artifactId>DemoService-ReadEp</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>4.0.0</version>
<name>${project.artifactId}-Webapp</name>
@@ -35,7 +19,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-beta-03</odata.version>
+ <odata.version>4.0.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
@@ -75,5 +59,12 @@
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.11</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
index 15140e1..14e3db6 100755
--- a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
@@ -53,8 +52,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
@Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName)
- throws ODataException {
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
// this method is called for one of the EntityTypes that are configured in the Schema
if(ET_PRODUCT_FQN.equals(entityTypeName)){
@@ -81,8 +79,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
- String entitySetName) throws ODataException {
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
if(entityContainer.equals(CONTAINER)){
if(entitySetName.equals(ES_PRODUCTS_NAME)){
CsdlEntitySet entitySet = new CsdlEntitySet();
@@ -98,9 +95,9 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainerInfo getEntityContainerInfo(
- FullQualifiedName entityContainerName) throws ODataException {
- // This method is invoked when displaying the service document at e.g. http://localhost:8080/DemoService/DemoService.svc
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
+ // This method is invoked when displaying the service document
+ // at e.g. http://localhost:8080/DemoService/DemoService.svc
if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
entityContainerInfo.setContainerName(CONTAINER);
@@ -112,7 +109,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public List<CsdlSchema> getSchemas() throws ODataException {
+ public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
@@ -134,7 +131,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
+ public CsdlEntityContainer getEntityContainer() {
// create EntitySets
List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
index d69d529..9b6e25a 100755
--- a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -28,7 +28,6 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -71,8 +70,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
EntityCollection entityCollection = storage.readEntitySetData(edmEntitySet);
// 3rd: create a serializer based on the requested format (json)
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
// and serialize the content: transform from the EntitySet object to InputStream
EdmEntityType edmEntityType = edmEntitySet.getEntityType();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
index e3c8767..82163f4 100755
--- a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -29,7 +29,6 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -88,8 +87,7 @@ public class DemoEntityProcessor implements EntityProcessor {
// expand and select currently not supported
EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
- ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ ODataSerializer serializer = this.odata.createSerializer(responseFormat);
SerializerResult serializerResult = serializer.entity(serviceMetadata, entityType, entity, options);
InputStream entityStream = serializerResult.getContent();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
index 1ba0c75..40ae7ca 100755
--- a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -31,7 +31,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -55,6 +54,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
private OData odata;
private Storage storage;
+ private ServiceMetadata serviceMetadata;
public DemoPrimitiveProcessor(Storage storage) {
this.storage = storage;
@@ -62,7 +62,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
public void init(OData odata, ServiceMetadata serviceMetadata) {
this.odata = odata;
-
+ this.serviceMetadata = serviceMetadata;
}
/*
@@ -111,13 +111,12 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
Object value = property.getValue();
if (value != null) {
// 3.1. configure the serializer
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
// 3.2. serialize
- SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ SerializerResult serializerResult = serializer.primitive(serviceMetadata, edmPropertyType, property, options);
InputStream propertyStream = serializerResult.getContent();
//4. configure the response object
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java
index c21d352..a645d46 100755
--- a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java
@@ -23,7 +23,6 @@ import java.util.Locale;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -31,10 +30,7 @@ import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfoResource;
import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
public class Util {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p3_write/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p3_write/pom.xml b/samples/tutorials/p3_write/pom.xml
index dc9ba69..7ff4f22 100755
--- a/samples/tutorials/p3_write/pom.xml
+++ b/samples/tutorials/p3_write/pom.xml
@@ -25,7 +25,7 @@
<groupId>my.group.id</groupId>
<artifactId>DemoService-Write</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>4.0.0</version>
<name>${project.artifactId}-Webapp</name>
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-beta-03</odata.version>
+ <odata.version>4.0.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
@@ -75,5 +75,11 @@
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.11</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
index f842af8..b19d7fd 100755
--- a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
@@ -58,7 +57,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
@Override
- public List<CsdlSchema> getSchemas() throws ODataException {
+ public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
@@ -81,7 +80,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
@Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
// this method is called for one of the EntityTypes that are configured in the Schema
if(entityTypeName.equals(ET_PRODUCT_FQN)){
@@ -111,7 +110,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
if(entityContainer.equals(CONTAINER)){
if(entitySetName.equals(ES_PRODUCTS_NAME)){
@@ -128,7 +127,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
- public CsdlEntityContainer getEntityContainer() throws ODataException {
+ public CsdlEntityContainer getEntityContainer() {
// create EntitySets
List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
@@ -143,7 +142,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
// This method is invoked when displaying the service document at
// e.g. http://localhost:8080/DemoService/DemoService.svc
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
index 53470cb..bae1ec5 100755
--- a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -27,7 +27,6 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -75,8 +74,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
EntityCollection entitySet = storage.readEntitySetData(edmEntitySet);
// 3rd: create a serializer based on the requested format (json)
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
// and serialize the content: transform from the EntitySet object to InputStream
EdmEntityType edmEntityType = edmEntitySet.getEntityType();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
index 35d4203..499f5f6 100755
--- a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -29,7 +29,6 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -87,8 +86,7 @@ public class DemoEntityProcessor implements EntityProcessor {
// expand and select currently not supported
EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
- ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ ODataSerializer serializer = this.odata.createSerializer(responseFormat);
SerializerResult result = serializer.entity(serviceMetadata, entityType, entity, options);
//4. configure the response object
@@ -120,8 +118,7 @@ public class DemoEntityProcessor implements EntityProcessor {
// 2. create the data in backend
// 2.1. retrieve the payload from the POST request for the entity to create and deserialize it
InputStream requestInputStream = request.getBody();
- ODataFormat requestODataFormat = ODataFormat.fromContentType(requestFormat);
- ODataDeserializer deserializer = this.odata.createDeserializer(requestODataFormat);
+ ODataDeserializer deserializer = this.odata.createDeserializer(requestFormat);
DeserializerResult result = deserializer.entity(requestInputStream, edmEntityType);
Entity requestEntity = result.getEntity();
// 2.2 do the creation in backend, which returns the newly created entity
@@ -131,8 +128,7 @@ public class DemoEntityProcessor implements EntityProcessor {
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build(); // expand and select currently not supported
- ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ ODataSerializer serializer = this.odata.createSerializer(responseFormat);
SerializerResult serializedResponse = serializer.entity(serviceMetadata, edmEntityType, createdEntity, options);
//4. configure the response object
@@ -156,8 +152,7 @@ public class DemoEntityProcessor implements EntityProcessor {
// 2. update the data in backend
// 2.1. retrieve the payload from the PUT request for the entity to be updated
InputStream requestInputStream = request.getBody();
- ODataFormat requestODataFormat = ODataFormat.fromContentType(requestFormat);
- ODataDeserializer deserializer = this.odata.createDeserializer(requestODataFormat);
+ ODataDeserializer deserializer = this.odata.createDeserializer(requestFormat);
DeserializerResult result = deserializer.entity(requestInputStream, edmEntityType);
Entity requestEntity = result.getEntity();
// 2.2 do the modification in backend
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
index ccf6d2b..8766b8d 100755
--- a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -30,7 +30,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -54,6 +53,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
private OData odata;
private Storage storage;
+ private ServiceMetadata serviceMetadata;
public DemoPrimitiveProcessor(Storage storage) {
this.storage = storage;
@@ -61,6 +61,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
public void init(OData odata, ServiceMetadata serviceMetadata) {
this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
}
/*
@@ -111,13 +112,12 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
Object value = property.getValue();
if (value != null) {
// 3.1. configure the serializer
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
// 3.2. serialize
- SerializerResult result = serializer.primitive(edmPropertyType, property, options);
+ SerializerResult result = serializer.primitive(serviceMetadata, edmPropertyType, property, options);
//4. configure the response object
response.setContent(result.getContent());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p4_navigation/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p4_navigation/pom.xml b/samples/tutorials/p4_navigation/pom.xml
index e24efea..2f22679 100755
--- a/samples/tutorials/p4_navigation/pom.xml
+++ b/samples/tutorials/p4_navigation/pom.xml
@@ -25,7 +25,7 @@
<groupId>my.group.id</groupId>
<artifactId>DemoService-Navigation</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>4.0.0</version>
<name>${project.artifactId}-Webapp</name>
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-beta-03</odata.version>
+ <odata.version>4.0.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
@@ -76,5 +76,12 @@
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.11</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
index 7b1fef8..8ce9bac 100755
--- a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
@@ -57,7 +56,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
public static final String ES_CATEGORIES_NAME = "Categories";
@Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
// this method is called for each EntityType that are configured in the Schema
CsdlEntityType entityType = null;
@@ -118,7 +117,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
CsdlEntitySet entitySet = null;
@@ -158,7 +157,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
// This method is invoked when displaying the service document at
// e.g. http://localhost:8080/DemoService/DemoService.svc
@@ -172,7 +171,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public List<CsdlSchema> getSchemas() throws ODataException {
+ public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
@@ -194,7 +193,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
+ public CsdlEntityContainer getEntityContainer() {
// create EntitySets
List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
index 9f281bb..5a87c0d 100755
--- a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -31,7 +31,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -136,7 +135,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with().contextURL(contextUrl).build();
EdmEntityType edmEntityType = responseEdmEntitySet.getEntityType();
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(responseFormat));
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
SerializerResult serializerResult = serializer.entityCollection(this.srvMetadata, edmEntityType,
responseEntityCollection, opts);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
index a2cf344..fba514a 100755
--- a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -31,7 +31,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -145,8 +144,7 @@ public class DemoEntityProcessor implements EntityProcessor {
ContextURL contextUrl = ContextURL.with().entitySet(responseEdmEntitySet).suffix(Suffix.ENTITY).build();
EntitySerializerOptions opts = EntitySerializerOptions.with().contextURL(contextUrl).build();
- ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ ODataSerializer serializer = this.odata.createSerializer(responseFormat);
SerializerResult serializerResult = serializer.entity(this.srvMetadata,
responseEdmEntityType, responseEntity, opts);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
index c32c5c2..9246bf1 100755
--- a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -31,7 +31,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -55,6 +54,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
private OData odata;
private Storage storage;
+ private ServiceMetadata serviceMetadata;
public DemoPrimitiveProcessor(Storage storage) {
this.storage = storage;
@@ -62,6 +62,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
public void init(OData odata, ServiceMetadata serviceMetadata) {
this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
}
@@ -114,13 +115,12 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
Object value = property.getValue();
if (value != null) {
// 3.1. configure the serializer
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
// 3.2. serialize
- SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ SerializerResult serializerResult = serializer.primitive(serviceMetadata, edmPropertyType, property, options);
InputStream propertyStream = serializerResult.getContent();
// 4. configure the response object
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p5_queryoptions-tcs/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p5_queryoptions-tcs/pom.xml b/samples/tutorials/p5_queryoptions-tcs/pom.xml
index d9b463e..db68f42 100755
--- a/samples/tutorials/p5_queryoptions-tcs/pom.xml
+++ b/samples/tutorials/p5_queryoptions-tcs/pom.xml
@@ -25,7 +25,7 @@
<groupId>my.group.id</groupId>
<artifactId>DemoService-QueryOptions-TCS</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>4.0.0</version>
<name>${project.artifactId}-Webapp</name>
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-beta-03</odata.version>
+ <odata.version>4.0.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
@@ -75,5 +75,11 @@
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.11</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
index 3c28a21..6ff041b 100755
--- a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
@@ -52,8 +51,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
public static final String ES_PRODUCTS_NAME = "Products";
@Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName)
- throws ODataException {
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
// this method is called for one of the EntityTypes that are configured in the Schema
if (ET_PRODUCT_FQN.equals(entityTypeName)) {
@@ -83,8 +81,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
- String entitySetName) throws ODataException {
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
if (entityContainer.equals(CONTAINER)) {
if (entitySetName.equals(ES_PRODUCTS_NAME)) {
CsdlEntitySet entitySet = new CsdlEntitySet();
@@ -100,8 +97,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainerInfo getEntityContainerInfo(
- FullQualifiedName entityContainerName) throws ODataException {
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
// This method is invoked when displaying the service document at
// e.g. http://localhost:8080/DemoService/DemoService.svc
if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
@@ -115,7 +111,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public List<CsdlSchema> getSchemas() throws ODataException {
+ public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
@@ -137,7 +133,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
+ public CsdlEntityContainer getEntityContainer() {
// create EntitySets
List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
index fc58c23..737c6b0 100755
--- a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -30,7 +30,6 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -121,8 +120,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
}
// 4th: create a serializer based on the requested format (json)
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
// and serialize the content: transform from the EntitySet object to InputStream
EdmEntityType edmEntityType = edmEntitySet.getEntityType();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
index 81453a0..a2ec937 100755
--- a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -29,7 +29,6 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -83,8 +82,7 @@ public class DemoEntityProcessor implements EntityProcessor {
// expand and select currently not supported
EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
- ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ ODataSerializer serializer = this.odata.createSerializer(responseFormat);
SerializerResult serializerResult = serializer.entity(serviceMetadata, entityType, entity, options);
InputStream entityStream = serializerResult.getContent();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
index 64f7949..b6c42a2 100755
--- a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -31,7 +31,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -55,6 +54,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
private OData odata;
private Storage storage;
+ private ServiceMetadata serviceMetadata;
public DemoPrimitiveProcessor(Storage storage) {
this.storage = storage;
@@ -62,7 +62,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
public void init(OData odata, ServiceMetadata serviceMetadata) {
this.odata = odata;
-
+ this.serviceMetadata = serviceMetadata;
}
/*
@@ -112,13 +112,12 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
Object value = property.getValue();
if (value != null) {
// 3.1. configure the serializer
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
// 3.2. serialize
- SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ SerializerResult serializerResult = serializer.primitive(serviceMetadata, edmPropertyType, property, options);
InputStream propertyStream = serializerResult.getContent();
//4. configure the response object
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java
index c21d352..a645d46 100755
--- a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java
@@ -23,7 +23,6 @@ import java.util.Locale;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -31,10 +30,7 @@ import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfoResource;
import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
public class Util {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p6_queryoptions-es/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p6_queryoptions-es/pom.xml b/samples/tutorials/p6_queryoptions-es/pom.xml
index bb095ad..da69b3a 100755
--- a/samples/tutorials/p6_queryoptions-es/pom.xml
+++ b/samples/tutorials/p6_queryoptions-es/pom.xml
@@ -25,7 +25,7 @@
<groupId>my.group.id</groupId>
<artifactId>DemoService-QueryOptions-ES</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>4.0.0</version>
<name>${project.artifactId}-Webapp</name>
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-beta-03</odata.version>
+ <odata.version>4.0.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
@@ -76,5 +76,11 @@
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.11</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
index 7b1fef8..8ce9bac 100755
--- a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
@@ -57,7 +56,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
public static final String ES_CATEGORIES_NAME = "Categories";
@Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
// this method is called for each EntityType that are configured in the Schema
CsdlEntityType entityType = null;
@@ -118,7 +117,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
CsdlEntitySet entitySet = null;
@@ -158,7 +157,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
// This method is invoked when displaying the service document at
// e.g. http://localhost:8080/DemoService/DemoService.svc
@@ -172,7 +171,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public List<CsdlSchema> getSchemas() throws ODataException {
+ public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
@@ -194,7 +193,7 @@ public class DemoEdmProvider extends CsdlAbstractEdmProvider {
}
@Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
+ public CsdlEntityContainer getEntityContainer() {
// create EntitySets
List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
index 83dd676..14ac8cb 100755
--- a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -33,7 +33,6 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -170,7 +169,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
.expand(expandOption)
.build();
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(responseFormat));
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
SerializerResult serializerResult = serializer.entityCollection(srvMetadata, edmEntityType, entityCollection, opts);
// 5th: configure the response object: set the body, headers and status code
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
index 281fdbe..6b623b0 100755
--- a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -35,7 +35,6 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -169,7 +168,7 @@ public class DemoEntityProcessor implements EntityProcessor {
.expand(expandOption)
.build();
- ODataSerializer serializer = this.odata.createSerializer(ODataFormat.fromContentType(responseFormat));
+ ODataSerializer serializer = this.odata.createSerializer(responseFormat);
SerializerResult serializerResult = serializer.entity(srvMetadata, edmEntityType, entity, opts);
// 5. configure the response object
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
index c32c5c2..bf05279 100755
--- a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -31,7 +31,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -55,6 +54,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
private OData odata;
private Storage storage;
+ private ServiceMetadata serviceMetadata;
public DemoPrimitiveProcessor(Storage storage) {
this.storage = storage;
@@ -62,7 +62,7 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
public void init(OData odata, ServiceMetadata serviceMetadata) {
this.odata = odata;
-
+ this.serviceMetadata = serviceMetadata;
}
/*
@@ -114,13 +114,12 @@ public class DemoPrimitiveProcessor implements PrimitiveProcessor {
Object value = property.getValue();
if (value != null) {
// 3.1. configure the serializer
- ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
// 3.2. serialize
- SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ SerializerResult serializerResult = serializer.primitive(serviceMetadata, edmPropertyType, property, options);
InputStream propertyStream = serializerResult.getContent();
// 4. configure the response object
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p7_queryoptions-f/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p7_queryoptions-f/pom.xml b/samples/tutorials/p7_queryoptions-f/pom.xml
deleted file mode 100644
index 439a37c..0000000
--- a/samples/tutorials/p7_queryoptions-f/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>my.group.id</groupId>
- <artifactId>DemoService-QueryOptions-F</artifactId>
- <packaging>war</packaging>
- <version>0.0.1</version>
-
- <name>${project.artifactId} Webapp</name>
-
- <build>
- <finalName>DemoService</finalName>
- </build>
-
- <properties>
- <javax.version>2.5</javax.version>
- <odata.version>4.0.0-beta-03</odata.version>
- <slf4j.version>1.7.7</slf4j.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>${javax.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-api</artifactId>
- <version>${odata.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-core</artifactId>
- <version>${odata.version}</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-api</artifactId>
- <version>${odata.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-core</artifactId>
- <version>${odata.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>${slf4j.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/data/Storage.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/data/Storage.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/data/Storage.java
deleted file mode 100644
index d5d16c2..0000000
--- a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/data/Storage.java
+++ /dev/null
@@ -1,125 +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 myservice.mynamespace.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import myservice.mynamespace.service.DemoEdmProvider;
-import myservice.mynamespace.util.Util;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriParameter;
-
-public class Storage {
-
- private List<Entity> productList;
-
- public Storage() {
- productList = new ArrayList<Entity>();
- initSampleData();
- }
-
- /* PUBLIC FACADE */
-
- public EntityCollection readEntitySetData(EdmEntitySet edmEntitySet)throws ODataApplicationException{
-
- // actually, this is only required if we have more than one Entity Sets
- if(edmEntitySet.getName().equals(DemoEdmProvider.ES_PRODUCTS_NAME)){
- return getProducts();
- }
-
- return null;
- }
-
- public Entity readEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams) throws ODataApplicationException{
-
- EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
- // actually, this is only required if we have more than one Entity Type
- if(edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)){
- return getProduct(edmEntityType, keyParams);
- }
-
- return null;
- }
-
-
-
- /* INTERNAL */
-
- private EntityCollection getProducts(){
- EntityCollection retEntitySet = new EntityCollection();
-
- for(Entity productEntity : this.productList){
- retEntitySet.getEntities().add(productEntity);
- }
-
- return retEntitySet;
- }
-
-
- private Entity getProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams) throws ODataApplicationException{
-
- // the list of entities at runtime
- EntityCollection entitySet = getProducts();
-
- /* generic approach to find the requested entity */
- Entity requestedEntity = Util.findEntity(edmEntityType, entitySet, keyParams);
-
- if(requestedEntity == null){
- // this variable is null if our data doesn't contain an entity for the requested key
- // Throw suitable exception
- throw new ODataApplicationException("Entity for requested key doesn't exist",
- HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
- }
-
- return requestedEntity;
- }
-
- /* HELPER */
-
- private void initSampleData(){
-
- // add some sample product entities
- productList.add(new Entity()
- .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1))
- .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"))
- .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB")));
-
- productList.add(new Entity()
- .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2))
- .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"))
- .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network")));
-
- productList.add(new Entity()
- .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3))
- .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"))
- .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960")));
-
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/170d561c/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
----------------------------------------------------------------------
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
deleted file mode 100644
index 15140e1..0000000
--- a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
+++ /dev/null
@@ -1,153 +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 myservice.mynamespace.service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
-import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
-import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
-import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-
-public class DemoEdmProvider extends CsdlAbstractEdmProvider {
-
- // Service Namespace
- public static final String NAMESPACE = "OData.Demo";
-
- // EDM Container
- public static final String CONTAINER_NAME = "Container";
- public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
-
- // Entity Types Names
- public static final String ET_PRODUCT_NAME = "Product";
- public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
-
- // Entity Set Names
- public static final String ES_PRODUCTS_NAME = "Products";
-
-
- @Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName)
- throws ODataException {
- // this method is called for one of the EntityTypes that are configured in the Schema
- if(ET_PRODUCT_FQN.equals(entityTypeName)){
-
- //create EntityType properties
- CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
- CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
- CsdlProperty description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
-
- // create PropertyRef for Key element
- CsdlPropertyRef propertyRef = new CsdlPropertyRef();
- propertyRef.setName("ID");
-
- // configure EntityType
- CsdlEntityType entityType = new CsdlEntityType();
- entityType.setName(ET_PRODUCT_NAME);
- entityType.setProperties(Arrays.asList(id, name, description));
- entityType.setKey(Collections.singletonList(propertyRef));
-
- return entityType;
- }
-
- return null;
-
- }
-
- @Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
- String entitySetName) throws ODataException {
- if(entityContainer.equals(CONTAINER)){
- if(entitySetName.equals(ES_PRODUCTS_NAME)){
- CsdlEntitySet entitySet = new CsdlEntitySet();
- entitySet.setName(ES_PRODUCTS_NAME);
- entitySet.setType(ET_PRODUCT_FQN);
-
- return entitySet;
- }
- }
-
- return null;
-
- }
-
- @Override
- public CsdlEntityContainerInfo getEntityContainerInfo(
- FullQualifiedName entityContainerName) throws ODataException {
- // This method is invoked when displaying the service document at e.g. http://localhost:8080/DemoService/DemoService.svc
- if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
- CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
- entityContainerInfo.setContainerName(CONTAINER);
- return entityContainerInfo;
- }
-
- return null;
-
- }
-
- @Override
- public List<CsdlSchema> getSchemas() throws ODataException {
- // create Schema
- CsdlSchema schema = new CsdlSchema();
- schema.setNamespace(NAMESPACE);
-
- // add EntityTypes
- List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
- entityTypes.add(getEntityType(ET_PRODUCT_FQN));
- schema.setEntityTypes(entityTypes);
-
- // add EntityContainer
- schema.setEntityContainer(getEntityContainer());
-
- // finally
- List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
- schemas.add(schema);
-
- return schemas;
-
- }
-
- @Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
- // create EntitySets
- List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
- entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
-
- // create EntityContainer
- CsdlEntityContainer entityContainer = new CsdlEntityContainer();
- entityContainer.setName(CONTAINER_NAME);
- entityContainer.setEntitySets(entitySets);
-
- return entityContainer;
-
- }
-
-
-
-}