use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class MetadataSerializableImplTest method deserialize.
private Set<IInstallableUnit> deserialize(File tmpDir) throws ProvisionException {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
IMetadataRepository repository = manager.loadRepository(tmpDir.toURI(), null);
IQueryResult<IInstallableUnit> queryResult = repository.query(QueryUtil.ALL_UNITS, null);
Set<IInstallableUnit> result = queryResult.toSet();
return result;
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class MetadataSerializableImplTest method testSerializeAndLoadWithEmptyIUList.
@Test
public void testSerializeAndLoadWithEmptyIUList() throws IOException, ProvisionException, OperationCanceledException {
File tmpDir = createTempDir("repo");
try {
Set<IInstallableUnit> units = new HashSet<>();
MetadataSerializableImpl subject = new MetadataSerializableImpl();
serialize(subject, units, tmpDir);
Assert.assertEquals(units, deserialize(tmpDir));
} finally {
deleteRecursive(tmpDir);
}
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class P2MirrorDisablingArtifactRepositoryManager method loadRepository.
@Override
public IArtifactRepository loadRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
IArtifactRepository repository = delegate.loadRepository(location, monitor);
disableMirrors(repository, mavenLogger);
return repository;
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class FeatureRootfileArtifactRepository method createRootfileOutputStream.
private OutputStream createRootfileOutputStream(IArtifactKey artifactKey) throws ProvisionException, IOException {
File outputFile = new File(this.outputDirectory, artifactKey.getId() + "-" + artifactKey.getVersion() + "-" + ROOTFILE_CLASSIFIER + "." + ROOTFILE_EXTENSION);
OutputStream target = null;
try {
SimpleArtifactDescriptor simpleArtifactDescriptor = (SimpleArtifactDescriptor) createArtifactDescriptor(artifactKey);
Collection<IPropertyAdvice> advices = publisherInfo.getAdvice(null, false, simpleArtifactDescriptor.getArtifactKey().getId(), simpleArtifactDescriptor.getArtifactKey().getVersion(), IPropertyAdvice.class);
boolean mavenPropAdviceExists = false;
for (IPropertyAdvice entry : advices) {
if (entry instanceof MavenPropertiesAdvice) {
mavenPropAdviceExists = true;
entry.getArtifactProperties(null, simpleArtifactDescriptor);
}
}
if (!mavenPropAdviceExists) {
throw new ProvisionException("MavenPropertiesAdvice does not exist for artifact: " + simpleArtifactDescriptor);
}
String mavenArtifactClassifier = getRootFileArtifactClassifier(simpleArtifactDescriptor.getArtifactKey().getId());
simpleArtifactDescriptor.setProperty(RepositoryLayoutHelper.PROP_CLASSIFIER, mavenArtifactClassifier);
simpleArtifactDescriptor.setProperty(RepositoryLayoutHelper.PROP_EXTENSION, ROOTFILE_EXTENSION);
target = new BufferedOutputStream(new FileOutputStream(outputFile));
this.publishedArtifacts.put(mavenArtifactClassifier, new P2Artifact(outputFile, Collections.<IInstallableUnit>emptySet(), simpleArtifactDescriptor));
descriptors.add(simpleArtifactDescriptor);
} catch (FileNotFoundException e) {
throw new ProvisionException(e.getMessage(), e);
}
return target;
}
use of org.eclipse.equinox.p2.core.ProvisionException in project gemoc-studio by eclipse.
the class PrepareInstallProfileJob method addRepositories.
private List<IMetadataRepository> addRepositories(SubMonitor monitor) throws MalformedURLException, URISyntaxException, ProvisionException {
// tell p2 that it's okay to use these repositories
ProvisioningSession session = ProvisioningUI.getDefaultUI().getSession();
RepositoryTracker repositoryTracker = ProvisioningUI.getDefaultUI().getRepositoryTracker();
repositoryLocations = new HashSet<URI>();
monitor.setWorkRemaining(installableConnectors.size() * 5);
for (InstallableComponent descriptor : installableConnectors) {
for (String url : descriptor.getSitesURLS()) {
addASiteURL(monitor, session, repositoryTracker, url);
}
}
// fetch meta-data for these repositories
ArrayList<IMetadataRepository> repositories = new ArrayList<IMetadataRepository>();
monitor.setWorkRemaining(repositories.size());
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
for (URI uri : repositoryLocations) {
checkCancelled(monitor);
IMetadataRepository repository = manager.loadRepository(uri, monitor.newChild(1));
repositories.add(repository);
}
return repositories;
}
Aggregations