• Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
    Java
  • License
    Other
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Oracle Cloud Infrastructure SDK for Java

Oracle Cloud Infrastructure SDK for Java

ReleasePublished

About

oci-java-sdk provides an SDK for Java that you can use to manage your Oracle Cloud Infrastructure resources.

The project is open source and maintained by Oracle Corp. The home page for the project is here.

The OCI Java SDK versions 1.x.y and 2.x.y are now referred as OCI Legacy Java SDK. Any updates or bug fixes related to OCI Legacy Java SDK can be found in legacy/v2/master branch. Please refer README.md to learn more about these legacy versions.

This Github repository will refer to OCI Java SDK version 3.x.y by default where support for new features and services will be added.

Documentation

Full documentation, including prerequisites, installation, supported JDK versions and configuration instructions, is available here.

API reference can be found here.

Installation

For basic set up, see Getting Started.

For details on compatibility, advanced configurations, and add-ons, see Configuration.

  • Circuit Breaker: By default, circuit breaker feature is enabled, if it is not expected, please explicitly set the environment variable:
export OCI_SDK_DEFAULT_CIRCUITBREAKER_ENABLED=FALSE

Changes Introduced In OCI Java SDK 3.x.y

For full details, look at the changelog for version 3.0.0-beta1.

HTTP client library is pluggable

There is no HTTP client library configured by default. The OCI Java SDK offers the following two choices for HTTP client libraries to choose from.

  • Jakarta EE 8/Jersey 2 - bmc-common-httpclient-jersey

  • Jakarta EE 9/Jersey 3 - bmc-common-httpclient-jersey3

  • The OCI Java SDK does not choose an HTTP client library for you, and there is no default. You have to explicitly choose one, by declaring a dependency on oci-java-sdk-common-httpclient-jersey or oci-java-sdk-common-httpclient-jersey3

  • Example:

      <dependency>
        <!-- Since this is the "application" pom.xml, we do want to
             choose the httpclient to use. -->
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
      </dependency>
    

Serializer/Deserializer is pluggable

  • The serializer is now pluggable and determined by the HttpProvider. For the Jersey 2 and Jersey 3 HTTP clients, Jackson continues to be used as the serializer
  • As part of the pluggable Serializer changes, when using the Jersey and Jersey 3 HTTP clients, the underlying Jackson ObjectMapper can now be obtained using com.oracle.bmc.serialization.jackson.JacksonSerializer.getDefaultObjectMapper(). The com.oracle.bmc.http.client.Serialization.getObjectMapper() method does not exist anymore.

Invocation callbacks

Instead of using com.oracle.bmc.util.internal.Consumer<Invocation.Builder> to register invocation callbacks, use com.oracle.bmc.http.client.RequestInterceptor instead, to decouple the implementation from the choice of the HTTP client.

Client configuration has been simplified

com.oracle.bmc.http.ClientConfigurator has a single customizeClient(HttpClientBuilder builder) method, instead of customizeBuilder, customizeClient, and customizeRequest methods. Example:

    IdentityClient.builder()
                  .clientConfigurator(
                          builder -> {
                      builder.property(
                              StandardClientProperties.BUFFER_REQUEST, false);
                  })
                  // ...
                  .build(authenticationDetailsProvider);

Specific client configuration examples

Setting whether to buffer a request
        builder.property(
                StandardClientProperties.BUFFER_REQUEST, shouldBuffer);
Setting an Apache connection manager
        builder.property(
                ApacheClientProperties.CONNECTION_MANAGER,
                connectionManager);
Setting a trust store
        // Server CA goes into the trust store
        KeyStore trustStore =
                keystoreGenerator.createTrustStoreWithServerCa(tlsConfig.getCaBundle());
        builder.property(StandardClientProperties.TRUST_STORE, trustStore);
Setting a key store
        builder.property(
                StandardClientProperties.KEY_STORE,
                new KeyStoreWithPassword(keyStore, keystorePassword));
Setting the SSL context
        builder.property(
                StandardClientProperties.SSL_CONTEXT, sslContext);
