|
Eclipse Platform Release 3.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.equinox.p2.operations.ProfileChangeOperation
public abstract class ProfileChangeOperation
ProfileChangeOperation describes a provisioning operation that modifies a profile. The operation must first be resolved, followed by the actual provisioning work being performed. This two-pass nature of the ProfileChangeOperation allows resolution status to be reported to a client to determine whether the operation should proceed. Each phase of the operation can be performed synchronously or in the background as a job. To perform the operation synchronously:
IStatus result = op.resolveModal(monitor); if (result.isOK()) op.getProvisioningJob(null).runModal(monitor); else { // interpret the result }To perform the resolution synchronously and the provisioning job in the background:
IStatus status = op.resolveModal(monitor); if (status.isOK()) { ProvisioningJob job = op.getProvisioningJob(monitor); job.schedule(); } else { // interpret the result }To resolve in the background and perform the job when it is complete:
ProvisioningJob job = op.getResolveJob(monitor); job.addJobChangeListener(new JobChangeAdapter() { public void done (JobChangeEvent event) { if (event.getResult().isOK() { op.getProvisioningJob(monitor).schedule(); } else { // interpret the result } } }); job.schedule();In general, it is expected that clients create a new ProfileChangeOperation if the resolution result of the current operation is not satisfactory. However, subclasses may prescribe a different life cycle where appropriate. When retrieving the resolution and provisioning jobs managed by this operation, a client may supply a progress monitor to be used by the job. When the job is run by the platform job manager, both the platform job manager progress indicator and the monitor supplied by the client will be updated.
Constructor Summary | |
---|---|
protected |
ProfileChangeOperation(ProvisioningSession session)
Create an operation using the provided provisioning session. |
Method Summary | |
---|---|
protected abstract void |
computeProfileChangeRequest(MultiStatus status,
IProgressMonitor monitor)
Compute the profile change request for this operation, adding any relevant intermediate status to the supplied status. |
org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest |
getProfileChangeRequest()
Return the profile change request that describes the receiver. |
String |
getProfileId()
Return the string id of the profile involved in this job. |
ProvisioningContext |
getProvisioningContext()
Get the provisioning context that will be used to resolve and perform the provisioning for the operation. |
ProvisioningJob |
getProvisioningJob(IProgressMonitor monitor)
Return a provisioning job that can be used to perform the resolved operation. |
protected abstract String |
getProvisioningJobName()
Return an appropriate name for the provisioning job. |
IProvisioningPlan |
getProvisioningPlan()
Return the provisioning plan obtained by resolving the receiver. |
String |
getResolutionDetails()
Return a string that can be used to describe the results of the resolution to a client. |
String |
getResolutionDetails(IInstallableUnit iu)
Return a string that describes the specific resolution results related to the supplied IInstallableUnit . |
IStatus |
getResolutionResult()
Return a status indicating the result of resolving this operation. |
ProvisioningJob |
getResolveJob(IProgressMonitor monitor)
Return a job that can be used to resolve this operation in the background. |
protected abstract String |
getResolveJobName()
Return an appropriate name for the resolution job. |
boolean |
hasResolved()
Return a boolean indicating whether the operation has been resolved. |
protected void |
prepareToResolve()
Perform any processing that must occur just before resolving this operation. |
IStatus |
resolveModal(IProgressMonitor monitor)
Resolve the operation in the current thread using the specified progress monitor. |
void |
setProfileId(String id)
Set the id of the profile that will be modified by this operation. |
void |
setProvisioningContext(ProvisioningContext context)
Set the provisioning context that should be used to resolve and perform the provisioning for the operation. |
protected void |
updateJobProvisioningContexts(org.eclipse.equinox.internal.p2.operations.PlannerResolutionJob job,
ProvisioningContext context)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ProfileChangeOperation(ProvisioningSession session)
session
- the provisioning session providing the servicesMethod Detail |
---|
public final IStatus resolveModal(IProgressMonitor monitor)
monitor
- the progress monitor to use
public void setProfileId(String id)
id
- the profile idpublic final ProvisioningJob getResolveJob(IProgressMonitor monitor)
monitor
- a progress monitor that should be used to report the job's progress in addition
to the standard job progress reporting. Can be null
. If provided, this monitor
will be called from a background thread.
protected void prepareToResolve()
protected abstract void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor)
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 requestprotected abstract String getResolveJobName()
protected abstract String getProvisioningJobName()
public IStatus getResolutionResult()
null
return indicates that
resolving has not occurred yet.
null
if resolution has not yet occurred.public String getResolutionDetails()
null
if the
operation has not been resolved.public String getResolutionDetails(IInstallableUnit iu)
IInstallableUnit
.
iu
- the IInstallableUnit for which resolution details are requested
null
if
there are no specific results available for the installable unit.public IProvisioningPlan getProvisioningPlan()
null
if the operation
has not been resolved, or if a plan could not be obtained when attempting to
resolve. If the plan is null and the operation has been resolved, then the
resolution result will explain the problem.hasResolved()
,
getResolutionResult()
public org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest getProfileChangeRequest()
null
if the operation
has not been resolved, or if a profile change request could not be assembled given
the operation's state. If the profile change request is null and the operation has
been resolved, the the resolution result will explain the problem.hasResolved()
,
getResolutionResult()
public ProvisioningJob getProvisioningJob(IProgressMonitor monitor)
Job.setUser(boolean)
,
Job.setSystem(boolean)
, or Job.setProperty(QualifiedName, Object)
,
before scheduling it.
monitor
- a progress monitor that should be used to report the job's progress in addition
to the standard job progress reporting. Can be null
. If provided, this monitor
will be called from a background thread.
null
if the operation has not been resolved, or if a plan could not be obtained when attempting to
resolve. If the job is null and the operation has been resolved, then the resolution result
will explain the problem.hasResolved()
,
getResolutionResult()
public void setProvisioningContext(ProvisioningContext context)
context
- the provisioning context.public ProvisioningContext getProvisioningContext()
public String getProfileId()
IProfileChangeJob
getProfileId
in interface IProfileChangeJob
public boolean hasResolved()
false
while resolution is taking place if it is performed
in the background.
true
if the operation has been resolved, false
if it has not resolved.protected void updateJobProvisioningContexts(org.eclipse.equinox.internal.p2.operations.PlannerResolutionJob job, ProvisioningContext context)
|
Eclipse Platform Release 3.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.