private URI generateAsynchronously ( String account , String spaceId , String storeId , String format ) throws Exception { StorageProviderType providerType = getStorageProviderType ( storeId ) ; InputStream manifest = manifestResource . getManifest ( account , storeId , spaceId , format ) ; String contentId = MessageFormat . format ( "generated-manifests/manifest-{0}_{1}_{2}.txt{3}" , spaceId , providerType . name ( ) . toLowerCase ( ) , DateUtil . convertToString ( System . currentTimeMillis ( ) , DateFormat . PLAIN_FORMAT ) , ".gz" ) ; String adminSpace = "x-duracloud-admin" ; URI uri = buildURI ( adminSpace , contentId ) ; StorageProvider provider = storageProviderFactory . getStorageProvider ( ) ; executor . execute ( ( ) -> { try { boolean gzip = true ; // write file to disk File file = IOUtil . writeStreamToFile ( manifest , gzip ) ; // upload to the default storage provider with retries uploadManifestToDefaultStorageProvider ( format , adminSpace , contentId , file , provider , gzip ) ; } catch ( Exception ex ) { log . error ( "failed to generate manifest for space: spaceId=" + spaceId + ", storeId=" + storeId + " : " + ex . getMessage ( ) , ex ) ; } } ) ; return uri ; }
Generates a manifest file asynchronously and uploads to DuraCloud