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

Thanks Susan,

that was exactly the explanation I was looking for! 

Regards,
Eugen

-------- Original-Nachricht --------
> Datum: Wed, 10 Sep 2008 14:03:12 -0700
> Von: Susan Franklin McCourt <susan_franklin@xxxxxxxxxx>
> An: P2 developer discussions <p2-dev@xxxxxxxxxxx>
> CC: P2 developer discussions <p2-dev@xxxxxxxxxxx>, p2-dev-bounces@xxxxxxxxxxx
> Betreff: Re: [p2-dev] IDirector and IEngine

> 
> Hi, Eugen.
> I think it depends on the nature of your GUI.
> 
> The p2 UI rarely calls the director because we almost always involve the
> user in confirmation of the plan or other decision making.
> In our case, we build the plan, show the user what will happen, possibly
> correct the plan for the user, and then invoke the engine.
> 
> Something like...
> 
> ProfileChangeRequest req = new ProfileChangeRequest(profile);
> req.addInstallableUnits(ius);
> ProvisioningPlan plan = planner.getProvisioningPlan(req, null, null);
> // validate the plan...get confirmation from the user or report a
> problem...
> // Might want to change the original request based on the input
> // Once we know the plan is approved by the user and is OK...
> engine.perform(profile, new DefaultPhaseSet(), plan.getOperands(), null,
> null);
> 
> For an example of building and/or changing the plan, take a look at this
> static method in InstallAction.  It does things like figure out that the
> user really means to upgrade when they pick an IU for install and other
> changes in the original request.
> computeProvisioningPlan(IInstallableUnit[] ius, String targetProfileId,
> IProgressMonitor monitor):
> 
> In headless situations, you see a lot more use of the director to carry
> out
> the whole operation since the user doesn't get a chance to modify the
> request.
> 
> susan
> 
> 
> |---------+---------------------------->
> |         |           Eugen Reiswich   |
> |         |           <reiswich@xxxxxx>|
> |         |           Sent by:         |
> |         |           p2-dev-bounces@ec|
> |         |           lipse.org        |
> |         |                            |
> |         |                            |
> |         |           09/10/2008 12:57 |
> |         |           PM               |
> |         |           Please respond to|
> |         |           P2 developer     |
> |         |           discussions      |
> |---------+---------------------------->
>  
> >---------------------------------------------------------------------------------------------------------------------|
>   |                                                                       
>                                              |
>   |       To:       P2 developer discussions <p2-dev@xxxxxxxxxxx>         
>                                              |
>   |       cc:                                                             
>                                              |
>   |       Subject:  Re: [p2-dev] IDirector and IEngine                    
>                                              |
>  
> >---------------------------------------------------------------------------------------------------------------------|
> 
> 
> 
> 
> Sorry John, didn't see that. So if I got it right I only invoke operations
> on the IDirector and he will delegate all further steps to the IEngine.
> Hence I should never use the IEngine directly, right?
> 
> Regards,
> Eugen
> 
> Am 10.09.2008 um 20:19 schrieb John Arthorne:
> 
> 
>       Hi Eugen, there is some background information on these concepts
>       here:
> 
>       http://wiki.eclipse.org/Equinox/p2/Concepts
> 
>       John
> 
> 
>                                                                           
>  Eugen Reiswich <?reiswich@xxxxxx>                                        
>  Sent by:                                                                 
>  p2-dev-bounces@xxxxxxxxxxx                                               
>                                                                         To
>                                                P2 developer discussions   
>  09/10/2008 01:44 PM                           <?,p2-dev@xxxxxxxxxxx>     
>                                                                         cc
>                                                                           
>           Please respond to                                        Subject
>     P2 developer discussions <?,               [p2-dev] IDirector and     
>          p2-dev@xxxxxxxxxxx>                   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_______________________________________________
>       p2-dev mailing list
>       p2-dev@xxxxxxxxxxx
>       https://dev.eclipse.org/mailman/listinfo/p2-dev
> 
>       _______________________________________________
>       p2-dev mailing list
>       p2-dev@xxxxxxxxxxx
>       https://dev.eclipse.org/mailman/listinfo/p2-dev
> _______________________________________________
> p2-dev mailing list
> p2-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/p2-dev

-- 
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196