@Override public IArtifactRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException { IArtifactRepository repository = delegate.createRepository(location, name, type, properties); disableMirrors(repository, mavenLogger); return repository; }
@Override public IArtifactRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException { return delegate.createRepository(translate(location), name, type, properties); }
static IArtifactRepository addArtifactRepository(IProvisioningAgent agent, URI location) { IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); boolean createRepo = "file".equals(location.getScheme()); //$NON-NLS-1$ if (manager == null) throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$ try { return manager.loadRepository(location, null); } catch (ProvisionException e) { //fall through and create a new repository if (!createRepo) return null; } // could not load a repo at that location so create one as a convenience String repositoryName = location + " - artifacts"; //$NON-NLS-1$ try { return manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); } catch (ProvisionException e) { return null; } }
public static synchronized IFileArtifactRepository getBundlePoolRepository(IProvisioningAgent agent, IProfile profile) { URI location = getBundlePoolLocation(agent, profile); if (location == null) return null; IArtifactRepositoryManager manager = getArtifactRepositoryManager(agent); try { return (IFileArtifactRepository) manager.loadRepository(location, null); } catch (ProvisionException e) { //the repository doesn't exist, so fall through and create a new one } try { String repositoryName = Messages.BundlePool; Map<String, String> properties = new HashMap<String, String>(1); properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString()); return (IFileArtifactRepository) manager.createRepository(location, repositoryName, REPOSITORY_TYPE, properties); } catch (ProvisionException e) { LogHelper.log(e); throw new IllegalArgumentException(NLS.bind(Messages.bundle_pool_not_writeable, location)); } }
/** * Returns the local bundle pool (repository) where bundles are stored * * @return local file artifact repository * @throws CoreException */ public static IFileArtifactRepository getBundlePool() throws CoreException { URI uri = BUNDLE_POOL.toFile().toURI(); IArtifactRepositoryManager manager = getArtifactRepositoryManager(); try { if (manager.contains(uri)) return (IFileArtifactRepository) manager.loadRepository(uri, null); } catch (CoreException e) { // could not load or there wasn't one, fall through to create } String repoName = "PDE Target Bundle Pool"; //$NON-NLS-1$ IArtifactRepository result = manager.createRepository(uri, repoName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); return (IFileArtifactRepository) result; }
public static synchronized IFileArtifactRepository getBundlePoolRepository(IProvisioningAgent agent, IProfile profile) { URI location = getBundlePoolLocation(agent, profile); if (location == null) return null; IArtifactRepositoryManager manager = getArtifactRepositoryManager(agent); try { return (IFileArtifactRepository) manager.loadRepository(location, null); } catch (ProvisionException e) { //the repository doesn't exist, so fall through and create a new one } try { String repositoryName = Messages.BundlePool; Map<String, String> properties = new HashMap<String, String>(1); properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString()); return (IFileArtifactRepository) manager.createRepository(location, repositoryName, REPOSITORY_TYPE, properties); } catch (ProvisionException e) { LogHelper.log(e); throw new IllegalArgumentException(NLS.bind(Messages.bundle_pool_not_writeable, location)); } }
public static IFileArtifactRepository getDownloadCacheRepo(IProvisioningAgent agent) throws ProvisionException { URI location = getDownloadCacheLocation(agent); if (location == null) throw new IllegalStateException(Messages.could_not_obtain_download_cache); IArtifactRepositoryManager manager = getArtifactRepositoryManager(agent); if (manager == null) throw new IllegalStateException(Messages.artifact_repo_not_found); IArtifactRepository repository; try { repository = manager.loadRepository(location, null); } catch (ProvisionException e) { // the download cache doesn't exist or couldn't be read. Create new cache. String repositoryName = location + " - Agent download cache"; //$NON-NLS-1$ Map<String, String> properties = new HashMap<String, String>(1); properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString()); repository = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); } IFileArtifactRepository downloadCache = (IFileArtifactRepository) repository.getAdapter(IFileArtifactRepository.class); if (downloadCache == null) throw new ProvisionException(NLS.bind(Messages.download_cache_not_writeable, location)); return downloadCache; }
/** * 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; }
/** * 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; }
protected CachingArtifactRepository initializeArtifactRepository(String name, URI repositoryLocation, Map<String, String> properties) { IArtifactRepositoryManager manager = Activator.getArtifactRepositoryManager(); if (manager == null) throw new IllegalStateException(Messages.artifact_repo_manager_not_registered); try { IArtifactRepository result = manager.loadRepository(repositoryLocation, null); return result == null ? null : new CachingArtifactRepository(result); } catch (ProvisionException e) { //fall through and create a new repository } try { IArtifactRepository result = manager.createRepository(repositoryLocation, name, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); return result == null ? null : new CachingArtifactRepository(result); } catch (ProvisionException e) { LogHelper.log(e); throw new IllegalStateException(NLS.bind(Messages.failed_create_artifact_repo, repositoryLocation)); } }
void saveArtifactsMeatdata( File directory, IProgressMonitor monitor ) throws ProvisionException { final IProvisioningAgent provisioningAgent = Activator.getDefault().getProvisioningAgent(); final IArtifactRepositoryManager repoMgr = (IArtifactRepositoryManager) provisioningAgent.getService( IArtifactRepositoryManager.SERVICE_NAME ); final IArtifactRepository target = repoMgr.createRepository( directory.toURI(), directory.getName(), IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, new HashMap<String, String>() ); final Set<IArtifactDescriptor> artifacts = new LinkedHashSet<IArtifactDescriptor>(); final ExpressionMatchQuery<IArtifactDescriptor> ALL_ARTIFACTS = new ExpressionMatchQuery<IArtifactDescriptor>( IArtifactDescriptor.class, ExpressionUtil.TRUE_EXPRESSION ); for ( final URI location : repositories ) { final IArtifactRepository repository = repoMgr.loadRepository( location, monitor ); artifacts.addAll( repository.descriptorQueryable().query( ALL_ARTIFACTS, monitor ).toUnmodifiableSet() ); } target.addDescriptors( artifacts.toArray( new IArtifactDescriptor[artifacts.size()] ), monitor ); }
private IArtifactRepository createDestinationArtifactRepository(IArtifactRepositoryManager mgr, Path path, String name) { try { return mgr.loadRepository(path.toUri(), IArtifactRepositoryManager.REPOSITORY_HINT_MODIFIABLE, new NullProgressMonitor()); } catch (ProvisionException e) { if (e.getStatus().getCode() != ProvisionException.REPOSITORY_NOT_FOUND) throw new StatusException("Loading repository failed (" + path + ")", e.getStatus()); } IArtifactRepository dest; try { dest = mgr.createRepository(path.toUri(), name, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); return dest; } catch (ProvisionException e) { throw new StatusException("Creating artifact repository failed (" + path + " " + name + ")", e.getStatus()); } }
repoManager.createRepository( directory.toURI(), directory.getName(), IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, new HashMap<String, String>() );
IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); if (result != null) { manager.removeRepository(result.getLocation());
IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); if (result != null) { manager.removeRepository(result.getLocation());
IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); if (result != null) { manager.removeRepository(result.getLocation());
IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); if (result != null) { manager.removeRepository(result.getLocation());