|
Lines 26-35
Link Here
|
| 26 |
private static final String VERSION_SUBSTITUTION = "$version$"; //$NON-NLS-1$ |
26 |
private static final String VERSION_SUBSTITUTION = "$version$"; //$NON-NLS-1$ |
| 27 |
|
27 |
|
| 28 |
private static final String UPDATE_DESCRIPTION = "update.description"; //$NON-NLS-1$ |
28 |
private static final String UPDATE_DESCRIPTION = "update.description"; //$NON-NLS-1$ |
| 29 |
private static final String UPDATE_SEVERITY = "update.severity"; //$NON-NLS-1$ |
29 |
private static final String UPDATE_SEVERITY = "update.severity"; //$NON-NLS-1$ |
| 30 |
private static final String UPDATE_RANGE = "update.range"; //$NON-NLS-1$ |
30 |
private static final String UPDATE_RANGE = "update.range"; //$NON-NLS-1$ |
|
|
31 |
private static final String UPDATE_URL = "update.url"; //$NON-NLS-1$ |
| 31 |
private static final String UPDATE_ID = "update.id"; //$NON-NLS-1$ |
32 |
private static final String UPDATE_ID = "update.id"; //$NON-NLS-1$ |
| 32 |
private static final String CLASSIFIER = "classifier"; //$NON-NLS-1$ |
33 |
private static final String CLASSIFIER = "classifier"; //$NON-NLS-1$ |
| 33 |
private static final String TOUCHPOINT_VERSION = "touchpoint.version"; //$NON-NLS-1$ |
34 |
private static final String TOUCHPOINT_VERSION = "touchpoint.version"; //$NON-NLS-1$ |
| 34 |
private static final String TOUCHPOINT_ID = "touchpoint.id"; //$NON-NLS-1$ |
35 |
private static final String TOUCHPOINT_ID = "touchpoint.id"; //$NON-NLS-1$ |
| 35 |
private static final String COPYRIGHT_LOCATION = "copyright.location"; //$NON-NLS-1$ |
36 |
private static final String COPYRIGHT_LOCATION = "copyright.location"; //$NON-NLS-1$ |
|
Lines 162-171
Link Here
|
| 162 |
private IUpdateDescriptor parseUpdateDescriptor(String prefix, String id) { |
163 |
private IUpdateDescriptor parseUpdateDescriptor(String prefix, String id) { |
| 163 |
String name = id; |
164 |
String name = id; |
| 164 |
String description = null; |
165 |
String description = null; |
| 165 |
String range = "[0.0.0,$version$)"; //$NON-NLS-1$ |
166 |
String range = "[0.0.0,$version$)"; //$NON-NLS-1$ |
| 166 |
String severity = "0"; //$NON-NLS-1$ |
167 |
String severity = "0"; //$NON-NLS-1$ |
|
|
168 |
URI unitUpdateLocation = null; |
| 167 |
|
169 |
|
| 168 |
while (current != null && current.startsWith(prefix)) { |
170 |
while (current != null && current.startsWith(prefix)) { |
| 169 |
String token = current; |
171 |
String token = current; |
| 170 |
if (token.equals(UPDATE_ID)) { |
172 |
if (token.equals(UPDATE_ID)) { |
| 171 |
name = currentValue(); |
173 |
name = currentValue(); |
|
Lines 173-191
Link Here
|
| 173 |
description = currentValue(); |
175 |
description = currentValue(); |
| 174 |
} else if (token.equals(UPDATE_RANGE)) { |
176 |
} else if (token.equals(UPDATE_RANGE)) { |
| 175 |
range = currentValue(); |
177 |
range = currentValue(); |
| 176 |
} else if (token.equals(UPDATE_SEVERITY)) { |
178 |
} else if (token.equals(UPDATE_SEVERITY)) { |
| 177 |
severity = currentValue(); |
179 |
severity = currentValue(); |
|
|
180 |
} else if (token.equals(UPDATE_URL)) { |
| 181 |
try { |
| 182 |
unitUpdateLocation = new URI(currentValue()); |
| 183 |
} catch (URISyntaxException e) { |
| 184 |
throw new IllegalStateException("bad unit update URI at token: " + current + ", " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ |
| 185 |
} |
| 178 |
} else { |
186 |
} else { |
| 179 |
// ignore |
187 |
// ignore |
| 180 |
} |
188 |
} |
| 181 |
next(); |
189 |
next(); |
| 182 |
} |
190 |
} |
| 183 |
|
191 |
|
| 184 |
range = substituteVersionAndQualifier(range); |
192 |
range = substituteVersionAndQualifier(range); |
| 185 |
VersionRange versionRange = new VersionRange(range); |
193 |
VersionRange versionRange = new VersionRange(range); |
| 186 |
return MetadataFactory.createUpdateDescriptor(name, versionRange, Integer.valueOf(severity), description); |
194 |
return MetadataFactory.createUpdateDescriptor(name, versionRange, Integer.valueOf(severity), description, unitUpdateLocation); |
| 187 |
} |
195 |
} |
| 188 |
|
196 |
|
| 189 |
private void parseProvides(String prefix, List<IProvidedCapability> provides) { |
197 |
private void parseProvides(String prefix, List<IProvidedCapability> provides) { |
| 190 |
while (current != null && current.startsWith(prefix)) { |
198 |
while (current != null && current.startsWith(prefix)) { |
| 191 |
int dotIndex = current.indexOf('.', prefix.length()); |
199 |
int dotIndex = current.indexOf('.', prefix.length()); |
|
Lines 314-323
Link Here
|
| 314 |
|
322 |
|
| 315 |
String unitUpdateId = null; |
323 |
String unitUpdateId = null; |
| 316 |
VersionRange unitUpdateRange = null; |
324 |
VersionRange unitUpdateRange = null; |
| 317 |
int unitUpdateSeverity = 0; |
325 |
int unitUpdateSeverity = 0; |
| 318 |
String unitUpdateDescription = null; |
326 |
String unitUpdateDescription = null; |
|
|
327 |
URI unitUpdateLocation = null; |
| 319 |
|
328 |
|
| 320 |
List<IArtifactKey> unitArtifacts = new ArrayList<IArtifactKey>(); |
329 |
List<IArtifactKey> unitArtifacts = new ArrayList<IArtifactKey>(); |
| 321 |
Map<String, String> unitProperties = new HashMap<String, String>(); |
330 |
Map<String, String> unitProperties = new HashMap<String, String>(); |
| 322 |
List<IRequirement> unitHostRequirements = new ArrayList<IRequirement>(); |
331 |
List<IRequirement> unitHostRequirements = new ArrayList<IRequirement>(); |
| 323 |
List<IProvidedCapability> unitProvides = new ArrayList<IProvidedCapability>(); |
332 |
List<IProvidedCapability> unitProvides = new ArrayList<IProvidedCapability>(); |
|
Lines 363-372
Link Here
|
| 363 |
unitUpdateSeverity = Integer.parseInt(currentValue()); |
372 |
unitUpdateSeverity = Integer.parseInt(currentValue()); |
| 364 |
next(); |
373 |
next(); |
| 365 |
} else if (token.equals(UPDATE_DESCRIPTION)) { |
374 |
} else if (token.equals(UPDATE_DESCRIPTION)) { |
| 366 |
unitUpdateDescription = currentValue(); |
375 |
unitUpdateDescription = currentValue(); |
| 367 |
next(); |
376 |
next(); |
|
|
377 |
} else if (token.equals(UPDATE_URL)) { |
| 378 |
try { |
| 379 |
unitUpdateLocation = new URI(currentValue()); |
| 380 |
} catch (URISyntaxException e) { |
| 381 |
throw new IllegalStateException("bad unit update URI at token: " + current + ", " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ |
| 382 |
} |
| 383 |
next(); |
| 368 |
} else if (token.startsWith(HOST_REQUIREMENTS_PREFIX)) |
384 |
} else if (token.startsWith(HOST_REQUIREMENTS_PREFIX)) |
| 369 |
parseRequires(prefix + HOST_REQUIREMENTS_PREFIX, unitHostRequirements); |
385 |
parseRequires(prefix + HOST_REQUIREMENTS_PREFIX, unitHostRequirements); |
| 370 |
else if (token.startsWith(ARTIFACTS_PREFIX)) |
386 |
else if (token.startsWith(ARTIFACTS_PREFIX)) |
| 371 |
parseArtifacts(prefix + ARTIFACTS_PREFIX, unitArtifacts); |
387 |
parseArtifacts(prefix + ARTIFACTS_PREFIX, unitArtifacts); |
| 372 |
else if (token.startsWith(LICENSES_PREFIX)) |
388 |
else if (token.startsWith(LICENSES_PREFIX)) |
|
Lines 402-412
Link Here
|
| 402 |
} |
418 |
} |
| 403 |
if (unitTouchpointId != null) |
419 |
if (unitTouchpointId != null) |
| 404 |
description.setTouchpointType(MetadataFactory.createTouchpointType(unitTouchpointId, unitTouchpointVersion)); |
420 |
description.setTouchpointType(MetadataFactory.createTouchpointType(unitTouchpointId, unitTouchpointVersion)); |
| 405 |
|
421 |
|
| 406 |
if (unitUpdateId != null) |
422 |
if (unitUpdateId != null) |
| 407 |
description.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(unitUpdateId, unitUpdateRange, unitUpdateSeverity, unitUpdateDescription)); |
423 |
description.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(unitUpdateId, unitUpdateRange, unitUpdateSeverity, unitUpdateDescription, unitUpdateLocation)); |
| 408 |
|
424 |
|
| 409 |
if (!unitLicenses.isEmpty()) |
425 |
if (!unitLicenses.isEmpty()) |
| 410 |
description.setLicenses(unitLicenses.toArray(new ILicense[unitLicenses.size()])); |
426 |
description.setLicenses(unitLicenses.toArray(new ILicense[unitLicenses.size()])); |
| 411 |
|
427 |
|
| 412 |
if (!unitArtifacts.isEmpty()) |
428 |
if (!unitArtifacts.isEmpty()) |