private void writeToFile ( List < DomainControllerData > data , String domainName ) throws IOException { if ( domainName == null || data == null ) { return ; } if ( conn == null ) { init ( ) ; } try { String key = S3Util . sanitize ( domainName ) + "/" + S3Util . sanitize ( DC_FILE_NAME ) ; byte [ ] buf = S3Util . domainControllerDataToByteBuffer ( data ) ; S3Object val = new S3Object ( buf , null ) ; if ( usingPreSignedUrls ( ) ) { Map headers = new TreeMap ( ) ; headers . put ( "x-amz-acl" , Arrays . asList ( "public-read" ) ) ; conn . put ( pre_signed_put_url , val , headers ) . connection . getResponseMessage ( ) ; } else { Map headers = new TreeMap ( ) ; headers . put ( "Content-Type" , Arrays . asList ( "text/plain" ) ) ; conn . put ( location , key , val , headers ) . connection . getResponseMessage ( ) ; } } catch ( Exception e ) { throw HostControllerLogger . ROOT_LOGGER . cannotWriteToS3File ( e . getLocalizedMessage ( ) ) ; } }
Write the domain controller data to an S3 file .