public abstract class AbstractPackageOperation extends java.lang.Object implements PackageOperation
Installers and Uninstallers that manages creation of temp
directories, writing package metadata and install status, and resuming in-progress installs.PackageOperation.InstallStatus, PackageOperation.StatusChangeListener, PackageOperation.StatusChangeListenerException| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPackageOperation(RepoManager repoManager,
FileOp fop) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
complete(ProgressIndicator progress)
Finds the prepared files using the installer metadata, and calls
doComplete(File, ProgressIndicator). |
protected abstract boolean |
doComplete(java.io.File installTemp,
ProgressIndicator progress)
Subclasses should implement this to do any install/uninstall completion actions required.
|
protected abstract boolean |
doPrepare(java.io.File installTempPath,
ProgressIndicator progress)
Subclasses should override this to prepare a package for (un)installation, including
downloading, unzipping, etc.
|
PackageOperation.InstallStatus |
getInstallStatus()
Gets the current
InstallStatus of this installer. |
RepoManager |
getRepoManager()
Gets the
RepoManager for which we're installing/uninstalling a package. |
boolean |
prepare(ProgressIndicator progress)
Writes information used to restore the operation state if needed, then calls
doPrepare(File, ProgressIndicator) |
void |
registerStateChangeListener(PackageOperation.StatusChangeListener listener)
Registers a listener that will be called when the
InstallStatus of
this installer changes. |
protected boolean |
updateStatus(PackageOperation.InstallStatus status,
ProgressIndicator progress)
Sets our status to
status and notifies our listeners. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocation, getName, getPackageprotected final FileOp mFop
protected AbstractPackageOperation(@NonNull
RepoManager repoManager,
@NonNull
FileOp fop)
protected abstract boolean doPrepare(@NonNull
java.io.File installTempPath,
@NonNull
ProgressIndicator progress)
installTempPath - The dir that should be used for any intermediate processing.progress - For logging and progress displayprotected abstract boolean doComplete(@Nullable
java.io.File installTemp,
@NonNull
ProgressIndicator progress)
installTemp - The temporary dir in which we prepared the (un)install. May be
null if for example the installer removed the installer
properties file, but should not be normally.progress - For logging and progress indication.true if the operation succeeded, false otherwise.complete(ProgressIndicator)public final boolean complete(@NonNull
ProgressIndicator progress)
doComplete(File, ProgressIndicator).complete in interface PackageOperationprogress - A ProgressIndicator, to show install progress and facilitate
logging.true if the install was successful, false otherwise.public final boolean prepare(@NonNull
ProgressIndicator progress)
doPrepare(File, ProgressIndicator)prepare in interface PackageOperationprogress - A ProgressIndicator, to show progress and facilitate logging.true if the operation succeeded, false otherwise.@NonNull public RepoManager getRepoManager()
PackageOperationRepoManager for which we're installing/uninstalling a package.getRepoManager in interface PackageOperationpublic final void registerStateChangeListener(@NonNull
PackageOperation.StatusChangeListener listener)
InstallStatus of
this installer changes.registerStateChangeListener in interface PackageOperation@NonNull public final PackageOperation.InstallStatus getInstallStatus()
InstallStatus of this installer.getInstallStatus in interface PackageOperationprotected final boolean updateStatus(@NonNull
PackageOperation.InstallStatus status,
@NonNull
ProgressIndicator progress)
status and notifies our listeners. If any listener throws an
exception we will stop processing listeners and update our status to InstallStatus.FAILED (calling the listeners again with that status update).