Class AbstractFetcher
java.lang.Object
ubic.gemma.core.loader.util.fetcher.AbstractFetcher
- All Implemented Interfaces:
Fetcher
- Direct Known Subclasses:
FtpFetcher, HttpFetcher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether 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 booleanWhether download is required even if the sizes match.protected static final intprotected Stringprotected static final org.apache.commons.logging.Logprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FilefetchedFile(String seekFile) protected FilefetchedFile(String seekFilePath, String outputFilePath) protected abstract StringformLocalFilePath(String identifier, File newDir) protected abstract StringformRemoteFilePath(String identifier) protected Collection<File> getExistingFile(File existingFile, String seekFile) Wrap the existing file in the required Collection<LocalFile>protected abstract voidbooleanisForce()protected Filemkdir()Like mkdir(accession) but for cases where there is no accession.protected FileCreate a directory according to the current accession number and set path information, including any non-existing parent directories.voidsetAllowUseExisting(boolean allowUseExisting) voidsetForce(boolean force) Set to true if downloads should proceed even if the file already exists.voidsetLocalBasePath(String localBasePath) Set the local directory where fetched files will be written.protected booleanwaitForDownload(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.
-
setLocalBasePath
Set the local directory where fetched files will be written. Callers (typically Spring-managed CLIs or services) source this from@Value("${gemma.download.path}")or an equivalent injection so the fetcher itself doesn't depend on a static configuration class. -
isForce
public boolean isForce()- Returns:
- the force
-
setForce
-
setAllowUseExisting
public void setAllowUseExisting(boolean allowUseExisting) - Parameters:
allowUseExisting- the allowUseExisting to set
-
fetchedFile
-
fetchedFile
-
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
-