I have a product which already has a mechanism of 'Checking for Available Updates' on startup using standard p2 Operations API. It works fine and can resolve all the dependencies (like which updates are installed and which are not), if new updates are available it will download them correctly.
Currently I am implementing similar functionality of 'Check for Available New Installs' on startup using same Operations API and my code looks the following:
InstallOperation install = new InstallOperation(provisioningSession, toInstall);
IStatus status = install.resolveModal(null);
if (status.getSeverity() == IStatus.OK) {
Job job = operation.getProvisioningJob(null);
job.schedule();
}
My problem is that after I install new bundles (only visible after restart of the application) I would like to check that they are already installed, I use the standard API for that:
IProfileRegistry profileRegistry = (IProfileRegistry) provisioningAgent.getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
Collection<IInstallableUnit> alreadyInstalled = profile.available(QueryUtil.ALL_UNITS, null).toUnmodifiableSet();
But it doesn't include my newly installed bundles. Another strange observation that my application would try to install the same bundles all the time because InstallOperation resolves to OK as if those bundles were never installed (I assume that is because they are not actually included in the current profile, same result as I get when listing all installed bundles from the current profile, see code above).
So my question is why the bundles that get installed using standard p2 Operations API do not get registered as part of current profile (even though I can see they are copied and installed in my app correctly).
The Operations API:
http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_api_overview.htm
[Updated on: Mon, 18 February 2013 08:40]
Report message to a moderator