Class S3Storage

  • All Implemented Interfaces:
    de.iip_ecosphere.platform.deviceMgt.storage.Storage
    Direct Known Subclasses:
    S3PackageStorage

    public class S3Storage
    extends java.lang.Object
    implements de.iip_ecosphere.platform.deviceMgt.storage.Storage
    A S3Storage grants access to the storage through s3. For this purpose it uses MinioClient to communicate with the s3 storage. The storage can be set to a fixed prefix, so it is only working with a subset of the bucket.
    Author:
    Dennis Pidun, University of Hildesheim
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String bucket  
      private io.minio.MinioClient minioClient  
      private java.lang.String prefix  
    • Constructor Summary

      Constructors 
      Constructor Description
      S3Storage​(java.lang.String prefix, io.minio.MinioClient minioClient, java.lang.String bucket)
      Creates a S3Storage.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String generateDownloadUrl​(java.lang.String key)  
      java.lang.String getPrefix()  
      java.util.Set<java.lang.String> list()  
      void storeFile​(java.lang.String key, java.io.File file)  
      • Methods inherited from class java.lang.Object

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

      • prefix

        private java.lang.String prefix
      • minioClient

        private io.minio.MinioClient minioClient
      • bucket

        private java.lang.String bucket
    • Constructor Detail

      • S3Storage

        public S3Storage​(java.lang.String prefix,
                         io.minio.MinioClient minioClient,
                         java.lang.String bucket)
        Creates a S3Storage.
        Parameters:
        prefix - the prefix to lock on
        minioClient - the connected MinioClient
        bucket - the bucket
    • Method Detail

      • getPrefix

        public java.lang.String getPrefix()
        Specified by:
        getPrefix in interface de.iip_ecosphere.platform.deviceMgt.storage.Storage
      • list

        public java.util.Set<java.lang.String> list()
        Specified by:
        list in interface de.iip_ecosphere.platform.deviceMgt.storage.Storage
      • generateDownloadUrl

        public java.lang.String generateDownloadUrl​(java.lang.String key)
        Specified by:
        generateDownloadUrl in interface de.iip_ecosphere.platform.deviceMgt.storage.Storage
      • storeFile

        public void storeFile​(java.lang.String key,
                              java.io.File file)
                       throws java.io.IOException
        Specified by:
        storeFile in interface de.iip_ecosphere.platform.deviceMgt.storage.Storage
        Throws:
        java.io.IOException