@Override public void addRepository(URI location) { delegate.addRepository(location); }
@Override public void addRepository(URI location) { delegate.addRepository(translate(location)); }
private void addRepos() { 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); List<URI> currentMetaRepos = Arrays.asList(metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)); if (reposToMigrate != null && metaManager != null && artifactManager != null) { for (int i = 0; i < reposToMigrate.length; i++) { if (!currentMetaRepos.contains(reposToMigrate[i])) { metaManager.addRepository(reposToMigrate[i]); artifactManager.addRepository(reposToMigrate[i]); addedRepos.add(reposToMigrate[i]); } } } }
/** * 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 addRepository(URI repoLocation, String nickname, ProvisioningSession session) { ui.signalRepositoryOperationStart(); try { getMetadataRepositoryManager().addRepository(repoLocation); getArtifactRepositoryManager().addRepository(repoLocation); getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_SYSTEM, Boolean.FALSE.toString()); getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_SYSTEM, Boolean.FALSE.toString()); if (nickname != null) { getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname); getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname); } } finally { // We know that the UI only responds to metadata repo events so we cheat... ui.signalRepositoryOperationComplete(new RepositoryEvent(repoLocation, IRepository.TYPE_METADATA, RepositoryEvent.ADDED, true), true); } }
ProvUI.getArtifactRepositoryManager(ui.getSession()).addRepository(location);
artManager.addRepository(location); artManager.addRepository(location); setColocatedRepositoryEnablement(ui, location, false);