use of org.eclipse.equinox.internal.p2.repository.Transport in project epp.mpc by eclipse.
the class AbstractP2TransportFactory method invokeStream.
@Override
protected InputStream invokeStream(URI location, IProgressMonitor monitor) throws Exception {
Transport repositoryTransport = getTransportService();
Method streamMethod = repositoryTransport.getClass().getMethod(STREAM_METHOD, URI.class, IProgressMonitor.class);
Object stream = streamMethod.invoke(repositoryTransport, location, monitor);
return (InputStream) stream;
}
use of org.eclipse.equinox.internal.p2.repository.Transport in project epp.mpc by eclipse.
the class Eclipse36TransportFactory method getTransportService.
@Override
protected Transport getTransportService() throws Exception {
try {
Bundle bundle = Platform.getBundle(P2_REPOSITORY_BUNDLE);
Class<?> clazz = bundle.loadClass(REPOSITORY_TRANSPORT_CLASS);
Method method = clazz.getDeclaredMethod(GET_INSTANCE_METHOD);
Object transportInstance = method.invoke(null);
return (Transport) transportInstance;
} catch (Exception e) {
return null;
}
}
use of org.eclipse.equinox.internal.p2.repository.Transport in project tycho by eclipse.
the class SiteDependenciesAction method perform.
@Override
public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) {
try {
// don't need transport to read local site.xml
Transport transport = null;
updateSite = UpdateSite.load(location.toURI(), transport, monitor);
} catch (ProvisionException e) {
return new Status(IStatus.ERROR, Activator.ID, "Error generating site xml action.", e);
}
return super.perform(publisherInfo, results, monitor);
}
use of org.eclipse.equinox.internal.p2.repository.Transport in project epp.mpc by eclipse.
the class P2TransportFactory method getTransportService.
@Override
public Transport getTransportService() throws Exception {
BundleContext bundleContext = Platform.getBundle(MarketplaceClientCore.BUNDLE_ID).getBundleContext();
ServiceReference<?> serviceReference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
if (serviceReference != null) {
IProvisioningAgent agent = (IProvisioningAgent) bundleContext.getService(serviceReference);
if (agent != null) {
return (Transport) agent.getService(getTransportServiceName());
}
}
return null;
}
use of org.eclipse.equinox.internal.p2.repository.Transport in project tycho by eclipse.
the class RemoteAgent method createConfiguredProvisioningAgent.
private static IProvisioningAgent createConfiguredProvisioningAgent(MavenContext mavenContext, boolean disableP2Mirrors, MavenRepositorySettings mavenRepositorySettings) throws ProvisionException {
// TODO set a temporary folder as persistence location
AgentBuilder agent = new AgentBuilder(Activator.newProvisioningAgent());
// suppress p2.index access
final Transport transport;
if (mavenContext.isOffline()) {
transport = new OfflineTransport();
agent.registerService(Transport.class, transport);
} else {
transport = agent.getService(Transport.class);
}
// cache indices of p2 repositories in the local Maven repository
RemoteRepositoryCacheManager cacheMgr = new RemoteRepositoryCacheManager(transport, mavenContext);
agent.registerService(CacheManager.class, cacheMgr);
if (disableP2Mirrors) {
addP2MirrorDisablingRepositoryManager(agent, mavenContext.getLogger());
}
if (mavenRepositorySettings != null) {
addMavenAwareRepositoryManagers(agent, mavenRepositorySettings, mavenContext.getLogger());
}
makeCompositeRepositoryLoadingAtomicByDefault();
return agent.getAgent();
}
Aggregations