public abstract class InstallerImpl extends java.lang.Object implements InstallerInterface
Modifier and Type | Class and Description |
---|---|
protected static class |
InstallerImpl.BIT_OPTION |
protected static class |
InstallerImpl.VERSION_OPTION |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARG_DEBUG
-debug if in debug mode
|
static java.lang.String |
ARG_INSTALLDIR
-installdir
optional command-line argument to explicitly set the installation directory for an installer. Ex: -installdir "C:\SAFS" (for SAFS proper) Ex: -installdir "C:\SeleniumPlus" (for SeleniumPlus proper) Ex: -installdir "C:\SeleniumPlus\extra\automation" (for SeleniumPlus OCR, etc.) |
static java.lang.String |
ARG_SAFS_DIR
-safs
Ex: -safs "C:\SAFS" (for SAFS product)
Ex: -safs "C:\SeleniumPlus" (for SeleniumPlus product) |
static java.lang.String |
ARG_SILENT
-silent if in silent mode
|
static java.lang.String |
ARG_UNINSTALL
-u
command-line argument to signal an uninstall invocation. |
static java.lang.String |
ARG_VERBOSE
-v if in verbose mode, more details will be output
|
protected boolean |
debug
if installation is in debug more, default is false.
|
static java.lang.String |
DIR_BIN
bin the sub directory holds executable
|
static java.lang.String |
DIR_INSTALL
install the sub directory where to find the install stuffs, such as installer executable file
|
static java.lang.String |
DIR_SAFS_HOME_DEFAULT
c:\safs the directory holds the SAFS product
|
protected java.lang.String |
home
The home directory where this product will be installed.
It may be the same as safsHome if we are installing SAFS or SeleniumPlus. |
protected static java.lang.String |
PARAM_SWITCH |
protected static java.lang.String |
PARAM_USE_LATEST_VERSION |
protected IProductDetector |
productDetector
The ProductDetector.
|
(package private) static ProgressIndicator |
progresser |
static java.lang.String |
REGSVR32 |
protected static java.lang.String |
rootdir |
static java.lang.String |
s |
protected java.lang.String |
safsHome
The full path to the SAFS or SeleniumPlus, which provides the installer for other tools.
We don't use this field as the installation directory to install SAFS or SeleniumPlus, we use home .It is only used to find install asserts (for other tools, products needed by SAFS/SeleniumPlus) provided by SAFS or SeleniumPlus. |
protected boolean |
silent
if installation is in silent more, default is true.
|
static java.lang.String |
SYSTEM32 |
static java.lang.String |
SYSWOW64 |
protected boolean |
verbose
if installation is in verbose more, default is false.
|
Constructor and Description |
---|
InstallerImpl()
Default no-arg constructor.
|
InstallerImpl(java.lang.String _installDir)
Preset the installation directory so it does not need to be deduced.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
appendSystemEnvironment(java.lang.String varname,
java.lang.String append,
java.lang.String sep)
Append a value to an existing Environment variable (CLASSPATH, PATH, etc..)
This adds the value at the end of any existing value. |
protected java.lang.String |
findInstaller(java.lang.String executable) |
java.lang.String |
getDefaultHome() |
protected IProductDetector |
getDefaultProductDetector() |
static java.lang.String |
getEnvValue(java.lang.String key)
Return a System Environment String value.
|
java.lang.String |
getHome()
The home directory where this product will be installed.
|
protected java.lang.String |
getInstallationRoot()
Subclasses use this to determine what is the root directory of the current
install/uninstall that is in-progress.
|
protected java.lang.String |
getInstallerDir() |
protected java.lang.String |
getProductName() |
static java.lang.String |
getRegistryValue(java.lang.String key,
java.lang.String valuename)
Gets the (Windows) registry value, or null if it doesn't exist.
|
java.lang.String |
getSafsHome() |
protected IProductDetector |
getUnixProductDetector() |
protected IProductDetector |
getWindowsProductDetector() |
static boolean |
hasRegistryEntry(java.lang.String key,
java.lang.String valuename)
True if the requested "registry key" already exists, false otherwise.
This is currently only supported on Windows. |
protected static void |
increaseProgress(int increase) |
protected void |
initilizeProductDetector()
Initialize the IProdcutDetector object according to the Operation System.
A ProductDetectorDefault will be returned if the OS is not Windows or UNIX/LINUX. |
static java.lang.String |
prependSystemEnvironment(java.lang.String varname,
java.lang.String prepend,
java.lang.String sep)
Prepend a value to an existing Environment variable (CLASSPATH, PATH, etc..)
This puts the value at the beginning of any existing value. |
static java.lang.String |
removeSystemEnvironmentSubstring(java.lang.String varname,
java.lang.String substring,
java.lang.String sep)
Remove a substring from an existing Environment variable (CLASSPATH, PATH, etc..)
|
static java.lang.String |
removeSystemEnvironmentSubstringContaining(java.lang.String varname,
java.lang.String substring,
java.lang.String sep)
Remove a string entry from an existing Environment variable (CLASSPATH, PATH, etc..)
In this method, we attempt to do a partial match on an entry between separators to locate the item to remove from the variable. |
void |
setEnvironment(java.lang.String key,
java.lang.String value)
A convenient method to set/clear an environment.
It will also write success/failure message to progresser . |
static boolean |
setEnvValue(java.lang.String key,
java.lang.String value)
Set a System Environment value.
|
void |
setHome(java.lang.String home) |
protected static void |
setProgress(int percent) |
static void |
setProgressIndicator(ProgressIndicator _progresser) |
protected static void |
setProgressMessage(java.lang.String message) |
protected static void |
setProgressMessage(java.lang.String message,
int logLevel) |
static boolean |
setRegistryValue(java.lang.String key,
java.lang.String valuename,
java.lang.String value) |
void |
setSafsHome(java.lang.String safsHome) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
install, uninstall
static ProgressIndicator progresser
public static final java.lang.String s
public static final java.lang.String SYSTEM32
public static final java.lang.String SYSWOW64
public static final java.lang.String REGSVR32
protected static final java.lang.String PARAM_USE_LATEST_VERSION
protected static final java.lang.String PARAM_SWITCH
public static final java.lang.String DIR_INSTALL
public static final java.lang.String DIR_BIN
public static final java.lang.String DIR_SAFS_HOME_DEFAULT
protected boolean verbose
protected boolean silent
protected boolean debug
protected java.lang.String safsHome
home
.protected java.lang.String home
safsHome
if we are installing SAFS or SeleniumPlus.protected IProductDetector productDetector
initilizeProductDetector()
public static final java.lang.String ARG_INSTALLDIR
public static final java.lang.String ARG_UNINSTALL
public static final java.lang.String ARG_SAFS_DIR
public static final java.lang.String ARG_DEBUG
public static final java.lang.String ARG_SILENT
public static final java.lang.String ARG_VERBOSE
protected static java.lang.String rootdir
public InstallerImpl()
public InstallerImpl(java.lang.String _installDir)
protected java.lang.String getProductName()
public java.lang.String getSafsHome()
public void setSafsHome(java.lang.String safsHome)
safsHome
- String, The full path to the SAFS or SeleniumPlus, which provides the installer for other toolspublic java.lang.String getHome()
public void setHome(java.lang.String home)
home
- String, The home directory where this product will be installed.public java.lang.String getDefaultHome()
protected java.lang.String getInstallerDir()
protected java.lang.String findInstaller(java.lang.String executable) throws java.io.FileNotFoundException
executable
- String, the installer executable file namejava.io.FileNotFoundException
protected java.lang.String getInstallationRoot()
Needs to be enhanced to temporarily flag what is in-progress, versus what might already exist as deduced from the normal SAFSDIREnv or SELENIUMDIREnv.
protected void initilizeProductDetector() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
protected IProductDetector getWindowsProductDetector() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
protected IProductDetector getUnixProductDetector() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
protected IProductDetector getDefaultProductDetector()
ProductDetectorDefault
public static void setProgressIndicator(ProgressIndicator _progresser)
protected static void setProgress(int percent)
protected static void increaseProgress(int increase)
protected static void setProgressMessage(java.lang.String message)
protected static void setProgressMessage(java.lang.String message, int logLevel)
public static java.lang.String getEnvValue(java.lang.String key)
Note: Environment variables set or changed after JVM start are NOT available to the currently running JVM through System.getEnv(). This is because the JVM does not refresh its Environment variable space after launch. Use this routine to get the latest "refreshed" value of any System Environment Variable.
key
- Environment variable value to retrieve.public static boolean setEnvValue(java.lang.String key, java.lang.String value)
Note: Environment variables set or changed after JVM start are NOT available to the currently running JVM through System.getEnv(). This is because the JVM does not refresh its Environment variable space after launch. Use getEnvValue to get the latest "refreshed" value of any System Environment Variable.
key
- name of variable to setvalue
- to be set. Null will remove the variable.NativeWrapper.SetSystemEnvironmentVariable(Object, Object)
,
getEnvValue(String)
public void setEnvironment(java.lang.String key, java.lang.String value)
progresser
.key
- name of variable to setvalue
- to be set. Null will remove the variable.setEnvValue(String, String)
public static java.lang.String appendSystemEnvironment(java.lang.String varname, java.lang.String append, java.lang.String sep)
varname
- -- name of Environment variable to modify. cannot be null.append
- -- the value to add if it is not already present. cannot be null.sep
- - optional separator to use between appends. if null, File.pathSeparator is used.
Can also be an empty string to indicate no separator should be used.public static java.lang.String prependSystemEnvironment(java.lang.String varname, java.lang.String prepend, java.lang.String sep)
varname
- -- name of Environment variable to modify. cannot be null.prepend
- -- the value to prepend if it is not already present. cannot be null.sep
- - optional separator to use between values. if null, File.pathSeparator is used.
Can also be an empty string to indicate no separator should be used.public static java.lang.String removeSystemEnvironmentSubstring(java.lang.String varname, java.lang.String substring, java.lang.String sep)
varname
- -- name of Environment variable to modify. cannot be null.substring
- -- the value to remove if it is present. cannot be null.sep
- - optional separator found between values. if null, File.pathSeparator is assumed.
Can also be an empty string to indicate no separator should be considered.public static java.lang.String removeSystemEnvironmentSubstringContaining(java.lang.String varname, java.lang.String substring, java.lang.String sep)
Ex: removeSystemEnvironmentSubstringContaining("CLASSPATH", "\\safs.jar", null);
This will remove the safs.jar reference in CLASSPATH no matter what the path to it might be.
varname
- -- name of Environment variable to modify. cannot be null.substring
- -- the partial match value to remove, if it is present. cannot be null.sep
- - optional separator found between values. if null or zero-length then File.pathSeparator is used.public static boolean hasRegistryEntry(java.lang.String key, java.lang.String valuename)
The Windows version uses Reg.EXE which is supplied with WindowsXP. If this EXE is not present on the Windows system then this function will return false.
key
- For Windows this is a String. Ex:"HKCU\\Environment"valuename
- For Windows this is a String. Ex:"Path". Can be null.public static java.lang.String getRegistryValue(java.lang.String key, java.lang.String valuename)
key
- -- Ex: "HKCU\\Environment"valuename
- -- Ex: "Path". can be nullNativeWrapper.GetRegistryKeyValue(Object, Object)
public static boolean setRegistryValue(java.lang.String key, java.lang.String valuename, java.lang.String value)
key
- valuename
- value
- NativeWrapper.GetRegistryKeyValue(Object, Object)
Copyright © SAS Institute. All Rights Reserved.