org.codehaus.cargo.container.installer
Class ZipURLInstaller

java.lang.Object
  extended byorg.codehaus.cargo.util.log.LoggedObject
      extended byorg.codehaus.cargo.container.installer.ZipURLInstaller
All Implemented Interfaces:
Installer, org.codehaus.cargo.util.log.Loggable

public class ZipURLInstaller
extends org.codehaus.cargo.util.log.LoggedObject
implements Installer

Installs a zipped container file from a URL to a location on your local disk.

Version:
$Id: ZipURLInstaller.java 1258 2007-01-01 22:04:45Z vmassol $

Constructor Summary
ZipURLInstaller(java.net.URL remoteLocation)
           
ZipURLInstaller(java.net.URL remoteLocation, java.lang.String installDir)
           
 
Method Summary
protected  void download()
          Downloads the zip file containing the container files.
protected  java.lang.String getDestinationDir()
           
 org.codehaus.cargo.util.FileHandler getFileHandler()
           
 java.lang.String getHome()
          
protected  java.lang.String getInstallDirName()
           
protected  java.lang.String getSourceFileName()
           
 void install()
          Installs the container.
 boolean isAlreadyInstalled()
           
 void registerInstallation()
          Create timestamp file to register that the installation has been successful.
protected  void setAntTaskFactory(org.codehaus.cargo.util.AntTaskFactory antTaskFactory)
          Convenience method used for testing in isolation.
 void setFileHandler(org.codehaus.cargo.util.FileHandler fileHandler)
           
 void setInstallDir(java.lang.String installDir)
           
 void setProxy(Proxy proxy)
          Sets proxy details.
 
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.cargo.util.log.Loggable
getLogger, setLogger
 

Constructor Detail

ZipURLInstaller

public ZipURLInstaller(java.net.URL remoteLocation)
Parameters:
remoteLocation - URL where the zipped container is located

ZipURLInstaller

public ZipURLInstaller(java.net.URL remoteLocation,
                       java.lang.String installDir)
Parameters:
remoteLocation - URL where the zipped container is located
installDir - directory where we will unpack the zip container file
Method Detail

setInstallDir

public void setInstallDir(java.lang.String installDir)
Parameters:
installDir - the destination directory where the zipped container install will be downloaded and installed.

setAntTaskFactory

protected void setAntTaskFactory(org.codehaus.cargo.util.AntTaskFactory antTaskFactory)
Convenience method used for testing in isolation. Test cases can use it for introducing a custom AntTaskFactory that returns a custom test-made Ant task.

Parameters:
antTaskFactory - the test-provided AntTaskFactory

getFileHandler

public org.codehaus.cargo.util.FileHandler getFileHandler()
Returns:
the file utility class to use for performing all file I/O.

setFileHandler

public void setFileHandler(org.codehaus.cargo.util.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 interface Installer
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.


isAlreadyInstalled

public boolean isAlreadyInstalled()
Returns:
true if the container has already been installed, false otherwise

getHome

public java.lang.String getHome()

Specified by:
getHome in interface Installer
Returns:
the directory where the container has been installed. Note that we're returning a String instead of a File because we want to leave the possibility of using URIs for specifying the home location.
See Also:
Installer.getHome()

download

protected void download()
Downloads the zip file containing the container files.


getSourceFileName

protected java.lang.String getSourceFileName()
Returns:
the name of the source zip file (without the path)

getInstallDirName

protected java.lang.String getInstallDirName()
Returns:
the directory where we will unpack the zip container file

getDestinationDir

protected java.lang.String getDestinationDir()
Returns:
the directory where we will puth both the zip container file and its unpacking

setProxy

public void setProxy(Proxy proxy)
Sets proxy details.

Parameters:
proxy - the proxy configuration to set


Copyright © 2004-2007 Codehaus. All Rights Reserved.