|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.izforge.izpack.installer.unpacker.UnpackerBase
public abstract class UnpackerBase
Abstract base class for all unpacker implementations.
| Field Summary | |
|---|---|
static String |
RESOURCES_PATH
Path to resources in jar |
| Constructor Summary | |
|---|---|
UnpackerBase(InstallData installData,
PackResources resources,
RulesEngine rules,
VariableSubstitutor variableSubstitutor,
UninstallData uninstallData,
FileQueueFactory factory,
Housekeeper housekeeper,
InstallerListeners listeners,
Prompt prompt,
PlatformModelMatcher matcher)
Constructs an UnpackerBase. |
|
| Method Summary | |
|---|---|
protected void |
checkInterrupt()
Throws an ResourceInterruptedException if installation has been interrupted. |
protected void |
cleanup()
Invoked after unpacking has completed, in order to clean up. |
protected void |
createDirectory(File dir,
PackFile file,
Pack pack)
Creates a directory including any necessary but nonexistent parent directories, associated with a pack file. |
protected FileUnpacker |
createFileUnpacker(PackFile file,
Pack pack,
FileQueue queue,
Cancellable cancellable)
Creates an unpacker to unpack a pack file. |
protected void |
extract(PackFile packFile,
File target,
InputStream packInputStream,
Pack pack,
FileQueue queue)
Extracts a pack file. |
protected InstallData |
getInstallData()
Returns the installation data. |
protected Prompt |
getPrompt()
Returns the prompt. |
protected PackResources |
getResources()
Returns the pack resources. |
boolean |
getResult()
Return the state of the operation. |
protected String |
getStepName(Pack pack)
Returns the step name for a pack, for reporting purposes. |
protected UninstallData |
getUninstallData()
Returns the uninstallation data. |
protected VariableSubstitutor |
getVariableSubstitutor()
Returns the variable replacer. |
protected void |
handleOverrideRename(PackFile pf,
File file)
Renames a file, if it exists and the pack file defines how it should be handled. |
boolean |
interrupt(long timeout)
Interrupts the unpacker, and waits for it to complete. |
protected boolean |
isConditionTrue(String id)
|
boolean |
isInterruptDisabled()
Determines if interrupts have been disabled or not. |
protected boolean |
isInterrupted()
Determines if the unpacker has been interrupted. |
protected boolean |
isOverwriteFile(PackFile pf,
File file)
Determines if a file should be overwritten. |
protected void |
performUpdateChecks(List<UpdateCheck> checks)
Performs update checks. |
protected void |
postUnpack(List<Pack> packs,
FileQueue queue)
Invoked after each pack has been unpacked. |
protected void |
preUnpack(List<Pack> packs)
Invoked prior to unpacking. |
protected void |
readExecutableFiles(PackInfo packInfo,
List<ExecutableFile> executables)
Initializes executable files according to the current environment. |
protected void |
readParsableFiles(PackInfo packInfo,
List<ParsableFile> parsables)
Initializes parseable files according to the current environment. |
protected void |
readUpdateChecks(PackInfo packInfo,
List<UpdateCheck> updateChecks)
Initializes update checks according to the current environment. |
void |
run()
Runs the unpacker. |
void |
setDisableInterrupt(boolean disable)
Determines if interrupts should be disabled. |
void |
setProgressListener(ProgressListener listener)
Sets the progress listener. |
protected void |
setResult(boolean result)
Sets the result of the unpacking operation. |
protected boolean |
shouldUnpack(Pack pack)
Determines if a pack should be unpacked. |
protected void |
skip(InputStream stream,
long bytes)
Skips bytes in a stream. |
protected void |
skip(PackFile packFile,
Pack pack,
InputStream packInputStream)
Skips a pack file. |
void |
unpack()
Unpacks the installation files. |
protected void |
unpack(List<PackInfo> packs,
FileQueue queue)
Unpacks the selected packs. |
protected void |
unpack(PackFile packFile,
InputStream packInputStream,
int fileNo,
Pack pack,
FileQueue queue)
Unpacks a pack file. |
protected void |
unpack(PackInfo packInfo,
int packNo,
FileQueue queue,
List<ParsableFile> parsables,
List<ExecutableFile> executables,
List<UpdateCheck> updateChecks)
Unpacks a pack. |
protected void |
writeInstallationInformation()
Writes information about the installed packs and the variables at installation time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String RESOURCES_PATH
| Constructor Detail |
|---|
public UnpackerBase(InstallData installData,
PackResources resources,
RulesEngine rules,
VariableSubstitutor variableSubstitutor,
UninstallData uninstallData,
FileQueueFactory factory,
Housekeeper housekeeper,
InstallerListeners listeners,
Prompt prompt,
PlatformModelMatcher matcher)
installData - the installation dataresources - the pack resourcesrules - the rules enginevariableSubstitutor - the variable substituteruninstallData - the uninstallation datafactory - the file queue factoryhousekeeper - the housekeeperlisteners - the listenersprompt - the promptmatcher - the platform-model matcher| Method Detail |
|---|
public void setProgressListener(ProgressListener listener)
setProgressListener in interface IUnpackerlistener - the progress listenerpublic void run()
run in interface Runnablepublic void unpack()
public boolean getResult()
getResult in interface IUnpackerpublic boolean interrupt(long timeout)
isInterruptDisabled() returns true), then this
returns immediately.
interrupt in interface IUnpackertimeout - the maximum time to wait, in milliseconds
public void setDisableInterrupt(boolean disable)
setDisableInterrupt in interface IUnpackerdisable - if true disable interrupts, otherwise enable thempublic boolean isInterruptDisabled()
isInterruptDisabled in interface IUnpacker
protected void preUnpack(List<Pack> packs)
throws InstallerException
ProgressListener, and any registered listeners.
packs - the packs to unpack
InstallerException - for any error
protected void unpack(List<PackInfo> packs,
FileQueue queue)
throws InstallerException
packs - the packs to unpackqueue - the file queue, or null if queuing is not supported
ResourceInterruptedException - if unpacking is cancelled
InstallerException - for any error
protected void unpack(PackInfo packInfo,
int packNo,
FileQueue queue,
List<ParsableFile> parsables,
List<ExecutableFile> executables,
List<UpdateCheck> updateChecks)
packInfo - the pack info of the current packpackNo - the pack numberqueue - the file queue, or null if queuing is not supported
IzPackException - for any error
protected void unpack(PackFile packFile,
InputStream packInputStream,
int fileNo,
Pack pack,
FileQueue queue)
throws IOException
packFile - the pack filepackInputStream - the pack file input streamfileNo - the pack file numberpack - the pack that the pack file comes fromqueue - the file queue, or null if queuing is not supported
IOException - for any I/O error
IzPackException - for any other error
protected void extract(PackFile packFile,
File target,
InputStream packInputStream,
Pack pack,
FileQueue queue)
throws IOException
packFile - the pack filetarget - the file to write topackInputStream - the pack file input streampack - the pack that the pack file comes fromqueue - the file queue, or null if queuing is not supported
IOException - for any I/O error
ResourceInterruptedException - if installation is cancelled
IzPackException - for any IzPack error
protected void skip(PackFile packFile,
Pack pack,
InputStream packInputStream)
throws IOException
packFile - the pack filepack - the packpackInputStream - the pack stream
IOException - if the file cannot be skipped
protected FileUnpacker createFileUnpacker(PackFile file,
Pack pack,
FileQueue queue,
Cancellable cancellable)
throws InstallerException
file - the pack file to unpackpack - the parent packqueue - the file queue. May be nullcancellable - determines if the unpacker should be cancelled
InstallerException - for any installer error
protected void postUnpack(List<Pack> packs,
FileQueue queue)
throws IOException,
InstallerException
packs - the packsqueue - the file queue, or null if queuing is not supported
ResourceInterruptedException - if installation is cancelled
IOException - for any I/O error
InstallerExceptionprotected void cleanup()
protected InstallData getInstallData()
protected UninstallData getUninstallData()
protected PackResources getResources()
protected VariableSubstitutor getVariableSubstitutor()
protected Prompt getPrompt()
protected boolean shouldUnpack(Pack pack)
pack - the pack
protected void setResult(boolean result)
result - if true denotes successprotected boolean isConditionTrue(String id)
protected String getStepName(Pack pack)
pack - the pack
protected void createDirectory(File dir,
PackFile file,
Pack pack)
InstallerListeners are registered, these will be notified for each directory created.
dir - the directory to createfile - the pack filepack - the pack that file comes from
IzPackException - if the directory cannot be created or a listener throws an exceptionprotected boolean isInterrupted()
protected void checkInterrupt()
ResourceInterruptedException if installation has been interrupted.
ResourceInterruptedException - if installation is interruptedprotected void performUpdateChecks(List<UpdateCheck> checks)
checks - the update checks. May be null
IzPackException - for any error
protected void writeInstallationInformation()
throws IOException
InstallerException - for any installer error
IOException - for any I/O error
protected void skip(InputStream stream,
long bytes)
throws IOException
stream - the streambytes - the no. of bytes to skip
IOException - for any I/O error, or if the no. of bytes skipped doesn't match that expected
protected boolean isOverwriteFile(PackFile pf,
File file)
pf - the pack filefile - the file to check
true if the file should be overwritten
protected void handleOverrideRename(PackFile pf,
File file)
pf - the pack filefile - the file to rename
InstallerException - if the file cannot be renamed
protected void readParsableFiles(PackInfo packInfo,
List<ParsableFile> parsables)
parseable files according to the current environment.
packInfo - the pack info fpor the current packparsables - used to collect the read objects
protected void readExecutableFiles(PackInfo packInfo,
List<ExecutableFile> executables)
executable files according to the current environment.
packInfo - the pack info fpor the current packexecutables - used to collect the read objects
protected void readUpdateChecks(PackInfo packInfo,
List<UpdateCheck> updateChecks)
update checks according to the current environment.
packInfo - the pack info fpor the current packupdateChecks - used to collect the read objects
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||