Class S3Resource

java.lang.Object
net.microfalx.resource.AbstractResource
net.microfalx.resource.AbstractStatefulResource<io.minio.MinioClient,io.minio.MinioClient>
net.microfalx.resource.s3.S3Resource
All Implemented Interfaces:
Serializable, AutoCloseable, Cloneable, net.microfalx.resource.Resource, net.microfalx.resource.StatefulResource

public class S3Resource extends net.microfalx.resource.AbstractStatefulResource<io.minio.MinioClient,io.minio.MinioClient>
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from interface net.microfalx.resource.Resource

    net.microfalx.resource.Resource.Type
  • Field Summary

    Fields inherited from interface net.microfalx.resource.Resource

    END_POINT_ATTR, FILE_NAME_ATTR, HASH_ATTR, NULL, PATH_ATTR
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.microfalx.resource.StatefulResource
    create(URI uri, net.microfalx.resource.Credential credential)
    Creates a resource and auto-detects the type.
    static net.microfalx.resource.StatefulResource
    create(net.microfalx.resource.Resource.Type type, URI uri, net.microfalx.resource.Credential credential)
    Creates a resource and auto-detects the type.
    static net.microfalx.resource.StatefulResource
    directory(URI uri, net.microfalx.resource.Credential credential)
    Creates a resource with a directory type.
    boolean
     
    static net.microfalx.resource.StatefulResource
    file(URI uri, net.microfalx.resource.Credential credential)
    Creates a resource with a file type.
    net.microfalx.resource.Resource
    get(String path, net.microfalx.resource.Resource.Type type)
     
    static URL
    Returns the default endpoint.
    Returns the URL to the S3 object store.
    Returns the ETag attached to the object.
     
    Returns the owner attached to the object.
    net.microfalx.resource.Resource
     
    net.microfalx.resource.Resource
    resolve(String path, net.microfalx.resource.Resource.Type type)
     
    static void
    Changes the default endpoint.
     

    Methods inherited from class net.microfalx.resource.AbstractStatefulResource

    close

    Methods inherited from class net.microfalx.resource.AbstractResource

    copyFrom, copyFrom, copyPropertiesFrom, create, createParents, delete, detectMimeType, empty, equals, exists, get, getAttribute, getAttributeNames, getAttributes, getCredential, getDescription, getFileExtension, getFragment, getId, getInputStream, getInputStream, getMimeType, getName, getOutputStream, getParent, getPath, getPath, getPath, getReader, getRoot, getType, getWriter, hasAttribute, hashCode, isAbsolutePath, isLocal, lastModified, length, list, loadAsBytes, loadAsBytes, loadAsString, loadAsString, toFile, toHash, toString, toURL, walk, walk, withAbsolutePath, withAttribute, withAttributes, withCredential, withDescription, withFragment, withMimeType, withMimeType, withName

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.microfalx.resource.Resource

    copyFrom, copyFrom, copyPropertiesFrom, create, createParents, delete, detectMimeType, empty, exists, get, getAttribute, getAttributeNames, getAttributes, getCredential, getDescription, getFileExtension, getFragment, getId, getInputStream, getInputStream, getMimeType, getName, getOutputStream, getParent, getPath, getPath, getPath, getReader, getRoot, getType, getWriter, hasAttribute, isAbsolutePath, isDirectory, isFile, isLocal, isReadable, isWritable, lastModified, length, list, loadAsBytes, loadAsBytes, loadAsString, loadAsString, toFile, toHash, toURL, walk, walk, withAbsolutePath, withAttribute, withAttributes, withCredential, withDescription, withFragment, withMimeType, withMimeType, withName
  • Method Details

    • file

      public static net.microfalx.resource.StatefulResource file(URI uri, net.microfalx.resource.Credential credential)
      Creates a resource with a file type.
      Parameters:
      uri - the URI
      credential - the credential
      Returns:
      a non-null instance
    • directory

      public static net.microfalx.resource.StatefulResource directory(URI uri, net.microfalx.resource.Credential credential)
      Creates a resource with a directory type.
      Parameters:
      uri - the URI
      credential - the credential
      Returns:
      a non-null instance
    • create

      public static net.microfalx.resource.StatefulResource create(URI uri, net.microfalx.resource.Credential credential)
      Creates a resource and auto-detects the type.
      Parameters:
      uri - the URI
      credential - the credential
      Returns:
      a non-null instance
    • create

      public static net.microfalx.resource.StatefulResource create(net.microfalx.resource.Resource.Type type, URI uri, net.microfalx.resource.Credential credential)
      Creates a resource and auto-detects the type.
      Parameters:
      type - the resource type
      uri - the URI
      credential - the credential
      Returns:
      a non-null instance
    • setDefaultEndpoint

      public static void setDefaultEndpoint(URL url)
      Changes the default endpoint.
      Parameters:
      url - the URL of the S3 object store
    • getDefaultEndpoint

      public static URL getDefaultEndpoint()
      Returns the default endpoint.
      Returns:
      the endpoint, NULL if a default one is not provided
    • getEndpoint

      public URL getEndpoint()
      Returns the URL to the S3 object store.
      Returns:
      a non-null instance
      Throws:
      S3Exception - if the URL cannot be retrieved
    • getFileName

      public String getFileName()
    • getEtag

      public String getEtag() throws IOException
      Returns the ETag attached to the object.
      Returns:
      the ETag, null if not available
      Throws:
      IOException
    • getOwner

      public String getOwner() throws IOException
      Returns the owner attached to the object.
      Returns:
      the owner, null if not available
      Throws:
      IOException
    • doExists

      public boolean doExists() throws IOException
      Throws:
      IOException
    • resolve

      public net.microfalx.resource.Resource resolve(String path)
      Specified by:
      resolve in interface net.microfalx.resource.Resource
      Overrides:
      resolve in class net.microfalx.resource.AbstractResource
    • resolve

      public net.microfalx.resource.Resource resolve(String path, net.microfalx.resource.Resource.Type type)
      Specified by:
      resolve in interface net.microfalx.resource.Resource
      Overrides:
      resolve in class net.microfalx.resource.AbstractResource
    • get

      public net.microfalx.resource.Resource get(String path, net.microfalx.resource.Resource.Type type)
    • toURI

      public URI toURI()