use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class Activator method createProvisioningAgent.
public static IProvisioningAgent createProvisioningAgent(final URI targetLocation) throws ProvisionException {
if (targetLocation == null)
throw new IllegalArgumentException("Creating the default agent is not supported");
BundleContext context = getContext();
ServiceReference<IProvisioningAgentProvider> agentFactoryReference = context.getServiceReference(IProvisioningAgentProvider.class);
IProvisioningAgentProvider agentFactory = context.getService(agentFactoryReference);
try {
return agentFactory.createAgent(targetLocation);
} finally {
context.ungetService(agentFactoryReference);
}
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class Activator method newProvisioningAgent.
/**
* @deprecated This method potentially creates multiple agent instances with the default
* location. This leads to concurrent file system access with undefined outcome.
*/
@Deprecated
public static IProvisioningAgent newProvisioningAgent() throws ProvisionException {
BundleContext context = getContext();
ServiceReference<IProvisioningAgentProvider> agentFactoryReference = context.getServiceReference(IProvisioningAgentProvider.class);
IProvisioningAgentProvider agentFactory = context.getService(agentFactoryReference);
try {
// null == currently running system
return agentFactory.createAgent(null);
} finally {
context.ungetService(agentFactoryReference);
}
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class P2ResolverFactoryImpl method getTargetPlatformFactory.
@Override
public TargetPlatformFactoryImpl getTargetPlatformFactory() {
try {
// TODO don't synchronize twice
LocalMetadataRepository localMetadataRepo = getLocalMetadataRepository(mavenContext, localRepoIndices);
LocalArtifactRepository localArtifactRepo = getLocalArtifactRepository(mavenContext, localRepoIndices);
return new TargetPlatformFactoryImpl(mavenContext, remoteAgentManager.getProvisioningAgent(), localArtifactRepo, localMetadataRepo, targetDefinitionResolverService);
} catch (ProvisionException e) {
throw new RuntimeException(e);
}
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class DependencyCollector method resolve.
@Override
public Collection<IInstallableUnit> resolve(Map<String, String> properties, IProgressMonitor monitor) {
Set<IInstallableUnit> result = new LinkedHashSet<>();
LinkedHashSet<IStatus> errors = new LinkedHashSet<>();
if (logger.isExtendedDebugEnabled()) {
logger.debug("Available IUs:\n" + ResolverDebugUtils.toDebugString(data.getAvailableIUs(), false));
logger.debug("Root IUs:\n" + ResolverDebugUtils.toDebugString(data.getRootIUs(), true));
}
result.addAll(data.getRootIUs());
QueryableCollection availableUIsQueryable = new QueryableCollection(data.getAvailableIUs());
for (IInstallableUnit iu : data.getRootIUs()) {
collectIncludedIUs(availableUIsQueryable, result, errors, iu, true, monitor);
}
if (logger.isExtendedDebugEnabled()) {
logger.debug("Collected IUs:\n" + ResolverDebugUtils.toDebugString(result, false));
}
if (!errors.isEmpty()) {
MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, 0, errors.toArray(new IStatus[errors.size()]), "Missing dependencies", null);
throw new RuntimeException(status.toString(), new ProvisionException(status));
}
return result;
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class P2MirrorDisablingArtifactRepositoryManager method createRepository.
// disable mirrors in returned repositories
@Override
public IArtifactRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
IArtifactRepository repository = delegate.createRepository(location, name, type, properties);
disableMirrors(repository, mavenLogger);
return repository;
}
Aggregations