install4j API documentation


com.install4j.api
Class FileOptions

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

public class FileOptions
extends java.lang.Object

An object that contains options for the installation of a file. Objects of this class have to be used as parameters for the installFile methods of the InstallerContext.

Author:
ej-technologies GmbH

Field Summary
static java.lang.String DEFAULT_MODE
          The default file mode on Unix and Mac OS X.
static int OVERWRITE_ALWAYS
          Indicates that if the destination file exists it will be replaced in any case.
static int OVERWRITE_ALWAYS_ASK
          Indicates that if the destination file exists and has not been installed by a previous run of the installer the user will be asked whether to replace the file.
static int OVERWRITE_ALWAYS_ASK_INCLUDING_UPDATE
          Indicates that the user will be asked whether to replace the file even if it was installed by a previous run of the installer.
static int OVERWRITE_IF_NEWER
          Indicates that if the destination file exists it will be replaced if the source file is newer.
static int OVERWRITE_IF_NEWER_OTHERWISE_ASK
          Indicates that if the destination file exists it will be replaced if the source file is newer.
static int OVERWRITE_NEVER
          Indicates that if the destination file exists it won't be replaced in any case.
 
Constructor Summary
FileOptions()
          Initializes a FileOptions instance.
FileOptions(long fileTime)
          Initializes a FileOptions instance.
FileOptions(long fileTime, int overwrite)
          Initializes a FileOptions instance.
FileOptions(long fileTime, java.lang.String mode, int overwrite, boolean shared, boolean dontUninstall)
          Initializes a FileOptions instance.
FileOptions(java.lang.String mode, int overwrite, boolean shared)
          Initializes a FileOptions instance.
 
Method Summary
 long getFileTime()
          Returns the file time.
 java.lang.String getMode()
          Returns the unix access mode.
 int getOverwrite()
          Returns the overwrite mode.
 boolean isDontUninstall()
          Returns whether the file will not be uninstalled.
 boolean isShared()
          Returns whether the file will be installed as a shared file on Windows.
 void setDontUninstall(boolean dontUninstall)
          Sets whether the file should not be uninstalled.
 void setFileTime(long fileTime)
          Sets the file time.
 void setMode(int intMode)
          Sets the unix file mode as an integer.
 void setMode(java.lang.String mode)
          Sets the unix file mode as a String.
 void setOverwrite(int overwrite)
          Sets the overwrite mode.
 void setShared(boolean shared)
          Sets whether the file should be installed as shared on Windows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OVERWRITE_NEVER

public static final int OVERWRITE_NEVER
Indicates that if the destination file exists it won't be replaced in any case.

See Also:
Constant Field Values

OVERWRITE_ALWAYS

public static final int OVERWRITE_ALWAYS
Indicates that if the destination file exists it will be replaced in any case.

See Also:
Constant Field Values

OVERWRITE_IF_NEWER

public static final int OVERWRITE_IF_NEWER
Indicates that if the destination file exists it will be replaced if the source file is newer. On Windows, the file version resource will be used for the comparison. If the destination file is newer, it will be skipped silently.

See Also:
Constant Field Values

OVERWRITE_IF_NEWER_OTHERWISE_ASK

public static final int OVERWRITE_IF_NEWER_OTHERWISE_ASK
Indicates that if the destination file exists it will be replaced if the source file is newer. On Windows the file version resource will be used for the comparison. If the destination file is newer, the framework will ask the user if the file should be replaced.

See Also:
Constant Field Values

OVERWRITE_ALWAYS_ASK

public static final int OVERWRITE_ALWAYS_ASK
Indicates that if the destination file exists and has not been installed by a previous run of the installer the user will be asked whether to replace the file. Please note that if the user chooses "Never" or "Always", the framework won't ask the user again.

See Also:
Constant Field Values

OVERWRITE_ALWAYS_ASK_INCLUDING_UPDATE

public static final int OVERWRITE_ALWAYS_ASK_INCLUDING_UPDATE
Indicates that the user will be asked whether to replace the file even if it was installed by a previous run of the installer. Please note that if the user chooses "Never" or "Always", the framework won't ask the user again.

