/** * Determine if the repository could be used as a valid destination (eg, it is modifiable) * @param repository the repository to test * @return the repository */ public static <T> IRepository<T> validDestinationRepository(IRepository<T> repository) { if (!repository.isModifiable()) throw new IllegalStateException(NLS.bind(Messages.DestinationNotModifiable, repository.getLocation())); return repository; }
/** * Determine if the repository could be used as a valid destination (eg, it is modifiable) * @param repository the repository to test * @return the repository */ public static <T> IRepository<T> validDestinationRepository(IRepository<T> repository) { if (!repository.isModifiable()) throw new IllegalStateException(NLS.bind(Messages.DestinationNotModifiable, repository.getLocation())); return repository; }
@Override public String getText( Object element ) { if ( element instanceof IRepository<?> ) { String prefix = ""; if ( element instanceof UpdateSiteMetadataRepository || element instanceof UpdateSiteArtifactRepository ) { prefix = "[PRE-P2 COMPAT] "; } return prefix + ( (IRepository<?>) element ).getLocation().toString(); } return super.getText( element ); }
/** * Constructs a mirror support class for the given repository. Mirrors are * not contacted and the mirrorsURL document is not parsed until a * mirror location request is sent. */ public MirrorSelector(IRepository<?> repository, Transport transport) { this.repository = repository; this.transport = transport; try { String base = repository.getProperties().get(IRepository.PROP_MIRRORS_BASE_URL); if (base != null) { this.baseURI = new URI(base); } else { URI repositoryLocation = repository.getLocation(); if (repositoryLocation != null) this.baseURI = repositoryLocation; } } catch (URISyntaxException e) { log("Error initializing mirrors for: " + repository.getLocation(), e); //$NON-NLS-1$ } }
/** * Constructs a mirror support class for the given repository. Mirrors are * not contacted and the mirrorsURL document is not parsed until a * mirror location request is sent. */ public MirrorSelector(IRepository<?> repository, Transport transport) { this.repository = repository; this.transport = transport; try { String base = repository.getProperties().get(IRepository.PROP_MIRRORS_BASE_URL); if (base != null) { this.baseURI = new URI(base); } else { URI repositoryLocation = repository.getLocation(); if (repositoryLocation != null) this.baseURI = repositoryLocation; } } catch (URISyntaxException e) { log("Error initializing mirrors for: " + repository.getLocation(), e); //$NON-NLS-1$ } }
/** * Constructs a mirror support class for the given repository. Mirrors are * not contacted and the mirrorsURL document is not parsed until a * mirror location request is sent. */ public MirrorSelector(IRepository<?> repository, Transport transport) { this.repository = repository; this.transport = transport; try { String base = repository.getProperties().get(IRepository.PROP_MIRRORS_BASE_URL); if (base != null) { this.baseURI = new URI(base); } else { URI repositoryLocation = repository.getLocation(); if (repositoryLocation != null) this.baseURI = repositoryLocation; } } catch (URISyntaxException e) { log("Error initializing mirrors for: " + repository.getLocation(), e); //$NON-NLS-1$ } }
/** * Constructs a mirror support class for the given repository. Mirrors are * not contacted and the mirrorsURL document is not parsed until a * mirror location request is sent. */ public MirrorSelector(IRepository<?> repository, Transport transport) { this.repository = repository; this.transport = transport; try { String base = repository.getProperties().get(IRepository.PROP_MIRRORS_BASE_URL); if (base != null) { this.baseURI = new URI(base); } else { URI repositoryLocation = repository.getLocation(); if (repositoryLocation != null) this.baseURI = repositoryLocation; } } catch (URISyntaxException e) { log("Error initializing mirrors for: " + repository.getLocation(), e); //$NON-NLS-1$ } }
if (repositories == null) restoreRepositories(); String key = getKey(repository.getLocation()); RepositoryInfo<T> info = repositories.get(key); if (info == null) { info.name = repository.getName(); info.description = repository.getDescription(); info.location = repository.getLocation(); String value = repository.getProperties().get(IRepository.PROP_SYSTEM); if (value != null) broadcastChangeEvent(repository.getLocation(), getRepositoryType(), RepositoryEvent.ADDED, true);
if (repositories == null) restoreRepositories(); String key = getKey(repository.getLocation()); RepositoryInfo<T> info = repositories.get(key); if (info == null) { info.name = repository.getName(); info.description = repository.getDescription(); info.location = repository.getLocation(); String value = repository.getProperties().get(IRepository.PROP_SYSTEM); if (value != null) broadcastChangeEvent(repository.getLocation(), getRepositoryType(), RepositoryEvent.ADDED, true);
return name; return URIUtil.toUnencodedString(((IRepository<?>) obj).getLocation());
private ProvisioningContext getProvisioningContext() { ProvisioningContext context = new ProvisioningContext(getProvisioningUI().getSession().getProvisioningAgent()); if (hasQueryable() && getQueryable() instanceof IRepository<?>) { context.setMetadataRepositories(new URI[] {((IRepository<?>) getQueryable()).getLocation()}); } return context; }
private void remember(IRepository<T> repository, String suffix) { boolean changed = false; Preferences node = getPreferences(); // Ensure we retrieved preferences if (node == null) return; node = node.node(getKey(repository.getLocation())); try { changed |= putValue(node, KEY_URI, repository.getLocation().toString()); changed |= putValue(node, KEY_URL, null); changed |= putValue(node, KEY_DESCRIPTION, repository.getDescription()); changed |= putValue(node, KEY_NAME, repository.getName()); changed |= putValue(node, KEY_PROVIDER, repository.getProvider()); changed |= putValue(node, KEY_TYPE, repository.getType()); changed |= putValue(node, KEY_VERSION, repository.getVersion()); //allow repository manager to define system property if it is undefined in the repository itself String value = repository.getProperties().get(IRepository.PROP_SYSTEM); if (value != null) changed |= putValue(node, KEY_SYSTEM, value); changed |= putValue(node, KEY_SUFFIX, suffix); if (changed) saveToPreferences(); } catch (IllegalStateException e) { //the repository was removed concurrently, so we don't need to save it } }
private void remember(IRepository<T> repository, String suffix) { boolean changed = false; Preferences node = getPreferences(); // Ensure we retrieved preferences if (node == null) return; node = node.node(getKey(repository.getLocation())); try { changed |= putValue(node, KEY_URI, repository.getLocation().toString()); changed |= putValue(node, KEY_URL, null); changed |= putValue(node, KEY_DESCRIPTION, repository.getDescription()); changed |= putValue(node, KEY_NAME, repository.getName()); changed |= putValue(node, KEY_PROVIDER, repository.getProvider()); changed |= putValue(node, KEY_TYPE, repository.getType()); changed |= putValue(node, KEY_VERSION, repository.getVersion()); //allow repository manager to define system property if it is undefined in the repository itself String value = repository.getProperties().get(IRepository.PROP_SYSTEM); if (value != null) changed |= putValue(node, KEY_SYSTEM, value); changed |= putValue(node, KEY_SUFFIX, suffix); if (changed) saveToPreferences(); } catch (IllegalStateException e) { //the repository was removed concurrently, so we don't need to save it } }
public String getColumnText(Object element, int columnIndex) { switch (columnIndex) { case COL_NAME : if (element instanceof IRepositoryElement<?>) { String name = ((IRepositoryElement<?>) element).getName(); if (name != null) { return name; } } if (element instanceof IRepository<?>) { String name = ((IRepository<?>) element).getName(); if (name != null) { return name; } } return ""; //$NON-NLS-1$ case COL_LOCATION : if (element instanceof IRepository<?>) { return TextProcessor.process(URIUtil.toUnencodedString(((IRepository<?>) element).getLocation())); } if (element instanceof IRepositoryElement<?>) { return TextProcessor.process(URIUtil.toUnencodedString(((IRepositoryElement<?>) element).getLocation())); } break; case COL_ENABLEMENT : if (element instanceof MetadataRepositoryElement) return ((MetadataRepositoryElement) element).isEnabled() ? ProvUIMessages.RepositoryDetailsLabelProvider_Enabled : ProvUIMessages.RepositoryDetailsLabelProvider_Disabled; } return null; }
return URIUtil.toUnencodedString(((IRepository<?>) element).getLocation());