Class S3NioSpiConfiguration

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.Object>

    public class S3NioSpiConfiguration
    extends java.util.HashMap<java.lang.String,​java.lang.Object>
    Object to hold configuration of the S3 NIO SPI
    See Also:
    Serialized Form
    • Field Detail

      • AWS_REGION_PROPERTY

        public static final java.lang.String AWS_REGION_PROPERTY
        See Also:
        Constant Field Values
      • AWS_ACCESS_KEY_PROPERTY

        public static final java.lang.String AWS_ACCESS_KEY_PROPERTY
        See Also:
        Constant Field Values
      • AWS_SECRET_ACCESS_KEY_PROPERTY

        public static final java.lang.String AWS_SECRET_ACCESS_KEY_PROPERTY
        See Also:
        Constant Field Values
      • S3_SPI_READ_MAX_FRAGMENT_SIZE_PROPERTY

        public static final java.lang.String S3_SPI_READ_MAX_FRAGMENT_SIZE_PROPERTY
        The name of the maximum fragment size property
        See Also:
        Constant Field Values
      • S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT

        public static final int S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT
        The default value of the maximum fragment size property
        See Also:
        Constant Field Values
      • S3_SPI_READ_MAX_FRAGMENT_NUMBER_PROPERTY

        public static final java.lang.String S3_SPI_READ_MAX_FRAGMENT_NUMBER_PROPERTY
        The name of the maximum fragment number property
        See Also:
        Constant Field Values
      • S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT

        public static final int S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT
        The default value of the maximum fragment size property
        See Also:
        Constant Field Values
      • S3_SPI_ENDPOINT_PROPERTY

        public static final java.lang.String S3_SPI_ENDPOINT_PROPERTY
        The name of the endpoint property
        See Also:
        Constant Field Values
      • S3_SPI_ENDPOINT_DEFAULT

        public static final java.lang.String S3_SPI_ENDPOINT_DEFAULT
        The default value of the endpoint property
        See Also:
        Constant Field Values
      • S3_SPI_ENDPOINT_PROTOCOL_PROPERTY

        public static final java.lang.String S3_SPI_ENDPOINT_PROTOCOL_PROPERTY
        The name of the endpoint protocol property
        See Also:
        Constant Field Values
      • S3_SPI_ENDPOINT_PROTOCOL_DEFAULT

        public static final java.lang.String S3_SPI_ENDPOINT_PROTOCOL_DEFAULT
        The default value of the endpoint protocol property
        See Also:
        Constant Field Values
      • S3_SPI_FORCE_PATH_STYLE_PROPERTY

        public static final java.lang.String S3_SPI_FORCE_PATH_STYLE_PROPERTY
        The name of the force path style property
        See Also:
        Constant Field Values
      • S3_SPI_FORCE_PATH_STYLE_DEFAULT

        public static final boolean S3_SPI_FORCE_PATH_STYLE_DEFAULT
        The default value of the force path style property
        See Also:
        Constant Field Values
      • S3_SPI_TIMEOUT_LOW_PROPERTY

        public static final java.lang.String S3_SPI_TIMEOUT_LOW_PROPERTY
        Low timeout (in minutes) for Async APIs
        See Also:
        Constant Field Values
      • S3_SPI_TIMEOUT_LOW_DEFAULT

        public static final java.lang.Long S3_SPI_TIMEOUT_LOW_DEFAULT
        The default value of low timeout property
      • S3_SPI_TIMEOUT_MEDIUM_PROPERTY

        public static final java.lang.String S3_SPI_TIMEOUT_MEDIUM_PROPERTY
        Medium timeout (in minutes) for Async APIs
        See Also:
        Constant Field Values
      • S3_SPI_TIMEOUT_MEDIUM_DEFAULT

        public static final java.lang.Long S3_SPI_TIMEOUT_MEDIUM_DEFAULT
        The default value of medium timeout property
      • S3_SPI_TIMEOUT_HIGH_PROPERTY

        public static final java.lang.String S3_SPI_TIMEOUT_HIGH_PROPERTY
        High timeout (in minutes) for Async APIs
        See Also:
        Constant Field Values
      • S3_SPI_TIMEOUT_HIGH_DEFAULT

        public static final java.lang.Long S3_SPI_TIMEOUT_HIGH_DEFAULT
        The default value of high timeout property
      • S3_SPI_CREDENTIALS_PROPERTY

        public static final java.lang.String S3_SPI_CREDENTIALS_PROPERTY
        The default value of the credentials property
        See Also:
        Constant Field Values
    • Constructor Detail

      • S3NioSpiConfiguration

        public S3NioSpiConfiguration()
        Create a new, empty configuration
      • S3NioSpiConfiguration

        public S3NioSpiConfiguration​(java.util.Map<java.lang.String,​?> overrides)
        Create a new, empty configuration
        Parameters:
        overrides - configuration to override default values
      • S3NioSpiConfiguration

        protected S3NioSpiConfiguration​(java.util.Properties overrides)
        Create a new configuration with overrides
        Parameters:
        overrides - the overrides
    • Method Detail

      • withMaxFragmentNumber

        public S3NioSpiConfiguration withMaxFragmentNumber​(int maxFragmentNumber)
        Fluently sets the value of maximum fragment number
        Parameters:
        maxFragmentNumber - the maximum fragment number
        Returns:
        this instance
      • withMaxFragmentSize

        public S3NioSpiConfiguration withMaxFragmentSize​(int maxFragmentSize)
        Fluently sets the value of maximum fragment size
        Parameters:
        maxFragmentSize - the maximum fragment size
        Returns:
        this instance
      • withEndpoint

        public S3NioSpiConfiguration withEndpoint​(java.lang.String endpoint)
        Fluently sets the value of the endpoint
        Parameters:
        endpoint - the endpoint
        Returns:
        this instance
      • withEndpointProtocol

        public S3NioSpiConfiguration withEndpointProtocol​(java.lang.String protocol)
        Fluently sets the value of the endpoint's protocol
        Parameters:
        protocol - the endpoint's protcol
        Returns:
        this instance
      • withRegion

        public S3NioSpiConfiguration withRegion​(java.lang.String region)
        Fluently sets the value of the region
        Parameters:
        region - the region; if null or blank the property is removed
        Returns:
        this instance
      • withBucketName

        public S3NioSpiConfiguration withBucketName​(java.lang.String bucketName)
        Fluently sets the value of bucketName
        Parameters:
        bucketName - the bucket name
        Returns:
        this instance
        Throws:
        java.lang.IllegalArgumentException - if bucketName is not compliant with https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
      • withCredentials

        public S3NioSpiConfiguration withCredentials​(java.lang.String accessKey,
                                                     java.lang.String secretAccessKey)
        Fluently sets the value of accessKey and secretAccessKey
        Parameters:
        accessKey - the accesskey; if null, credentials are removed
        secretAccessKey - the secretAccesskey; if accessKey is not null, it can not be null
        Returns:
        this instance
      • withCredentials

        public S3NioSpiConfiguration withCredentials​(software.amazon.awssdk.auth.credentials.AwsCredentials credentials)
        Fluently sets the value of accessKey and secretAccessKey given a AwsCredentials object.
        Parameters:
        credentials - the credentials; if null, credentials are removed
        Returns:
        this instance
      • withForcePathStyle

        public S3NioSpiConfiguration withForcePathStyle​(java.lang.Boolean forcePathStyle)
        Fluently sets the value of forcePathStyle and adds S3_SPI_FORCE_PATH_STYLE_PROPERTY to the map unless the given value is null. If null, S3_SPI_FORCE_PATH_STYLE_PROPERTY is removed from the map.
        Parameters:
        forcePathStyle - the new value; can be null
        Returns:
        this instance
      • withTimeoutLow

        public S3NioSpiConfiguration withTimeoutLow​(java.lang.Long timeoutLow)
        Fluently sets the value of timeoutLow and adds S3_SPI_TIMEOUT_LOW_PROPERTY to the map unless the given value is null. If null, S3_SPI_TIMEOUT_LOW_PROPERTY takes default value of 1.
        Parameters:
        timeoutLow - the new value; can be null
        Returns:
        this instance
      • withTimeoutMedium

        public S3NioSpiConfiguration withTimeoutMedium​(java.lang.Long timeoutMedium)
        Fluently sets the value of timeoutMedium and adds S3_SPI_TIMEOUT_MEDIUM_PROPERTY to the map unless the given value is null. If null, S3_SPI_TIMEOUT_MEDIUM_PROPERTY takes default value of 3.
        Parameters:
        timeoutMedium - the new value; can be null
        Returns:
        this instance
      • withTimeoutHigh

        public S3NioSpiConfiguration withTimeoutHigh​(java.lang.Long timeoutHigh)
        Fluently sets the value of timeoutHigh and adds S3_SPI_TIMEOUT_HIGH_PROPERTY to the map unless the given value is null. If null, S3_SPI_TIMEOUT_HIGH_PROPERTY holds default value of 5.
        Parameters:
        timeoutHigh - the new value; can be null
        Returns:
        this instance
      • getMaxFragmentSize

        public int getMaxFragmentSize()
        Get the value of the Maximum Fragment Size
        Returns:
        the configured value or the default if not overridden
      • getMaxFragmentNumber

        public int getMaxFragmentNumber()
        Get the value of the Maximum Fragment Number
        Returns:
        the configured value or the default if not overridden
      • getEndpoint

        public java.lang.String getEndpoint()
        Get the value of the endpoint. Not that no endvar/sysprop is taken as default.
        Returns:
        the configured value or the default ("") if not overridden
      • getEndpointProtocol

        public java.lang.String getEndpointProtocol()
        Get the value of the endpoint protocol
        Returns:
        the configured value or the default if not overridden
      • getCredentials

        public software.amazon.awssdk.auth.credentials.AwsCredentials getCredentials()
        Get the configured credentials. Note that credentials can be provided in two ways:

        1. withCredentials(String accessKey, String secretAcccessKey) 2. withCredentials(AwsCredentials credentials)

        The latter takes the priority, so if both are used, getCredentials() returns the most complete object, which is the value of the property S3_SPI_CREDENTIALS_PROPERTY

        Returns:
        the configured value or null if not provided
      • getRegion

        public java.lang.String getRegion()
        Get the configured region if any
        Returns:
        the configured value or null if not provided
      • getBucketName

        public java.lang.String getBucketName()
        Get the configured bucket name if configured
        Returns:
        the configured value or null if not provided
      • getForcePathStyle

        public boolean getForcePathStyle()
      • getTimeoutLow

        public java.lang.Long getTimeoutLow()
        Get the value of the Timeout Low
        Returns:
        the configured value or the default if not overridden
      • getTimeoutMedium

        public java.lang.Long getTimeoutMedium()
        Get the value of the Timeout Medium
        Returns:
        the configured value or the default if not overridden
      • getTimeoutHigh

        public java.lang.Long getTimeoutHigh()
        Get the value of the Timeout High
        Returns:
        the configured value or the default if not overridden
      • convertPropertyNameToEnvVar

        protected java.lang.String convertPropertyNameToEnvVar​(java.lang.String propertyName)
        Generates an environment variable name from a property name. E.g 'some.property' becomes 'SOME_PROPERTY'
        Parameters:
        propertyName - the name to convert
        Returns:
        the converted name
      • endpointUri

        public java.net.URI endpointUri()