Class ModuleUploads.Async

  • Enclosing class:
    ModuleUploads

    public class ModuleUploads.Async
    extends java.lang.Object
    Async module.
    • Constructor Detail

      • Async

        public Async()
    • Method Detail

      • create

        public CMACallback<CMAUpload> create​(java.io.InputStream stream,
                                             int chunkSize,
                                             CMACallback<CMAUpload> callback)
        Create a new upload, asynchronously.

        Once an upload is created, you can use it in CMAClient#assets for creating an asset based on a local file.

        Parameters:
        stream - the actual binary representation of the upload. Cannot be null.
        callback - the callback to be informed about success or failure.
        Returns:
        the callback passed in.
        Throws:
        java.lang.IllegalArgumentException - if configured spaceId is null.
        java.lang.IllegalArgumentException - if file is null.
        java.lang.IllegalStateException - if something in the transmittal went wrong.
        CMANotWithEnvironmentsException - if environmentId was set using CMAClient.Builder.setEnvironmentId(String).
        See Also:
        CMAClient.Builder.setSpaceId(String)
      • create

        public CMACallback<CMAUpload> create​(java.lang.String spaceId,
                                             java.lang.String environmentId,
                                             java.io.InputStream stream,
                                             int chunkSize,
                                             CMACallback<CMAUpload> callback)
        Create a new upload, asynchronously.

        Once an upload is created, you can use it in CMAClient#assets for creating an asset based on a local file.

        This method will override the configuration specified through CMAClient.Builder.setSpaceId(String) and will ignore CMAClient.Builder.setEnvironmentId(String).

        Parameters:
        spaceId - a nonnull id representing the space to add the upload to.
        stream - the actual binary representation of the upload. Cannot be null.
        callback - the callback to be informed about success or failure.
        Returns:
        the callback passed in.
        Throws:
        java.lang.IllegalArgumentException - if spaceId is null.
        java.lang.IllegalArgumentException - if file is null.
        java.lang.IllegalStateException - if something in the transmittal went wrong.
      • fetchOne

        public CMACallback<CMAUpload> fetchOne​(java.lang.String spaceId,
                                               java.lang.String environmentId,
                                               java.lang.String uploadId,
                                               CMACallback<CMAUpload> callback)
        Get information about the given upload, asynchronously.

        This method will override the configuration specified through CMAClient.Builder.setSpaceId(String) and will ignore CMAClient.Builder.setEnvironmentId(String).

        Parameters:
        spaceId - which space is this upload hosted under?
        uploadId - what id does the upload have?
        callback - the callback to be informed about success or failure.
        Returns:
        the callback passed in.
        Throws:
        java.lang.IllegalArgumentException - if spaceId is null.
        java.lang.IllegalArgumentException - if uploadId is null.
      • delete

        public CMACallback<java.lang.Integer> delete​(CMAUpload upload,
                                                     java.lang.String environmentId,
                                                     CMACallback<java.lang.Integer> callback)
        Delete a given upload again, asynchronously.
        Parameters:
        upload - upload
        callback - the callback to be informed about success or failure.
        Returns:
        the callback passed in.
        Throws:
        java.lang.IllegalArgumentException - if spaceId is null.
        java.lang.IllegalArgumentException - if uploadId is null.