|
Lines 126-145
Link Here
|
| 126 |
// Check if the right version exists in the new meta repo |
126 |
// Check if the right version exists in the new meta repo |
| 127 |
Version newVersion = Version.parseVersion(version); |
127 |
Version newVersion = Version.parseVersion(version); |
| 128 |
IQueryResult queryMatches = metaRepo.query(new InstallableUnitQuery(id, newVersion), monitor); |
128 |
IQueryResult queryMatches = metaRepo.query(new InstallableUnitQuery(id, newVersion), monitor); |
| 129 |
if (queryMatches.size() == 0) { |
129 |
if (queryMatches.isEmpty()) { |
| 130 |
return new Status(IStatus.ERROR, PDEPlugin.getPluginId(), NLS.bind(PDEUIMessages.RuntimeInstallJob_ErrorCouldNotFindUnitInRepo, new String[] {id, version})); |
130 |
return new Status(IStatus.ERROR, PDEPlugin.getPluginId(), NLS.bind(PDEUIMessages.RuntimeInstallJob_ErrorCouldNotFindUnitInRepo, new String[] {id, version})); |
| 131 |
} |
131 |
} |
| 132 |
|
132 |
|
| 133 |
IInstallableUnit iuToInstall = (IInstallableUnit) queryMatches.toArray(IInstallableUnit.class)[0]; |
133 |
IInstallableUnit iuToInstall = (IInstallableUnit) queryMatches.iterator().next(); |
| 134 |
|
134 |
|
| 135 |
// Find out if the profile already has that iu installed |
135 |
// Find out if the profile already has that iu installed |
| 136 |
queryMatches = profile.query(new InstallableUnitQuery(id), new SubProgressMonitor(monitor, 0)); |
136 |
queryMatches = profile.query(new InstallableUnitQuery(id), new SubProgressMonitor(monitor, 0)); |
| 137 |
if (queryMatches.size() == 0) { |
137 |
if (queryMatches.isEmpty()) { |
| 138 |
// Just install the new iu into the profile |
138 |
// Just install the new iu into the profile |
| 139 |
toInstall.add(iuToInstall); |
139 |
toInstall.add(iuToInstall); |
| 140 |
} else { |
140 |
} else { |
| 141 |
// There is an existing iu that we need to replace using an installable unit patch |
141 |
// There is an existing iu that we need to replace using an installable unit patch |
| 142 |
Version existingVersion = ((IInstallableUnit) queryMatches.toArray(IInstallableUnit.class)[0]).getVersion(); |
142 |
Version existingVersion = ((IInstallableUnit) queryMatches.iterator().next()).getVersion(); |
| 143 |
toInstall.add(createInstallableUnitPatch(id, newVersion, existingVersion, profile, monitor)); |
143 |
toInstall.add(createInstallableUnitPatch(id, newVersion, existingVersion, profile, monitor)); |
| 144 |
} |
144 |
} |
| 145 |
monitor.worked(2); |
145 |
monitor.worked(2); |
|
Lines 204-212
Link Here
|
| 204 |
IQueryResult queryMatches = profile.query(new MatchQuery() { |
204 |
IQueryResult queryMatches = profile.query(new MatchQuery() { |
| 205 |
public boolean isMatch(Object candidate) { |
205 |
public boolean isMatch(Object candidate) { |
| 206 |
if (candidate instanceof IInstallableUnit) { |
206 |
if (candidate instanceof IInstallableUnit) { |
| 207 |
IRequirement[] reqs = ((IInstallableUnit) candidate).getRequiredCapabilities(); |
207 |
List/*<IRequirement>*/reqs = ((IInstallableUnit) candidate).getRequiredCapabilities(); |
| 208 |
for (int i = 0; i < reqs.length; i++) { |
208 |
for (int i = 0; i < reqs.size(); i++) { |
| 209 |
IRequiredCapability reqCap = (IRequiredCapability) reqs[i]; |
209 |
IRequiredCapability reqCap = (IRequiredCapability) reqs.get(i); |
| 210 |
if (reqCap.getName().equals(id)) { |
210 |
if (reqCap.getName().equals(id)) { |
| 211 |
if (new VersionRange(existingVersion, true, existingVersion, true).equals(reqCap.getRange())) { |
211 |
if (new VersionRange(existingVersion, true, existingVersion, true).equals(reqCap.getRange())) { |
| 212 |
return true; |
212 |
return true; |
|
Lines 218-224
Link Here
|
| 218 |
} |
218 |
} |
| 219 |
}, monitor); |
219 |
}, monitor); |
| 220 |
if (!queryMatches.isEmpty()) { |
220 |
if (!queryMatches.isEmpty()) { |
| 221 |
IInstallableUnit lifecycleUnit = (IInstallableUnit) queryMatches.toArray(IInstallableUnit.class)[0]; |
221 |
IInstallableUnit lifecycleUnit = (IInstallableUnit) queryMatches.iterator().next(); |
| 222 |
iuPatchDescription.setLifeCycle(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, lifecycleUnit.getId(), new VersionRange(lifecycleUnit.getVersion(), true, lifecycleUnit.getVersion(), true), null, false, false, false)); |
222 |
iuPatchDescription.setLifeCycle(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, lifecycleUnit.getId(), new VersionRange(lifecycleUnit.getVersion(), true, lifecycleUnit.getVersion(), true), null, false, false, false)); |
| 223 |
} |
223 |
} |
| 224 |
|
224 |
|