See Also:
Constant Field Values

DEFAULT_MODE

public static final java.lang.String DEFAULT_MODE
The default file mode on Unix and Mac OS X.

See Also:
Constant Field Values
Constructor Detail

FileOptions

public FileOptions()
Initializes a FileOptions instance. This is the same as calling FileOptions(new Date().getTime(), DEFAULT_MODE, OVERWRITE_ALWAYS_ASK, false, false).


FileOptions

public FileOptions(java.lang.String mode,
                   int overwrite,
                   boolean shared)
Initializes a FileOptions instance. This is the same as calling FileOptions(new Date().getTime(), mode, overwrite, shared, false).

Parameters:
mode - the mode for the destination file (e.g. "644"). This has no effect on Windows.
overwrite - one of the OVERWRITE_* constants.
shared - the file will be installed as shared on Windows. This means that a reference counter will ensure that the file won't be uninstalled if it is also used by another program. This is highly recommended for files that will be installed in windows system directories.

FileOptions

public FileOptions(long fileTime)
Initializes a FileOptions instance. This is the same as calling FileOptions(fileTime, DEFAULT_MODE, OVERWRITE_ALWAYS_ASK, false, false).

Parameters:
fileTime - the last modified time the file will be set to.

FileOptions

public FileOptions(long fileTime,
                   int overwrite)
Initializes a FileOptions instance. This is the same as calling FileOptions(fileTime, DEFAULT_MODE, overwrite, false, false).

Parameters:
fileTime - the last modified time the file will be set to.
overwrite - one of the OVERWRITE_* constants.

FileOptions

public FileOptions(long fileTime,
                   java.lang.String mode,
                   int overwrite,
                   boolean shared,
                   boolean dontUninstall)
Initializes a FileOptions instance.

Parameters:
fileTime - the last modified time the file will be set to.
mode - the mode for the destination file (e.g. "644"). This has no effect on Windows.
overwrite - one of the OVERWRITE_* constants.
shared - the file will be installed as shared on Windows. This means that a reference counter will ensure that the file won't be uninstalled if it is also used by another program. This is highly recommended for files that will be installed in windows system directories.
dontUninstall - if true, the file won't be registered for uninstallation.
Method Detail

getFileTime

public long getFileTime()
Returns the file time. This is the same time format as in java.io.File.lastModified().

Returns:
the file time.

setFileTime

public void setFileTime(long fileTime)
Sets the file time. This is the same time format as in java.io.File.lastModified().

Parameters:
fileTime - the new file time.

getMode

public java.lang.String getMode()
Returns the unix access mode.

Returns:
the mode as String (e.g. "644")

setMode

public void setMode(int intMode)
Sets the unix file mode as an integer. For specifying integer file modes, you can use octal numbers by prefixing a "0".

Parameters:
intMode - the mode as an integer (e.g. 0664).

setMode

public void setMode(java.lang.String mode)
Sets the unix file mode as a String.

Parameters:
mode - the mode as a String (e.g. "664").

getOverwrite

public int getOverwrite()
Returns the overwrite mode.

Returns:
one of the OVERWRITE_* constants.

setOverwrite

public void setOverwrite(int overwrite)
Sets the overwrite mode.

Parameters:
overwrite - one of the OVERWRITE_* constants.

isShared

public boolean isShared()
Returns whether the file will be installed as a shared file on Windows.

Returns:
true if the file will be installed as shared.

setShared

public void setShared(boolean shared)
Sets whether the file should be installed as shared on Windows.

Parameters:
shared - true if the file should be installed as shared.

isDontUninstall

public boolean isDontUninstall()
Returns whether the file will not be uninstalled.

Returns:
true if the file will not be uninstalled.

setDontUninstall

public void setDontUninstall(boolean dontUninstall)
Sets whether the file should not be uninstalled.

Parameters:
dontUninstall - true if the file should not be uninstalled.