Class OciExtension
- java.lang.Object
-
- io.helidon.integrations.oci.sdk.cdi.OciExtension
-
- All Implemented Interfaces:
Extension
public final class OciExtension extends Object implements Extension
A CDI 2.0 portable extension that enables the injection of any service interface, service client, service client builder, asynchronous service interface, asynchronous service client, or asynchronous service client builder from the Oracle Cloud Infrastructure Java SDK.Terminology
The terms service interface, service client, service client builder, asynchronous service interface, asynchronous service client, and asynchronous service client builder are defined as follows:
- Service
- An Oracle Cloud Infrastructure service supported by the Oracle Cloud Infrastructure Java SDK.
- Service interface
- A Java interface describing the functionality of a service.
Distinguished from an asynchronous service interface.
For a hypothetical service named Cloud Example, the corresponding service interface will be in a package named
com.oracle.bmc.cloudexample. The service interface's simple name is often also named after the service, e.g.CloudExample, but need not be. - Service client
- A concrete Java class that implements the service interface and
has the same package name as
it. Distinguished from an asynchronous service client.
The service client's simple name is formed by appending the simple name of the service interface with
Client. The class name for the service client for the hypotheticalcom.oracle.bmc.cloudexample.CloudExampleservice interface described above will thus becom.oracle.bmc.cloudexample.CloudExampleClient. - Service client builder
- A concrete Java "builder" class that creates possibly
customized instances of its corresponding service client.
Distinguished from an asynchronous service client builder.
The service client builder is nearly always a nested class of the service client whose instances it builds with a simple name of
Builder. (In the single case in the entirety of the Oracle Cloud Infrastructure Java SDK where this pattern is not followed, the service client builder's simple name is formed by addingBuilderto the service client's simple name.) The class name for the service client builder for the hypotheticalcom.oracle.bmc.cloudexample.CloudExampleClientservice client described above will thus becom.oracle.bmc.cloudexample.CloudExampleClient$Builder. - Asynchronous service interface
- A Java interface describing the functionality of a service.
Distinguished from a service interface.
For a hypothetical service named Cloud Example, the corresponding service interface will be in the same package as that of the service interface. The asynchronous service interface's simple name is formed by adding
Asyncto the service interface's simple name. The class name for the asynchronous service interface for the hypotheticalcom.oracle.bmc.cloudexample.CloudExampleservice interface described above will thus becom.oracle.bmc.cloudexample.CloudExampleAsync. - Asynchronous service client
- A concrete Java class that implements the asynchronous service interface and
has the same package name as
it. Distinguised from a service client.
The asynchronous service client's simple name is formed by appending the simple name of the asynchronous service interface with
Client. The class name for the service client for the hypotheticalcom.oracle.bmc.cloudexample.CloudExampleservice interface described above will thus becom.oracle.bmc.cloudexample.CloudExampleAsyncClient. - Asynchronous service client builder
- A concrete Java "builder" class that creates possibly
customized instances of its corresponding asynchronous service
client. Distinguished from a service client builder.
The asynchronous service client builder is nearly always a nested class of the asynchronous service client whose instances it builds with a simple name of
Builder. (In the single case in the entirety of the Oracle Cloud Infrastructure Java SDK where this pattern is not followed, the asynchronous service client builder's class name is formed by addingBuilderto the asynchronous service client's class name.) The class name for the service client builder for the hypotheticalcom.oracle.bmc.cloudexample.CloudExampleAsyncClientservice client described above will thus becom.oracle.bmc.cloudexample.CloudExampleAsyncClient$Builder.
Additionally, for any given service interface, service client, service client builder, asynchronous service interface, asynchronous service client, or asynchronous service client builder, this extension also enables the injection of an appropriate
AbstractAuthenticationDetailsProvider, which allows the corresponding service client to authenticate with the service.In all cases, user-supplied beans will be preferred over any otherwise installed by this extension.
Basic Usage
To use this extension, make sure it is on your project's runtime classpath. To inject a service interface named
com.oracle.bmc.cloudexample.CloudExample(or an analogous asynchronous service interface), you will also need to ensure that its containing artifact is on your compile classpath (e.g.oci-java-sdk-cloudexample-$VERSION.jar, where$VERSIONshould be replaced by a suitable version number).Advanced Usage
In the course of providing injection support for a service interface or an asynchronous service interface, this extension will create service client builder and asynchronous service client builder instances by invoking the
staticbuilder()method that is present on all service client classes, and will then add those instances as beans. The resulting service client or asynchronous service client will be built by that builder'sbuild(AbstractAuthenticationDetailsProvider)method and will itself be added as a bean.A user may wish to customize this builder so that the resulting service client or asynchronous service client reflects the customization. She has two options:
- She may supply her own bean with the service client builder type (or asynchronous client builder type) as one of its bean types. In this case, this extension does not supply the service client builder (or asynchronous service client builder) and the user is in full control of how her service client (or asynchronous service client) is constructed.
- She may customize the service client builder (or asynchronous
service client builder) supplied by this extension. To do this, she declares an observer method that observes the
service client builder object (or asynchronous service client
builder object) that is returned from the
staticservice client (or asynchronous service client)builder()method. In her observer method, she may call any method on the supplied service client builder (or asynchronous service client builder) and her customizations will be retained.
Configuration
This extension uses the following MicroProfile Config property names (note, however, that no configuration is required):
MicroProfile Config property names Name Type Description Default Value Notes oci.auth-strategiesString[]A comma-separated list of descriptors describing the strategy, or strategies, to use to select an appropriate AbstractAuthenticationDetailsProviderwhen one is called for.autoZero or more of the following: autoconfigconfig-fileinstance-principalsresource-principal
A strategy descriptor of
configwill cause aSimpleAuthenticationDetailsProviderto be used, populated with other MicroProfile Config properties described here.A strategy descriptor of
config-filewill cause aConfigFileAuthenticationDetailsProviderto be used, customized with other MicroProfile Config properties described here.A strategy descriptor of
instance-principalswill cause anInstancePrincipalsAuthenticationDetailsProviderto be used.A strategy descriptor of
resource-principalwill cause aResourcePrincipalAuthenticationDetailsProviderto be used.If there are many strategy descriptors supplied, the first one that is deemed to be available or suitable will be used and all others will be ignored.
If
autois present in the list, or if no value for this property exists, the behavior will be as ifconfig,config-file,instance-principals,resource-principalwere supplied instead.oci.config.pathStringA Stringthat is a path to a valid OCI configuration fileA default location This configuration property has an effect only when config-fileis, explicitly or implicitly, present in the value for theoci.auth-strategiesconfiguration property described elsewhere in this table.oci.config.profileStringAn OCI configuration file profile. DEFAULTThis configuration property has an effect only when config-fileis, explicitly or implicitly, present in the value for theoci.auth-strategiesconfiguration property described elsewhere in this table.oci.auth.fingerprintStringAn API signing key's fingerprint. This configuration property has an effect only when configis, explicitly or implicitly, present in the value for theoci.auth-strategiesconfiguration property described elsewhere in this table.oci.auth.regionRegion(Stringrepresentation)A region identifier. This configuration property has an effect only when configis, explicitly or implicitly, present in the value for theoci.auth-strategiesconfiguration property described elsewhere in this table.oci.auth.tenant-idStringAn OCID of a tenancy. This configuration property has an effect only when configis, explicitly or implicitly, present in the value for theoci.auth-strategiesconfiguration property described elsewhere in this table.oci.auth.user-idStringAn OCID of a user. This configuration property has an effect only when configis, explicitly or implicitly, present in the value for theoci.auth-strategiesconfiguration property described elsewhere in this table.oci.extension.classname-vetoesString[]A comma-separated list of class names beginning with com.oracle.bmc.that should be skipped, even if they match the service pattern described above.It is recommended not to supply a value for this property name except in extraordinary circumstances. oci.extension.lenient-classloadingbooleanIf true, classes that cannot be loaded will not cause a definition error and will simply be skipped (recommended).true- See Also:
Extension, Oracle Cloud Infrastructure Java SDK
-
-
Constructor Detail
-
OciExtension
@Deprecated public OciExtension()
Deprecated.ForServiceLoaderuse only.Creates a newOciExtension.
-
-