Setting a proxy
        builder.property(
                StandardClientProperties.PROXY, proxyConfig);
Setting a hostname verifier
        builder.property(
                StandardClientProperties.HOSTNAME_VERIFIER,
                NoopHostnameVerifier.INSTANCE);

More client configuration examples

Apache Connector changes

There were numerous changes to decouple the implementation from the choice of the HTTP client.

  • com.oracle.bmc.http.ApacheConfigurator, has been replaced by com.oracle.bmc.http.client.jersey.ApacheClientProperties or com.oracle.bmc.http.client.jersey3.ApacheClientProperties (for Jersey 3).
    • For clients that should not buffer requests into memory:

      ObjectStorageClient nonBufferingObjectStorageClient = ObjectStorageClient
          .builder()
          .clientConfigurator(builder -> {
              builder.property(StandardClientProperties.BUFFER_REQUEST, false);
              builder.property(ApacheClientProperties.RETRY_HANDLER, null);
              builder.property(ApacheClientProperties.REUSE_STRATEGY, null);
          })
          .region(Region.US_PHOENIX_1)
          .build(provider);
      
    • For clients that should buffer requests into memory:

      IdentityClient bufferingIdentityClient = IdentityClient
          .builder()
          .clientConfigurator(builder -> {
              builder.property(StandardClientProperties.BUFFER_REQUEST, true);
              builder.property(ApacheClientProperties.RETRY_HANDLER, null);
              builder.property(ApacheClientProperties.REUSE_STRATEGY, null);
          })
          .region(Region.US_PHOENIX_1)
          .build(provider);
      

Circuit breaker changes

  • The circuit breaker interface has been renamed from com.oracle.bmc.circuitbreaker.JaxRsCircuitBreaker to com.oracle.bmc.circuitbreaker.OciCircuitBreaker
  • Instead of using the constructor of com.oracle.bmc.circuitbreaker.CircuitBreakerConfiguration, use the builder. The constructor is not public anymore.
  • The com.oracle.bmc.util.CircuitBreakerUtils class does not deal with actual circuit breakers anymore, just with com.oracle.bmc.circuitbreaker.CircuitBreakerConfiguration. As such, the DEFAULT_CIRCUIT_BREAKER field and the getUserDefinedCircuitBreaker method were removed. Construct a new circuit breaker from the default configuration if necessary using the build methods in com.oracle.bmc.circuitbreaker.CircuitBreakerFactory.

Moved classes

  • Class com.oracle.bmc.Options was moved to com.oracle.bmc.http.client.Options
  • Class com.oracle.bmc.http.Serialization was moved to com.oracle.bmc.http.client.Serialization and is available from OCI Java SDK versions 3.0.0 to 3.13.1
  • Class com.oracle.bmc.io.DuplicatableInputStream was moved to com.oracle.bmc.http.client.io.DuplicatableInputStream

Long deprecated code was removed

  • The signing strategy OBJECT_STORAGE was removed from com.oracle.bmc.http.signing.SigningStrategy; it had been deprecated for years and had been replaced by EXCLUDE_BODY.
  • The getPublicKey() and getPrivateKey() methods were removed from com.oracle.bmc.auth.SessionKeySupplier and implementing classes; they had been deprecated for years and had been replaced by the getKeyPair() method.

Removed code

  • The setInstanceMetadataServiceClientConfig method in com.oracle.bmc.Region was removed; it never had any effect.
  • AbstractFederationClientAuthenticationDetailsProviderBuilder.simpleRetry method has been removed without replacement, since it is not needed in the OCI Java SDK 3.0.0 and higher.
  • You can copy and paste the previous implementation if you need it.
  • Starting OCI Java SDK version 3.14.0, class com.oracle.bmc.http.client.Serialization has been removed.

Removed dependencies on the following third-party libraries

  • Guava: Guava types have been replaced with JDK types:
    • com.google.common.base.Optional has been replaced with java.util.Optional
    • com.google.common.base.Function has been replaced with java.util.function.Function
    • com.google.common.base.Predicate has been replaced with java.util.function.Predicate
    • com.google.common.base.Supplier has been replaced with java.util.function.Supplier

