com.izforge.izpack.installer
Class InstallerBase

java.lang.Object
  extended by com.izforge.izpack.installer.InstallerBase
Direct Known Subclasses:
AutomatedInstaller, ConsoleInstaller, GUIInstaller

public class InstallerBase
extends java.lang.Object

Common utility functions for the GUI and text installers. (Do not import swing/awt classes to this class.)

Author:
Jonathan Halliday, Julien Ponge

Field Summary
private static java.lang.String CONDITIONS_SPECRESOURCENAME
          Resource name of the conditions specification
private  java.util.Map<java.lang.String,java.util.List<DynamicVariable>> dynamicvariables
           
private  java.util.List<InstallerRequirement> installerrequirements
           
protected static java.lang.String LANG_FILE_NAME
          The base name of the XML file that specifies the custom langpack.
private  RulesEngine rules
           
 
Constructor Summary
InstallerBase()
           
 
Method Summary
protected  void addCustomLangpack(AutomatedInstallData idata)
          Add the contents of a custom langpack (if exist) to the previos loaded comman langpack.
private  java.lang.String buildWindowsDefaultPath()
          Get the default path for Windows (i.e Program Files/...).
private  java.lang.String buildWindowsDefaultPathFromProps()
          just plain wrong in case the programfiles are not stored where the developer expects them.
private  void checkForPrivilegedExecution(Info info)
           
 boolean checkInstallerRequirements(AutomatedInstallData installdata)
           
 java.util.List<java.lang.String> getAvailableLangPacks()
          Returns an ArrayList of the available langpacks ISO3 codes.
 java.io.InputStream getResource(java.lang.String res)
          Gets the stream to a resource.
 RulesEngine getRules()
           
protected  void loadConditions(AutomatedInstallData installdata)
          Reads the conditions specification file and initializes the rules engine.
private  void loadCustomData(AutomatedInstallData installdata)
          Loads custom data like listener and lib references if exist and fills the installdata.
protected  void loadDynamicVariables()
          Loads Dynamic Variables.
 void loadInstallData(AutomatedInstallData installdata)
          Loads the installation data.
 void loadInstallerRequirements()
          Load installer conditions
protected  void refreshDynamicVariables(VariableSubstitutor substitutor, AutomatedInstallData installdata)
          Refreshes Dynamic Variables.
protected  void showMissingRequirementMessage(java.lang.String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONDITIONS_SPECRESOURCENAME

private static final java.lang.String CONDITIONS_SPECRESOURCENAME
Resource name of the conditions specification

See Also:
Constant Field Values

rules

private RulesEngine rules

installerrequirements

private java.util.List<InstallerRequirement> installerrequirements

dynamicvariables

private java.util.Map<java.lang.String,java.util.List<DynamicVariable>> dynamicvariables

LANG_FILE_NAME

protected static final java.lang.String LANG_FILE_NAME
The base name of the XML file that specifies the custom langpack. Searched is for the file with the name expanded by _ISO3.

See Also:
Constant Field Values
Constructor Detail

InstallerBase

public InstallerBase()
Method Detail

getAvailableLangPacks

public java.util.List<java.lang.String> getAvailableLangPacks()
                                                       throws java.lang.Exception
Returns an ArrayList of the available langpacks ISO3 codes.

Returns:
The available langpacks list.
Throws:
java.lang.Exception - Description of the Exception

getRules

public RulesEngine getRules()

loadInstallData

public void loadInstallData(AutomatedInstallData installdata)
                     throws java.lang.Exception
Loads the installation data. Also sets environment variables to installdata. All system properties are available as $SYSTEM_ where is the actual name _BUT_ with all separators replaced by '_'. Properties with null values are never stored. Example: $SYSTEM_java_version or $SYSTEM_os_name

Parameters:
installdata - Where to store the installation data.
Throws:
java.lang.Exception - Description of the Exception

checkForPrivilegedExecution

private void checkForPrivilegedExecution(Info info)

addCustomLangpack

protected void addCustomLangpack(AutomatedInstallData idata)
Add the contents of a custom langpack (if exist) to the previos loaded comman langpack. If not exist, trace an info and do nothing more.

Parameters:
idata - install data to be used

buildWindowsDefaultPath

private java.lang.String buildWindowsDefaultPath()
Get the default path for Windows (i.e Program Files/...). Windows has a Setting for this in the environment and in the registry. Just try to use the setting in the environment. If it fails for whatever reason, we take the former solution (buildWindowsDefaultPathFromProps).

Returns:
The Windows default installation path for applications.

buildWindowsDefaultPathFromProps

private java.lang.String buildWindowsDefaultPathFromProps()
just plain wrong in case the programfiles are not stored where the developer expects them. E.g. in custom installations of large companies or if used internationalized version of windows with a language pack.

Returns:
the program files path

loadCustomData

private void loadCustomData(AutomatedInstallData installdata)
                     throws java.lang.Exception
Loads custom data like listener and lib references if exist and fills the installdata.

Parameters:
installdata - installdata into which the custom action data should be stored
Throws:
java.lang.Exception

loadConditions

protected void loadConditions(AutomatedInstallData installdata)
Reads the conditions specification file and initializes the rules engine.


loadDynamicVariables

protected void loadDynamicVariables()
Loads Dynamic Variables.


loadInstallerRequirements

public void loadInstallerRequirements()
                               throws java.lang.Exception
Load installer conditions

Throws:
java.lang.Exception

checkInstallerRequirements

public boolean checkInstallerRequirements(AutomatedInstallData installdata)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

showMissingRequirementMessage

protected void showMissingRequirementMessage(java.lang.String message)

getResource

public java.io.InputStream getResource(java.lang.String res)
                                throws java.lang.Exception
Gets the stream to a resource.

Parameters:
res - The resource id.
Returns:
The resource value, null if not found
Throws:
java.lang.Exception

refreshDynamicVariables

protected void refreshDynamicVariables(VariableSubstitutor substitutor,
                                       AutomatedInstallData installdata)
Refreshes Dynamic Variables.