Class InstallerProxy
- java.lang.Object
-
- com.zerog.ia.api.pub.InstallerProxy
-
- All Implemented Interfaces:
I18NAccess,IAProxy,InstallerAccess,InstallerControl,ProgressAccess,ResourceAccess,ServiceAccess,VariableAccess
public class InstallerProxy extends java.lang.Object implements ResourceAccess, VariableAccess, I18NAccess, InstallerAccess, InstallerControl, ServiceAccess, IAProxy, ProgressAccess
InstallerProxy provides methods for classes extending
CustomCodeActionto access information in an InstallAnywhere installer, set status, control flow, and locate and access resources.An instance of
InstallerProxyis provided toCustomCodeActionsat install time.
-
-
Constructor Summary
Constructors Constructor Description InstallerProxy(com.zerog.ia.installer.Installer installer)InstallerProxy(com.zerog.ia.installer.Installer installer, ResourceAccess _ra, VariableAccess _va, I18NAccess _i18na, InstallerAccess _ia, InstallerControl _ic)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortInstallation(int exitCode)This method exits the installer.java.lang.StringdecryptEncryptedValue(java.lang.String var)This method returns the decrypted value if an numeric encrypted value is passedintgetCurrentProgressPercentage()This method returns the current percentage completed value for the progress bar as String Sets the percentage of the progress bar.java.lang.ObjectgetEncryptedVariable(java.lang.String var)This method returns the encrypted literal Object represented by an InstallAnywhere variablejava.io.DataOutputgetLogOutput()This method returns an instance that implements java.io.DataOutput.java.lang.StringgetLogOutputAsString()Returns theDataOutputas aString.java.net.URLgetResource(java.lang.String archivePath)This method provides a mechanism to access resources located in the installer or user archive.java.lang.ObjectgetService(java.lang.Class requestedServiceClass)This method provides access to InstallAnywhere installer servicesjava.io.FilegetTempDirectory()This method creates and returns a temporary directory.java.lang.StringgetValue(java.lang.String key)This method loads an i18n resource for the current default locale.java.lang.StringgetValue(java.lang.String key, java.util.Locale locale)This method loads an i18n resource for a specific locale.java.lang.ObjectgetVariable(java.lang.String var)This method returns the literal Object represented by an InstallAnywhere variablejava.util.EnumerationgetVariables()This method returns an enumeration containing the name of all variables defined in the installer or uninstaller.java.io.FilesaveURLContentToFile(java.net.URL url)This method is used to store the contents of the given java.net.URL to a temporary file.voidsetProgressAccess(ProgressAccess progressAccess)NOTE : This method is for InstallAnywhere internal use.voidsetProgressDescription(java.lang.String text)Sets the description that is shown during the action's execution.voidsetProgressPercentage(float percentage)Sets the percentage of the progress bar.voidsetProgressStatusText(java.lang.String text)Sets the status text associated with the action's current progress.voidsetProgressTitle(java.lang.String title)Sets the title of the panel showing the action's current progress.java.lang.ObjectsetVariable(java.lang.String var, java.lang.Object value)This method sets the named variable to the specified value.java.lang.Stringsubstitute(java.lang.String var)This method fully resolves a String that may contain embedded InstallAnywhere variables
-
-
-
Constructor Detail
-
InstallerProxy
public InstallerProxy(com.zerog.ia.installer.Installer installer)
-
InstallerProxy
public InstallerProxy(com.zerog.ia.installer.Installer installer, ResourceAccess _ra, VariableAccess _va, I18NAccess _i18na, InstallerAccess _ia, InstallerControl _ic)Constructor
Creates an instance of the InstallerProxy.
- Parameters:
_ra- Access to the designer-specified resources._va- Access to the runtime variables._i18na- Access to the international resources._ia- Access to a log file for storing information for use at uninstall._ic- Access to control the installer.
-
-
Method Detail
-
setProgressAccess
public void setProgressAccess(ProgressAccess progressAccess)
NOTE : This method is for InstallAnywhere internal use. Customer use is not recommended.This method provides a mechanism to set the current access object for interaction with the progress bar.
- Parameters:
progressAccess- The ProgressAccess instance to be utilized for interaction with the progress architecture.
-
getResource
public java.net.URL getResource(java.lang.String archivePath)
This method provides a mechanism to access resources located in the installer or user archive. Resources placed in the installer should be put into the DO NOT INSTALL magic folder.
- Specified by:
getResourcein interfaceIAProxy- Specified by:
getResourcein interfaceResourceAccess- Parameters:
archivePath- a forward-slash ('/') delimited path relative to the root of the archive. For example "com/acme/picture.gif". If the resource is put into the installer then the path is the absolute path. For example "C:\foo\bar\picture.gif". If the path contains a source path variable then that should also by put into the archive path (ie. "$IA_PROJECT_DIR$\foo\bar\test.txt")- Returns:
- an instance of java.net.URL that refers to a resource located in the installer archive.
-
getTempDirectory
public java.io.File getTempDirectory() throws java.io.IOExceptionThis method creates and returns a temporary directory.
InstallAnywhere will delete the temp directory and all of its contents at the completion of the installation.
- Specified by:
getTempDirectoryin interfaceIAProxy- Specified by:
getTempDirectoryin interfaceResourceAccess- Returns:
- an instance of java.io.File that rerepresents the temp directory created by InstallAnywhere.
- Throws:
java.io.IOException
-
substitute
public java.lang.String substitute(java.lang.String var)
This method fully resolves a String that may contain embedded InstallAnywhere variables
The String returned is guaranteed to resolve all InstallAnywhere variables embedded in the parameter passed to this method. Variables contained (embedded) within the String are fully and recursively resolved (i.e., they are resolved recursively). InstallAnywhere variables that are to be resolved are identified by their surrounding dollar signs ($). If no value has been set for a given variable name, that variable is resolved to the empty String.
For example, calling this method on the String:
"The files have been $PLACED$ in $USER_INSTALL_DIR$"
would return a String with $PLACED$ and $USER_INSTALL_DIR$ resolved to thetoString()values of the objects represented by the InstallAnywhere variables.This method is particularly useful for resolving file system paths represented by InstallAnywhere variables for Magic Folders and is the preferred mechanism for retrieving this type of data.
- Specified by:
substitutein interfaceIAProxy- Specified by:
substitutein interfaceVariableAccess- Parameters:
var- the String that is to be substituted (i.e., the String whose embedded InstallAnywhere variables are to be resolved).- Returns:
- a String representing the fully resolved contents of the String
varthat is passed to the method. - See Also:
getVariable(String),setVariable(String, Object)
-
saveURLContentToFile
public java.io.File saveURLContentToFile(java.net.URL url) throws java.io.IOExceptionThis method is used to store the contents of the given java.net.URL to a temporary file.
- Specified by:
saveURLContentToFilein interfaceIAProxy- Specified by:
saveURLContentToFilein interfaceResourceAccess- Parameters:
url- the java.net.URL whose contents are to be stored to a temporary file.- Returns:
- an instance of java.io.File that refers to the temporary file in which the contents of the URL have been stored.
- Throws:
java.io.IOException
-
getVariable
public java.lang.Object getVariable(java.lang.String var)
This method returns the literal Object represented by an InstallAnywhere variable
InstallAnywhere variables are identified by their surrounding dollar signs ($). If no value has been set for a given variable name, null is returned.
The
getVariable()method does not recursively resolve variables. If the intention is to get the String representation of a particular InstallAnywhere variable, thesubstitute()method is generally preferred.For example,
getVariable("$USER_INSTALL_DIR$")would return theMagicFolderobject for the current install location, whilesubstitute("$USER_INSTALL_DIR$")would return a String representing the absolute path to the current install location.- Specified by:
getVariablein interfaceIAProxy- Specified by:
getVariablein interfaceVariableAccess- Parameters:
var- the String that represents the name of the InstallAnywhere variable whose contents are to be retrieved.- Returns:
- the
Objectrepresenting contents of the named InstallAnywhere variable that is passed as a parameter to the method. - See Also:
substitute(String),setVariable(String, Object)
-
getVariables
public java.util.Enumeration getVariables()
This method returns an enumeration containing the name of all variables defined in the installer or uninstaller.
To get the literal Object represented by an InstallAnywhere variable use the
getVariable()method.- Specified by:
getVariablesin interfaceVariableAccess- Returns:
Enumerationwith the name of the variables.- See Also:
getVariable(String)
-
setVariable
public java.lang.Object setVariable(java.lang.String var, java.lang.Object value)This method sets the named variable to the specified value.
If the variable was already set, its previous value is returned. Otherwise, returns null.
- Specified by:
setVariablein interfaceIAProxy- Specified by:
setVariablein interfaceVariableAccess- Parameters:
var- TheStringrepresentation of the variable to be set.value- The value of the variable to be set.- Returns:
- The previous value of the variable, or
nullif the variable was not previously set.
-
getEncryptedVariable
public java.lang.Object getEncryptedVariable(java.lang.String var)
This method returns the encrypted literal Object represented by an InstallAnywhere variable
InstallAnywhere variables are identified by their surrounding dollar signs ($). If no value has been set for a given variable name, null is returned.
The
getVariable()method does not recursively resolve variables. If the intention is to get the String representation of a particular InstallAnywhere variable, thesubstitute()method is generally preferred.For example,
getVariable("$USER_INSTALL_DIR$")would return theMagicFolderobject for the current install location, whilesubstitute("$USER_INSTALL_DIR$")would return a String representing the absolute path to the current install location.- Specified by:
getEncryptedVariablein interfaceVariableAccess- Parameters:
var- the String that represents the name of the InstallAnywhere variable whose contents are to be retrieved.- Returns:
- the
Objectrepresenting contents of the named InstallAnywhere variable that is passed as a parameter to the method. - See Also:
substitute(String)
-
decryptEncryptedValue
public java.lang.String decryptEncryptedValue(java.lang.String var)
This method returns the decrypted value if an numeric encrypted value is passed
- Specified by:
decryptEncryptedValuein interfaceVariableAccess- Parameters:
var- the String that represents the numeric value of the encrypted value which has to be decrypted.- Returns:
- the
Stringrepresenting decrypted value.
-
getValue
public java.lang.String getValue(java.lang.String key, java.util.Locale locale)This method loads an i18n resource for a specific locale.
Gives access to locale-specific static UI strings. The resource is returned from the specified custom_
file. This is useful if you want to internationalize custom code. Localized resources should be placed in the custom_
files in the i18nresources directory in the resource directory of your InstallAnywhere installation ([InstallAnywhere]/resource/i18nresources/custom_[locale]) prior to building the installer in the InstallAnywhere designer. Resources are included in the locale files using Java properties file notation (i.e., a key/value combination delimited by an equals sign ('=') with no spaces between the key, value, and delimiter). Resources are then accessed during install time by specifying the desired key.
For example:
getValue("userpanel.imageresource", Locale.ENGLISH)
would retrieve the value of userpanel.imagesource from the custom_en locale file.- Specified by:
getValuein interfaceI18NAccess- Specified by:
getValuein interfaceIAProxy- Parameters:
key- the Key in the externalized property file for i18n.locale- the Locale from which property file to load value specified by the Key.- Returns:
- the value of the Key from the Locales property file.
-
getValue
public java.lang.String getValue(java.lang.String key)
This method loads an i18n resource for the current default locale.
Gives access to locale-specific static UI strings. The resource is returned from the custom_
file the installation locale. This is useful if you want to internationalize custom code. Localized resources should be placed in the custom_
files in the i18nresources directory in the resource directory of your InstallAnywhere installation ([InstallAnywhere]/resource/i18nresources/custom_[locale]) prior to building the installer in the InstallAnywhere designer. Resources are included in the locale files using Java properties file notation (i.e., a key/value combination delimited by an equals sign ('=') with no spaces between the key, value, and delimiter). Resources are then accessed during install time by specifying the desired key.
For example:
getValue("userpanel.imageresource")
would retrieve the value of userpanel.imagesource from locale file for the current installation locale.- Specified by:
getValuein interfaceI18NAccess- Specified by:
getValuein interfaceIAProxy- Parameters:
key- the Key in the externalized property file for i18n.- Returns:
- the value of the Key from the Locales property file.
-
getLogOutput
public java.io.DataOutput getLogOutput()
This method returns an instance that implements java.io.DataOutput.
Information written to the instance of java.io.DataOutput will be available at uninstall to the same custom code action via the java.io.DataInput object returned by the
getLogInput()method.ExecuteCustomCode's run as part of the Pre/Post Install sequences should not write to getLogOutput().
- Specified by:
getLogOutputin interfaceInstallerAccess- See Also:
DataOutput,UninstallerProxy.getLogInput()
-
getLogOutputAsString
public java.lang.String getLogOutputAsString()
Description copied from interface:InstallerAccessReturns theDataOutputas aString.- Specified by:
getLogOutputAsStringin interfaceInstallerAccess
-
abortInstallation
public void abortInstallation(int exitCode)
This method exits the installer.
This method never returns. Similar to calling System.exit(), except installer temporary files will be cleaned up and the installation log will be written to the user's hard drive if the installer has been set to generate a log.
- Specified by:
abortInstallationin interfaceInstallerControl- Parameters:
exitCode- the exit code to be returned by the installation process.
-
setProgressPercentage
public void setProgressPercentage(float percentage)
Sets the percentage of the progress bar.
NOTE: This feature is available at install/uninstall time only when the action overrides the getEstimatedTimeToInstall/getEstimatedTimeToUninstall methods respectively.
- Specified by:
setProgressPercentagein interfaceProgressAccess- Parameters:
percentage- The current percentage value for the progress bar
-
setProgressStatusText
public void setProgressStatusText(java.lang.String text)
Sets the status text associated with the action's current progress. This is shown above the progress bar in GUI mode.
NOTE: This feature is available at install/uninstall time only when the action overrides the getEstimatedTimeToInstall/getEstimatedTimeToUninstall methods respectively.
- Specified by:
setProgressStatusTextin interfaceProgressAccess- Parameters:
text- The status text to be associated with the progress
-
setProgressTitle
public void setProgressTitle(java.lang.String title)
Sets the title of the panel showing the action's current progress. e.g. The "Please, wait" panel that can be optionally shown when a custom action is occurring.
NOTE: This feature is available at install/uninstall time only when the action overrides the getEstimatedTimeToInstall/getEstimatedTimeToUninstall methods respectively.
NOTE: This progress title is only utilized when the action is operating outside of the install sequence (e.g. it would operate within the pre-install sequence, etc.). Within the install sequence, use of this method is allowed, but ignored.
- Specified by:
setProgressTitlein interfaceProgressAccess- Parameters:
title- The title of the panel showing the progress
-
setProgressDescription
public void setProgressDescription(java.lang.String text)
Sets the description that is shown during the action's execution. e.g. This is the main text in the "Please, wait" panel that can be optionally shown when a custom action is occurring.
NOTE: This feature is available at install/uninstall time only when the action overrides the getEstimatedTimeToInstall/getEstimatedTimeToUninstall methods respectively.
NOTE: This progress description is only utilized when the action is operating outside of the install sequence (e.g. it would operate within the pre-install sequence, etc.). Within the install sequence, use of this method is allowed, but ignored.
- Specified by:
setProgressDescriptionin interfaceProgressAccess- Parameters:
text- The description text of the panel showing the progress
-
getService
public java.lang.Object getService(java.lang.Class requestedServiceClass)
This method provides access to InstallAnywhere installer services
The Object returned by this method must be cast to the requested service. The returned Object, if the service is available, is guaranteed to implement
requestedServiceClass.- Specified by:
getServicein interfaceIAProxy- Specified by:
getServicein interfaceServiceAccess- Parameters:
requestedServiceClass- a class representing the the interface of the service requested.- Returns:
- an instance of the requested service.
The extensions currently available are:
- See Also:
SimpleRegistryManager,InstallerResources,CustomError,ReplayVariableService
-
getCurrentProgressPercentage
public int getCurrentProgressPercentage()
This method returns the current percentage completed value for the progress bar as String Sets the percentage of the progress bar.
- Specified by:
getCurrentProgressPercentagein interfaceIAProxy- Returns:
- percentageDone The current percentage completed value for the progress bar
-
-