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; }
/** * Returns whether a profile with the given ID exists in a profile registry * stored in the give p2 data area. * * @param profileID id of the profile to check * @param p2DataArea data area where the profile registry is * @return whether the profile exists */ public static boolean profileExists(String profileID, File p2DataArea) throws CoreException { IProvisioningAgentProvider provider = (IProvisioningAgentProvider) PDECore.getDefault().acquireService(IProvisioningAgentProvider.SERVICE_NAME); if (provider == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.P2Utils_UnableToAcquireP2Service)); } IProvisioningAgent agent = provider.createAgent(p2DataArea.toURI()); if (agent == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.P2Utils_UnableToAcquireP2Service)); } IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); if (registry == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.P2Utils_UnableToAcquireP2Service)); } return registry.containsProfile(profileID); }
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); }
throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.IUBundleContainer_7)); IProvisioningAgent agent = provider.createAgent(AGENT_LOCATION); if (agent == null) { throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, Messages.IUBundleContainer_7));
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)); } }