Examples

Examples for OCI Java SDK 3.x.y can be found bmc-examples/src/main/java.

Example for Jersey 2 as HTTP client library (OCI Java SDK 3.x.y)

In order to use Jersey 2 as HTTP client library, a dependency on oci-java-sdk-common-httpclient-jersey needs to be explicitly declared in application's pom.xml. Please refer bmc-jersey-examples/pom.xml

Examples for Jersey 2 as HTTP client library can be found in bmc-other-examples/bmc-jersey-examples

Example for Jersey 3 as HTTP client library (OCI Java SDK 3.x.y)

In order to use Jersey 3 as HTTP client library, a dependency on oci-java-sdk-common-httpclient-jersey3 needs to be explicitly declared in application's pom.xml. Please refer bmc-jersey3-examples/pom.xml

Examples for Jersey 3 as HTTP client library can be found in bmc-other-examples/bmc-jersey3-examples

Example for OCI Legacy Java SDK (OCI Java SDK 1.x.y and 2.x.y)

Examples for OCI Legacy Java SDK can be found here.

Help

For details on contributions, questions, or feedback, see Contact Us.

Changes

See CHANGELOG.

Contributing

oci-java-sdk is an open source project. See CONTRIBUTING for details.

Oracle gratefully acknowledges the contributions to oci-java-sdk that have been made by the community.

Known Issues

You can find information on any known issues with the SDK here and under the “Issues” tab of this GitHub repository.

To learn about known issues with OCI Legacy Java SDK, please refer Known Issues in OCI Legacy Java SDK

Potential data corruption issue with OCI Java SDK on binary data upload with RefreshableOnNotAuthenticatedProvider

Details: When using version 1.25.1 or earlier of the OCI Java SDK clients that upload streams of data (for example ObjectStorageClient or FunctionsInvokeClient), either synchronously and asynchronously, and you use a RefreshableOnNotAuthenticatedProvider (for example, for Resource Principals or Instance Principals) you may be affected by silent data corruption.

Workaround: Update the OCI Java SDK client to version 1.25.2 or later. For more information about this issue and workarounds, see Potential data corruption issue for OCI Java SDK on binary data upload with RefreshableOnNotAuthenticatedProvider.

Direct link to this issue: Potential data corruption issue with OCI Java SDK on binary data upload with RefreshableOnNotAuthenticatedProvider

Program hangs for an indefinite time

If the request to the server hangs for an indefinite time and the program gets stuck, it could be because the connection is not released from the Apache connection pool. If you're calling APIs that return a binary/stream response, please make sure to close all the streams returned from the response to release the connections from the connection pool in case of partial reads. If reading the stream completely, the SDK will automatically try to close the stream to release the connection from the connection pool, to disable this feature of auto-closing streams on full read, please call Options.shouldAutoCloseResponseInputStream(false). This is because the SDK for Java supports the Apache Connector for sending requests and managing connections to the service. By default, the Apache Connector supports connection pooling and in the cases where the stream from the response is not closed, the connections don't get released from the connection pool and in turn results in an indefinite wait time. This can be avoided either by closing the streams or switching back to the Jersey default connector, i.e. HttpUrlConnector. You can find more information about the same in the OCI Java SDK Troubleshooting section.

Performance issues and switching between connection closing strategies with the Apache Connector

The Java SDK supports the Apache Connector as the default. The Apache Connector supports the use of two connection closing strategies - ApacheConnectionClosingStrategy.GracefulClosingStrategy and ApacheConnectionClosingStrategy.ImmediateClosingStrategy. When using ApacheConnectionClosingStrategy.GracefulClosingStrategy, streams returned from response are read till the end of the stream when closing the stream. This can introduce additional time when closing the stream with partial read, depending on how large the remaining stream is. Use ApacheConnectionClosingStrategy.ImmediateClosingStrategy for large files with partial reads instead for faster close. One of the disadvantages of using ApacheConnectionClosingStrategy.ImmediateClosingStrategy on the other hand takes longer when using partial read for smaller stream size (< 1MB). Please consider your use-case and change accordingly. For more info please look into : https://github.com/oracle/oci-java-sdk/blob/master/ApacheConnector-README.md.

