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 void
doDownload()
Perform the actual HTTP download.void
download()
Downloads the compressed file containing the container files.String
getDownloadDir()
String
getDownloadFile()
String
getExtractDir()
FileHandler
getFileHandler()
String
getHome()
protected String
getSourceFileName()
void
install()
Installs the container.boolean
isAlreadyDownloaded()
boolean
isAlreadyExtracted()
void
registerInstallation()
Create timestamp file to register that the installation has been successful.void
setDownloadDir(String downloadDir)
void
setExtractDir(String extractDir)
void
setFileHandler(FileHandler fileHandler)
void
setLogger(Logger logger)
Overriden in order to set the logger on ancillary components.void
setProxy(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:
setLogger
in interfaceLoggable
- Overrides:
setLogger
in 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:Installer
Installs the container.- Specified by:
install
in 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 IOException
Perform 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
-
-