public class ApplicationInstallerKF extends Object
Modifier and Type | Field and Description |
---|---|
protected ApplicationManagerKF |
applicationManager
the application manager to update when applications are installed or uninstalled
|
protected static String |
INSTALL
Install task name
|
protected static String |
UNINSTALL
Uninstall task name
|
Constructor and Description |
---|
ApplicationInstallerKF(ApplicationManagerKF applicationManager)
Creates an application installer on KF.
|
Modifier and Type | Method and Description |
---|---|
void |
addApplicationInstallationListener(ApplicationInstallationListener applicationInstallationListener)
Adds an application installation listener.
|
boolean |
canUninstall(Application application)
Checks if we can uninstall the given application.
|
protected void |
checkPermission(Application application,
String action)
Checks that an action on a application is permitted.
|
ApplicationManagerKF |
getApplicationManager()
Gets the application manager.
|
Application |
install(InputStream stream)
Installs an application from an input stream.
|
Application |
install(InputStream stream,
IProgressMonitor monitor)
Installs an application from an input stream.
|
protected Application |
installKF(InputStream stream,
IProgressMonitor monitor)
Installs an application into KF.
|
protected void |
notifyInstall(Application application)
Notifies the listener that an application has been installed.
|
protected void |
notifyUninstall(Application application)
Notifies the listener that an application has been uninstalled.
|
void |
removeApplicationInstallationListener(ApplicationInstallationListener applicationInstallationListener)
Removes an application installation listener.
|
void |
stateChanged(Feature feature,
Feature.State previousState)
Called when the state of a Feature has changed.
|
boolean |
uninstall(Application application)
Uninstalls an application.
|
boolean |
uninstall(Application application,
IProgressMonitor monitor)
Uninstalls an application.
|
protected boolean |
uninstallKF(Application application,
IProgressMonitor monitor)
Uninstalls an application from KF.
|
protected final ApplicationManagerKF applicationManager
protected static final String INSTALL
protected static final String UNINSTALL
public ApplicationInstallerKF(ApplicationManagerKF applicationManager)
applicationManager
- the applications manager it depends on.public Application install(InputStream stream, IProgressMonitor monitor) throws ApplicationOperationException
ApplicationInstaller
stream
- the stream containing the application.monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility to
call done() on the given monitor.ApplicationOperationException
- if any unexpected errors occur while installing this application.public boolean uninstall(Application application, IProgressMonitor monitor) throws ApplicationOperationException
ApplicationInstaller
application
- the application to uninstall.monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility to
call done() on the given monitor.true
if the application has been uninstalled, false
otherwise.ApplicationOperationException
- if any unexpected errors occur while uninstalling this application.public void addApplicationInstallationListener(ApplicationInstallationListener applicationInstallationListener)
ApplicationInstaller
It will be notified for each application installation or uninstallation.
addApplicationInstallationListener
in interface ApplicationInstaller
applicationInstallationListener
- the listener to add.public boolean canUninstall(Application application)
ApplicationInstaller
canUninstall
in interface ApplicationInstaller
application
- the application to check.true
if the application can been uninstalled, false
otherwise.protected void checkPermission(@Nullable Application application, String action)
application
- the application.action
- the action.public ApplicationManagerKF getApplicationManager()
public Application install(InputStream stream) throws ApplicationOperationException
ApplicationInstaller
install
in interface ApplicationInstaller
stream
- the stream containing the application.ApplicationOperationException
- if any unexpected errors occur while installing this application.protected Application installKF(InputStream stream, IProgressMonitor monitor) throws ApplicationOperationException
stream
- the stream containing the application.monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility to
call done() on the given monitor.ApplicationOperationException
- if any unexpected errors occur while installing this application.protected void notifyInstall(Application application)
application
- the installed application.protected void notifyUninstall(Application application)
application
- the uninstalled application.public void removeApplicationInstallationListener(ApplicationInstallationListener applicationInstallationListener)
ApplicationInstaller
If the given listener is not registered, nothing is done.
removeApplicationInstallationListener
in interface ApplicationInstaller
applicationInstallationListener
- the listener to remove.public void stateChanged(@Nullable Feature feature, @Nullable Feature.State previousState)
FeatureStateListener
stateChanged
in interface FeatureStateListener
feature
- the Feature which state has changedpreviousState
- the previous state, null
if Feature state is Feature.State.INSTALLED
public boolean uninstall(Application application) throws ApplicationOperationException
ApplicationInstaller
uninstall
in interface ApplicationInstaller
application
- the application to uninstall.true
if the application has been uninstalled, false
otherwise.ApplicationOperationException
- if any unexpected errors occur while uninstalling this application.protected boolean uninstallKF(Application application, IProgressMonitor monitor) throws ApplicationOperationException
application
- the application to uninstall.monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility to
call done() on the given monitor.true
if the application has been uninstalled, false
otherwise.ApplicationOperationException
- if any unexpected errors occur while uninstalling this application.