Search code examples
javaobject-storage

How manage with Java a non AWS , Google or IBM Object Storage


I'm trying to manage my ProfitBricks S3 Object Storage Bucket using java, I want to do the basics (add, remove, list) operations but all I have found on internet is to connect to a AWS, Google or IBM Object Storage.

I have tried to use one implementation of those but I don't find how to provide my provider Endpoint.


Solution

  • I have achieved this using the jets3t library and I have set the endpoint property using a Jets3tProperties object.

        Jets3tProperties props = new Jets3tProperties();
        props.setProperty("s3service.disable-dns-buckets", String.valueOf(true));
        props.setProperty("s3service.s3-endpoint", PB_ENDPOINT);
        props.setProperty("s3service.s3-endpoint-http-port", PB_ENDPOINT_HTTP_PORT);
        props.setProperty("s3service.s3-endpoint-https-port", PB_ENDPOINT_HTTPS_PORT);
        props.setProperty("s3service.https-only", String.valueOf(false));
        AWSCredentials creds = new AWSCredentials(PB_ACCESS_KEY, PB_SECRET_KEY);
        RestS3Service s3Service = new RestS3Service(creds, null, null, props);
    

    And then with the s3Service object I was able to manage my ProfitBricks S3 Object Storage Bucket using java.