Skip to content

Commit

Permalink
Fixup syntax and javadoc based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cbridgha committed Jul 16, 2024
1 parent c8e60d8 commit 6571a97
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2019 IBM Corporation and others.
* Copyright (c) 2014, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -44,7 +44,6 @@ public class RepositoryResolutionException extends RepositoryException {
private final Map<String, Collection<Chain>> featureConflicts;
private Set<String> resolvedPlatforms;
private Set<String> missingPlatforms;
private boolean hasVersionlessIssue;
private List<String> missingBasePlatforms;

/**
Expand Down Expand Up @@ -373,20 +372,23 @@ private String getResourceName(RepositoryResource resource) {
}

/**
* This states the target platforms that were used during the resolution
* @return the resolvedPlatforms
*/
public Set<String> getResolvedPlatforms() {
return resolvedPlatforms;
}

/**
* This describes missspelled or unknown platform names, official names are collected by the feature metadata
* @return the missingPlatforms
*/
public Set<String> getMissingPlatforms() {
return missingPlatforms;
}

/**
* This describes base platforms like "jakartaee" that are not derived, either by passed platform values, or by other included versioned features
* @return the missingBasePlatforms
*/
public List<String> getMissingBasePlatforms() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ public Collection<List<RepositoryResource>> resolve(String toResolve) throws Rep
* For example, if {@code ejbLite-3.2} is already installed and {@code resolve(Arrays.asList("cdi-2.0"))} is called, it will not return the autofeature which would be required
* for {@code cdi-2.0} and {@code ejbLite-3.2} to work together.
*
* @deprecated - calling this method should be replaced by passing the platform list, required to support versionless features.
*
* @param toResolve A collection of the identifiers of the resources to resolve. It should be in the form:</br>
* <code>{name}/{version}</code></br>
* <p>Where the <code>{name}</code> can be either the symbolic name, short name or lower case short name of the resource and <code>/{version}</code> is
Expand All @@ -389,6 +391,7 @@ public Collection<List<RepositoryResource>> resolve(String toResolve) throws Rep
*
* @throws RepositoryResolutionException If the resource cannot be resolved
*/
@Deprecated
public Collection<List<RepositoryResource>> resolveAsSet(Collection<String> toResolve) throws RepositoryResolutionException {
return resolve(toResolve, null, ResolutionMode.DETECT_CONFLICTS);
}
Expand Down Expand Up @@ -591,8 +594,6 @@ private void recordVersionless(Result result, Repository resolverRepo) {

resolvedPlatforms = result.getResolvedPlatforms();
missingPlatforms = result.getMissingPlatforms();
if (resolvedPlatforms.isEmpty() || !missingPlatforms.isEmpty())
hasVersionlessIssue = true;

}

Expand Down Expand Up @@ -1012,15 +1013,18 @@ private void reportErrors() throws RepositoryResolutionException {

List<String> missingBasePlatforms = new ArrayList<String>();

// Versionless feature issues will appear in missingTopLevelRequirements, and this will gather the associated platform unable to target.
// Versionless features can't be resolved if a corresponding platform is not derived, making the choice ambiguous, and the feature won't be included in the resolved list. - will gather the associated platform unable to target.
for (String name : missingTopLevelRequirements) {
ProvisioningFeatureDefinition feature = resolverRepository.getFeature(name);
if (feature != null && feature.isVersionless()) {
ProvisioningFeatureDefinition firstChild = resolverRepository.findAllPossibleVersions(feature).get(0);
String plat = firstChild.getPlatformName();
if (plat != null) {//This will add just the platform name without version
missingBasePlatforms.add(resolverRepository.getFeatureBaseName(plat));
}
List<ProvisioningFeatureDefinition> featureChildren = resolverRepository.findAllPossibleVersions(feature);
if (!featureChildren.isEmpty() {
ProvisioningFeatureDefinition firstChild = featureChildren.get(0);
String plat = firstChild.getPlatformName();
if (plat != null) {//This will add just the platform name without version
missingBasePlatforms.add(resolverRepository.getFeatureBaseName(plat));
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,12 @@ public boolean isVersionless() {
return false;
}

if (getSymbolicName().indexOf(".versionless.") == -1) {
return false;
} else if (getSymbolicName().indexOf(".internal.versionless.") != -1) {
if (getSymbolicName().contains(".versionless.")
&& !getSymbolicName().contains(".internal.")) {
return true;
} else {
return false;
}

return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public List<ProvisioningFeatureDefinition> findAllPossibleVersions(ProvisioningF
publicFeature = getVersionedFeature(dependency.getSymbolicName());
if (publicFeature != null)
result.add(publicFeature);

String baseName = getFeatureBaseName(dependency.getSymbolicName());
List<String> tolerates = dependency.getTolerates();
if (tolerates != null) {
Expand All @@ -275,13 +275,13 @@ public List<ProvisioningFeatureDefinition> findAllPossibleVersions(ProvisioningF

/**
*
* Answer the public versioned feature based on the internal versionless linking feature
* Answer the public versioned feature based on the internal versionless linking feature, or null if can't be found
*
* @param versionlessLinkingFeatureName
* @return ProvisioningFeatureDefinition
*/
private ProvisioningFeatureDefinition getVersionedFeature(String versionlessLinkingFeatureName) {
ProvisioningFeatureDefinition result = null;

ProvisioningFeatureDefinition feature = getFeature(versionlessLinkingFeatureName);
if (feature != null) {
//This is the versionless linking feature pointing to a public versioned feature
Expand Down

0 comments on commit 6571a97

Please sign in to comment.