56 lines
997 B
Java
56 lines
997 B
Java
package org.gcube.data.transfer.library;
|
|
|
|
import java.io.File;
|
|
import java.net.URL;
|
|
|
|
import org.gcube.data.transfer.library.faults.InvalidSourceException;
|
|
import org.gcube.data.transfer.library.faults.SourceNotSetException;
|
|
import org.gcube.data.transfer.library.model.Source;
|
|
|
|
|
|
public abstract class Transferer {
|
|
|
|
|
|
|
|
|
|
protected Source source=null;
|
|
|
|
|
|
public Transferer localFile(File f){
|
|
|
|
}
|
|
|
|
public Transferer localFile(String path){
|
|
|
|
}
|
|
|
|
public Transferer storageFileId(String fileId){
|
|
|
|
}
|
|
|
|
public Transferer fromURL(URL sourceURL){
|
|
|
|
}
|
|
|
|
|
|
public TransferResult transfer() throws SourceNotSetException, InvalidSourceException{
|
|
checkSource();
|
|
source.prepare();
|
|
TransferResult result=doTheTransfer();
|
|
source.clean();
|
|
return result;
|
|
}
|
|
|
|
|
|
protected void checkSource() throws SourceNotSetException, InvalidSourceException{
|
|
if(source==null) throw new SourceNotSetException();
|
|
source.validate();
|
|
}
|
|
|
|
protected abstract TransferResult doTheTransfer();
|
|
|
|
|
|
|
|
|
|
}
|