Package com.gpudb.filesystem.upload
Class FileUploader
- java.lang.Object
-
- com.gpudb.filesystem.common.FileOperation
-
- com.gpudb.filesystem.upload.FileUploader
-
public class FileUploader extends FileOperation
This is an internal class and not meant to be used by the end users of thefilesystemAPI. The consequences of using this class directly in client code is not guaranteed and maybe undesirable. This class handles uploading of either single part file or multiple part uploads. This class extends the classFileOperationand provides additional functionalities of creating instances ofUploadIoJob, starting them and waiting for them to terminate. The main exposed method to call isupload()which calls two private methods nameduploadFullFiles()anduploadMultiPartFiles()respectively. The methoduploadFullFiles()does the upload by calling the Java endpoint to upload all files in one go. The methoduploadMultiPartFiles()does the uploads by creating background threads since each file could take a long time to upload. The multiple parts of a single file are uploaded sequentially in a single thread and multiple files are uploaded in different threads.
-
-
Field Summary
-
Fields inherited from class com.gpudb.filesystem.common.FileOperation
db, dirName, fileHandlerOptions, fileNames, fullFileBatchManager, fullFileList, multiPartList, multiPartRemoteFileNames, namesOfFilesUploaded, opMode, recursive
-
-
Constructor Summary
Constructors Constructor Description FileUploader(GPUdb db, List<String> fileNames, String remoteDirName, UploadOptions options, FileUploadListener callback, GPUdbFileHandler.Options fileHandlerOptions)Constructs a newFileUploadermanager for uploading a given set of files to a given KiFS directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetRankForLocalDist()UploadOptionsgetUploadOptions()voidsetRankForLocalDist(int rankForLocalDist)voidsetUploadOptions(UploadOptions uploadOptions)voidupload()This is the main upload method which is to be called by the users of this class.-
Methods inherited from class com.gpudb.filesystem.common.FileOperation
decideMultiPart, getFileInfoFromServer, getKifsPathSeparator, getNamesOfFilesUploaded, localDirExists, localFileExists, parseFileNames, searchLocalDirectories, sortFilesIntoFullAndMultipartLists
-
-
-
-
Constructor Detail
-
FileUploader
public FileUploader(GPUdb db, List<String> fileNames, String remoteDirName, UploadOptions options, FileUploadListener callback, GPUdbFileHandler.Options fileHandlerOptions) throws GPUdbException
Constructs a newFileUploadermanager for uploading a given set of files to a given KiFS directory.- Parameters:
db- TheGPUdbinstance used to access KiFS.fileNames- List of names of the local files to upload.remoteDirName- Name of KiFS directory to upload to.options- TheUploadOptionsobject which is used to configure the upload operation.callback- The callbackFileUploadListenerfor this upload manager to notify as the upload job progresses.fileHandlerOptions- Options for setting up the files for transfer.- Throws:
GPUdbException
-
-
Method Detail
-
upload
public void upload() throws GPUdbExceptionThis is the main upload method which is to be called by the users of this class. Internally depending whether there are files to be uploaded one shot or in parts it will call the methodsuploadFullFiles()anduploadMultiPartFiles()- Throws:
GPUdbException- If an error occurs transferring any of the files to the server.
-
getUploadOptions
public UploadOptions getUploadOptions()
-
setUploadOptions
public void setUploadOptions(UploadOptions uploadOptions)
-
getRankForLocalDist
public int getRankForLocalDist()
-
setRankForLocalDist
public void setRankForLocalDist(int rankForLocalDist)
-
-