use of org.eclipse.equinox.p2.core.ProvisionException in project knime-core by knime.
the class InstallMissingNodesJob method findExtensions.
private IStatus findExtensions(final IProgressMonitor monitor, final List<NodeAndBundleInformation> missingNodes, final Set<IInstallableUnit> featuresToInstall) {
ProvisioningSession session = ProvisioningUI.getDefaultUI().getSession();
Bundle myself = FrameworkUtil.getBundle(getClass());
try {
IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
for (URI uri : metadataManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)) {
if (!missingNodes.isEmpty()) {
IMetadataRepository repo = metadataManager.loadRepository(uri, monitor);
for (Iterator<NodeAndBundleInformation> it = missingNodes.iterator(); it.hasNext(); ) {
NodeAndBundleInformation info = it.next();
if (searchInRepository(repo, info, metadataManager, monitor, featuresToInstall)) {
it.remove();
}
}
}
}
return Status.OK_STATUS;
} catch (ProvisionException ex) {
NodeLogger.getLogger(getClass()).error("Could not create provisioning agent: " + ex.getMessage(), ex);
return new Status(IStatus.ERROR, myself.getSymbolicName(), "Could not query updates site for missing extensions", ex);
}
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class MetadataSerializableImplTest method testSerializeAndLoad.
@Test
public void testSerializeAndLoad() throws IOException, ProvisionException, OperationCanceledException {
File tmpDir = createTempDir("repo");
try {
Set<IInstallableUnit> units = new HashSet<>(Arrays.asList(InstallableUnitUtil.createIU("org.example.test", "1.0.0")));
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 RemoteAgentCompositeLoadingTest method testLoadingCompositeRepositoryWithMissingChildFailsByDefault.
@Test
public void testLoadingCompositeRepositoryWithMissingChildFailsByDefault() throws IOException {
/*
* In Tycho, we want composite repositories to fail if they have missing children (and don't
* explicitly specify the "p2.atomic.composite.loading" property).
*/
ProvisionException expectedException = null;
try {
subject.getService(IArtifactRepositoryManager.class).loadRepository(ResourceUtil.resourceFile("repositories/composite/missingChildAndAtomicUnset").toURI(), new NullProgressMonitor());
} catch (ProvisionException e) {
expectedException = e;
}
assertThat(expectedException, not(nullValue()));
assertThat(expectedException.getStatus().getCode(), is(ProvisionException.REPOSITORY_FAILED_READ));
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class RemoteAgentMetadataRepositoryCacheTest method loadHttpRepository.
private IMetadataRepository loadHttpRepository(RemoteAgent agent) throws ProvisionException {
IMetadataRepositoryManager metadataRepositoryManager = agent.getService(IMetadataRepositoryManager.class);
IMetadataRepository repo = metadataRepositoryManager.loadRepository(localHttpRepo, null);
return repo;
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class RepositoryFactoryTools method invalidCreationLocation.
public static ProvisionException invalidCreationLocation(String repositoryType, URI location) {
String message = "Cannot create repositories of type " + repositoryType + " at location " + location;
int errorCode = ProvisionException.REPOSITORY_INVALID_LOCATION;
return new ProvisionException(new Status(IStatus.ERROR, BUNDLE_ID, errorCode, message, null));
}
Aggregations