Note : If both the above Apache Connection closing strategies do not give you optimal results for your use-cases, please consider switching back to Jersey Default HttpUrlConnectorProvider. For more info on Apache Connector, please look into ApacheConnector-README.

License

Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.

See LICENSE for more details.

More Repositories

1

graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
Java
20,237
star
2

docker-images

Official source of container configurations, images, and examples for Oracle products and projects
Shell
6,160
star
3

opengrok

OpenGrok is a fast and usable source code search and cross reference engine, written in Java
Java
3,971
star
4

truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
Ruby
3,018
star
5

helidon

Java libraries for writing microservices
Java
2,596
star
6

visualvm

VisualVM is an All-in-One Java Troubleshooting Tool
Java
2,563
star
7

node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
JavaScript
2,174
star
8

graaljs

A ECMAScript 2022 compliant JavaScript implementation built on GraalVM. With polyglot language interoperability support. Running Node.js applications!
C++
1,418
star
9

tribuo

Tribuo - A Java machine learning library
Java
1,211
star
10

railcar

RailCar: Rust implementation of the Open Containers Initiative oci-runtime
Rust
1,115
star
11

oracle-db-examples

Examples of applications and tool usage for Oracle Database
Java
958
star
12

graalpython

A Python 3 implementation built on GraalVM
Python
957
star
13

mysql-operator

Create, operate and scale self-healing MySQL clusters in Kubernetes
Go
868
star
14

python-cx_Oracle

Python interface to Oracle Database now superseded by python-oracledb
C
861
star
15

vagrant-projects

Vagrant projects for Oracle products and other examples
Shell
840
star
16

graphpipe

Machine Learning Model Deployment Made Simple
Makefile
725
star
17

terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
Go
622
star
18

bpftune

bpftune uses BPF to auto-tune Linux systems
C
615
star
19

smith

Smith: A microcontainer builder
Go
602
star
20

fastr

A high-performance implementation of the R programming language, built on GraalVM.
Java
598
star
21

oraclejet

Oracle JET is a modular JavaScript Extension Toolkit for developers working on client-side applications.
479
star
22

db-sample-schemas

Oracle Database Sample Schemas
PLSQL
435
star
23

coherence

Oracle Coherence Community Edition
Java
408
star
24

dotnet-db-samples

.NET code samples for Oracle database developers #OracleDotNet
C#
381
star
25

apex

Official Oracle APEX repo for sample code, starter apps, plug-ins, and more! #orclapex
354
star
26

graalvm-reachability-metadata

Repository which contains community-driven collection of GraalVM reachability metadata for open-source libraries.
Java
352
star
27

oci-cli

Command Line Interface for Oracle Cloud Infrastructure
Python
343
star
28

centos2ol

Script and documentation to switch CentOS/Rocky Linux to Oracle Linux
Shell
330
star
29

oci-python-sdk

Oracle Cloud Infrastructure SDK for Python
Python
303
star
30

crashcart

CrashCart: sideload binaries into a running container
Rust
275
star
31

oracle-db-tools

This project is a repository of sample code that will demonstrate various concepts to assist developers in building applications around Oracle Database technologies. SDKs and scripts will be available to integrate with SQL Developer, Data Modeler, Oracle REST Data Services and DBaaS.
JavaScript
274
star
32

python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
Python
256
star
33

oci-designer-toolkit

OCI designer toolKIT (OKIT) is a set of tools for enabling design, deploy and visualise OCI environments through a graphical web based interface.
JavaScript
254
star
34

linux-uek

Oracle Linux UEK: Unbreakable Enterprise Kernel
253
star
35

odpi

ODPI-C: Oracle Database Programming Interface for Drivers and Applications
C
235
star
36

weblogic-kubernetes-operator

WebLogic Kubernetes Operator
Java
225
star
37

netsuite-suitecloud-sdk

SuiteCloud Software Development Kit (SuiteCloud SDK) are the set of tools that allow you to customize accounts and create SuiteApps through SuiteCloud Development Framework (SDF).
JavaScript
184
star
38

