[p2] updateOperation returns null as ProvisioningPlan and ProvisioningJob [message #1690210] |
Wed, 25 March 2015 17:01 |
Thomas Elskens Messages: 159 Registered: September 2014 Location: Brussels - Belgium |
Senior Member |
|
|
Hello,
I was trying out a very basic self-update for an RCP application, but I'm really stuck.
In two words : when I try to resolve the updateOperation, both the getProvisioningPlan() and getProvisioningJob return null.
When I ask for the details of the resolving of the UpdateOperation, I get nothing more than the following message:
Quote:Your original request has been modified. Unexpected error. Could not process the request. Check the error log for details.
I've already spent two afternoons just finding out how to retrieve this error log, not to speak about the rest
My code (simplified) :
static final String REPOSITORY_LOC = "file:///C:/data/buildtest/target/repository" ;
private IProvisioningAgent agent ;
private UpdateOperation operation ;
private URI uri = null ;
@Inject
public UpdateManager(IProvisioningAgentProvider provider, LoggerFactory loggerFactory)
{
//...
uri = new URI(REPOSITORY_LOC) ;
agent = provider.createAgent(uri) ;
//...
}
public void update(LifecycleRV rv) throws InterruptedException
{
UpdateStatus preparationStatus = prepareUpdateJob() ;
UpdateStatus finalStatus ;
//...
finalStatus = doUpdateJob() ;
//...
}
private UpdateStatus prepareUpdateJob()
{
//...
operation = initOperation() ;
IStatus check = operation.resolveModal(null) ;
logger.debug(String.format("updateOperation resolved with details : %s", operation.getResolutionDetails()));
IProvisioningPlan plan = operation.getProvisioningPlan() ;
if (plan == null)
logger.error("Provisioningplan null") ;
//...
}
private UpdateOperation initOperation()
{
ProvisioningSession session = new ProvisioningSession(agent);
UpdateOperation result = new UpdateOperation(session);
result.getProvisioningContext().setArtifactRepositories(new URI[] { uri });
result.getProvisioningContext().setMetadataRepositories(new URI[] { uri });
return result ;
}
private UpdateStatus doUpdateJob()
{
if (operation == null)
return UpdateStatus.UPDATE_NOK ;
ProvisioningJob job = operation.getProvisioningJob(null);
if (job == null)
return UpdateStatus.UPDATE_NOK;
IStatus status = job.runModal(null) ;
//...
}
The plugins manifest contains the following required bundles :
org.eclipse.equinox.p2.core;bundle-version="2.4.0",
org.eclipse.equinox.p2.engine;bundle-version="2.3.0",
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.2.100",
org.eclipse.equinox.p2.operations;bundle-version="2.4.0"
The product file contains the following feature:
<feature id="org.eclipse.equinox.p2.core.feature" version="1.3.0.v20150126-1400"/>
I really have no idea how to make this work. Anybody any ideas ... ?
Thomas Elskens
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01994 seconds