Odilon Client 1.8 API

About Odilon

Odilon is an Open Source Object Storage that runs on standard hardware..

It was designed as a redundant and secure file storage for applications that need to manage medium to large size objects (like pdfs, photos, audio, video).

It is small and easy to integrate, offers encryption, data protection and fault tolerance (software RAID and Erasure Codes) and detection of silent data degradation. Odilon also supports version control and master - standby replication over the Internet.

Odilon keeps objects encrypted (Encryption at Rest) using modern algorithms such as AES-256. Each object has a unique encryption key. In turn, the encryption key of the object can be generated by Odilon or, which is recommended for greater security, by a Key Management Server (KMS)

Article on Odilon Architecture

Odilon Java SDK

Odilon Java SDK is a client to perform bucket and object operations to a Odilon server. The Interface OdilonClient contains the API to interact with the Server. The Implemention class is ODClient.

Minimum Requirements

Java 11 or above is required to use this SDK.

JAR download

The latest JAR can be downloaded from https://odilon.io#download

Maven usage

From Maven Central

 
         <dependency>
                 <groupId>io.odilon</groupId>
                 <artifactId>odilon-client</artifactId>
                 <version>1.8</version>
         </dependency>
 


Quick Start Example - File Uploader

This example program connects to an Odilon server, makes a bucket on the server and then uploads a file to the bucket.
You need these items in order to connect to an Odilon server.

  • Endpoint. URL to target Odilon server (example: "http://localhost")
  • Port. port of the target Odilon server (default is 9234)
  • Access key. username of the target Odilon server (default is "odilon")
  • Secret Key. Secret key (password) of the target Odilon server (default is "odilon")

/* these are the default values for the Server */
String endpoint = "http://localhost";
int port = 9234;
String accessKey = "odilon";
String secretKey = "odilon";
                                                
/** OdilonClient is the interface, ODClient is the implementation */
OdilonClient client = new ODClient(endpoint, port, accessKey, secretKey);

/** ping checks the status of server, it returns the String "ok" when the server is normal */
String ping = client.ping();
if (!ping.equals("ok")) {
        System.out.println("ping error -> " + ping);
        System.exit(1);
}

String bucketName = "bucket-demo";
        
try {
    /** check if the bucket exists, if not create it */
    if (client.existsBucket(bucketName))
        System.out.println("bucket already exists ->" + bucketName );
    else 
        client.createBucket(bucketName);
} catch (ODClientException e) {
        System.out.println(String.valueOf(e.getHttpStatus())+ " " + e.getMessage()+" " + String.valueOf(e.getErrorCode()));
                System.exit(1);
}

File file = new File("test.pdf");
String objectName = file.getName();

try (InputStream inputStream = new BufferedInputStream(new FileInputStream(file))) {    
        client.putObjectStream(bucketName, objectName, inputStream, Optional.of(file.getName()), Optional.empty());
} catch (ODClientException e) {
        System.out.println(String.valueOf(e.getHttpStatus())+" " + e.getMessage()+" " + String.valueOf(e.getErrorCode()));
        System.exit(1);
} catch (FileNotFoundException | IOException e1) {
        System.out.println(e1.getClass().getName() + " " + e1.getMessage());
        System.exit(1);
}


Odilon Server

Java development

Videos

Packages
Package
Description
The Interface OdilonClient contains the API to interact with the Server, the Implementation class is ODClient.
Error management for client server interaction.
Utility classes used by ODClient.
Utility classes used by ODClient for POST Multipart using Java HTTTP client.
General utility classes used by ODClient.