oracle-r2dbc

R2DBC Driver for Oracle Database
Java
183
star
39

javavscode

Java platform support for Visual Studio Code for full featured Java development (edit-compile-debug & test cycle)
TypeScript
179
star
40

terraform-kubernetes-installer

Terraform Installer for Kubernetes on Oracle Cloud Infrastructure
HCL
178
star
41

pgql-lang

PGQL is an SQL-based query language for property graphs
Java
158
star
42

speedle

Speedle is an open source project for access control.
Go
156
star
43

oci-ansible-collection

Oracle Cloud Infrastructure Ansible Collection provides an easy way to provision and manage resources in Oracle Cloud using Ansible.
Python
152
star
44

oci-go-sdk

Go SDK for Oracle Cloud Infrastructure
Go
150
star
45

wookiee

Scala based lightweight service framework using zookeeper, gRPC, and other popular technologies.
Scala
143
star
46

cordova-plugin-wkwebview-file-xhr

Cordova Plugin for WebView File XHR
JavaScript
140
star
47

weblogic-deploy-tooling

WebLogic Deploy Tooling
Python
140
star
48

solaris-userland

Open Source software in Solaris using gmake based build system to drive building various software components.
C
137
star
49

macaron

Macaron is an extensible supply-chain security analysis framework from Oracle Labs that supports a wide range of build systems and CI/CD services. It can be used to prevent supply chain attacks, detect malicious Python packages, or check conformance to frameworks, such as SLSA. Documentation:
Python
134
star
50

sd4j

Stable diffusion pipeline in Java using ONNX Runtime
Java
131
star
51

analytical-sql-examples

NO LONGER MAINTAINED. Code samples for Oracle's analytical SQL features
PLSQL
127
star
52

container-images

Oracle Linux container images
124
star
53

oracle-database-operator

The Oracle Database Operator for Kubernetes (a.k.a. OraOperator) helps developers, DBAs, DevOps and GitOps teams reduce the time and complexity of deploying and managing Oracle Databases. It eliminates the dependency on a human operator or administrator for the majority of database operations.
Go
120
star
54

oracle-linux

Scripts, examples, and tutorials to get started with Oracle Linux
Shell
115
star
55

kernel-fuzzing

Fuzzers for the Linux kernel
Hack
109
star
56

oci-cloud-controller-manager

Kubernetes Cloud Controller Manager implementation for Oracle Cloud Infrastucture
Go
109
star
57

oci-ansible-modules

