org.eclipse.equinox.p2.core.ProvisionException Java Examples

The following examples show how to use org.eclipse.equinox.p2.core.ProvisionException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstallWizardOpener.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public void open(Map<String, Set<String>> features, IProgressMonitor monitor) {
	try {
		IProvisioningAgent agent = agentProvider.get();
		IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent
				.getService(IMetadataRepositoryManager.SERVICE_NAME);

		Set<IInstallableUnit> units = collectIUs(features, manager, monitor);
		if (monitor.isCanceled())
			return;

		List<URI> knownRepos = Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL));
		InstallOperation op = new OperationFactory().createInstallOperation(units, knownRepos, monitor);
		agent.stop();

		open(units, op);
	} catch (ProvisionException e) {
		e.printStackTrace();
	}
}
 
Example #2
Source File: InstallationChecker.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public boolean isFeatureInstalled(String featureId) {
	try {
		IProvisioningAgent agent = agentProvider.get();
		IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
		IProfile selfProfile = profileRegistry.getProfile(IProfileRegistry.SELF);
		if(selfProfile == null)
			return true;
		Set<IInstallableUnit> installed = selfProfile
				.available(QueryUtil.createIUQuery(featureId), new NullProgressMonitor()).toUnmodifiableSet();
		agent.stop();
		return !installed.isEmpty();
	} catch (ProvisionException e) {
		e.printStackTrace();
	}
	return false;
}
 
Example #3
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public static IProvisioningAgent getAgent ( final URI location ) throws ProvisionException
{
    final IProvisioningAgentProvider provider = INSTANCE.tracker.getService ();
    if ( provider == null )
    {
        throw new IllegalStateException ( "Provisioning agent provider not found. Is P2 started?" );
    }

    return provider.createAgent ( location );
}
 
Example #4
Source File: Processor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void processInternal ( final IProgressMonitor pm ) throws ProvisionException, Exception
{
    this.output.mkdirs ();

    System.out.println ( "Loading metadata..." );
    this.metaRepo = this.metaManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "Loading artifacts..." );
    this.artRepo = this.artManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "done!" );

    for ( final URI uri : this.validationRepositoryUris )
    {
        System.out.format ( "Loading validation repository: %s%n", uri );
        final IMetadataRepository repo = this.metaManager.loadRepository ( uri, pm );
        this.validationRepositories.put ( uri, repo );
        System.out.println ( "Done!" );
    }

    final IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery ();
    final IQueryResult<IInstallableUnit> result = this.metaRepo.query ( query, pm );

    for ( final IInstallableUnit iu : result )
    {
        processUnit ( iu, pm );
    }

    writeUploadScript ();

    for ( final Map.Entry<MavenReference, Set<String>> entry : this.metadata.entrySet () )
    {
        writeMetaData ( entry.getKey (), entry.getValue () );
    }
}
 
Example #5
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public static IProvisioningAgent getAgent ( final URI location ) throws ProvisionException
{
    final IProvisioningAgentProvider provider = INSTANCE.tracker.getService ();
    if ( provider == null )
    {
        throw new IllegalStateException ( "Provisioning agent provider not found. Is P2 started?" );
    }

    return provider.createAgent ( location );
}
 
Example #6
Source File: ProvisioningAgentProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
public IProvisioningAgent get() throws ProvisionException {
	ServiceReference sr = getContext().getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
	if (sr == null) {
		throw new ProvisionException("No service reference found for " + IProvisioningAgentProvider.SERVICE_NAME);
	}
	IProvisioningAgentProvider agentProvider = (IProvisioningAgentProvider) getContext().getService(sr);
	return agentProvider.createAgent(null);
}