Class ObjectStoreAccess


  • @Component
    public class ObjectStoreAccess
    extends Object

    Grants access to the S3 compatible object storage hosted by Telekom in Germany, enabling basic functionality for working with files.


    Make sure the following properties are available on the env:
    • services.distribution.objectstore.endpoint
    • services.distribution.objectstore.bucket
    • services.distribution.objectstore.accessKey
    • services.distribution.objectstore.secretKey
    • services.distribution.objectstore.port
    • Field Detail

      • DEFAULT_MAX_CACHE_AGE

        public static final int DEFAULT_MAX_CACHE_AGE
        Specifies the default maximum amount of time in seconds that a published resource can be considered "fresh" when held in a cache.
        See Also:
        Constant Field Values
    • Method Detail

      • putObject

        public void putObject​(LocalFile localFile)
        Stores the target file on the S3 and sets cache control headers according to the default maximum age value.
        Parameters:
        localFile - The file to be published.
      • putObject

        public void putObject​(LocalFile localFile,
                              int maxAge)
        Stores the target file on the S3 and sets cache control headers according to the specified maximum age value.
        Parameters:
        localFile - The file to be published.
        maxAge - A cache control parameter that specifies the maximum amount of time in seconds that a resource can be considered "fresh" when held in a cache.
      • deleteObjectsWithPrefix

        public void deleteObjectsWithPrefix​(String prefix)
        Deletes objects in the object store, based on the given prefix (folder structure).
        Parameters:
        prefix - the prefix, e.g. my/folder/
      • getObjectsWithPrefix

        public List<S3Object> getObjectsWithPrefix​(String prefix)
        Fetches the list of objects in the store with the given prefix.
        Parameters:
        prefix - the prefix, e.g. my/folder/
        Returns:
        the list of objects