= Helidon OCI Object Storage CDI Integration

The Helidon OCI Object Storage CDI Integration project supplies a
http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#spi[CDI portable
extension] that lets the end user inject an `ObjectStorage` client
into her CDI application.

== Prerequisites

The OCI Java SDK is not available in Maven Central at the moment.
You will need to populate your local Maven repository with the OCI Java SDK
 artifacts in order to resolve the helidon dependency described in the next section.

```bash
    git clone --depth 1 --branch v1.2.44 https://github.com/oracle/oci-java-sdk.git
    mvn -B -U -f oci-java-sdk/pom.xml \
        -Dmaven.test.skip=true \
        -Dmaven.source.skip=true \
        -Dmaven.javadoc.skip=true \
        -Dlombok.delombok.skip=true \
        -pl bmc-objectstorage \
        -am \
        install
```

== Installation

Ensure that the Helidon OCI Object Storage CDI Integration project and
its runtime dependencies are present on your application's runtime
classpath.

For Maven users, your `<dependency>` stanza should look like this:

[source,xml]
----
<dependency>
  <groupId>io.helidon.integrations.cdi</groupId>
  <artifactId>helidon-integrations-cdi-oci-objectstorage</artifactId>
  <version>1.0.0</version>
  <scope>runtime</scope>
</dependency>
----

== Usage

If you want to use an `ObjectStorage` client
in your application code, simply inject it in the
http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#injection_and_resolution[usual,
idiomatic CDI way].  Here is a field injection example:

[source,java]
----
@Inject
private ObjectStorage client;
----

And here is a constructor injection example:

[source,java]
----
private final ObjectStorage client;

@Inject
public YourConstructor(@Named("orders") ObjectStorage client) {
  super();
  this.client = client;
}
----

The Helidon OCI Object Storage CDI Integration project will satisfy
this injection point with an `ObjectStorageClient` in
http://docs.jboss.org/cdi/api/2.0/javax/enterprise/context/ApplicationScoped.html[application
scope].

To create it, the Helidon OCI Object Storage CDI Integration project
will use
https://static.javadoc.io/org.eclipse.microprofile.config/microprofile-config-api/1.3/index.html?overview-summary.html[MicroProfile
Config] to locate its configuration.  The following
https://static.javadoc.io/org.eclipse.microprofile.config/microprofile-config-api/1.3/org/eclipse/microprofile/config/Config.html#getPropertyNames--[Property
names] will be used to establish a connection to the OCI Object
Storage service:

. `oci.auth.fingerprint`
. `oci.auth.keyFile`
. `oci.auth.passphraseCharacters`
. `oci.auth.user`
. `oci.auth.tenancy`
. `oci.objectstorage.region`

These properties are
https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/javasdk.htm#Configur[documented
in the OCI Object Storage Java SDK documentation].
