From dfe2ac3413faefa57889613ddba7a1f2d228dddf Mon Sep 17 00:00:00 2001 From: Laird Nelson Date: Tue, 24 Oct 2023 16:17:42 -0700 Subject: [PATCH] [2.x] Upgrades OCI to version 3.x (#7883) * Upgrades OCI to version 3.x Signed-off-by: Laird Nelson --- dependencies/pom.xml | 740 +----------------- .../cdi/oci-objectstorage/pom.xml | 5 + .../integrations/oci/atp/cdi/AtpResource.java | 7 +- integrations/oci/sdk/cdi/pom.xml | 28 +- .../oci/sdk/cdi/OciExtension.java | 17 +- .../sdk/cdi/src/main/java/module-info.java | 5 +- .../integrations/oci/sdk/cdi/TestSpike.java | 22 +- 7 files changed, 58 insertions(+), 766 deletions(-) diff --git a/dependencies/pom.xml b/dependencies/pom.xml index 26e2b367e55..98f13dccd54 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -124,7 +124,7 @@ 5.12.0.Final 4.1.100.Final 0.0.19.Final - 2.66.0 + 3.26.0 ${version.lib.oci} 21.3.0.0 19.3.0.0 @@ -1410,8 +1410,6 @@ pom import - - - - - - - - com.oracle.oci.sdk - oci-java-sdk-circuitbreaker - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-common - ${version.lib.oci} - false - - - - com.oracle.oci.sdk - oci-java-sdk-audit - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-containerengine - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-core - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-database - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-dns - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-email - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-filestorage - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-identity - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-loadbalancer - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-objectstorage - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-addons-resteasy-client-configurator - ${version.lib.oci} - - - com.oracle.oci.sdk - oci-java-sdk-addons-sasl - ${version.lib.oci} - - - com.oracle.oci.sdk - oci-java-sdk-addons-graalvm - ${version.lib.oci} - - - com.oracle.oci.sdk - oci-java-sdk-resourcesearch - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-addons-apache - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-keymanagement - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-announcementsservice - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-healthchecks - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-waas - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-streaming - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-resourcemanager - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-monitoring - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-ons - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-autoscaling - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-budget - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-workrequests - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-limits - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-functions - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-events - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-dts - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-oce - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-oda - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-analytics - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-integration - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-osmanagement - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-marketplace - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-apigateway - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-applicationmigration - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-datacatalog - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-dataflow - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-datascience - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-nosql - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-secrets - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-vault - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-bds - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-encryption - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-cims - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-datasafe - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-mysql - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-dataintegration - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-ocvp - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-usageapi - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-blockchain - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-loggingingestion - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-logging - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-loganalytics - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-managementdashboard - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-sch - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-loggingsearch - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-managementagent - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-cloudguard - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-opsi - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-computeinstanceagent - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-optimizer - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-tenantmanagercontrolplane - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-rover - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-databasemanagement - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-artifacts - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-apmsynthetics - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-goldengate - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-apmcontrolplane - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-apmtraces - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-networkloadbalancer - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-vulnerabilityscanning - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-databasemigration - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-servicecatalog - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-ailanguage - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-operatoraccesscontrol - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-bastion - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-genericartifactscontent - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-jms - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-devops - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-aianomalydetection - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-datalabelingservice - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-datalabelingservicedataplane - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-apmconfig - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-waf - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-certificates - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-certificatesmanagement - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-usage - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-databasetools - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-servicemanagerproxy - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-appmgmtcontrol - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-ospgateway - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-identitydataplane - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-visualbuilder - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-osubusage - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-osubsubscription - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-osuborganizationsubscription - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-osubbillingschedule - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-dashboardservice - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-threatintelligence - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-aivision - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-aispeech - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-dataconnectivity - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-stackmonitoring - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-servicemesh - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-adm - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-licensemanager - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-onesubscription - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-governancerulescontrolplane - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-waa - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-networkfirewall - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-vnmonitoring - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-emwarehouse - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-lockbox - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-fusionapps - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-mediaservices - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-opa - ${version.lib.oci} - false - - - com.oracle.oci.sdk - oci-java-sdk-opensearch - ${version.lib.oci} - false - - diff --git a/examples/integrations/cdi/oci-objectstorage/pom.xml b/examples/integrations/cdi/oci-objectstorage/pom.xml index c0daa5172f8..64ac668f750 100644 --- a/examples/integrations/cdi/oci-objectstorage/pom.xml +++ b/examples/integrations/cdi/oci-objectstorage/pom.xml @@ -42,6 +42,11 @@ oci-java-sdk-objectstorage compile + + jakarta.ws.rs + jakarta.ws.rs-api + compile + org.eclipse.microprofile.config microprofile-config-api diff --git a/examples/integrations/oci/atp-cdi/src/main/java/io/helidon/examples/integrations/oci/atp/cdi/AtpResource.java b/examples/integrations/oci/atp-cdi/src/main/java/io/helidon/examples/integrations/oci/atp/cdi/AtpResource.java index 91657046067..85e73c18a98 100644 --- a/examples/integrations/oci/atp-cdi/src/main/java/io/helidon/examples/integrations/oci/atp/cdi/AtpResource.java +++ b/examples/integrations/oci/atp-cdi/src/main/java/io/helidon/examples/integrations/oci/atp/cdi/AtpResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,10 +44,11 @@ import com.oracle.bmc.database.model.GenerateAutonomousDatabaseWalletDetails; import com.oracle.bmc.database.requests.GenerateAutonomousDatabaseWalletRequest; import com.oracle.bmc.database.responses.GenerateAutonomousDatabaseWalletResponse; -import com.oracle.bmc.http.internal.ResponseHelper; import oracle.security.pki.OraclePKIProvider; import oracle.ucp.jdbc.PoolDataSource; import org.eclipse.microprofile.config.inject.ConfigProperty; + +import static com.oracle.bmc.http.client.Options.shouldAutoCloseResponseInputStream; /** * JAX-RS resource - REST API for the atp example. */ @@ -82,7 +83,7 @@ public class AtpResource { @GET @Path("/wallet") public Response generateWallet() { - ResponseHelper.shouldAutoCloseResponseInputStream(false); + shouldAutoCloseResponseInputStream(false); GenerateAutonomousDatabaseWalletResponse walletResponse = databaseClient.generateAutonomousDatabaseWallet( GenerateAutonomousDatabaseWalletRequest.builder() diff --git a/integrations/oci/sdk/cdi/pom.xml b/integrations/oci/sdk/cdi/pom.xml index cdc73ee63ae..4e7722effe7 100644 --- a/integrations/oci/sdk/cdi/pom.xml +++ b/integrations/oci/sdk/cdi/pom.xml @@ -57,6 +57,32 @@ + + com.oracle.oci.sdk + oci-java-sdk-common-httpclient-jersey + compile + + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + + + jakarta.inject + jakarta.inject-api + compile + + + jakarta.ws.rs + jakarta.ws.rs-api + compile + org.glassfish.jersey.connectors @@ -149,5 +175,5 @@ - + diff --git a/integrations/oci/sdk/cdi/src/main/java/io/helidon/integrations/oci/sdk/cdi/OciExtension.java b/integrations/oci/sdk/cdi/src/main/java/io/helidon/integrations/oci/sdk/cdi/OciExtension.java index 2795e064247..43d9b82f002 100644 --- a/integrations/oci/sdk/cdi/src/main/java/io/helidon/integrations/oci/sdk/cdi/OciExtension.java +++ b/integrations/oci/sdk/cdi/src/main/java/io/helidon/integrations/oci/sdk/cdi/OciExtension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ import com.oracle.bmc.Service; import com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider; import com.oracle.bmc.common.ClientBuilderBase; -import com.oracle.bmc.http.ClientConfigurator; +import com.oracle.bmc.http.client.jersey.ClientBuilderDecorator; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; @@ -1065,7 +1065,7 @@ private static Class loadClassUnresolved(String name) throws ClassNotFoundExc private static void customizeEndpointResolution(ClientBuilderBase clientBuilder) { EndpointAdjuster ea = EndpointAdjuster.of(clientBuilder.getClass().getName()); if (ea != null) { - clientBuilder.additionalClientConfigurator(ea); + clientBuilder.clientConfigurator(b -> b.property(ClientBuilderDecorator.PROPERTY, ea)); } } @@ -1321,7 +1321,7 @@ public final boolean equals(Object other) { } - private enum EndpointAdjuster implements ClientConfigurator, ClientRequestFilter, Predicate { + private enum EndpointAdjuster implements ClientBuilderDecorator, ClientRequestFilter, Predicate { /* @@ -1432,9 +1432,10 @@ private enum EndpointAdjuster implements ClientConfigurator, ClientRequestFilter */ - @Override // ClientConfigurator - public void customizeBuilder(ClientBuilder builder) { + @Override // ClientBuilderDecorator + public Client finish(ClientBuilder builder) { builder.register(this, Map.of(ClientRequestFilter.class, Integer.valueOf(Priorities.AUTHENTICATION - 500))); + return builder.build(); } @Override // Predicate @@ -1459,10 +1460,6 @@ private void adjust(ClientRequestContext crc, String hostname) { crc.setUri(UriBuilder.fromUri(crc.getUri()).host(this.adjuster.apply(hostname)).build()); } - @Override // ClientConfigurator - public void customizeClient(Client client) { - } - /* * Static methods. diff --git a/integrations/oci/sdk/cdi/src/main/java/module-info.java b/integrations/oci/sdk/cdi/src/main/java/module-info.java index fca390ccb34..fc4e435e327 100644 --- a/integrations/oci/sdk/cdi/src/main/java/module-info.java +++ b/integrations/oci/sdk/cdi/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ @SuppressWarnings({ "requires-automatic", "requires-transitive-automatic" }) module io.helidon.integrations.oci.sdk.cdi { - requires com.google.common; // OCI dependency requires java.annotation; requires java.logging; requires java.ws.rs; @@ -35,6 +34,8 @@ requires jakarta.interceptor.api; requires microprofile.config.api; requires oci.java.sdk.common; + requires oci.java.sdk.common.httpclient; + requires oci.java.sdk.common.httpclient.jersey; exports io.helidon.integrations.oci.sdk.cdi; diff --git a/integrations/oci/sdk/cdi/src/test/java/io/helidon/integrations/oci/sdk/cdi/TestSpike.java b/integrations/oci/sdk/cdi/src/test/java/io/helidon/integrations/oci/sdk/cdi/TestSpike.java index 8bc0e6c8a94..5f2df40c8ae 100644 --- a/integrations/oci/sdk/cdi/src/test/java/io/helidon/integrations/oci/sdk/cdi/TestSpike.java +++ b/integrations/oci/sdk/cdi/src/test/java/io/helidon/integrations/oci/sdk/cdi/TestSpike.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. + * Copyright (c) 2022, 2023 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -190,7 +190,7 @@ private ExampleBean(// The service* parameters below are // isn't; see the comments in the // constructor body below. It should be // unsatisfied. - Instance unresolvedJaxRsCircuitBreakerInstance, + Instance unresolvedOciCircuitBreakerInstance, // Streaming turns out to be the only // convention-violating service in the // entire portfolio, and the violation is @@ -217,26 +217,26 @@ private ExampleBean(// The service* parameters below are StreamClient streamingServiceClient, // oddball StreamClientBuilder streamingServiceClientBuilder) { // oddball super(); - // unresolvedJaxRsCircuitBreakerInstance - // (Instance) + // unresolvedOciCircuitBreakerInstance + // (Instance) // is an example of something that seems like it obeys the // OCI client service pattern. But it deviates in a // couple ways. // - // First, JaxRsCircuitBreaker is part of the common + // First, OciCircuitBreaker is part of the common // runtime (see // https://docs.oracle.com/en-us/iaas/tools/java/latest/overview-summary.html#:~:text=Oracle%20Cloud%20Infrastructure%20Common%20Runtime), // and hence is not a service itself. // - // Second, there are no JaxRsCircuitBreakerAsync, - // JaxRsCircuitBreakerAsyncClient, - // JaxRsCircuitBreakerAsyncClient$Builder, - // JaxRsCircuitBreakerClient or - // JaxRsCircuitBreakerClient$Builder classes. + // Second, there are no OciCircuitBreakerAsync, + // OciCircuitBreakerAsyncClient, + // OciCircuitBreakerAsyncClient$Builder, + // OciCircuitBreakerClient or + // OciCircuitBreakerClient$Builder classes. // // For all these reasons it should be excluded from // processing (and is, or this test would fail). - assertTrue(unresolvedJaxRsCircuitBreakerInstance.isUnsatisfied()); + assertTrue(unresolvedOciCircuitBreakerInstance.isUnsatisfied()); } private static void customizeAsyncBuilder(@Observes AIServiceLanguageAsyncClient.Builder asyncClientBuilder) {