Class AbstractFetcher
- java.lang.Object
-
- ubic.gemma.core.loader.util.fetcher.AbstractFetcher
-
- All Implemented Interfaces:
Fetcher
- Direct Known Subclasses:
FtpFetcher
,HttpFetcher
public abstract class AbstractFetcher extends Object implements Fetcher
- Author:
- pavlidis
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
allowUseExisting
Whether we are allowed to use an existing file rather than downloading again, in the case where we can't connect to the remote host to check the size of the file.protected boolean
force
Whether download is required even if the sizes match.protected static int
INFO_UPDATE_INTERVAL
protected String
localBasePath
protected static org.apache.commons.logging.Log
log
protected String
remoteBaseDir
-
Constructor Summary
Constructors Constructor Description AbstractFetcher()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected LocalFile
fetchedFile(String seekFile)
protected LocalFile
fetchedFile(String seekFilePath, String outputFilePath)
protected abstract String
formLocalFilePath(String identifier, File newDir)
protected abstract String
formRemoteFilePath(String identifier)
protected Collection<LocalFile>
getExistingFile(File existingFile, String seekFile)
Wrap the existing file in the required Collection<LocalFile>String
getLocalBasePath()
protected abstract void
initConfig()
boolean
isForce()
protected File
mkdir()
Like mkdir(accession) but for cases where there is no accession.protected File
mkdir(String accession)
Create a directory according to the current accession number and set path information, including any non-existing parent directories.void
setAllowUseExisting(boolean allowUseExisting)
void
setForce(boolean force)
Set to true if downloads should proceed even if the file already exists.protected boolean
waitForDownload(Future<Boolean> future, long expectedSize, File outputFile)
-
-
-
Field Detail
-
INFO_UPDATE_INTERVAL
protected static final int INFO_UPDATE_INTERVAL
- See Also:
- Constant Field Values
-
log
protected static final org.apache.commons.logging.Log log
-
allowUseExisting
protected boolean allowUseExisting
Whether we are allowed to use an existing file rather than downloading again, in the case where we can't connect to the remote host to check the size of the file. Setting force=true overrides this. Default is FALSE.
-
force
protected boolean force
Whether download is required even if the sizes match.
-
localBasePath
protected String localBasePath
-
remoteBaseDir
protected String remoteBaseDir
-
-
Method Detail
-
getLocalBasePath
public String getLocalBasePath()
- Returns:
- Returns the localBasePath.
-
isForce
public boolean isForce()
- Returns:
- the force
-
setForce
public void setForce(boolean force)
Set to true if downloads should proceed even if the file already exists.
-
setAllowUseExisting
public void setAllowUseExisting(boolean allowUseExisting)
- Parameters:
allowUseExisting
- the allowUseExisting to set
-
fetchedFile
protected LocalFile fetchedFile(String seekFilePath, String outputFilePath)
- Parameters:
seekFilePath
- Absolute path to the file for downloadoutputFilePath
- Absolute path to the download location.- Returns:
- local file
-
getExistingFile
protected Collection<LocalFile> getExistingFile(File existingFile, String seekFile)
Wrap the existing file in the required Collection<LocalFile>- Parameters:
existingFile
- existing fileseekFile
- seek file- Returns:
- collection of local files
-
initConfig
protected abstract void initConfig()
-
mkdir
protected File mkdir() throws IOException
Like mkdir(accession) but for cases where there is no accession.- Returns:
- file
- Throws:
IOException
- when there are IO problems.
-
mkdir
protected File mkdir(String accession) throws IOException
Create a directory according to the current accession number and set path information, including any non-existing parent directories. If the path cannot be used, we use a temporary directory.- Parameters:
accession
- accession- Returns:
- new directory
- Throws:
IOException
- if there is a problem while manipulating the file
-
-