@SuppressWarnings("rawtypes") private boolean isEnabled(IRepositoryManager manager, IRepositoryReference reference) { return (manager.contains(reference.getLocation()) && manager.isEnabled(reference.getLocation())) || ((!manager.contains(reference.getLocation())) && ((reference.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); }
/** * {@inheritDoc} */ public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof IRepositoryReference)) return false; IRepositoryReference other = (IRepositoryReference) obj; if (location == null) { if (other.getLocation() != null) return false; } else if (!location.equals(other.getLocation())) return false; if (type != other.getType()) return false; return true; }
/** * 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; }
public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { try { runnable.run(monitor); } catch (OperationCanceledException oce) { return new Status(IStatus.CANCEL, Activator.ID, oce.getMessage(), oce); } catch (Exception e) { return new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e); } return Status.OK_STATUS; } }
/** * Initialize {@link #mirrors} for {@link #repository}, or <code>null</code> if * they could not be computed. */ private void initMirrors(IProgressMonitor monitor) { if (mirrors != null) return; String mirrorsURL = repository.getProperties().get(IRepository.PROP_MIRRORS_URL); if (mirrorsURL != null) mirrors = computeMirrors(mirrorsURL, monitor); }
@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 ); }
/** * Removes the repository corresponding to the given event from the currently running instance. */ protected void removeFromSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); Preferences node = getRepositoryPreferenceNode(agentLocation, null, event.getRepositoryLocation(), event.getRepositoryType()); int count = getRepositoryCount(node); // modify the repository count before (potentially) removing the preference node setRepositoryCount(node, --count); if (count < 1 && manager != null) manager.removeRepository(event.getRepositoryLocation()); }
protected Collection<URI> getRepoLocations(IRepositoryManager<T> manager) { Set<URI> locations = new HashSet<URI>(); locations.addAll(Arrays.asList(manager.getKnownRepositories(repositoryFlags))); if (includeDisabledRepos) { locations.addAll(Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | repositoryFlags))); } return locations; }
private void setListRepositoryProperty(IRepository<?> repository, String key, List<String> listProperty) { StringBuffer buffer = new StringBuffer(); for (Iterator<String> it = listProperty.iterator(); it.hasNext();) { String repositoryString = it.next(); buffer.append(repositoryString); if (it.hasNext()) buffer.append(PIPE); } String value = (buffer.length() == 0) ? null : buffer.toString(); repository.setProperty(key, value); }
protected Transport getTransport(IPublisherInfo info) { @SuppressWarnings("rawtypes") IRepository repo = info.getMetadataRepository(); if (repo == null) repo = info.getArtifactRepository(); if (repo == null) throw new IllegalStateException("The transport service can not be found."); //$NON-NLS-1$ return (Transport) repo.getProvisioningAgent().getService(Transport.SERVICE_NAME); } }
@SuppressWarnings("rawtypes") private boolean isEnabled(IRepositoryManager manager, IRepositoryReference reference) { return (manager.contains(reference.getLocation()) && manager.isEnabled(reference.getLocation())) || ((!manager.contains(reference.getLocation())) && ((reference.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); }
public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { try { runnable.run(monitor); } catch (OperationCanceledException oce) { return new Status(IStatus.CANCEL, Activator.ID, oce.getMessage(), oce); } catch (Exception e) { return new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e); } return Status.OK_STATUS; } }
/** * {@inheritDoc} */ public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof IRepositoryReference)) return false; IRepositoryReference other = (IRepositoryReference) obj; if (location == null) { if (other.getLocation() != null) return false; } else if (!location.equals(other.getLocation())) return false; if (type != other.getType()) return false; return true; }
/** * 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; }
/** * Returns the mirror locations for this repository, or <code>null</code> if * they could not be computed. */ private MirrorInfo[] initMirrors(IProgressMonitor monitor) { if (mirrors != null) return mirrors; String mirrorsURL = repository.getProperties().get(IRepository.PROP_MIRRORS_URL); if (mirrorsURL != null) mirrors = computeMirrors(mirrorsURL, monitor); return mirrors; }
/** * Removes the repository corresponding to the given event from the currently running instance. */ protected void removeFromSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); Preferences node = getRepositoryPreferenceNode(agentLocation, null, event.getRepositoryLocation(), event.getRepositoryType()); int count = getRepositoryCount(node); // modify the repository count before (potentially) removing the preference node setRepositoryCount(node, --count); if (count < 1 && manager != null) manager.removeRepository(event.getRepositoryLocation()); }
public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { try { runnable.run(monitor); } catch (OperationCanceledException oce) { return new Status(IStatus.CANCEL, Activator.ID, oce.getMessage(), oce); } catch (Exception e) { return new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e); } return Status.OK_STATUS; } }
/** * Returns the mirror locations for this repository, or <code>null</code> if * they could not be computed. */ private MirrorInfo[] initMirrors(IProgressMonitor monitor) { if (mirrors != null) return mirrors; String mirrorsURL = repository.getProperties().get(IRepository.PROP_MIRRORS_URL); if (mirrorsURL != null) mirrors = computeMirrors(mirrorsURL, monitor); return mirrors; }
/** * {@inheritDoc} */ public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { try { runnable.run(monitor); } catch (OperationCanceledException oce) { return new Status(IStatus.CANCEL, Activator.ID, oce.getMessage(), oce); } catch (Exception e) { return new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e); } return Status.OK_STATUS; }
/** * Returns the mirror locations for this repository, or <code>null</code> if * they could not be computed. */ private MirrorInfo[] initMirrors(IProgressMonitor monitor) { if (mirrors != null) return mirrors; String mirrorsURL = repository.getProperties().get(IRepository.PROP_MIRRORS_URL); if (mirrorsURL != null) mirrors = computeMirrors(mirrorsURL, monitor); return mirrors; }