@Override public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties) { return delegate.createMirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties); }
@Override public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties) { return delegate.createMirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties); }
@Override public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties, String downloadStatsParameters) { return delegate.createMirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties, downloadStatsParameters); }
@Override public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties, String downloadStatsParameters) { return delegate.createMirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties, downloadStatsParameters); }
@Override public IStatus execute(Map<String, Object> parameters) { InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); IInstallableUnit installableUnit = operand.second(); if (installableUnit == null) return Status.OK_STATUS; IArtifactRepositoryManager manager; try { Collection<?> toDownload = installableUnit.getArtifacts(); if (toDownload == null) return Status.OK_STATUS; @SuppressWarnings("unchecked") List<IArtifactRequest> artifactRequests = (List<IArtifactRequest>) parameters.get(NATIVE_ARTIFACTS); IArtifactRepository destinationArtifactRepository = getBundlePool(); manager = getArtifactRepositoryManager(); for (Iterator<?> i = toDownload.iterator(); i.hasNext();) { IArtifactKey keyToDownload = (IArtifactKey) i.next(); IArtifactRequest request = manager.createMirrorRequest(keyToDownload, destinationArtifactRepository, null, null); artifactRequests.add(request); } } catch (CoreException e) { return e.getStatus(); } return Status.OK_STATUS; }
IArtifactRequest[] collect(IProvisioningAgent agent, IInstallableUnit installableUnit, IProfile profile) throws ProvisionException { Collection<IArtifactKey> toDownload = installableUnit.getArtifacts(); if (toDownload == null) return new IArtifactRequest[0]; IArtifactRepository destination = Util.getDownloadCacheRepo(agent); IArtifactRequest[] requests = new IArtifactRequest[toDownload.size()]; int count = 0; for (IArtifactKey key : toDownload) { //TODO Here there are cases where the download is not necessary again because what needs to be done is just a configuration step requests[count++] = Util.getArtifactRepositoryManager(agent).createMirrorRequest(key, destination, null, null, profile.getProperty(IProfile.PROP_STATS_PARAMETERS)); } if (requests.length == count) return requests; IArtifactRequest[] result = new IArtifactRequest[count]; System.arraycopy(requests, 0, result, 0, count); return result; } }
static IArtifactRequest[] collect(IProvisioningAgent agent, IProfile profile, IInstallableUnit installableUnit) throws ProvisionException { Collection<IArtifactKey> toDownload = installableUnit.getArtifacts(); if (toDownload == null || toDownload.size() == 0) return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST; IArtifactRepository aggregatedRepositoryView = Util.getAggregatedBundleRepository(agent, profile); IArtifactRepository bundlePool = Util.getBundlePoolRepository(agent, profile); if (bundlePool == null) throw new ProvisionException(Util.createError(NLS.bind(Messages.no_bundle_pool, profile.getProfileId()))); List<IArtifactRequest> requests = new ArrayList<IArtifactRequest>(); for (IArtifactKey key : toDownload) { if (!aggregatedRepositoryView.contains(key)) { Map<String, String> repositoryProperties = CollectAction.createArtifactDescriptorProperties(installableUnit); requests.add(Util.getArtifactRepositoryManager(agent).createMirrorRequest(key, bundlePool, null, repositoryProperties, profile.getProperty(IProfile.PROP_STATS_PARAMETERS))); } } if (requests.isEmpty()) return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST; IArtifactRequest[] result = requests.toArray(new IArtifactRequest[requests.size()]); return result; } }
static IArtifactRequest[] collect(IProvisioningAgent agent, IProfile profile, IInstallableUnit installableUnit) throws ProvisionException { Collection<IArtifactKey> toDownload = installableUnit.getArtifacts(); if (toDownload == null || toDownload.size() == 0) return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST; IArtifactRepository aggregatedRepositoryView = Util.getAggregatedBundleRepository(agent, profile); IArtifactRepository bundlePool = Util.getBundlePoolRepository(agent, profile); if (bundlePool == null) throw new ProvisionException(Util.createError(NLS.bind(Messages.no_bundle_pool, profile.getProfileId()))); List<IArtifactRequest> requests = new ArrayList<IArtifactRequest>(); for (IArtifactKey key : toDownload) { if (!aggregatedRepositoryView.contains(key)) { Map<String, String> repositoryProperties = CollectAction.createArtifactDescriptorProperties(installableUnit); requests.add(Util.getArtifactRepositoryManager(agent).createMirrorRequest(key, bundlePool, null, repositoryProperties, profile.getProperty(IProfile.PROP_STATS_PARAMETERS))); } } if (requests.isEmpty()) return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST; IArtifactRequest[] result = requests.toArray(new IArtifactRequest[requests.size()]); return result; } }
IArtifactRequest request = repoManager.createMirrorRequest( key, targetRepository, null, null ); mgr.add( request );