Class CloudStorageTool

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class CloudStorageTool
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Cloud storage toolbox.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String AWS_S3
      AWS S3 storage
      static java.lang.String AZUREBLOB
      AzureBlob storage
      static java.lang.String GOOGLE_CLOUD_STORAGE
      Google Cloud storage
      static java.lang.String OPENSTACK_SWIFT
      OpenStack Swift storage
    • Constructor Summary

      Constructors 
      Constructor Description
      CloudStorageTool​(Grant g, org.json.JSONObject config)
      Constructor
      CloudStorageTool​(org.json.JSONObject config)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      org.json.JSONObject get​(java.lang.String name)
      Get file from storage
      org.json.JSONObject get​(java.lang.String name, boolean read)
      Get file from storage
      java.lang.String getContainer()
      Get container
      Grant getGrant()
      Get grant
      java.lang.String getProvider()
      Get provider
      java.lang.String getRegion()
      Get region
      java.lang.String put​(org.json.JSONObject file)
      Put file in storage
      void setGrant​(Grant grant)
      Set grant
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • GOOGLE_CLOUD_STORAGE

        public static final java.lang.String GOOGLE_CLOUD_STORAGE
        Google Cloud storage
        See Also:
        Constant Field Values
      • AZUREBLOB

        public static final java.lang.String AZUREBLOB
        AzureBlob storage
        See Also:
        Constant Field Values
      • OPENSTACK_SWIFT

        public static final java.lang.String OPENSTACK_SWIFT
        OpenStack Swift storage
        See Also:
        Constant Field Values
    • Constructor Detail

      • CloudStorageTool

        public CloudStorageTool​(org.json.JSONObject config)
                         throws java.lang.Exception
        Constructor
        Parameters:
        config - Configuration
        Throws:
        java.lang.Exception
      • CloudStorageTool

        public CloudStorageTool​(Grant g,
                                org.json.JSONObject config)
                         throws java.lang.Exception
        Constructor
        Parameters:
        g - Grant
        config - Configuration
        Throws:
        java.lang.Exception
    • Method Detail

      • getGrant

        public Grant getGrant()
        Get grant
        Returns:
        Grant
      • setGrant

        public void setGrant​(Grant grant)
        Set grant
        Parameters:
        grant - Grant
      • getProvider

        public java.lang.String getProvider()
        Get provider
        Returns:
        Provider
      • getRegion

        public java.lang.String getRegion()
        Get region
      • getContainer

        public java.lang.String getContainer()
        Get container
      • put

        public java.lang.String put​(org.json.JSONObject file)
                             throws java.lang.Exception
        Put file in storage
        Parameters:
        file - File decription (name, mime, content, encoding, ...)
        Throws:
        java.lang.Exception
      • get

        public org.json.JSONObject get​(java.lang.String name)
                                throws java.lang.Exception
        Get file from storage
        Parameters:
        name - File name
        Throws:
        java.lang.Exception
      • get

        public org.json.JSONObject get​(java.lang.String name,
                                       boolean read)
                                throws java.lang.Exception
        Get file from storage
        Parameters:
        name - File name
        read - Read content?
        Throws:
        java.lang.Exception
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable