Class ProvisioningUI


  • public class ProvisioningUI
    extends Object
    ProvisioningUI defines the provisioning session, UI policy, and related services for a provisioning UI.
    Since:
    2.0
    • Constructor Detail

      • ProvisioningUI

        public ProvisioningUI​(ProvisioningSession session,
                              String profileId,
                              Policy policy)
        Creates a new instance of the provisioning user interface.
        Parameters:
        session - The current provisioning session
        profileId - The profile that this user interface is operating on
        policy - The user interface policy settings to use
    • Method Detail

      • getDefaultUI

        public static ProvisioningUI getDefaultUI()
        Return the default ProvisioningUI.
        Returns:
        the default Provisioning UI.
      • getPolicy

        public Policy getPolicy()
        Return the UI policy used for this instance of the UI.
        Returns:
        the UI policy, must not be null
      • getSession

        public ProvisioningSession getSession()
        Return the provisioning session that should be used to obtain provisioning services.
        Returns:
        the provisioning session, must not be null
      • getLicenseManager

        public LicenseManager getLicenseManager()
        Return the license manager that should be used to remember accepted user licenses.
        Returns:
        the license manager. May be null if licenses are not to be remembered.
      • getRepositoryTracker

        public RepositoryTracker getRepositoryTracker()
        Return the repository tracker that should be used to add, remove, and track the statuses of known repositories.
        Returns:
        the repository tracker, must not be null
      • getProfileId

        public String getProfileId()
        Return the profile id that should be assumed for this ProvisioningUI if no other id is otherwise specified. Some UI classes are assigned a profile id, while others are not. For those classes that are not assigned a current profile id, this id can be used to obtain one.
        Returns:
        a profile id
      • getInstallOperation

        public InstallOperation getInstallOperation​(Collection<IInstallableUnit> iusToInstall,
                                                    URI[] repositories)
        Return an install operation that describes installing the specified IInstallableUnits from the provided list of repositories.
        Parameters:
        iusToInstall - the IInstallableUnits to be installed
        repositories - the repositories to use for the operation
        Returns:
        the install operation
      • getUpdateOperation

        public UpdateOperation getUpdateOperation​(Collection<IInstallableUnit> iusToUpdate,
                                                  URI[] repositories)
        Return an update operation that describes updating the specified IInstallableUnits from the provided list of repositories.
        Parameters:
        iusToUpdate - the IInstallableUnits to be updated
        repositories - the repositories to use for the operation
        Returns:
        the update operation
      • getUninstallOperation

        public UninstallOperation getUninstallOperation​(Collection<IInstallableUnit> iusToUninstall,
                                                        URI[] repositories)
        Return an uninstall operation that describes uninstalling the specified IInstallableUnits, using the supplied repositories to replace any metadata that must be retrieved for the uninstall.
        Parameters:
        iusToUninstall - the IInstallableUnits to be installed
        repositories - the repositories to use for the operation
        Returns:
        the uninstall operation
      • openInstallWizard

        public int openInstallWizard​(Collection<IInstallableUnit> initialSelections,
                                     InstallOperation operation,
                                     LoadMetadataRepositoryJob job)
        Open an install wizard for installing the specified IInstallableUnits
        Parameters:
        initialSelections - the IInstallableUnits that should be selected when the wizard opens. May be null.
        operation - the operation describing the proposed install. If this operation is not null, then a wizard showing only the IInstallableUnits described in the operation will be shown. If the operation is null, then a wizard allowing the user to browse the repositories will be opened.
        job - a repository load job that is loading or has already loaded the repositories. Can be used to pass along an in-memory repository reference to the wizard.
        Returns:
        the wizard return code
      • openInstallWizard

        public int openInstallWizard​(Collection<IInstallableUnit> initialSelections,
                                     InstallOperation operation,
                                     RemediationOperation remediationOperation,
                                     LoadMetadataRepositoryJob job)
        Open an install wizard for installing the specified IInstallableUnits and remediationOperation.
        Parameters:
        initialSelections - the IInstallableUnits that should be selected when the wizard opens. May be null.
        operation - the operation describing the proposed install. If this operation is not null, then a wizard showing only the IInstallableUnits described in the operation will be shown. If the operation is null, then a wizard allowing the user to browse the repositories will be opened.
        remediationOperation - the alternate operations if the proposed update failed. May be null.
        job - a repository load job that is loading or has already loaded the repositories. Can be used to pass along an in-memory repository reference to the wizard.
        Returns:
        the wizard return code
        Since:
        2.3
        See Also:
        RemediationOperation
      • openUpdateWizard

        public int openUpdateWizard​(boolean skipSelectionsPage,
                                    UpdateOperation operation,
                                    LoadMetadataRepositoryJob job)
        Open an update wizard for the specified update operation.
        Parameters:
        skipSelectionsPage - true if the selection page should be skipped so that the user is viewing the resolution results. false if the update selection page should be shown first.
        operation - the operation describing the proposed update. Must not be null.
        job - a repository load job that is loading or has already loaded the repositories. Can be used to pass along an in-memory repository reference to the wizard.
        Returns:
        the wizard return code
      • openUpdateWizard

        public int openUpdateWizard​(boolean skipSelectionsPage,
                                    UpdateOperation operation,
                                    RemediationOperation remediationOperation,
                                    LoadMetadataRepositoryJob job)
        Open an update wizard for the specified update operation and remediationOperation.
        Parameters:
        skipSelectionsPage - true if the selection page should be skipped so that the user is viewing the resolution results. false if the update selection page should be shown first.
        operation - the operation describing the proposed update. Must not be null.
        remediationOperation - the alternate operations if the proposed update failed. May be null.
        job - a repository load job that is loading or has already loaded the repositories. Can be used to pass along an in-memory repository reference to the wizard.
        Returns:
        the wizard return code
        Since:
        2.3
      • openUninstallWizard

        public int openUninstallWizard​(Collection<IInstallableUnit> initialSelections,
                                       UninstallOperation operation,
                                       LoadMetadataRepositoryJob job)
        Open an uninstall wizard for the specified uninstall operation.
        Parameters:
        initialSelections - the IInstallableUnits that should be selected when the wizard opens. May be null.
        operation - the operation describing the proposed uninstall. Must not be null.
        job - a repository load job that is loading or has already loaded the repositories. Can be used to pass along an in-memory repository reference to the wizard.
        Returns:
        the wizard return code
      • manipulateRepositories

        public void manipulateRepositories​(Shell shell)
        Open a UI that allows the user to manipulate the repositories.
        Parameters:
        shell - the shell that should parent the UI
      • schedule

        public void schedule​(ProvisioningJob job,
                             int errorStyle)
        Schedule a job to execute the supplied ProvisioningOperation.
        Parameters:
        job - The operation to execute
        errorStyle - the flags passed to the StatusManager for error reporting
      • manageJob

        public void manageJob​(Job job,
                              int jobRestartPolicy)
        Manage the supplied job as a provisioning operation. This will allow the ProvisioningUI to be aware that a provisioning job is running, as well as manage the restart behavior for the job.
        Parameters:
        job - the job to be managed
        jobRestartPolicy - an integer constant specifying whether the supplied job should cause a restart of the system. The UI Policy's restart policy is used in conjunction with this constant to determine what actually occurs when a job completes.
        See Also:
        ProvisioningJob.RESTART_NONE, ProvisioningJob.RESTART_ONLY, ProvisioningJob.RESTART_OR_APPLY
      • hasScheduledOperations

        public boolean hasScheduledOperations()
        Return a boolean indicating whether the receiver has scheduled any operations for the profile under management.
        Returns:
        true if other provisioning operations have been scheduled, false if there are no operations scheduled.
      • getOperationRunner

        public org.eclipse.equinox.internal.p2.ui.ProvisioningOperationRunner getOperationRunner()
        This method is for automated testing only.
        Returns:
        the provisioning operation that can suppress restart for automated testing.
        Restriction:
        This method is not intended to be referenced by clients.
      • signalRepositoryOperationStart

        public void signalRepositoryOperationStart()
        Signal that a repository operation is about to begin. This allows clients to ignore intermediate events until the operation is completed. Callers are responsible for ensuring that a corresponding operation ending event is signaled.
      • signalRepositoryOperationComplete

        public void signalRepositoryOperationComplete​(org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent event,
                                                      boolean update)
        Signal that a repository operation has completed.
        Parameters:
        event - a RepositoryEvent that describes the overall operation. May be null, which indicates that there was no single event that can describe the operation.
        update - true if the event should be reflected in the UI, false if it should be ignored.
      • loadMetadataRepository

        public IMetadataRepository loadMetadataRepository​(URI location,
                                                          boolean notify,
                                                          IProgressMonitor monitor)
                                                   throws ProvisionException
        Load the specified metadata repository, signaling a repository operation start event before loading, and a repository operation complete event after loading.
        Parameters:
        location - the location of the repository
        notify - true if the UI should be updated as a result of the load, false if it should not
        monitor - the progress monitor to be used
        Returns:
        the repository
        Throws:
        ProvisionException - if the repository could not be loaded
      • loadArtifactRepository

        public IArtifactRepository loadArtifactRepository​(URI location,
                                                          boolean update,
                                                          IProgressMonitor monitor)
                                                   throws ProvisionException
        Load the specified artifact repository, signaling a repository operation start event before loading, and a repository operation complete event after loading.
        Parameters:
        location - the location of the repository
        update - true if the UI should be updated as a result of the load, false if it should not
        monitor - the progress monitor to be used
        Returns:
        the repository
        Throws:
        ProvisionException - if the repository could not be loaded