use of org.eclipse.equinox.p2.core.IProvisioningAgentProvider in project tycho by eclipse.
the class Activator method start.
@Override
public void start(BundleContext context) throws Exception {
Activator.context = context;
ServiceReference<IProvisioningAgentProvider> providerRef = context.getServiceReference(IProvisioningAgentProvider.class);
IProvisioningAgentProvider provider = context.getService(providerRef);
// TODO this doesn't return the running agent; is this intended?
// null == currently running system
agent = provider.createAgent(null);
context.ungetService(providerRef);
}
use of org.eclipse.equinox.p2.core.IProvisioningAgentProvider 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.IProvisioningAgentProvider 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.IProvisioningAgentProvider in project tycho by eclipse.
the class Activator method createProvisioningAgent.
public static IProvisioningAgent createProvisioningAgent(final BuildOutputDirectory targetDirectory) throws FacadeException {
ServiceReference<?> serviceReference = context.getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
IProvisioningAgentProvider agentFactory = (IProvisioningAgentProvider) context.getService(serviceReference);
try {
return agentFactory.createAgent(targetDirectory.getChild("p2agent").toURI());
} catch (ProvisionException e) {
throw new FacadeException(e);
} finally {
context.ungetService(serviceReference);
}
}
use of org.eclipse.equinox.p2.core.IProvisioningAgentProvider in project tycho by eclipse.
the class Activator method createProvisioningAgent.
public static IProvisioningAgent createProvisioningAgent(final URI targetLocation) throws ProvisionException {
ServiceReference<IProvisioningAgentProvider> serviceReference = context.getServiceReference(IProvisioningAgentProvider.class);
IProvisioningAgentProvider agentFactory = context.getService(serviceReference);
try {
return agentFactory.createAgent(targetLocation);
} finally {
context.ungetService(serviceReference);
}
}
Aggregations