Search in sources :

Example 1 with IProvisioningAgentProvider

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);
}
Also used : IProvisioningAgentProvider(org.eclipse.equinox.p2.core.IProvisioningAgentProvider)

Example 2 with IProvisioningAgentProvider

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);
    }
}
Also used : IProvisioningAgentProvider(org.eclipse.equinox.p2.core.IProvisioningAgentProvider) BundleContext(org.osgi.framework.BundleContext)

Example 3 with IProvisioningAgentProvider

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);
    }
}
Also used : IProvisioningAgentProvider(org.eclipse.equinox.p2.core.IProvisioningAgentProvider) BundleContext(org.osgi.framework.BundleContext)

Example 4 with IProvisioningAgentProvider

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);
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) IProvisioningAgentProvider(org.eclipse.equinox.p2.core.IProvisioningAgentProvider)

Example 5 with IProvisioningAgentProvider

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);
    }
}
Also used : IProvisioningAgentProvider(org.eclipse.equinox.p2.core.IProvisioningAgentProvider)

Aggregations

IProvisioningAgentProvider (org.eclipse.equinox.p2.core.IProvisioningAgentProvider)5 BundleContext (org.osgi.framework.BundleContext)2 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)1 FacadeException (org.eclipse.tycho.p2.tools.FacadeException)1