I have to work with an already existing Eclipse RAP application which contains of two features and around 40 dependencies.
Since the Eclipse RAP doesn't have a preStartup()
method I call the update procedure in the RAP's start()
method:
public class MyApplication implements IApplication
{
@Override
public Object start( IApplicationContext context ) throws Exception
{
P2Util.update();
...
}
}
The IProvisioningAgent
is not null, the IMetadataRepositoryManager
and IArtifactRepositoryManager
are correctly initialized.
public static boolean configureRepository( IProvisioningAgent agent )
{
String repo = "file:///c:/export/repository/"; // TODO HERE!
log.debug( "Initiliazing Repository Managers" );
IMetadataRepositoryManager metadataManager = ( IMetadataRepositoryManager ) agent.getService( IMetadataRepositoryManager.SERVICE_NAME );
IArtifactRepositoryManager artifactManager = ( IArtifactRepositoryManager ) agent.getService( IArtifactRepositoryManager.SERVICE_NAME );
URI uri;
try
{
uri = new URI( repo );
}
catch ( URISyntaxException e1 )
{
log.error( "Unexpected URISyntaxException, the specified path is not a valid URI", e1 ); //$NON-NLS-1$
return false;
}
if ( metadataManager == null )
{
log.error( "IMetadataRepositoryManager instance is null!" );
return false;
}
metadataManager.addRepository( uri );
log.debug( "Added repository to MetadataManager: " + repo );
if ( artifactManager == null )
{
log.error( "IArtifactRepositoryManager instance is null!" );
return false;
}
artifactManager.addRepository( uri );
log.debug( "Added repository to ArtifactManager: " + repo );
return true;
}
Still one problem occurs all the time after I call checkForUpdates()
.
public static IStatus checkForUpdates( IProvisioningAgent agent ) throws OperationCanceledException
{
log.info( "Checking for new updates in repository" );
ProvisioningSession session = new ProvisioningSession( agent );
UpdateOperation operation = new UpdateOperation( session );
IStatus status = operation.resolveModal( new NullProgressMonitor() );
return status;
}
It returns the following status:
Status OK: org.eclipse.equinox.p2.operations code=10001 Your original request has been modified. null children=[]
I have already checked the flag "Support software installation in the launched application" in my run configuration, the problem persists.