@Override public void setRepositoryProperty(URI location, String key, String value) { delegate.setRepositoryProperty(location, key, value); }
@Override public void setRepositoryProperty(URI location, String key, String value) { delegate.setRepositoryProperty(translate(location), key, value); }
/** * Helper method to load an extension location metadata repository from the given URL. * * @throws IllegalStateException * @throws ProvisionException */ public static IArtifactRepository loadArtifactRepository(URI location, IProgressMonitor monitor) throws ProvisionException { IArtifactRepositoryManager manager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) throw new IllegalStateException("ArtifactRepositoryManager not registered."); //$NON-NLS-1$ IArtifactRepository repository = manager.loadRepository(location, monitor); manager.setRepositoryProperty(location, IRepository.PROP_SYSTEM, String.valueOf(true)); return repository; }
/** * Helper method to create an extension location artifact repository at the given URL. * If one already exists at that location then an exception will be thrown. * * This method never returns <code>null</code>. * * @throws IllegalStateException * @throws ProvisionException */ public static IArtifactRepository createExtensionLocationArtifactRepository(URI location, String name, Map<String, String> properties) throws ProvisionException { IProvisioningAgent agent = getAgent(); IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) throw new IllegalStateException("ArtifactRepositoryManager not registered."); //$NON-NLS-1$ ExtensionLocationArtifactRepositoryFactory factory = new ExtensionLocationArtifactRepositoryFactory(); factory.setAgent(agent); // always compress repositories that we are creating. Map<String, String> repositoryProperties = new HashMap<String, String>(); repositoryProperties.put(IRepository.PROP_COMPRESSED, Boolean.TRUE.toString()); if (properties != null) repositoryProperties.putAll(properties); IArtifactRepository repository = factory.create(location, name, ExtensionLocationArtifactRepository.TYPE, repositoryProperties); //we need to add the concrete repository to the repository manager, or its properties will not be correct ((ArtifactRepositoryManager) manager).addRepository(repository); manager.setRepositoryProperty(location, IRepository.PROP_SYSTEM, String.valueOf(true)); return repository; }
/** * 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); } }
private IArtifactRepository load(URI repoURI, IProgressMonitor monitor) throws ProvisionException { // make sure we are dealing with an absolute location repoURI = URIUtil.makeAbsolute(repoURI, getLocation()); boolean loaded = getManager().contains(repoURI); IArtifactRepository repo = getManager().loadRepository(repoURI, monitor); if (!loaded) { //set enabled to false so repositories do not get polled twice getManager().setEnabled(repoURI, false); //set repository to system to hide from users getManager().setRepositoryProperty(repoURI, IRepository.PROP_SYSTEM, String.valueOf(true)); } return repo; }
private IArtifactRepository load(URI repoURI, IProgressMonitor monitor) throws ProvisionException { // make sure we are dealing with an absolute location repoURI = URIUtil.makeAbsolute(repoURI, getLocation()); boolean loaded = getManager().contains(repoURI); IArtifactRepository repo = getManager().loadRepository(repoURI, monitor); if (!loaded) { //set enabled to false so repositories do not get polled twice getManager().setEnabled(repoURI, false); //set repository to system to hide from users getManager().setRepositoryProperty(repoURI, IRepository.PROP_SYSTEM, String.valueOf(true)); } return repo; }
private IArtifactRepository load(URI repoURI, IProgressMonitor monitor) throws ProvisionException { // make sure we are dealing with an absolute location repoURI = URIUtil.makeAbsolute(repoURI, getLocation()); boolean loaded = getManager().contains(repoURI); IArtifactRepository repo = getManager().loadRepository(repoURI, monitor); if (!loaded) { //set enabled to false so repositories do not get polled twice getManager().setEnabled(repoURI, false); //set repository to system to hide from users getManager().setRepositoryProperty(repoURI, IRepository.PROP_SYSTEM, String.valueOf(true)); } return repo; }
private IArtifactRepository load(URI repoURI, IProgressMonitor monitor) throws ProvisionException { // make sure we are dealing with an absolute location repoURI = URIUtil.makeAbsolute(repoURI, getLocation()); boolean loaded = getManager().contains(repoURI); IArtifactRepository repo = getManager().loadRepository(repoURI, monitor); if (!loaded) { //set enabled to false so repositories do not get polled twice getManager().setEnabled(repoURI, false); //set repository to system to hide from users getManager().setRepositoryProperty(repoURI, IRepository.PROP_SYSTEM, String.valueOf(true)); } return repo; }
name = manager.getRepositoryProperty(location, IRepository.PROP_NAME); if (name != null) manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
if (name != null && name.length() > 0) { metaManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name); artManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);