install4j API documentation


com.install4j.api
Class InstallationHandler

java.lang.Object
  extended by com.install4j.api.InstallationHandler

public abstract class InstallationHandler
extends java.lang.Object

If you define an installation handler derived from this class on the "Advanced tasks" tab in the install4j GUI it will be instantiated and queried before the installation of each file. With this handler, you can achive a fine-grained customization of the installation process or install files in the distribution tree to different directories than the installation directory without using custom install actions.

Author:
ej-technologies GmbH

Constructor Summary
InstallationHandler()
           
 
Method Summary
abstract  java.io.File getInstallationDirectory(java.io.File defaultInstallationDirectory, java.io.File file)
          Will be queried for each file in the distribution tree that is about to be installed.
 InstallerContext getInstallerContext()
          Returns the InstallerContext that the framework has associated with this handler in setInstallerContext.
 void setInstallerContext(InstallerContext context)
          This method is called by the framework to set the InstallerContext.
abstract  boolean shouldInstall(java.io.File file)
          Will be queried for each file in the distribution tree that is about to be installed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstallationHandler

public InstallationHandler()
Method Detail

getInstallerContext

public InstallerContext getInstallerContext()
Returns the InstallerContext that the framework has associated with this handler in setInstallerContext. For the GUI wizard, this context will be a InstallerWizardContext.

Returns:
the context.

setInstallerContext

public void setInstallerContext(InstallerContext context)
This method is called by the framework to set the InstallerContext. This is the context that is returned from getInstallerContext. If you have to register an InstallerEventListener on the context you can override this method. Do not forget to call the super implementation in that case.

Parameters:
context - the context.

shouldInstall

public abstract boolean shouldInstall(java.io.File file)
Will be queried for each file in the distribution tree that is about to be installed. If you return true the file will be installed, if you return false, the file will not be installed.

Parameters:
file - the file that is about to be installed. This file is relative to the installation root directory, it is not an absolute file.
Returns:
whether to install or not.

getInstallationDirectory

public abstract java.io.File getInstallationDirectory(java.io.File defaultInstallationDirectory,
                                                      java.io.File file)
Will be queried for each file in the distribution tree that is about to be installed. You can return a different installation root directory for each file. Note: The directory structure in the file argument (which is a relative file) will still be append to the return value.

Parameters:
defaultInstallationDirectory - the default installation root directory.
file - the file that is about to be installed. This file is relative to the installation root directory, it is not an absolute file.
Returns:
the new installation root directory. If you do not want to substitute anything, just return defaultInstallationDirectory.