Class ZipURLInstaller
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.container.installer.ZipURLInstaller
-
public class ZipURLInstaller extends LoggedObject implements Installer
Installs a compressed container file from a URL to a location on your local disk.
Though the name of this class isZipURLInstaller, all formats supported by commons-compress are supported.
-
-
Constructor Summary
Constructors Constructor Description ZipURLInstaller(URL remoteLocation)ZipURLInstaller(URL remoteLocation, String downloadDir, String extractDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoDownload()Perform the actual HTTP download.voiddownload()Downloads the compressed file containing the container files.StringgetDownloadDir()StringgetDownloadFile()StringgetExtractDir()FileHandlergetFileHandler()StringgetHome()protected StringgetSourceFileName()voidinstall()Installs the container.booleanisAlreadyDownloaded()booleanisAlreadyExtracted()voidregisterInstallation()Create timestamp file to register that the installation has been successful.voidsetDownloadDir(String downloadDir)voidsetExtractDir(String extractDir)voidsetFileHandler(FileHandler fileHandler)voidsetLogger(Logger logger)Overriden in order to set the logger on ancillary components.voidsetProxy(Proxy proxy)Sets proxy details.-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger
-
-
-
-
Constructor Detail
-
ZipURLInstaller
public ZipURLInstaller(URL remoteLocation)
- Parameters:
remoteLocation- URL where the compressed container is located
-
ZipURLInstaller
public ZipURLInstaller(URL remoteLocation, String downloadDir, String extractDir)
- Parameters:
remoteLocation- URL where the compressed container is locateddownloadDir- directory where the compressed container install will be downloaded.extractDir- directory where the compressed container install will be extracted.
-
-
Method Detail
-
setLogger
public void setLogger(Logger logger)
Overriden in order to set the logger on ancillary components.- Specified by:
setLoggerin interfaceLoggable- Overrides:
setLoggerin classLoggedObject- Parameters:
logger- the logger to set and set in the ancillary objects
-
setDownloadDir
public void setDownloadDir(String downloadDir)
- Parameters:
downloadDir- the destination directory where the compressed container install will be downloaded.
-
setExtractDir
public void setExtractDir(String extractDir)
- Parameters:
extractDir- the destination directory where the compressed container install will be installed.
-
getDownloadDir
public String getDownloadDir()
- Returns:
- The destination directory where the compressed container install will be downloaded.
-
getDownloadFile
public String getDownloadFile()
- Returns:
- The destination file where the compressed container install will be downloaded.
-
getExtractDir
public String getExtractDir()
- Returns:
- The destination directory where the compressed container install will be extracted.
-
getFileHandler
public FileHandler getFileHandler()
- Returns:
- the file utility class to use for performing all file I/O.
-
setFileHandler
public void setFileHandler(FileHandler fileHandler)
- Parameters:
fileHandler- the file utility class to use for performing all file I/O.
-
install
public void install()
Description copied from interface:InstallerInstalls the container.- Specified by:
installin interfaceInstaller- See Also:
Installer.install()
-
registerInstallation
public void registerInstallation()
Create timestamp file to register that the installation has been successful. This allows to prevent installing again next time. If the remote URL changes, then the container will be reinstalled.
-
isAlreadyDownloaded
public boolean isAlreadyDownloaded()
- Returns:
- true if the container has already been downloaded, false otherwise
-
isAlreadyExtracted
public boolean isAlreadyExtracted()
- Returns:
- true if the container has already been extracted, false otherwise
-
getHome
public String getHome()
-
download
public void download()
Downloads the compressed file containing the container files.
-
doDownload
protected void doDownload() throws IOExceptionPerform the actual HTTP download.- Throws:
IOException- if any I/O exception occurs (with the URL connection or file streams)
-
getSourceFileName
protected String getSourceFileName()
- Returns:
- the name of the source compressed file (without the path)
-
setProxy
public void setProxy(Proxy proxy)
Sets proxy details.- Parameters:
proxy- the proxy configuration to set
-
-