diff options
Diffstat (limited to 'src/main/java/org/onap/aai/rest')
12 files changed, 36 insertions, 47 deletions
diff --git a/src/main/java/org/onap/aai/rest/AuditSqlDbConsumer.java b/src/main/java/org/onap/aai/rest/AuditSqlDbConsumer.java index aec7224..61cac13 100644 --- a/src/main/java/org/onap/aai/rest/AuditSqlDbConsumer.java +++ b/src/main/java/org/onap/aai/rest/AuditSqlDbConsumer.java @@ -27,13 +27,12 @@ import org.onap.aai.restcore.RESTAPI; import org.onap.aai.util.AAIConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.ws.rs.*; -import javax.ws.rs.core.*; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.*; +import jakarta.ws.rs.core.Response.Status; @Component @Path("{version: v1}/audit-sql-db") @@ -47,7 +46,6 @@ public class AuditSqlDbConsumer extends RESTAPI { private String rdbmsDbName; private AuditGraphson2Sql auditGraphson2Sql; - @Autowired public AuditSqlDbConsumer( AuditGraphson2Sql auditGraphson2Sql, @Value("${aperture.rdbmsname}") String rdbmsDbName diff --git a/src/main/java/org/onap/aai/rest/ExceptionHandler.java b/src/main/java/org/onap/aai/rest/ExceptionHandler.java index 14c45da..25be192 100644 --- a/src/main/java/org/onap/aai/rest/ExceptionHandler.java +++ b/src/main/java/org/onap/aai/rest/ExceptionHandler.java @@ -25,14 +25,14 @@ import com.sun.istack.SAXParseException2; import org.onap.aai.exceptions.AAIException; import org.onap.aai.logging.ErrorLogHelper; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; import java.util.ArrayList; import java.util.List; @@ -59,8 +59,7 @@ public class ExceptionHandler implements ExceptionMapper<Exception> { //the general case is that cxf will give us a WebApplicationException //with a linked exception - if (exception instanceof WebApplicationException) { - WebApplicationException e = (WebApplicationException) exception; + if (exception instanceof WebApplicationException e) { if (e.getCause() != null) { if (e.getCause() instanceof SAXParseException2) { templateVars.add("UnmarshalException"); @@ -93,8 +92,7 @@ public class ExceptionHandler implements ExceptionMapper<Exception> { if (response == null) { Exception actual_e = exception; - if (exception instanceof WebApplicationException) { - WebApplicationException e = (WebApplicationException) exception; + if (exception instanceof WebApplicationException e) { response = e.getResponse(); } else { templateVars.add(request.getMethod()); diff --git a/src/main/java/org/onap/aai/rest/QueryConsumer.java b/src/main/java/org/onap/aai/rest/QueryConsumer.java index a0ba61a..c77fafd 100644 --- a/src/main/java/org/onap/aai/rest/QueryConsumer.java +++ b/src/main/java/org/onap/aai/rest/QueryConsumer.java @@ -43,15 +43,14 @@ import org.onap.aai.setup.SchemaVersions; import org.onap.aai.util.AAIConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.*; -import javax.ws.rs.core.Response.Status; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.*; +import jakarta.ws.rs.core.Response.Status; import java.util.List; @Component @@ -74,7 +73,6 @@ public class QueryConsumer extends RESTAPI { private String basePath; - @Autowired public QueryConsumer( @Qualifier("traversalUriHttpEntry") HttpEntry traversalUriHttpEntry, DslQueryProcessor dslQueryProcessor, diff --git a/src/main/java/org/onap/aai/rest/SchemaJobStatusController.java b/src/main/java/org/onap/aai/rest/SchemaJobStatusController.java index 50cbddb..3004b59 100644 --- a/src/main/java/org/onap/aai/rest/SchemaJobStatusController.java +++ b/src/main/java/org/onap/aai/rest/SchemaJobStatusController.java @@ -19,9 +19,9 @@ */ package org.onap.aai.rest; -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; import org.onap.aai.exceptions.AAIException; import org.onap.aai.service.SchemaJobStatusService; diff --git a/src/main/java/org/onap/aai/rest/client/ApertureService.java b/src/main/java/org/onap/aai/rest/client/ApertureService.java index 226e681..ead12dc 100644 --- a/src/main/java/org/onap/aai/rest/client/ApertureService.java +++ b/src/main/java/org/onap/aai/rest/client/ApertureService.java @@ -21,12 +21,11 @@ package org.onap.aai.rest.client; import com.google.gson.JsonObject; -import org.apache.http.conn.ConnectTimeoutException; +import org.apache.hc.client5.http.ConnectTimeoutException; import org.onap.aai.exceptions.AAIException; import org.onap.aai.restclient.RestClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpMethod; @@ -72,7 +71,6 @@ public class ApertureService { private final String appName; - @Autowired public ApertureService( @Qualifier("apertureRestClient") RestClient apertureRestClient, @Value("${spring.application.name}") String appName diff --git a/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java b/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java index 703420e..8e1bd8b 100644 --- a/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java +++ b/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java @@ -47,6 +47,7 @@ public class ApertureServiceNoAuthClient extends NoAuthRestClient { protected HttpComponentsClientHttpRequestFactory getHttpRequestFactory() throws Exception { HttpComponentsClientHttpRequestFactory requestFactory = super.getHttpRequestFactory(); requestFactory.setConnectionRequestTimeout(timeout); + // Manual migration to `SocketConfig.Builder.setSoTimeout(Timeout)` necessary; see: https://docs.spring.io/spring-framework/docs/6.0.0/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html#setReadTimeout(int) requestFactory.setReadTimeout(timeout); requestFactory.setConnectTimeout(timeout); return requestFactory; diff --git a/src/main/java/org/onap/aai/rest/client/ApertureServiceOneWayClient.java b/src/main/java/org/onap/aai/rest/client/ApertureServiceOneWayClient.java index 5b4fa0d..4cc72f6 100644 --- a/src/main/java/org/onap/aai/rest/client/ApertureServiceOneWayClient.java +++ b/src/main/java/org/onap/aai/rest/client/ApertureServiceOneWayClient.java @@ -54,6 +54,7 @@ public class ApertureServiceOneWayClient extends OneWaySSLRestClient { protected HttpComponentsClientHttpRequestFactory getHttpRequestFactory() throws Exception { HttpComponentsClientHttpRequestFactory requestFactory = super.getHttpRequestFactory(); requestFactory.setConnectionRequestTimeout(timeout); + // Manual migration to `SocketConfig.Builder.setSoTimeout(Timeout)` necessary; see: https://docs.spring.io/spring-framework/docs/6.0.0/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html#setReadTimeout(int) requestFactory.setReadTimeout(timeout); requestFactory.setConnectTimeout(timeout); return requestFactory; diff --git a/src/main/java/org/onap/aai/rest/client/ApertureServiceRestClient.java b/src/main/java/org/onap/aai/rest/client/ApertureServiceRestClient.java index 19c32fb..095c7f9 100644 --- a/src/main/java/org/onap/aai/rest/client/ApertureServiceRestClient.java +++ b/src/main/java/org/onap/aai/rest/client/ApertureServiceRestClient.java @@ -59,6 +59,7 @@ public class ApertureServiceRestClient extends TwoWaySSLRestClient { protected HttpComponentsClientHttpRequestFactory getHttpRequestFactory() throws Exception { HttpComponentsClientHttpRequestFactory requestFactory = super.getHttpRequestFactory(); requestFactory.setConnectionRequestTimeout(timeout); + // Manual migration to `SocketConfig.Builder.setSoTimeout(Timeout)` necessary; see: https://docs.spring.io/spring-framework/docs/6.0.0/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html#setReadTimeout(int) requestFactory.setReadTimeout(timeout); requestFactory.setConnectTimeout(timeout); return requestFactory; diff --git a/src/main/java/org/onap/aai/rest/dsl/DslListener.java b/src/main/java/org/onap/aai/rest/dsl/DslListener.java index 70d8bf8..e806154 100644 --- a/src/main/java/org/onap/aai/rest/dsl/DslListener.java +++ b/src/main/java/org/onap/aai/rest/dsl/DslListener.java @@ -29,7 +29,6 @@ import org.onap.aai.edges.EdgeRule; import org.onap.aai.edges.EdgeRuleQuery; import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; import java.util.HashMap; import java.util.List; @@ -68,7 +67,6 @@ public class DslListener extends AAIDslBaseListener { /** * Instantiates a new DslListener. */ - @Autowired public DslListener(EdgeIngestor edgeIngestor) { this.edgeRules = edgeIngestor; } diff --git a/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java b/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java index 3e77e6c..b77c9f0 100644 --- a/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java +++ b/src/main/java/org/onap/aai/rest/dsl/DslQueryProcessor.java @@ -27,7 +27,6 @@ import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.onap.aai.AAIDslLexer; import org.onap.aai.AAIDslParser; -import org.springframework.beans.factory.annotation.Autowired; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -42,7 +41,6 @@ public class DslQueryProcessor { private DslListener dslListener; - @Autowired public DslQueryProcessor(DslListener dslListener){ this.dslListener = dslListener; } diff --git a/src/main/java/org/onap/aai/rest/search/GenericQueryProcessor.java b/src/main/java/org/onap/aai/rest/search/GenericQueryProcessor.java index 85573fc..6fbf110 100644 --- a/src/main/java/org/onap/aai/rest/search/GenericQueryProcessor.java +++ b/src/main/java/org/onap/aai/rest/search/GenericQueryProcessor.java @@ -32,8 +32,8 @@ import org.onap.aai.restcore.util.URITools; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.SubGraphStyle; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; import java.io.FileNotFoundException; import java.net.URI; import java.util.*; diff --git a/src/main/java/org/onap/aai/rest/util/EchoResponse.java b/src/main/java/org/onap/aai/rest/util/EchoResponse.java index 12b62b3..2e18f38 100644 --- a/src/main/java/org/onap/aai/rest/util/EchoResponse.java +++ b/src/main/java/org/onap/aai/rest/util/EchoResponse.java @@ -20,23 +20,22 @@ package org.onap.aai.rest.util; import java.util.ArrayList; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import org.onap.aai.exceptions.AAIException; import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.restcore.RESTAPI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component @@ -50,7 +49,6 @@ public class EchoResponse extends RESTAPI { private static final String UP_RESPONSE="{\"status\":\"UP\",\"groups\":[\"liveness\",\"readiness\"]}"; - @Autowired public EchoResponse(AaiGraphChecker aaiGraphChecker ) { this.aaiGraphChecker = aaiGraphChecker; } |