Skip to content

Commit

Permalink
Replace OCI Java SDK shaded jar with v3 for OCI integration (#5908)
Browse files Browse the repository at this point in the history
  • Loading branch information
klustria authored Jan 19, 2023
1 parent 5be3a03 commit e740944
Show file tree
Hide file tree
Showing 19 changed files with 873 additions and 401 deletions.
745 changes: 744 additions & 1 deletion dependencies/pom.xml

Large diffs are not rendered by default.

59 changes: 0 additions & 59 deletions docs/includes/oci.adoc

This file was deleted.

10 changes: 3 additions & 7 deletions docs/mp/integrations/oci.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

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.
Expand Down Expand Up @@ -35,9 +35,7 @@ include::{rootdir}/includes/mp.adoc[]
== Overview
Helidon MP OCI Integration provides easy access to Oracle Cloud Infrastructure using the OCI Java SDK.
NOTE: OCI SDK uses JAX-RS Client 2.1.6 (javax package names), which makes it incompatible with Helidon 3 applications and any application that uses JAX-RS 3 (jakarta package naming). See <<oci-compatibility, Resolving compatibility issue with OCI SDK>> for detailed information on how to work around this issue.
Helidon MP OCI Integration provides easy access to Oracle Cloud Infrastructure using the OCI Java SDK.`
include::{rootdir}/includes/dependencies.adoc[]
Expand Down Expand Up @@ -137,9 +135,7 @@ Once you have injected an ObjectStorage client you can use it as described in:
* link:{oci-javasdk-objstore-javadoc-base-url}/package-summary.html[OCI SDK Object Storage Javadocs]
* link:{oci-objstore-url}[OCI Object Storage Overview]
include::{rootdir}/includes/oci.adoc[leveloffset=+1]
== References
* link:{integration-oci-sdk-cdi-javadoc-base-url}/io/helidon/integrations/oci/sdk/cdi/OciExtension.html[OciExtension] Javadocs
* link:{helidon-github-tree-url}/examples/integrations/oci[OCI SDK Usage Examples]
* link:{helidon-github-tree-url}/examples/integrations/oci[OCI SDK Usage Examples]
12 changes: 4 additions & 8 deletions docs/se/integrations/oci.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

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.
Expand Down Expand Up @@ -35,8 +35,6 @@ include::{rootdir}/includes/se.adoc[]
Helidon SE OCI Integration provides easy access to Oracle Cloud Infrastructure using the OCI Java SDK.
NOTE: OCI SDK uses JAX-RS Client 2.1.6 (javax package names), which makes it incompatible with Helidon 3 applications and any application that uses JAX-RS 3 (jakarta package naming). See <<oci-compatibility, Resolving compatibility issue with OCI SDK>> for detailed information on how to work around this issue.
== Usage
It is recommended that you use the OCI Java SDK directly, in particular the Async clients. All you need to do is configure and create an OCI SDK Client object. The configuration primarily
Expand Down Expand Up @@ -64,7 +62,8 @@ You also need to add the following dependency to your application for this
----
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
<scope>runtime</scope>
</dependency>
----
Expand Down Expand Up @@ -108,11 +107,8 @@ Once you have created an ObjectStorage client you can use it as described in:
* link:{oci-javasdk-objstore-javadoc-base-url}/package-summary.html[OCI SDK Object Storage Javadocs]
* link:{oci-objstore-url}[OCI Object Storage Overview]
include::{rootdir}/includes/oci.adoc[leveloffset=+1]
== References
* link:{helidon-github-tree-url}/examples/integrations/oci[OCI SDK Usage Examples]
* link:https://docs.oracle.com/en-us/iaas/Content/home.htm[OCI Documentation]
]
]
8 changes: 1 addition & 7 deletions examples/integrations/oci/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
# OCI SDK setup for Examples Build

OCI SDK uses JAX-RS Client 2.1.6 (javax package names), which makes it incompatible with Helidon 3 applications and any application that uses JAX-RS 3 (jakarta package naming).

Please see our [Guide](https://github.com/oracle/helidon/tree/master/docs/includes/oci.adoc) for detailed information on how to work around this issue.

Once you have this setup, you can build examples in this repository directory.
# OCI Java SDK Examples
19 changes: 2 additions & 17 deletions examples/integrations/oci/atp-cdi/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
Expand Down Expand Up @@ -33,16 +33,6 @@
<name>Helidon Examples Integration OCI ATP CDI</name>
<description>CDI integration with OCI ATP.</description>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<version>${version.lib.oci}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.helidon.microprofile.bundles</groupId>
Expand All @@ -64,12 +54,7 @@
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<scope>runtime</scope>
<artifactId>oci-java-sdk-database</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -39,7 +39,7 @@
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 com.oracle.bmc.http.client.Options;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.ws.rs.GET;
Expand Down Expand Up @@ -82,7 +82,7 @@ public class AtpResource {
@GET
@Path("/wallet")
public Response generateWallet() {
ResponseHelper.shouldAutoCloseResponseInputStream(false);
Options.shouldAutoCloseResponseInputStream(false);
GenerateAutonomousDatabaseWalletResponse walletResponse =
databaseClient.generateAutonomousDatabaseWallet(
GenerateAutonomousDatabaseWalletRequest.builder()
Expand Down
18 changes: 4 additions & 14 deletions examples/integrations/oci/atp-reactive/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
Expand Down Expand Up @@ -37,16 +37,6 @@
<mainClass>io.helidon.examples.integrations.oci.atp.reactive.OciAtpMain</mainClass>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<version>${version.lib.oci}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.helidon.reactive.webserver</groupId>
Expand All @@ -71,11 +61,11 @@
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<artifactId>oci-java-sdk-database</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand Down
18 changes: 4 additions & 14 deletions examples/integrations/oci/metrics-reactive/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
Expand Down Expand Up @@ -37,16 +37,6 @@
<name>Helidon Examples Integration OCI Metrics Reactive</name>
<description>Reactive integration with OCI Metrics.</description>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<version>${version.lib.oci}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.helidon.reactive.webserver</groupId>
Expand All @@ -58,11 +48,11 @@
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<artifactId>oci-java-sdk-monitoring</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand Down
20 changes: 2 additions & 18 deletions examples/integrations/oci/objectstorage-cdi/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
Expand Down Expand Up @@ -37,16 +37,6 @@
<mainClass>io.helidon.examples.integrations.oci.objectstorage.cdi.ObjectStorageCdiMain</mainClass>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<version>${version.lib.oci}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.helidon.microprofile.bundles</groupId>
Expand All @@ -55,16 +45,10 @@
<dependency>
<groupId>io.helidon.integrations.oci.sdk</groupId>
<artifactId>helidon-integrations-oci-sdk-cdi</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<scope>runtime</scope>
<artifactId>oci-java-sdk-objectstorage</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -90,10 +90,10 @@ public Response download(@PathParam("file-name") String fileName) {
try (InputStream fileStream = getObjectResponse.getInputStream()) {
byte[] objectContent = fileStream.readAllBytes();
Response.ResponseBuilder ok = Response.ok(objectContent)
.header(Http.Header.CONTENT_DISPOSITION, "attachment; filename=\"" + fileName + "\"")
.header(Http.Header.CONTENT_DISPOSITION.defaultCase(), "attachment; filename=\"" + fileName + "\"")
.header("opc-request-id", getObjectResponse.getOpcRequestId())
.header("request-id", getObjectResponse.getOpcClientRequestId())
.header(Http.Header.CONTENT_LENGTH, getObjectResponse.getContentLength());
.header(Http.Header.CONTENT_LENGTH.defaultCase(), getObjectResponse.getContentLength());

return ok.build();
} catch (IOException e) {
Expand Down
18 changes: 5 additions & 13 deletions examples/integrations/oci/objectstorage-reactive/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
Expand Down Expand Up @@ -36,15 +36,7 @@
<properties>
<mainClass>io.helidon.examples.integrations.oci.objecstorage.reactive.OciObjectStorageMain</mainClass>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<version>${version.lib.oci}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.helidon.reactive.webserver</groupId>
Expand All @@ -56,11 +48,11 @@
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-shaded-full</artifactId>
<artifactId>oci-java-sdk-objectstorage</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand Down
Loading

0 comments on commit e740944

Please sign in to comment.