Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » P2 Update fails with non default osgi.configuration.area
P2 Update fails with non default osgi.configuration.area [message #1058478] Tue, 14 May 2013 10:25
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hello

I am trying to use an equinox based application in a shared environment as described here as Szenario #2 or #3.

The installation is done with the p2 director using a p2 site created with buckminster.

My hope was that multiple users could use the shared install, but have their own configuration area so that they can individualy update the application. My problem is that the p2 update does not work anymore in this case: It does not find the changed plugins and returns "nothing to update" although this is not true.

In my search for an answer i found out that the p2 update stops working as soon as I use a non default configuration area (osgi.configuration.area), even with a local install.

I think that this might by a problem with the query on a profile. I did some more tests with this code to get the root feature (of which I know that it is the only one with an id that starts with "de.emsw.gosa.feature"):

private IInstallableUnit findRootFeature(IProfile profile) {
	IInstallableUnit[] userVisibleRoot = profile.query(new UserVisibleRootQuery(), null).toArray(IInstallableUnit.class);
	if (userVisibleRoot.length == 0) {
		logger.warn("Root IU not found!"); //$NON-NLS-1$
	} else {
		logIu(userVisibleRoot[0], "ROOT"); //$NON-NLS-1$
		for (IRequirement requirement : userVisibleRoot[0].getRequirements()) {
			IMatchExpression<IInstallableUnit> matchExpression = requirement.getMatches();
			String id = matchExpression.getParameters()[0].toString();
			if (id.startsWith("de.emsw.gosa.feature")) { //$NON-NLS-1$
				IInstallableUnit[] queryResult = profile.query(QueryUtil.createIUQuery(id), null).toArray(IInstallableUnit.class);
				return getLatestVersion(queryResult);
			}
		}
	}
	return null;
}

private IInstallableUnit getLatestVersion(IInstallableUnit[] queryResult) {
	if (queryResult.length == 0)
		return null;
	IInstallableUnit latest = queryResult[0];
	if (queryResult.length > 1) {
		for (int i = 1; i < queryResult.length; i++) {
			if (queryResult[i].getVersion().compareTo(latest.getVersion()) > 0) {
				latest = queryResult[i];
			}
		}
	}
	return latest;
}


With a standard local install this code works as expected and returns the root feature which was installed. With a costum configuration area the root feature is not found because
profile.query(QueryUtil.createIUQuery(id), null)
returns an emtpy result.

Does anybody have any experience with this kind of situation or any other pointer?

If it is of interest, this is the config file (including osgi.configuration.area):
#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Tue May 14 11:09:34 CEST 2013
eclipse.p2.profile=gosa
osgi.instance.area.default=@user.home/Anwendungsdaten/gosa/client/data
osgi.configuration.area=@user.home/Anwendungsdaten/gosa/client/configuration
osgi.nl=de_DE
osgi.framework=file\:plugins/org.eclipse.osgi_3.8.0.v20120529-1548.jar
equinox.use.ds=true
osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.300.v20110815-1744.jar@1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
eclipse.product=de.emsw.gosa.product.client.product
osgi.splashPath=platform\:/base/plugins/de.emsw.gosa.images
osgi.framework.extensions=
osgi.bundles.defaultStartLevel=4
eclipse.application=de.emsw.gosa.product.client.ClientApplication
eclipse.p2.data.area=@config.dir/../p2

Thanks for your help!
Christoph
Previous Topic:Clean Equinox' cache after uninstallation of bundles
Next Topic:Eclipse RCP app with Worldwind - Globe vanishes
Goto Forum:
  


Current Time: Tue Mar 19 06:14:24 GMT 2024

Powered by FUDForum. Page generated in 0.02088 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top