@ Override public StorageObjectMetadata getObjectMetadata ( String remoteStorageLocation , String prefix ) throws StorageProviderException { AzureObjectMetadata azureObjectMetadata = null ; try { // Get a reference to the BLOB, to retrieve its metadata CloudBlobContainer container = azStorageClient . getContainerReference ( remoteStorageLocation ) ; CloudBlob blob = container . getBlockBlobReference ( prefix ) ; blob . downloadAttributes ( ) ; // Get the user-defined BLOB metadata Map < String , String > userDefinedMetadata = blob . getMetadata ( ) ; // Get the BLOB system properties we care about BlobProperties properties = blob . getProperties ( ) ; long contentLength = properties . getLength ( ) ; String contentEncoding = properties . getContentEncoding ( ) ; // Construct an Azure metadata object azureObjectMetadata = new AzureObjectMetadata ( contentLength , contentEncoding , userDefinedMetadata ) ; } catch ( StorageException ex ) { logger . debug ( "Failed to retrieve BLOB metadata: {} - {}" , ex . getErrorCode ( ) , ex . getExtendedErrorInformation ( ) ) ; throw new StorageProviderException ( ex ) ; } catch ( URISyntaxException ex ) { logger . debug ( "Cannot retrieve BLOB properties, invalid URI: {}" , ex ) ; throw new StorageProviderException ( ex ) ; } return azureObjectMetadata ; }
Returns the metadata properties for a remote storage object