private void initializeServices() throws ProvisionException { IProvisioningAgentProvider provider = GCActivator.getService(IProvisioningAgentProvider.class); agent = provider.createAgent(null); }
private void initializeServices() throws ProvisionException { IProvisioningAgentProvider provider = GCActivator.getService(IProvisioningAgentProvider.class); agent = provider.createAgent(null); }
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); } }
public void activateManager() throws IOException, ProvisionException { agentDir = createTempDir("tycho_reactor_agent"); agent = agentFactory.createAgent(agentDir.toURI()); }
private void initializeServices() throws ProvisionException { IProvisioningAgentProvider provider = GCActivator.getService(IProvisioningAgentProvider.class); agent = provider.createAgent(null); }
private void initializeServices() throws ProvisionException { IProvisioningAgentProvider provider = GCActivator.getService(IProvisioningAgentProvider.class); agent = provider.createAgent(null); }
/** * @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 { return agentFactory.createAgent(null); // null == currently running system } finally { context.ungetService(agentFactoryReference); } }
private IProvisioningAgent createProvisiongAgent() throws ProvisionException { IProvisioningAgent result = null; providerRef = Activator.getContext().getServiceReference(IProvisioningAgentProvider.SERVICE_NAME); if (providerRef == null) { throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ } IProvisioningAgentProvider provider = (IProvisioningAgentProvider) Activator.getContext().getService(providerRef); if (provider == null) { throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ } // obtain agent for currently running system result = provider.createAgent(null); return result; }
public IProvisioningAgent createAgent() { IProvisioningAgent agent = null; try { agent = agentProvider.createAgent(URIUtil.fromString(p2DataAreaURI)); } catch (ProvisionException e) { //Can't happen } catch (URISyntaxException e) { //Can't happen since we are always constructing the string from code that manipulate files (included the code in the Manipulator) } agent.registerService("FORCED_SELF", profileId); return agent; }
public IProvisioningAgent createAgent() { IProvisioningAgent agent = null; try { agent = agentProvider.createAgent(URIUtil.fromString(p2DataAreaURI)); } catch (ProvisionException e) { //Can't happen } catch (URISyntaxException e) { //Can't happen since we are always constructing the string from code that manipulate files (included the code in the Manipulator) } agent.registerService("FORCED_SELF", profileId); return agent; }
private void setupAgent() throws ProvisionException { agentRef = Activator.getContext().getServiceReference(IProvisioningAgent.class); if (agentRef != null) { agent = Activator.getContext().getService(agentRef); if (agent != null) return; } ServiceReference<IProvisioningAgentProvider> providerRef = Activator.getContext().getServiceReference(IProvisioningAgentProvider.class); if (providerRef == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ IProvisioningAgentProvider provider = Activator.getContext().getService(providerRef); if (provider == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ //obtain agent for currently running system agent = provider.createAgent(null); Activator.getContext().ungetService(providerRef); }
private void setupAgent() throws ProvisionException { agentRef = Activator.getContext().getServiceReference(IProvisioningAgent.class); if (agentRef != null) { agent = Activator.getContext().getService(agentRef); if (agent != null) return; } ServiceReference<IProvisioningAgentProvider> providerRef = Activator.getContext().getServiceReference(IProvisioningAgentProvider.class); if (providerRef == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ IProvisioningAgentProvider provider = Activator.getContext().getService(providerRef); if (provider == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ //obtain agent for currently running system agent = provider.createAgent(null); Activator.getContext().ungetService(providerRef); }
private void setupAgent() throws ProvisionException { agentRef = Activator.getContext().getServiceReference(IProvisioningAgent.class); if (agentRef != null) { agent = Activator.getContext().getService(agentRef); if (agent != null) return; } ServiceReference<IProvisioningAgentProvider> providerRef = Activator.getContext().getServiceReference(IProvisioningAgentProvider.class); if (providerRef == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ IProvisioningAgentProvider provider = Activator.getContext().getService(providerRef); if (provider == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ //obtain agent for currently running system agent = provider.createAgent(null); Activator.getContext().ungetService(providerRef); }
private void setupAgent() throws ProvisionException { agentRef = Activator.getContext().getServiceReference(IProvisioningAgent.class); if (agentRef != null) { agent = Activator.getContext().getService(agentRef); if (agent != null) return; } ServiceReference<IProvisioningAgentProvider> providerRef = Activator.getContext().getServiceReference(IProvisioningAgentProvider.class); if (providerRef == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ IProvisioningAgentProvider provider = Activator.getContext().getService(providerRef); if (provider == null) throw new RuntimeException("No provisioning agent provider is available"); //$NON-NLS-1$ //obtain agent for currently running system agent = provider.createAgent(null); Activator.getContext().ungetService(providerRef); }
static IProvisioningAgent getAgent() { ServiceReference<?> serviceReference = Activator.getContext() .getServiceReference(IProvisioningAgentProvider.SERVICE_NAME); IProvisioningAgentProvider agentFactory = (IProvisioningAgentProvider) Activator.getContext() .getService(serviceReference); IProvisioningAgent ourAgent; try { ourAgent = agentFactory.createAgent(null); // targetDirectory.getChild("p2agent").toURI()); } catch (ProvisionException e) { throw new StatusException("Creating an agent failed", e.getStatus()); } finally { Activator.getContext().ungetService(serviceReference); } return ourAgent; }
private void registerSharedAgent(IProvisioningAgent currentAgent, IProvisioningAgentProvider provider) { URI location = computeLocationSharedAgent(currentAgent, provider); if (location == null) { return; } IProvisioningAgent sharedAgent; try { sharedAgent = provider.createAgent(location); currentAgent.registerService(IProvisioningAgent.SHARED_BASE_AGENT, sharedAgent); sharedAgent.registerService(IProvisioningAgent.SHARED_CURRENT_AGENT, currentAgent); } catch (ProvisionException e) { final String msg = "Unable to instantiate p2 agent for shared location " + location; //$NON-NLS-1$ LogHelper.log(new Status(IStatus.WARNING, ID, msg, e)); } }
private void registerSharedAgent(IProvisioningAgent currentAgent, IProvisioningAgentProvider provider) { URI location = computeLocationSharedAgent(currentAgent, provider); if (location == null) { return; } IProvisioningAgent sharedAgent; try { sharedAgent = provider.createAgent(location); currentAgent.registerService(IProvisioningAgent.SHARED_BASE_AGENT, sharedAgent); sharedAgent.registerService(IProvisioningAgent.SHARED_CURRENT_AGENT, currentAgent); } catch (ProvisionException e) { final String msg = "Unable to instantiate p2 agent for shared location " + location; //$NON-NLS-1$ LogHelper.log(new Status(IStatus.WARNING, ID, msg, e)); } }
private void registerSharedAgent(IProvisioningAgent currentAgent, IProvisioningAgentProvider provider) { URI location = computeLocationSharedAgent(currentAgent, provider); if (location == null) { return; } IProvisioningAgent sharedAgent; try { sharedAgent = provider.createAgent(location); currentAgent.registerService(IProvisioningAgent.SHARED_BASE_AGENT, sharedAgent); sharedAgent.registerService(IProvisioningAgent.SHARED_CURRENT_AGENT, currentAgent); } catch (ProvisionException e) { final String msg = "Unable to instantiate p2 agent for shared location " + location; //$NON-NLS-1$ LogHelper.log(new Status(IStatus.WARNING, ID, msg, e)); } }
private void registerSharedAgent(IProvisioningAgent currentAgent, IProvisioningAgentProvider provider) { URI location = computeLocationSharedAgent(currentAgent, provider); if (location == null) { return; } IProvisioningAgent sharedAgent; try { sharedAgent = provider.createAgent(location); currentAgent.registerService(IProvisioningAgent.SHARED_BASE_AGENT, sharedAgent); sharedAgent.registerService(IProvisioningAgent.SHARED_CURRENT_AGENT, currentAgent); } catch (ProvisionException e) { final String msg = "Unable to instantiate p2 agent for shared location " + location; //$NON-NLS-1$ LogHelper.log(new Status(IStatus.WARNING, ID, msg, e)); } }
/** * Register the agent instance representing the currently running system. * This will be the "default" agent for anyone not specifically trying to manipulate * a different p2 agent location */ private void registerAgent() { //no need to register an agent if there is no agent location if (agentDataLocation == null) return; ServiceReference<IProvisioningAgentProvider> agentProviderRef = context.getServiceReference(IProvisioningAgentProvider.class); IProvisioningAgentProvider provider = null; if (agentProviderRef != null) provider = context.getService(agentProviderRef); if (provider == null) { // If we don't have a provider, which could happen if the p2.core bundle is // eagerly started, we should create one. provider = new DefaultAgentProvider(); ((DefaultAgentProvider) provider).activate(context); } try { agent = provider.createAgent(null); } catch (Exception e) { final String msg = "Unable to instantiate p2 agent at location " + agentDataLocation.getRootLocation(); //$NON-NLS-1$ LogHelper.log(new Status(IStatus.ERROR, ID, msg, e)); } registerSharedAgent(agent, provider); }