Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] IDirector and IEngine

Hi folks,

I'm trying to get familiar with p2 and had a look at the p2 tests (org.eclipse.equinox.p2.tests).  Basically I'm looking for install/update/unistall operations with P2.

Right now I don't get the point with IDirector and IEngine. It seems that both are able to install IUs, is that right? The IDirector has a provision(...) method while the IEngine has a perform(...) method. So which one do I have to use if I want to create a custom provisioning GUI? 

Is this the best way to install IUs (found in org.eclipse.equinox.p2.tests):

protected IStatus install(IProfile profile, IInstallableUnit[] ius, boolean strict, IPlanner planner, IEngine engine) {
ProfileChangeRequest req = new ProfileChangeRequest(profile);
req.addInstallableUnits(ius);
for (int i = 0; i < ius.length; i++) {
req.setInstallableUnitInclusionRules(ius[i], strict ? PlannerHelper.createStrictInclusionRule(ius[i]) : PlannerHelper.createOptionalInclusionRule(ius[i]));
}

ProvisioningPlan plan = planner.getProvisioningPlan(req, null, null);
if (plan.getStatus().getSeverity() == IStatus.ERROR || plan.getStatus().getSeverity() == IStatus.CANCEL)
return plan.getStatus();
return engine.perform(profile, new DefaultPhaseSet(), plan.getOperands(), null, null);
}

Regards,
Eugen

Back to the top