Skip to content

Commit

Permalink
updated Para to 1.31.0, fixed deprecated API calls, removed deprecate…
Browse files Browse the repository at this point in the history
…d IndexBasedDAO, JDK 11 compatibility
  • Loading branch information
albogdano committed Oct 5, 2018
1 parent 2f6fd44 commit 032daff
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 696 deletions.
23 changes: 14 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,28 @@
<skipTests>false</skipTests>
<skipITs>${skipTests}</skipITs>
<skipUTs>${skipTests}</skipUTs>
<elasticsearch.version>6.3.2</elasticsearch.version>
<elasticsearch.version>6.4.1</elasticsearch.version>
<jerseyVer>2.27</jerseyVer>
</properties>

<dependencies>
<dependency>
<groupId>com.erudika</groupId>
<artifactId>para-core</artifactId>
<version>1.30.0</version>
<version>1.31.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1</version>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>

<!-- ELASTICSEARCH CLIENTS -->
<dependency>
Expand All @@ -93,14 +98,14 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.10.0</version>
<version>2.11.1</version>
</dependency>

<!-- TESTING -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.11.0</version>
<version>2.22.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -128,7 +133,7 @@
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<version>6.6</version>
<version>6.8</version>
<configuration>
<skip>${skipITs}</skip>
<!--<autoCreateIndex>false</autoCreateIndex>-->
Expand Down Expand Up @@ -160,7 +165,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -191,7 +196,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<version>2.22.0</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -265,7 +270,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.1.1168</version>
<version>3.5.0.1254</version>
</plugin>
</plugins>
</build>
Expand Down
268 changes: 0 additions & 268 deletions src/main/java/com/erudika/para/persistence/IndexBasedDAO.java

This file was deleted.

13 changes: 11 additions & 2 deletions src/main/java/com/erudika/para/rest/ProxyResourceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
import org.apache.http.entity.ContentType;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.message.BasicHeader;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -126,11 +128,18 @@ Response proxyRequest(String method, ContainerRequestContext ctx) {
HttpEntity resp;
RestClient client = getClient();
if (client != null) {
org.elasticsearch.client.Request esRequest = new Request(method, path);
RequestOptions.Builder opts = RequestOptions.DEFAULT.toBuilder();
for (Header header : headers) {
opts.addHeader(header.getName(), header.getValue());
}
esRequest.setOptions(opts);
if (ctx.getEntityStream() != null && ctx.getEntityStream().available() > 0) {
HttpEntity body = new InputStreamEntity(ctx.getEntityStream(), ContentType.APPLICATION_JSON);
resp = client.performRequest(method, path, Collections.emptyMap(), body, headers).getEntity();
esRequest.setEntity(body);
resp = client.performRequest(esRequest).getEntity();
} else {
resp = client.performRequest(method, path, headers).getEntity();
resp = client.performRequest(esRequest).getEntity();
}
if (resp != null && resp.getContent() != null) {
Header type = resp.getContentType();
Expand Down
Loading

0 comments on commit 032daff

Please sign in to comment.