Repository: olingo-odata4 Updated Branches: refs/heads/OLINGO-549-ODataV4-JPA 503acb0c9 -> c42ca9222
[OLINGO-618] Sample Servlet extending ODataJPAServlet Signed-off-by: Chandan V A <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/c42ca922 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/c42ca922 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/c42ca922 Branch: refs/heads/OLINGO-549-ODataV4-JPA Commit: c42ca9222f4547e5bdd3048b519d69930e33bbcd Parents: 503acb0 Author: Chandan V A <[email protected]> Authored: Sun Aug 23 13:00:06 2015 +0530 Committer: Chandan V A <[email protected]> Committed: Sun Aug 23 13:00:06 2015 +0530 ---------------------------------------------------------------------- ext/odata-jpa/odata-jpa-ref-persistence/pom.xml | 2 +- ext/odata-jpa/odata-jpa-ref-web/pom.xml | 39 ++++++++++---------- .../servlet/SalesOrderProcessingServlet.java | 22 +++++++++++ .../src/main/webapp/WEB-INF/web.xml | 34 ++++++++--------- 4 files changed, 58 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c42ca922/ext/odata-jpa/odata-jpa-ref-persistence/pom.xml ---------------------------------------------------------------------- diff --git a/ext/odata-jpa/odata-jpa-ref-persistence/pom.xml b/ext/odata-jpa/odata-jpa-ref-persistence/pom.xml index 6307f0b..7cd5733 100644 --- a/ext/odata-jpa/odata-jpa-ref-persistence/pom.xml +++ b/ext/odata-jpa/odata-jpa-ref-persistence/pom.xml @@ -19,7 +19,7 @@ <version>4.0.0-beta-01-SNAPSHOT</version> </parent> <artifactId>odata-jpa-ref-persistence</artifactId> - <name>${project-artifactId}</name> + <name>${project.artifactId}</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c42ca922/ext/odata-jpa/odata-jpa-ref-web/pom.xml ---------------------------------------------------------------------- diff --git a/ext/odata-jpa/odata-jpa-ref-web/pom.xml b/ext/odata-jpa/odata-jpa-ref-web/pom.xml index a7b85cc..9e0c3d5 100644 --- a/ext/odata-jpa/odata-jpa-ref-web/pom.xml +++ b/ext/odata-jpa/odata-jpa-ref-web/pom.xml @@ -1,22 +1,14 @@ <?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"> @@ -36,7 +28,16 @@ <artifactId>odata-jpa-api</artifactId> <version>${project.version}</version> </dependency> - + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.olingo</groupId> + <artifactId>odata-jpa-core</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> <build> <finalName>odata-jpa-ref-web</finalName> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c42ca922/ext/odata-jpa/odata-jpa-ref-web/src/main/java/org/apache/olingo/jpa/ref/web/servlet/SalesOrderProcessingServlet.java ---------------------------------------------------------------------- diff --git a/ext/odata-jpa/odata-jpa-ref-web/src/main/java/org/apache/olingo/jpa/ref/web/servlet/SalesOrderProcessingServlet.java b/ext/odata-jpa/odata-jpa-ref-web/src/main/java/org/apache/olingo/jpa/ref/web/servlet/SalesOrderProcessingServlet.java new file mode 100644 index 0000000..8e69b92 --- /dev/null +++ b/ext/odata-jpa/odata-jpa-ref-web/src/main/java/org/apache/olingo/jpa/ref/web/servlet/SalesOrderProcessingServlet.java @@ -0,0 +1,22 @@ +package org.apache.olingo.jpa.ref.web.servlet; + +import org.apache.olingo.jpa.api.ODataJPAContext; +import org.apache.olingo.jpa.api.ODataJPAService; +import org.apache.olingo.jpa.api.ODataJPAServlet; +import org.apache.olingo.jpa.api.factory.ODataJPAFactory; + +public class SalesOrderProcessingServlet extends ODataJPAServlet { + + /** + * + */ + private static final long serialVersionUID = 1L; + private ODataJPAService odataJPAService = null; + private ODataJPAContext odataJPAContext = null; + + @Override + protected void initializeODataJPAContext(ODataJPAContext odataJPAContext) { + odataJPAContext.setPersistenceUnitName(); + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c42ca922/ext/odata-jpa/odata-jpa-ref-web/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/ext/odata-jpa/odata-jpa-ref-web/src/main/webapp/WEB-INF/web.xml b/ext/odata-jpa/odata-jpa-ref-web/src/main/webapp/WEB-INF/web.xml index 3da07e0..707e732 100644 --- a/ext/odata-jpa/odata-jpa-ref-web/src/main/webapp/WEB-INF/web.xml +++ b/ext/odata-jpa/odata-jpa-ref-web/src/main/webapp/WEB-INF/web.xml @@ -1,22 +1,14 @@ <?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. ---> +<!-- 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" @@ -28,7 +20,11 @@ <servlet> <servlet-name>ODataJPAReferenceServlet</servlet-name> - <servlet-class>org.apache.odata.jpa.api.servlet</servlet-class> + <servlet-class>org.apache.olingo.jpa.ref.web.servlet.SalesOrderProcessingServlet</servlet-class> + <init-param> + <param-name>persistence.unit</param-name> + <param-value>salesorderprocessing</param-value> + </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping>
