Skip to main content

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

Hi Pascal,

 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. 

We use the 'simple' PDE build to create an executable application. Thus we do not provide a profile name or create one. In addition to that we have to work with RCP applications deployed in times where P2 did not exist. So the question is how can I use p2 to install or update these applications? 

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.

That's a bit confusing. The way we managed to create a profile is: 

... 
public void bindProfileRegistry(IProfileRegistry registry) {
this.profileRegistry = registry;
}
...

String location = new File("/Users/me/Projects/P2/installdir", "testprofile").toString();
Map<String, String> props = new HashMap<String, String>();
props.put(IProfile.PROP_INSTALL_FOLDER, location);
props.put(IProfile.PROP_CONFIGURATION_FOLDER, location);
props.put(IProfile.PROP_CACHE, location);
props.put(IProfile.PROP_SHARED_CACHE, location);
// props.put(IProfile.PROP_ENVIRONMENTS,"osgi.os=win32,osgi.os=win32,osgi.arch=x86");
props.put(IProfile.PROP_FLAVOR, "tooling");
profileRegistry.addProfile("testprofile", props);

So what I am looking for is a reliable possibility to find out the user's profile and the directory where I can install new features. Say I will install a new feature in a remote server application. How can I find out which profileID and install directory I have to use?

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.

That's a good hint, thanks. I will give it a try.

Regards,
Eugen

Am Jan 18, 2010 um 16:59  schrieb Pascal Rapicault:

> 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'/>
</references>

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.

_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev


Back to the top