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

> 1. Profiles: how exactly do I use profiles for install procedures?
> Say I have provisioned (not necessary with P2) my RCP application to
> some customer PCs. Now I want to remotely update these RCP-clients
> and e.g. install a new feature. Say I am able to connect with these
> clients and execute remote calls.

> - Is there a default profile each customer has where I have to
> install my new features?

Each application is the result of a provisioning operation that has happened at some point or another. For example if the user just unzipped a zip, this zip mostly likely result from a provisioning operation that occurred at build time, consequently it contains a profile. This profile is typically located in <folder>/p2/org.eclipse.equinox.p2.engine/profileRegistry/<profileId> This folder should also be referenced from the application config.ini and so should be the profile id.

> - Or do I have to create a new profile for my new features I want to
> add? If so, I do not know the customer's disk layout, so how do I
> know where to create the new profile?

If the installation did not had a profile, you could generate one profile on the fly but we usually don't recommend this approach as this usually leads to some loss of precision.

> 2. IDirector and dependencies: To install a new feature I have to
> provide the repository URL and the featureID:

> metadataRepositoryManager

> .addRepository(new URI(repositorylocation));
> artifactRepositoryManager
> .addRepository(new URI(repositorylocation));
> ...

> Query query = new MatchQuery() {

> @Override

> public boolean isMatch(Object object) {
> IInstallableUnit candidate = (IInstallableUnit) object;
> System.err.println(candidate.getId());
> //  FEature to install
> return candidate.getId().equals(
> "org.eclipse.epp.usagedata.feature.feature.group");
> }
> };
> Collector collector = new Collector();

> Collector test = metadataRepository.query(query, collector,
> new NullProgressMonitor());
> ....

> In case my feature has dependencies to other plug-ins (not
> features!) which are located in a different repository. When I
> create a feature project I can define on the dependencies-tab which
> plug-ins my feature depends on. How does P2 know where to download
> these dependencies? Do I have to provide P2 an additional repositorylocation?

The repositories needed must be added to the repository manager. However if these other repositories are referred to (and marked enabled) from the repository you initially add, then they will be automatically added to the repository manager. In the XML, it looks like that. This snippet causes the addition of a metadata repository (type = 1 and enables it options = 1) and then adds the artifact repository.
<references size='4'>
<repository url='http://download.eclipse.org/' type='1' options='1'/>
<repository url='http://download.eclipse.org/' type='0' options='1'/>

Now if you are grabbing http://download.eclipse.org/eclipse/downloads/drops/I20100115-1100/index.php you may want to look at the org.eclipse.equinox.p2.operations bundle which aims at simplifying the installation process. This build is the first one to contain our the first cut at an API. Feedback welcome.