DEPRECATED - Please migrate to the new OCI Ansible collection (https://github.com/oracle/oci-ansible-collection).
Python
106
star
58

cloud-native-devops-workshop

Oracle's Cloud Native and DevOps Workshop on Oracle Cloud
JavaScript
106
star
59

weblogic-monitoring-exporter

WebLogic Monitoring Exporter exposes metrics and monitoring data through REST APIs for consumption by other tools (e.g. Prometheus)
Java
105
star
60

macest

Model Agnostic Confidence Estimator (MACEST) - A Python library for calibrating Machine Learning models' confidence scores
Jupyter Notebook
99
star
61

hospitality-api-docs

This repository stores REST API specifications and accompanying Postman collections for Oracle Hospitality APIs.
HTML
99
star
62

cloudtestdrive

HTML
95
star
63

font-apex

Font APEX is an open source icon library from the Oracle APEX team.
CSS
93
star
64

coherence-operator

Oracle Coherence Operator
Go
93
star
65

ktf

Kernel Test Framework - a unit test framework for the Linux kernel
Shell
88
star
66

kubernetes-vault-kms-plugin

Go
74
star
67

dtrace-utils

DTrace-utils contains the DTrace port to Linux
C
74
star
68

oci-grafana-metrics

Grafana datasource plugin for OCI metrics
Go
71
star
69

hiq

HiQ - Observability And Optimization In Modern AI Era
Python
68
star
70

accelerated-data-science

ADS is the Oracle Data Science Cloud Service's python SDK supporting, model ops (train/eval/deploy), along with running workloads on Jobs and Pipeline resources.
Python
67
star
71

graphpipe-go

GraphPipe for go
Go
66
star
72

soda-for-java

SODA (Simple Oracle Document Access) for Java is an Oracle library for writing Java apps that work with JSON (and not only JSON!) in the Oracle Database. SODA allows your Java app to use the Oracle Database as a NoSQL document store.
Java
65
star
73

oci-typescript-sdk

Oracle Cloud Infrastructure SDK for TypeScript and JavaScript
TypeScript
64
star
74

oracle-functions-samples

Examples demonstrating how to use Oracle Functions
61
star
75

yo

A fast and simple command line OCI client
Python
60
star
76

solaris-ips

Solaris IPS: Image Packaging System
Python
57
star
77

weblogic-image-tool

WebLogic Image Tool
Java
57
star
78

nvm-direct

A C library to support applications that map Non-Volatile Memory into their address space for load/store access.
C
56
star
79

microservices-datadriven

Sample code of application examples to build microservices with converged Oracle database and multi-cloud / hybrid cloud services
CSS
56
star
80

bots-node-sdk

Oracle Bots Node.js SDK
TypeScript
51
star
81

db-appdev-vm

Database Application Development Virtual Machine
Shell
50
star
82

souffle

DEPRECATED. Soufflé is a translator of declarative Datalog programs into the C++ language.
C++
49
star
83

xml-sample-demo

Oracle Database XMLDB Code samples
VBScript
48
star
84

oci-service-broker

Oracle Cloud Infrastructure Service Broker is an open source implementation of Open service broker API Spec for OCI services. Customers can use this implementation to install Open Service Broker in Oracle Container Engine for Kubernetes or in other Kubernetes clusters.
Java
48
star
85

free

Free Oracle technologies for Developers
HTML
47
star
86

oraclesolaris-contrib

oraclesolaris-contrib is a repository focussed on the Oracle Solaris 11.4 StatsStore, using methodologies like REST to connect to Oracle Solaris 11.4 and the new features being introduced in Oracle Solaris 11.4 OS.
Jupyter Notebook
46
star
87

oci-utils

Oracle Cloud Infrastructure utilities
Python
45
star
88

content-and-experience-toolkit

The Oracle Content Management Toolkit and SDKs help you develop custom applications that consume content that is managed in the OCM repository. These applications can be developed in the Content Management Cloud or using 3rd party tools.
JavaScript
45
star
89

navarkos

Enables a Kubernetes federation to automatically manage multi-cluster infrastructure
Go
44
star
90

nosql-examples

This is a top level repository for code examples related to the use of Oracle NoSQL Database.
HTML
44
star
91

rwloadsim

RWP*Load Simulator - your tool for scripting, simulation and much more. Like having a bit of bash and SQL, a nip of C or Java, a dash of awk, a grain of sed plus drops of secret sauce in one single tool. See https://blogs.oracle.com/database/rwploadsim-oracle-db-performance-simluator for the announcement on the Oracle database blog.
C
44
star
92

fmw-chef-cookbook

Official repository of samples that show how to use Chef to provision Oracle Fusion Middleware (FMW) products.
Ruby
43
star
93

oci-dotnet-sdk

Oracle Cloud Infrastructure SDK for .NET
C#
43
star
94

graphpipe-py

GraphPipe for python
Python
42
star
95

terraform-examples

Terraform Examples for Oracle Cloud Infrastructure and Platfrom
41
star
96

heatwave-tpch

SQL scripts for HeatWave benchmarking
41
star
97

oci-data-science-ai-samples

This repo contains a series of tutorials and code examples highlighting different features of the OCI Data Science and AI services, along with a release vehicle for experimental programs.
Jupyter Notebook
41
star
98

oracle-db-appdev-monitoring

Metrics exporter and samples for unified observability for data-centric app dev and microservices
Go
41
star
99

dbt-oracle

dbt (data build tool) adapter for Oracle Autonomous Database
Python
40
star
100

offline-persistence-toolkit

Offline Persistence Toolkit for Javascript Applications
JavaScript
40
star