@ Override public String beginFileUpload ( ) throws TException { String fileLoc = null ; try { String path ; String key = UUID . randomUUID ( ) . toString ( ) ; path = StormConfig . masterInbox ( conf ) + "/" + key ; FileUtils . forceMkdir ( new File ( path ) ) ; FileUtils . cleanDirectory ( new File ( path ) ) ; fileLoc = path + "/stormjar-" + key + ".jar" ; data . getUploaders ( ) . put ( fileLoc , Channels . newChannel ( new FileOutputStream ( fileLoc ) ) ) ; LOG . info ( "Begin upload file from client to " + fileLoc ) ; return path ; } catch ( FileNotFoundException e ) { LOG . error ( "File not found: " + fileLoc , e ) ; throw new TException ( e ) ; } catch ( IOException e ) { LOG . error ( "Upload file error: " + fileLoc , e ) ; throw new TException ( e ) ; } }
prepare to upload topology jar return the file location