org.netbeans.modules.autoupdate.services 1.20.1

org.netbeans.api.autoupdate
Class InstallSupport

java.lang.Object
  extended by org.netbeans.api.autoupdate.InstallSupport

public final class InstallSupport
extends Object

Performs all operations scheduled on instance of OperationContainer. Instance of InstallSupport can be obtained by calling OperationContainer.getSupport()

Typical scenario how to use:

Code example:
 
 UpdateElement element = ...;
 OperationContainer<InstallSupport> container = createForInstall();
 ... add elements ...
 InstallSupport support = container.getSupport();
 Validator v = support.doDownload(null, false);
 Installer i = support.doValidate(v, null);
 Restarter r = support.doInstall(i, null);
 if (r != null) {
      support.doRestart(r, null);
 }
 


Nested Class Summary
static class InstallSupport.Installer
          A helper object returned by a doValidate(org.netbeans.api.autoupdate.InstallSupport.Validator, org.netbeans.api.progress.ProgressHandle) for invoke the method doInstall(org.netbeans.api.autoupdate.InstallSupport.Installer, org.netbeans.api.progress.ProgressHandle)
static class InstallSupport.Validator
          A helper object returned by a doDownload(org.netbeans.api.progress.ProgressHandle, boolean) for invoke the method doValidate(org.netbeans.api.autoupdate.InstallSupport.Validator, org.netbeans.api.progress.ProgressHandle)
 
Method Summary
 void doCancel()
          Cancels changes done in previous calling methods.
 InstallSupport.Validator doDownload(ProgressHandle progress, boolean isGlobal)
          Downloads all instances i.e.
 OperationSupport.Restarter doInstall(InstallSupport.Installer installer, ProgressHandle progress)
          Validates all instances that have been verified in the previous step.
 void doRestart(OperationSupport.Restarter restarter, ProgressHandle progress)
          Completes the operation, applies all changes and ensures restart of the application immediately.
 void doRestartLater(OperationSupport.Restarter restarter)
          Finishes operation, all the changes will be completed after restart the application.
 InstallSupport.Installer doValidate(InstallSupport.Validator validator, ProgressHandle progress)
          Validates all instances that have been downloaded in the previous step.
 String getCertificate(InstallSupport.Installer validator, UpdateElement uElement)
          Returns java.security.cert.Certificate.toString() of given UpdateElement.
 OperationContainer<InstallSupport> getContainer()
          Returns the corresponing OperationContainer.
 boolean isSigned(InstallSupport.Installer validator, UpdateElement uElement)
          Returns if the UpdateElement is signed or not.
 boolean isTrusted(InstallSupport.Installer validator, UpdateElement uElement)
          Returns if the UpdateElement is trusted or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

doDownload

public InstallSupport.Validator doDownload(ProgressHandle progress,
                                           boolean isGlobal)
                                    throws OperationException
Downloads all instances i.e. UpdateElements in corresponing OperationContainer.

Parameters:
progress - ProgressHandle for notification progress in downloading, can be null
isGlobal - if true then forces download instances into shared directories i.e. installation directory
Returns:
Validator an instance of Validator which allows to verify downloaded instances in the next step
Throws:
OperationException

doValidate

public InstallSupport.Installer doValidate(InstallSupport.Validator validator,
                                           ProgressHandle progress)
                                    throws OperationException
Validates all instances that have been downloaded in the previous step.

Parameters:
validator - an instance of Validator that has been returned by {link @doDownload}. Mustn't be null.
progress - ProgressHandle for notification progress in validation, can be null
Returns:
Installer an instance of Installer which allows to install all verified instances
Throws:
OperationException
See Also:
doDownload(org.netbeans.api.progress.ProgressHandle, boolean)

doInstall

public OperationSupport.Restarter doInstall(InstallSupport.Installer installer,
                                            ProgressHandle progress)
                                     throws OperationException
Validates all instances that have been verified in the previous step.

Parameters:
installer - an instance of Installer that has been returned by InstallSupport#doValidate. Mustn't be null.
progress - ProgressHandle for notification progress in installation, can be null
Returns:
Restarter an instance of Restart if application restart is required for complete the install operation, or null
Throws:
OperationException
See Also:
doValidate(org.netbeans.api.autoupdate.InstallSupport.Validator, org.netbeans.api.progress.ProgressHandle)

doCancel

public void doCancel()
              throws OperationException
Cancels changes done in previous calling methods.

Throws:
OperationException
See Also:
OperationException

doRestart

public void doRestart(OperationSupport.Restarter restarter,
                      ProgressHandle progress)
               throws OperationException
Completes the operation, applies all changes and ensures restart of the application immediately. If method doInstall(org.netbeans.api.autoupdate.InstallSupport.Installer, org.netbeans.api.progress.ProgressHandle) returns non null instance of Restarter then this method must be called to apply all changes.

Parameters:
restarter - instance of Restarter obtained from previous call doInstall(org.netbeans.api.autoupdate.InstallSupport.Installer, org.netbeans.api.progress.ProgressHandle). Mustn't be null.
progress - instance of ProgressHandle or null
Throws:
OperationException
See Also:
OperationException

doRestartLater

public void doRestartLater(OperationSupport.Restarter restarter)
Finishes operation, all the changes will be completed after restart the application. If method doInstall(org.netbeans.api.autoupdate.InstallSupport.Installer, org.netbeans.api.progress.ProgressHandle) returns non null instance of Restarter then this method must be called to apply all changes

Parameters:
restarter - instance of Restarter obtained from previous call doInstall(org.netbeans.api.autoupdate.InstallSupport.Installer, org.netbeans.api.progress.ProgressHandle). Mustn't be null.

getCertificate

public String getCertificate(InstallSupport.Installer validator,
                             UpdateElement uElement)
Returns java.security.cert.Certificate.toString() of given UpdateElement.

Parameters:
validator - Installer an instance of Installer has been returned by {link @doValidate}
uElement - UpdateElement
Returns:
content of UpdateElement's certificate
See Also:
doValidate(org.netbeans.api.autoupdate.InstallSupport.Validator, org.netbeans.api.progress.ProgressHandle)

isTrusted

public boolean isTrusted(InstallSupport.Installer validator,
                         UpdateElement uElement)
Returns if the UpdateElement is trusted or not.

Parameters:
validator - Installer an instance of Installer has been returned by {link @doValidate}
uElement - UpdateElement
Returns:
true for trusted UpdateElement
See Also:
doValidate(org.netbeans.api.autoupdate.InstallSupport.Validator, org.netbeans.api.progress.ProgressHandle), java.security.cert.Certificate

isSigned

public boolean isSigned(InstallSupport.Installer validator,
                        UpdateElement uElement)
Returns if the UpdateElement is signed or not.

Parameters:
validator - Installer an instance of Installer has been returned by {link @doValidate}
uElement - UpdateElement
Returns:
true for trusted UpdateElement
See Also:
java.security.cert.Certificate, doValidate(org.netbeans.api.autoupdate.InstallSupport.Validator, org.netbeans.api.progress.ProgressHandle)

getContainer

public OperationContainer<InstallSupport> getContainer()
Returns the corresponing OperationContainer.

Returns:
the OperationContainer

org.netbeans.modules.autoupdate.services 1.20.1

Built on April 28 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.