use of org.eclipse.equinox.p2.operations.Update in project knime-core by knime.
the class RepositoryUpdater method addDefaultRepositories.
/**
* Adds default KNIME repositories if they don't already exist.
*/
public void addDefaultRepositories() {
BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
ServiceReference<IProvisioningAgent> ref = context.getServiceReference(IProvisioningAgent.class);
if (ref != null) {
IProvisioningAgent agent = context.getService(ref);
try {
IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
URL usFileUrl = FrameworkUtil.getBundle(getClass()).getEntry("/update-sites.txt");
if ((metadataManager != null) && (usFileUrl != null)) {
processDefaultRepositories(metadataManager, usFileUrl);
}
} finally {
context.ungetService(ref);
}
}
}
Aggregations