Class AbstractFetcher
java.lang.Object
ubic.gemma.core.loader.util.fetcher.AbstractFetcher
- All Implemented Interfaces:
Fetcher
- Direct Known Subclasses:
FtpFetcher
,HttpFetcher
- Author:
- pavlidis
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
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
Whether download is required even if the sizes match.protected static final int
protected String
protected static final org.apache.commons.logging.Log
protected String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected File
fetchedFile
(String seekFile) protected File
fetchedFile
(String seekFilePath, String outputFilePath) protected abstract String
formLocalFilePath
(String identifier, File newDir) protected abstract String
formRemoteFilePath
(String identifier) protected Collection
<File> getExistingFile
(File existingFile, String seekFile) Wrap the existing file in the required Collection<LocalFile>protected abstract void
boolean
isForce()
protected File
mkdir()
Like mkdir(accession) but for cases where there is no accession.protected File
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 Details
-
INFO_UPDATE_INTERVAL
protected static final int INFO_UPDATE_INTERVAL- See Also:
-
log
protected static final org.apache.commons.logging.Log log -
allowUseExisting
protected boolean allowUseExistingWhether 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 forceWhether download is required even if the sizes match. -
localBasePath
-
remoteBaseDir
-
-
Constructor Details
-
AbstractFetcher
public AbstractFetcher()
-
-
Method Details
-
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
-
fetchedFile
- Parameters:
seekFilePath
- Absolute path to the file for downloadoutputFilePath
- Absolute path to the download location.- Returns:
- local file
-
formLocalFilePath
-
formRemoteFilePath
-
getExistingFile
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
Like mkdir(accession) but for cases where there is no accession.- Returns:
- file
- Throws:
IOException
- when there are IO problems.
-
mkdir
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
-
waitForDownload
- Parameters:
future
- future taskexpectedSize
- expected sizeoutputFile
- output file- Returns:
- true if it finished normally, false if it was cancelled.
-