Class UpdateOperation
java.lang.Object
org.eclipse.equinox.p2.operations.ProfileChangeOperation
org.eclipse.equinox.p2.operations.UpdateOperation
- All Implemented Interfaces:
IProfileChangeJob
An UpdateOperation describes an operation that updates
IInstallableUnits in
a profile.
The following snippet shows how one might use an UpdateOperation to check for updates
to the profile and then install them in the background.
UpdateOperation op = new UpdateOperation(session);
IStatus result = op.resolveModal(monitor);
if (result.isOK()) {
op.getProvisioningJob(monitor).schedule();
}
The life cycle of an UpdateOperation is different than that of the other
operations. Since assembling the list of possible updates may be costly,
clients should not have to create a new update operation if the desired updates
to be applied need to change. In this case, the client can set a new set of
chosen updates on the update operation and resolve again.
UpdateOperation op = new UpdateOperation(session);
IStatus result = op.resolveModal(monitor);
if (result.isOK()) {
op.getProvisioningJob(monitor).schedule();
} else if (result.getSeverity() == IStatus.ERROR) {
Update [] chosenUpdates = letUserPickFrom(op.getPossibleUpdates());
op.setSelectedUpdates(chosenUpdates);
IStatus result = op.resolveModal(monitor);
}
- Since:
- 2.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA status code used to indicate that there were no updates found when looking for updates. -
Constructor Summary
ConstructorsConstructorDescriptionUpdateOperation(ProvisioningSession session) Create an update operation that will update all of the user-visible installable units in the profile (the profile roots).UpdateOperation(ProvisioningSession session, Collection<IInstallableUnit> toBeUpdated) Create an update operation on the specified provisioning session that updates the specified IInstallableUnits. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcomputeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) Compute the profile change request for this operation, adding any relevant intermediate status to the supplied status.Update[]Get the list of all possible updates.protected StringReturn an appropriate name for the provisioning job.protected StringReturn an appropriate name for the resolution job.Update[]Get the updates that have been selected from the set of available updates.booleanReturn a boolean indicating whether the operation has been resolved.protected voidPerform any processing that must occur just before resolving this operation.voidsetSelectedUpdates(Update[] defaultUpdates) Set the updates that should be selected from the set of available updates.Methods inherited from class org.eclipse.equinox.p2.operations.ProfileChangeOperation
getProfileChangeRequest, getProfileId, getProvisioningContext, getProvisioningJob, getProvisioningPlan, getResolutionDetails, getResolutionDetails, getResolutionResult, getResolveJob, resolveModal, setProfileId, setProvisioningContext, updateJobProvisioningContexts
-
Field Details
-
STATUS_NOTHING_TO_UPDATE
public static final int STATUS_NOTHING_TO_UPDATEA status code used to indicate that there were no updates found when looking for updates.- See Also:
-
-
Constructor Details
-
UpdateOperation
Create an update operation on the specified provisioning session that updates the specified IInstallableUnits. Unless otherwise specified, the operation will be associated with the currently running profile.- Parameters:
session- the session to use for obtaining provisioning servicestoBeUpdated- the IInstallableUnits to be updated.
-
UpdateOperation
Create an update operation that will update all of the user-visible installable units in the profile (the profile roots).- Parameters:
session- the session providing the provisioning services
-
-
Method Details
-
setSelectedUpdates
Set the updates that should be selected from the set of available updates. If the selected updates are not specified, then the latest available update for each IInstallableUnit with updates will be chosen.- Parameters:
defaultUpdates- the updates that should be chosen from all of the available updates.
-
getSelectedUpdates
Get the updates that have been selected from the set of available updates. If none have been specified by the client, then the latest available update for each IInstallableUnit with updates will be chosen.- Returns:
- the updates that should be chosen from all of the available updates
-
getPossibleUpdates
Get the list of all possible updates. This list may include multiple versions of updates for the same IInstallableUnit, as well as patches to the IInstallableUnit.- Returns:
- an array of all possible updates
-
computeProfileChangeRequest
Description copied from class:ProfileChangeOperationCompute the profile change request for this operation, adding any relevant intermediate status to the supplied status.- Specified by:
computeProfileChangeRequestin classProfileChangeOperation- Parameters:
status- a multi-status to be used to add relevant status. If a profile change request cannot be computed for any reason, a status should be added to explain the problem.monitor- the progress monitor to use for computing the profile change request
-
getProvisioningJobName
Description copied from class:ProfileChangeOperationReturn an appropriate name for the provisioning job.- Specified by:
getProvisioningJobNamein classProfileChangeOperation- Returns:
- the provisioning job name.
-
getResolveJobName
Description copied from class:ProfileChangeOperationReturn an appropriate name for the resolution job.- Specified by:
getResolveJobNamein classProfileChangeOperation- Returns:
- the resolution job name.
-
prepareToResolve
protected void prepareToResolve()Description copied from class:ProfileChangeOperationPerform any processing that must occur just before resolving this operation.- Overrides:
prepareToResolvein classProfileChangeOperation
-
hasResolved
public boolean hasResolved()Description copied from class:ProfileChangeOperationReturn a boolean indicating whether the operation has been resolved. This method should be used to determine whether a client can expect to retrieve a profile change request, provisioning plan, or resolution result. It is possible that this method returnfalsewhile resolution is taking place if it is performed in the background.- Overrides:
hasResolvedin classProfileChangeOperation- Returns:
trueif the operation has been resolved,falseif it has not resolved.
-