private void removeFromRepoManager(List<URI> currentLoadedRepositories) { if (currentLoadedRepositories == null) return; for (URI loadedChild : currentLoadedRepositories) { manager.removeRepository(loadedChild); } }
private void removeFromRepoManager(List<URI> currentLoadedRepositories) { if (currentLoadedRepositories == null) return; for (URI loadedChild : currentLoadedRepositories) { manager.removeRepository(loadedChild); } }
private void removeFromRepoManager(List<URI> currentLoadedRepositories) { if (currentLoadedRepositories == null) return; for (URI loadedChild : currentLoadedRepositories) { manager.removeRepository(loadedChild); } }
@Override public boolean removeRepository(URI location) { return delegate.removeRepository(location); }
private void removeFromRepoManager(List<URI> currentLoadedRepositories) { if (currentLoadedRepositories == null) return; for (URI loadedChild : currentLoadedRepositories) { manager.removeRepository(loadedChild); } }
static void removeArtifactRepository(IProvisioningAgent agent, URI location) { IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) // TODO log here return; manager.removeRepository(location); }
@Override public boolean removeRepository(URI location) { return delegate.removeRepository(translate(location)); }
public void removeArtifactRepository(String urlString) { IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) throw new IllegalStateException(Messages.artifact_repo_manager_not_registered); try { manager.removeRepository(new URI(urlString)); } catch (URISyntaxException e) { LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error occurred while creating URL from: " + urlString, e)); //$NON-NLS-1$ } }
/** * Create a Composite repository in memory. * @return the repository or null if unable to create one */ public static CompositeArtifactRepository createMemoryComposite(IProvisioningAgent agent) { if (agent == null) return null; IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) return null; try { //create a unique URI long time = System.currentTimeMillis(); URI repositoryURI = new URI("memory:" + String.valueOf(time)); //$NON-NLS-1$ while (manager.contains(repositoryURI)) repositoryURI = new URI("memory:" + String.valueOf(++time)); //$NON-NLS-1$ CompositeArtifactRepository result = (CompositeArtifactRepository) manager.createRepository(repositoryURI, repositoryURI.toString(), IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, null); manager.removeRepository(repositoryURI); return result; } catch (ProvisionException e) { LogHelper.log(e); // just return null } catch (URISyntaxException e) { // just return null } return null; }
/** * Create a Composite repository in memory. * @return the repository or null if unable to create one */ public static CompositeArtifactRepository createMemoryComposite(IProvisioningAgent agent) { if (agent == null) return null; IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) return null; try { //create a unique URI long time = System.currentTimeMillis(); URI repositoryURI = new URI("memory:" + String.valueOf(time)); //$NON-NLS-1$ while (manager.contains(repositoryURI)) repositoryURI = new URI("memory:" + String.valueOf(++time)); //$NON-NLS-1$ CompositeArtifactRepository result = (CompositeArtifactRepository) manager.createRepository(repositoryURI, repositoryURI.toString(), IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, null); manager.removeRepository(repositoryURI); return result; } catch (ProvisionException e) { LogHelper.log(e); // just return null } catch (URISyntaxException e) { // just return null } return null; }
/** * Create a Composite repository in memory. * @return the repository or null if unable to create one */ public static CompositeArtifactRepository createMemoryComposite(IProvisioningAgent agent) { if (agent == null) return null; IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) return null; try { //create a unique URI long time = System.currentTimeMillis(); URI repositoryURI = new URI("memory:" + String.valueOf(time)); //$NON-NLS-1$ while (manager.contains(repositoryURI)) repositoryURI = new URI("memory:" + String.valueOf(++time)); //$NON-NLS-1$ CompositeArtifactRepository result = (CompositeArtifactRepository) manager.createRepository(repositoryURI, repositoryURI.toString(), IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, null); manager.removeRepository(repositoryURI); return result; } catch (ProvisionException e) { LogHelper.log(e); // just return null } catch (URISyntaxException e) { // just return null } return null; }
/** * Load an artifact repository from the given location. * @param location the URI location of the repository * @param modifiable whether to ask the manager for a modifiable repository * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded * @return the loaded repository * @throws ProvisionException */ public static IArtifactRepository loadArtifactRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); IArtifactRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; }
/** * Load an artifact repository from the given location. * @param location the URI location of the repository * @param modifiable whether to ask the manager for a modifiable repository * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded * @return the loaded repository * @throws ProvisionException */ public static IArtifactRepository loadArtifactRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); IArtifactRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; }
/** * Load an artifact repository from the given location. * @param location the URI location of the repository * @param modifiable whether to ask the manager for a modifiable repository * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded * @return the loaded repository * @throws ProvisionException */ public static IArtifactRepository loadArtifactRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); IArtifactRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; }
private void removeRepos() { IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.SERVICE_NAME); IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (metaManager != null && artifactManager != null) { for (int i = 0; i < addedRepos.size(); i++) { metaManager.removeRepository(reposToMigrate[i]); artifactManager.removeRepository(reposToMigrate[i]); } } }
/** * Load an artifact repository from the given location. * @param location the URI location of the repository * @param modifiable whether to ask the manager for a modifiable repository * @param removeFromManager remove the loaded repository from the manager if it wasn't already loaded * @return the loaded repository * @throws ProvisionException */ public static IArtifactRepository loadArtifactRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager) throws ProvisionException { IArtifactRepositoryManager manager = getService(agent, IArtifactRepositoryManager.SERVICE_NAME); boolean existing = manager.contains(location); IArtifactRepository result = manager.loadRepository(location, modifiable ? IRepositoryManager.REPOSITORY_HINT_MODIFIABLE : 0, null); if (!existing && removeFromManager) manager.removeRepository(location); return result; }
/** * Removes repositories from fragments locations as they might be obsolete and adds them back. */ private void setUpRepos() { //clean old junk IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); URI[] knownRepositories = metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL); for (URI uri : knownRepositories) { if ("true".equals(metaManager.getRepositoryProperty(uri, EngineActivator.P2_FRAGMENT_PROPERTY))) { //$NON-NLS-1$ metaManager.removeRepository(uri); } } IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); knownRepositories = artifactManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL); for (URI uri : knownRepositories) { if ("true".equals(artifactManager.getRepositoryProperty(uri, EngineActivator.P2_FRAGMENT_PROPERTY))) { //$NON-NLS-1$ artifactManager.removeRepository(uri); } } File[] fragments = EngineActivator.getExtensionsDirectories(); for (File f : fragments) { metaManager.addRepository(f.toURI()); metaManager.setRepositoryProperty(f.toURI(), EngineActivator.P2_FRAGMENT_PROPERTY, Boolean.TRUE.toString()); artifactManager.addRepository(f.toURI()); artifactManager.setRepositoryProperty(f.toURI(), EngineActivator.P2_FRAGMENT_PROPERTY, Boolean.TRUE.toString()); } }
/** * Removes repositories from fragments locations as they might be obsolete and adds them back. */ private void setUpRepos() { //clean old junk IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); URI[] knownRepositories = metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL); for (URI uri : knownRepositories) { if ("true".equals(metaManager.getRepositoryProperty(uri, EngineActivator.P2_FRAGMENT_PROPERTY))) { //$NON-NLS-1$ metaManager.removeRepository(uri); } } IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); knownRepositories = artifactManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL); for (URI uri : knownRepositories) { if ("true".equals(artifactManager.getRepositoryProperty(uri, EngineActivator.P2_FRAGMENT_PROPERTY))) { //$NON-NLS-1$ artifactManager.removeRepository(uri); } } File[] fragments = EngineActivator.getExtensionsDirectories(); for (File f : fragments) { metaManager.addRepository(f.toURI()); metaManager.setRepositoryProperty(f.toURI(), EngineActivator.P2_FRAGMENT_PROPERTY, Boolean.TRUE.toString()); artifactManager.addRepository(f.toURI()); artifactManager.setRepositoryProperty(f.toURI(), EngineActivator.P2_FRAGMENT_PROPERTY, Boolean.TRUE.toString()); } }
public void removeRepositories(URI[] repoLocations, ProvisioningSession session) { ui.signalRepositoryOperationStart(); try { for (int i = 0; i < repoLocations.length; i++) { getMetadataRepositoryManager().removeRepository(repoLocations[i]); getArtifactRepositoryManager().removeRepository(repoLocations[i]); } } finally { ui.signalRepositoryOperationComplete(null, true); } }
public void cleanLocalRepository() { if (metaURIs != null && metaURIs.length > 0) { IProvisioningAgent runningAgent = getProvisioningUI().getSession().getProvisioningAgent(); IMetadataRepositoryManager manager = (IMetadataRepositoryManager) runningAgent.getService(IMetadataRepositoryManager.SERVICE_NAME); for (URI uri : metaURIs) manager.removeRepository(uri); IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) runningAgent.getService(IArtifactRepositoryManager.SERVICE_NAME); for (URI uri : artiURIs) artifactManager.removeRepository(uri); } }