diff --git a/apache-olingo/olingo2/.gitignore b/apache-olingo/.gitignore
similarity index 99%
rename from apache-olingo/olingo2/.gitignore
rename to apache-olingo/.gitignore
index 153c9335eb..b85b366850 100644
--- a/apache-olingo/olingo2/.gitignore
+++ b/apache-olingo/.gitignore
@@ -27,3 +27,4 @@ HELP.md
### VS Code ###
.vscode/
+
diff --git a/apache-olingo/Samples.md b/apache-olingo/Samples.md
index def8971d64..66f514b4d9 100644
--- a/apache-olingo/Samples.md
+++ b/apache-olingo/Samples.md
@@ -4,15 +4,15 @@ This following table contains test URLs that can be used with the Olingo V2 demo
| URL | Description |
|------------------------------------------|-------------------------------------------------|
-| `http://localhost:8180/odata/$metadata` | fetch OData metadata document |
-| `http://localhost:8180/odata/CarMakers?$top=10&$skip=10` | Get 10 entities starting at offset 10 |
-| `http://localhost:8180/odata/CarMakers?$count` | Return total count of entities in this set |
-| `http://localhost:8180/odata/CarMakers?$filter=startswith(Name,'B')` | Return entities where the *Name* property starts with 'B' |
-| `http://localhost:8180/odata/CarModels?$filter=Year eq 2008 and CarMakerDetails/Name eq 'BWM'` | Return *CarModel* entities where the *Name* property of its maker starts with 'B' |
-| `http://localhost:8180/odata/CarModels(1L)?$expand=CarMakerDetails` | Return the *CarModel* with primary key '1', along with its maker|
-| `http://localhost:8180/odata/CarModels(1L)?$select=Name,Sku` | Return the *CarModel* with primary key '1', returing only its *Name* and *Sku* properties |
-| `http://localhost:8180/odata/CarModels?$orderBy=Name asc,Sku desc` | Return *CarModel* entities, ordered by the their *Name* and *Sku* properties |
-| `http://localhost:8180/odata/CarModels?$format=json` | Return *CarModel* entities, using a JSON representation|
+| `http://localhost:8080/odata/$metadata` | fetch OData metadata document |
+| `http://localhost:8080/odata/CarMakers?$top=10&$skip=10` | Get 10 entities starting at offset 10 |
+| `http://localhost:8080/odata/CarMakers?$count` | Return total count of entities in this set |
+| `http://localhost:8080/odata/CarMakers?$filter=startswith(Name,'B')` | Return entities where the *Name* property starts with 'B' |
+| `http://localhost:8080/odata/CarModels?$filter=Year eq 2008 and CarMakerDetails/Name eq 'BWM'` | Return *CarModel* entities where the *Name* property of its maker starts with 'B' |
+| `http://localhost:8080/odata/CarModels(1L)?$expand=CarMakerDetails` | Return the *CarModel* with primary key '1', along with its maker|
+| `http://localhost:8080/odata/CarModels(1L)?$select=Name,Sku` | Return the *CarModel* with primary key '1', returing only its *Name* and *Sku* properties |
+| `http://localhost:8080/odata/CarModels?$orderBy=Name asc,Sku desc` | Return *CarModel* entities, ordered by the their *Name* and *Sku* properties |
+| `http://localhost:8080/odata/CarModels?$format=json` | Return *CarModel* entities, using a JSON representation|
diff --git a/apache-olingo/olingo2/pom.xml b/apache-olingo/pom.xml
similarity index 85%
rename from apache-olingo/olingo2/pom.xml
rename to apache-olingo/pom.xml
index c86428d054..5de0dfd511 100644
--- a/apache-olingo/olingo2/pom.xml
+++ b/apache-olingo/pom.xml
@@ -3,16 +3,16 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.baeldung.examples.olingo2
- olingo2
- olingo2
- Sample Olingo 2 Project
+ com.baeldung.examples.olingo
+ apache-olingo
+ apache-olingo
+ Sample Apache Olingo Project
com.baeldung
parent-boot-2
0.0.1-SNAPSHOT
- ../../parent-boot-2
+ ../parent-boot-2
@@ -43,7 +43,7 @@
org.apache.olingo
olingo-odata2-core
- ${olingo2.version}
+ ${olingo.version}
@@ -55,12 +55,12 @@
org.apache.olingo
olingo-odata2-jpa-processor-core
- ${olingo2.version}
+ ${olingo.version}
org.apache.olingo
olingo-odata2-jpa-processor-ref
- ${olingo2.version}
+ ${olingo.version}
org.eclipse.persistence
@@ -80,7 +80,7 @@
- 2.0.11
+ 2.0.11
-
\ No newline at end of file
+
diff --git a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java
similarity index 97%
rename from apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java
rename to apache-olingo/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java
index 55155732c8..343af93de9 100644
--- a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java
+++ b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/CarsODataJPAServiceFactory.java
@@ -27,11 +27,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-/**
- * ODataJPAServiceFactory implementation for our sample domain
- * @author Philippe
- *
- */
@Component
public class CarsODataJPAServiceFactory extends ODataJPAServiceFactory {
@@ -44,7 +39,7 @@ public class CarsODataJPAServiceFactory extends ODataJPAServiceFactory {
/**
* This method will be called by Olingo on every request to
- * initialize the ODataJPAContext that will be used.
+ * initialize the ODataJPAContext that will be used.
*/
@Override
public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
@@ -54,14 +49,14 @@ public class CarsODataJPAServiceFactory extends ODataJPAServiceFactory {
ODataContext octx = ctx.getODataContext();
HttpServletRequest request = (HttpServletRequest)octx.getParameter(ODataContext.HTTP_SERVLET_REQUEST_OBJECT);
EntityManager em = (EntityManager)request.getAttribute(JerseyConfig.EntityManagerFilter.EM_REQUEST_ATTRIBUTE);
-
+
// Here we're passing the EM that was created by the EntityManagerFilter (see JerseyConfig)
ctx.setEntityManager(new EntityManagerWrapper(em));
ctx.setPersistenceUnitName("default");
-
+
// We're managing the EM's lifecycle, so we must inform Olingo that it should not
// try to manage transactions and/or persistence sessions
- ctx.setContainerManaged(true);
+ ctx.setContainerManaged(true);
return ctx;
}
diff --git a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java
similarity index 89%
rename from apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java
rename to apache-olingo/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java
index 02e5ce5adf..f300f552fe 100644
--- a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java
+++ b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/JerseyConfig.java
@@ -1,6 +1,12 @@
- package com.baeldung.examples.olingo2;
+package com.baeldung.examples.olingo2;
-import java.io.IOException;
+import org.apache.olingo.odata2.api.ODataServiceFactory;
+import org.apache.olingo.odata2.core.rest.ODataRootLocator;
+import org.apache.olingo.odata2.core.rest.app.ODataApplication;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
@@ -15,28 +21,15 @@ import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.core.Context;
import javax.ws.rs.ext.Provider;
-import org.apache.olingo.odata2.api.ODataServiceFactory;
-import org.apache.olingo.odata2.core.rest.ODataRootLocator;
-import org.apache.olingo.odata2.core.rest.app.ODataApplication;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * Jersey JAX-RS configuration
- * @author Philippe
- *
- */
@Component
@ApplicationPath("/odata")
public class JerseyConfig extends ResourceConfig {
-
-
- public JerseyConfig(CarsODataJPAServiceFactory serviceFactory, EntityManagerFactory emf) {
-
+
+
+ public JerseyConfig(CarsODataJPAServiceFactory serviceFactory, EntityManagerFactory emf) {
+
ODataApplication app = new ODataApplication();
-
+
app
.getClasses()
.forEach( c -> {
@@ -46,11 +39,11 @@ public class JerseyConfig extends ResourceConfig {
register(c);
}
});
-
- register(new CarsRootLocator(serviceFactory));
+
+ register(new CarsRootLocator(serviceFactory));
register( new EntityManagerFilter(emf));
}
-
+
/**
* This filter handles the EntityManager transaction lifecycle.
* @author Philippe
@@ -72,7 +65,7 @@ public class JerseyConfig extends ResourceConfig {
}
@Override
- public void filter(ContainerRequestContext ctx) throws IOException {
+ public void filter(ContainerRequestContext ctx) {
log.info("[I60] >>> filter");
EntityManager em = this.emf.createEntityManager();
httpRequest.setAttribute(EM_REQUEST_ATTRIBUTE, em);
@@ -85,7 +78,7 @@ public class JerseyConfig extends ResourceConfig {
}
@Override
- public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
log.info("[I68] <<< filter");
EntityManager em = (EntityManager) httpRequest.getAttribute(EM_REQUEST_ATTRIBUTE);
diff --git a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java
similarity index 88%
rename from apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java
rename to apache-olingo/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java
index f76e0e00e3..7210f4c812 100644
--- a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java
+++ b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/Olingo2SampleApplication.java
@@ -7,7 +7,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
@SpringBootApplication
public class Olingo2SampleApplication extends SpringBootServletInitializer {
- public static void main(String[] args) {
+ public static void main(String[] args) {
SpringApplication.run(Olingo2SampleApplication.class);
}
}
diff --git a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarMaker.java b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/domain/CarMaker.java
similarity index 100%
rename from apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarMaker.java
rename to apache-olingo/src/main/java/com/baeldung/examples/olingo2/domain/CarMaker.java
diff --git a/apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarModel.java b/apache-olingo/src/main/java/com/baeldung/examples/olingo2/domain/CarModel.java
similarity index 100%
rename from apache-olingo/olingo2/src/main/java/com/baeldung/examples/olingo2/domain/CarModel.java
rename to apache-olingo/src/main/java/com/baeldung/examples/olingo2/domain/CarModel.java
diff --git a/apache-olingo/olingo2/src/main/resources/application.yml b/apache-olingo/src/main/resources/application.yml
similarity index 100%
rename from apache-olingo/olingo2/src/main/resources/application.yml
rename to apache-olingo/src/main/resources/application.yml
diff --git a/apache-olingo/olingo2/src/main/resources/data.sql b/apache-olingo/src/main/resources/data.sql
similarity index 100%
rename from apache-olingo/olingo2/src/main/resources/data.sql
rename to apache-olingo/src/main/resources/data.sql
diff --git a/apache-olingo/olingo2/src/main/resources/logback.xml b/apache-olingo/src/main/resources/logback.xml
similarity index 100%
rename from apache-olingo/olingo2/src/main/resources/logback.xml
rename to apache-olingo/src/main/resources/logback.xml
diff --git a/apache-olingo/olingo2/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java b/apache-olingo/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationIntegrationTest.java
similarity index 84%
rename from apache-olingo/olingo2/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java
rename to apache-olingo/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationIntegrationTest.java
index 74033a49cd..402c288673 100644
--- a/apache-olingo/olingo2/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationUnitTest.java
+++ b/apache-olingo/src/test/java/com/baeldung/examples/olingo2/Olingo2SampleApplicationIntegrationTest.java
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class Olingo2SampleApplicationUnitTest {
+public class Olingo2SampleApplicationIntegrationTest {
@Test
public void contextLoads() {
diff --git a/apache-olingo/olingo2/src/test/resources/logback-test.xml b/apache-olingo/src/test/resources/logback-test.xml
similarity index 100%
rename from apache-olingo/olingo2/src/test/resources/logback-test.xml
rename to apache-olingo/src/test/resources/logback-test.xml
diff --git a/apache-olingo/olingo2/src/test/resources/olingo2-queries.json b/apache-olingo/src/test/resources/olingo2-queries.json
similarity index 100%
rename from apache-olingo/olingo2/src/test/resources/olingo2-queries.json
rename to apache-olingo/src/test/resources/olingo2-queries.json
diff --git a/pom.xml b/pom.xml
index f2a230357c..f5378f9961 100644
--- a/pom.xml
+++ b/pom.xml
@@ -353,7 +353,7 @@
apache-cxf
apache-kafka
apache-libraries
- apache-olingo/olingo2
+ apache-olingo
apache-poi
apache-rocketmq
apache-shiro
@@ -839,7 +839,7 @@
apache-cxf
apache-kafka
apache-libraries
- apache-olingo/olingo2
+ apache-olingo
apache-poi
apache-rocketmq
apache-shiro