public List < StorageAccount > createStorageAccountsFrom ( Element accounts ) { List < StorageAccount > accts = new ArrayList < StorageAccount > ( ) ; try { Iterator < ? > accountList = accounts . getChildren ( ) . iterator ( ) ; while ( accountList . hasNext ( ) ) { Element accountXml = ( Element ) accountList . next ( ) ; String type = accountXml . getChildText ( "storageProviderType" ) ; StorageProviderType acctType = StorageProviderType . fromString ( type ) ; StorageAccountProviderBinding providerBinding = providerBindings . get ( acctType ) ; if ( null != providerBinding ) { accts . add ( providerBinding . getAccountFromXml ( accountXml ) ) ; } else { log . warn ( "Unexpected account type: " + acctType ) ; } } // Make sure that there is at least one storage account if ( accts . isEmpty ( ) ) { String error = "No storage accounts could be read" ; throw new StorageException ( error ) ; } } catch ( Exception e ) { String error = "Unable to build storage account information due " + "to error: " + e . getMessage ( ) ; log . error ( error ) ; throw new StorageException ( error , e ) ; } return accts ; }
This method deserializes the provided xml into a durastore acct config object .