Skip to content

Commit 7a96829

Browse files
committed
Switch to native HttpClient in olog es
1 parent 4064f8f commit 7a96829

File tree

15 files changed

+750
-1081
lines changed

15 files changed

+750
-1081
lines changed

app/logbook/olog/client-es/pom.xml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,9 @@
1111

1212
<dependencies>
1313
<dependency>
14-
<groupId>com.sun.jersey</groupId>
15-
<artifactId>jersey-core</artifactId>
16-
<version>1.19</version>
17-
</dependency>
18-
<dependency>
19-
<groupId>com.sun.jersey</groupId>
20-
<artifactId>jersey-client</artifactId>
21-
<version>1.19</version>
22-
</dependency>
23-
<dependency>
24-
<groupId>com.sun.jersey.contribs</groupId>
25-
<artifactId>jersey-multipart</artifactId>
26-
<version>1.19</version>
14+
<groupId>jakarta.ws.rs</groupId>
15+
<artifactId>jakarta.ws.rs-api</artifactId>
16+
<version>4.0.0</version>
2717
</dependency>
2818
<dependency>
2919
<groupId>com.fasterxml.jackson.datatype</groupId>

app/logbook/olog/client-es/src/main/java/org/phoebus/applications/logbook/OlogESLogbook.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.phoebus.logbook.LogClient;
44
import org.phoebus.logbook.LogFactory;
5-
import org.phoebus.olog.es.api.OlogClient.OlogClientBuilder;
5+
import org.phoebus.olog.es.api.OlogHttpClient;
66
import org.phoebus.security.tokens.SimpleAuthenticationToken;
77

88
import java.util.logging.Level;
@@ -33,7 +33,7 @@ public String getId() {
3333
@Override
3434
public LogClient getLogClient() {
3535
try {
36-
return OlogClientBuilder.serviceURL().create();
36+
return OlogHttpClient.builder().build();
3737
} catch (Exception e) {
3838
logger.log(Level.SEVERE, "Failed to create olog es client", e);
3939
}
@@ -50,8 +50,8 @@ public LogClient getLogClient(Object authToken) {
5050
try {
5151
if (authToken instanceof SimpleAuthenticationToken) {
5252
SimpleAuthenticationToken token = (SimpleAuthenticationToken) authToken;
53-
return OlogClientBuilder.serviceURL().withHTTPAuthentication(true).username(token.getUsername()).password(token.getPassword())
54-
.create();
53+
return OlogHttpClient.builder().username(token.getUsername()).password(token.getPassword())
54+
.build();
5555
} else {
5656
return getLogClient();
5757
}

app/logbook/olog/client-es/src/main/java/org/phoebus/applications/logbook/authentication/OlogServiceAuthenticationProvider.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
package org.phoebus.applications.logbook.authentication;
2020

21-
import org.phoebus.olog.es.api.OlogClient;
22-
import org.phoebus.olog.es.api.OlogClient.OlogClientBuilder;
21+
import org.phoebus.olog.es.api.OlogHttpClient;
2322
import org.phoebus.security.authorization.ServiceAuthenticationProvider;
2423
import org.phoebus.security.tokens.AuthenticationScope;
2524

@@ -30,12 +29,11 @@ public class OlogServiceAuthenticationProvider implements ServiceAuthenticationP
3029

3130
@Override
3231
public void authenticate(String username, String password){
33-
OlogClient ologClient = OlogClientBuilder.serviceURL().create();
3432
try {
35-
ologClient.authenticate(username, password);
33+
OlogHttpClient.builder().build().authenticate(username, password);
3634
} catch (Exception e) {
3735
Logger.getLogger(OlogServiceAuthenticationProvider.class.getName())
38-
.log(Level.WARNING, "Failed to authenticate user " + username + " against Olog service", e);
36+
.log(Level.WARNING, "Failed to authenticate user " + username + " with logbook service", e);
3937
throw new RuntimeException(e);
4038
}
4139
}

0 commit comments

Comments
 (0)