|
Lines 24-29
Link Here
|
| 24 |
import org.eclipse.equinox.p2.engine.*; |
24 |
import org.eclipse.equinox.p2.engine.*; |
| 25 |
import org.eclipse.equinox.p2.metadata.IArtifactKey; |
25 |
import org.eclipse.equinox.p2.metadata.IArtifactKey; |
| 26 |
import org.eclipse.equinox.p2.metadata.IInstallableUnit; |
26 |
import org.eclipse.equinox.p2.metadata.IInstallableUnit; |
|
|
27 |
import org.eclipse.equinox.p2.metadata.query.IQueryResult; |
| 27 |
import org.eclipse.equinox.p2.repository.IRepositoryManager; |
28 |
import org.eclipse.equinox.p2.repository.IRepositoryManager; |
| 28 |
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; |
29 |
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; |
| 29 |
import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository; |
30 |
import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository; |
|
Lines 247-253
Link Here
|
| 247 |
|
248 |
|
| 248 |
// query for bundles |
249 |
// query for bundles |
| 249 |
OSGiBundleQuery query = new OSGiBundleQuery(); |
250 |
OSGiBundleQuery query = new OSGiBundleQuery(); |
| 250 |
Collector collector = slice.query(query, new SubProgressMonitor(subMonitor, 10)); |
251 |
IQueryResult queryResult = slice.query(query, new SubProgressMonitor(subMonitor, 10)); |
| 251 |
|
252 |
|
| 252 |
if (subMonitor.isCanceled()) { |
253 |
if (subMonitor.isCanceled()) { |
| 253 |
return new IResolvedBundle[0]; |
254 |
return new IResolvedBundle[0]; |
|
Lines 255-261
Link Here
|
| 255 |
|
256 |
|
| 256 |
Map bundles = new LinkedHashMap(); |
257 |
Map bundles = new LinkedHashMap(); |
| 257 |
IFileArtifactRepository repo = getBundlePool(profile); |
258 |
IFileArtifactRepository repo = getBundlePool(profile); |
| 258 |
Iterator iterator = collector.iterator(); |
259 |
Iterator iterator = queryResult.iterator(); |
| 259 |
while (iterator.hasNext()) { |
260 |
while (iterator.hasNext()) { |
| 260 |
IInstallableUnit unit = (IInstallableUnit) iterator.next(); |
261 |
IInstallableUnit unit = (IInstallableUnit) iterator.next(); |
| 261 |
IArtifactKey[] artifacts = unit.getArtifacts(); |
262 |
IArtifactKey[] artifacts = unit.getArtifacts(); |
|
Lines 362-375
Link Here
|
| 362 |
slicer = new PermissiveSlicer(allMetadata, props, true, false, false, true, false); |
363 |
slicer = new PermissiveSlicer(allMetadata, props, true, false, false, true, false); |
| 363 |
} |
364 |
} |
| 364 |
IQueryable slice = slicer.slice(units, new SubProgressMonitor(subMonitor, 10)); |
365 |
IQueryable slice = slicer.slice(units, new SubProgressMonitor(subMonitor, 10)); |
| 365 |
Collector collector = slice.query(InstallableUnitQuery.ANY, new SubProgressMonitor(subMonitor, 10)); |
366 |
IQueryResult queryResult = slice.query(InstallableUnitQuery.ANY, new SubProgressMonitor(subMonitor, 10)); |
| 366 |
|
367 |
|
| 367 |
if (subMonitor.isCanceled() || collector.isEmpty()) { |
368 |
if (subMonitor.isCanceled() || queryResult.isEmpty()) { |
| 368 |
return new IResolvedBundle[0]; |
369 |
return new IResolvedBundle[0]; |
| 369 |
} |
370 |
} |
| 370 |
|
371 |
|
| 371 |
ArrayList operands = new ArrayList(collector.size()); |
372 |
ArrayList operands = new ArrayList(queryResult.size()); |
| 372 |
Iterator itor = collector.iterator(); |
373 |
Iterator itor = queryResult.iterator(); |
| 373 |
while (itor.hasNext()) { |
374 |
while (itor.hasNext()) { |
| 374 |
operands.add(new InstallableUnitOperand(null, (IInstallableUnit) itor.next())); |
375 |
operands.add(new InstallableUnitOperand(null, (IInstallableUnit) itor.next())); |
| 375 |
} |
376 |
} |
|
Lines 404-410
Link Here
|
| 404 |
} |
405 |
} |
| 405 |
|
406 |
|
| 406 |
// query for bundles |
407 |
// query for bundles |
| 407 |
collector = slice.query(new OSGiBundleQuery(), new SubProgressMonitor(subMonitor, 10)); |
408 |
queryResult = slice.query(new OSGiBundleQuery(), new SubProgressMonitor(subMonitor, 10)); |
| 408 |
|
409 |
|
| 409 |
if (subMonitor.isCanceled()) { |
410 |
if (subMonitor.isCanceled()) { |
| 410 |
return new IResolvedBundle[0]; |
411 |
return new IResolvedBundle[0]; |
|
Lines 412-418
Link Here
|
| 412 |
|
413 |
|
| 413 |
Map bundles = new LinkedHashMap(); |
414 |
Map bundles = new LinkedHashMap(); |
| 414 |
IFileArtifactRepository repo = getBundlePool(profile); |
415 |
IFileArtifactRepository repo = getBundlePool(profile); |
| 415 |
Iterator iterator = collector.iterator(); |
416 |
Iterator iterator = queryResult.iterator(); |
| 416 |
while (iterator.hasNext()) { |
417 |
while (iterator.hasNext()) { |
| 417 |
IInstallableUnit unit = (IInstallableUnit) iterator.next(); |
418 |
IInstallableUnit unit = (IInstallableUnit) iterator.next(); |
| 418 |
IArtifactKey[] artifacts = unit.getArtifacts(); |
419 |
IArtifactKey[] artifacts = unit.getArtifacts(); |
|
Lines 469-492
Link Here
|
| 469 |
fUnits = new IInstallableUnit[fIds.length]; |
470 |
fUnits = new IInstallableUnit[fIds.length]; |
| 470 |
for (int i = 0; i < fIds.length; i++) { |
471 |
for (int i = 0; i < fIds.length; i++) { |
| 471 |
InstallableUnitQuery query = new InstallableUnitQuery(fIds[i], fVersions[i]); |
472 |
InstallableUnitQuery query = new InstallableUnitQuery(fIds[i], fVersions[i]); |
| 472 |
Collector collector = profile.query(query, null); |
473 |
IQueryResult queryResult = profile.query(query, null); |
| 473 |
if (collector.isEmpty()) { |
474 |
if (queryResult.isEmpty()) { |
| 474 |
// try repositories |
475 |
// try repositories |
| 475 |
URI[] repositories = resolveRepositories(); |
476 |
URI[] repositories = resolveRepositories(); |
| 476 |
for (int j = 0; j < repositories.length; j++) { |
477 |
for (int j = 0; j < repositories.length; j++) { |
| 477 |
IMetadataRepository repository = getRepository(repositories[j]); |
478 |
IMetadataRepository repository = getRepository(repositories[j]); |
| 478 |
collector = repository.query(query, null); |
479 |
queryResult = repository.query(query, null); |
| 479 |
if (!collector.isEmpty()) { |
480 |
if (!queryResult.isEmpty()) { |
| 480 |
break; |
481 |
break; |
| 481 |
} |
482 |
} |
| 482 |
} |
483 |
} |
| 483 |
} |
484 |
} |
| 484 |
if (collector.isEmpty()) { |
485 |
if (queryResult.isEmpty()) { |
| 485 |
// not found |
486 |
// not found |
| 486 |
fUnits = null; |
487 |
fUnits = null; |
| 487 |
throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.IUBundleContainer_1, fIds[i]))); |
488 |
throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.IUBundleContainer_1, fIds[i]))); |
| 488 |
} |
489 |
} |
| 489 |
fUnits[i] = (IInstallableUnit) collector.iterator().next(); |
490 |
fUnits[i] = (IInstallableUnit) queryResult.iterator().next(); |
| 490 |
} |
491 |
} |
| 491 |
} |
492 |
} |
| 492 |
return fUnits; |
493 |
return fUnits; |