destFilePattern = IvyPatternHelper.substituteVariables(destFilePattern, settings
.getVariables());
String destIvyPattern = IvyPatternHelper.substituteVariables(options.getDestIvyPattern(),
settings.getVariables());
RepositoryCacheManager cacheManager = getCacheManager(options);
String[] confs = getConfs(mrid, options);
Message.info("\tconfs: " + Arrays.asList(confs));
if (this.eventManager != null) {
this.eventManager.fireIvyEvent(new StartRetrieveEvent(mrid, confs, options));
}
try {
Map artifactsToCopy = determineArtifactsToCopy(mrid, destFilePattern, options);
File fileRetrieveRoot = new File(IvyPatternHelper.getTokenRoot(destFilePattern));
File ivyRetrieveRoot = destIvyPattern == null ? null : new File(IvyPatternHelper
.getTokenRoot(destIvyPattern));
Collection targetArtifactsStructure = new HashSet(); // Set(File) set of all paths
// which should be present at
// then end of retrieve (useful
// for sync)
Collection targetIvysStructure = new HashSet(); // same for ivy files
// do retrieve
int targetsCopied = 0;
int targetsUpToDate = 0;
long totalCopiedSize = 0;
for (Iterator iter = artifactsToCopy.keySet().iterator(); iter.hasNext();) {
Artifact artifact = (Artifact) iter.next();
File archive;
if ("ivy".equals(artifact.getType())) {
archive = cacheManager.getIvyFileInCache(artifact.getModuleRevisionId());
} else {
archive = cacheManager.getArchiveFileInCache(artifact, cacheManager
.getSavedArtifactOrigin(artifact), options.isUseOrigin());
if (!options.isUseOrigin() && !archive.exists()) {
// file is not available in cache, maybe the last resolve was performed with
// useOrigin=true.
// we try to use the best we can
archive = cacheManager.getArchiveFileInCache(artifact, cacheManager
.getSavedArtifactOrigin(artifact));
}
}
Set dest = (Set) artifactsToCopy.get(artifact);
Message.verbose("\tretrieving " + archive);