Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding platforms to ESA #28973

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2023 IBM Corporation and others.
* Copyright (c) 2015, 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 @@ -253,6 +253,21 @@ public EsaResourceWritable parseFileToResource(File assetFile, File metadataFile
}
}

// handle platforms
String platformsValue = feature.getHeader("WLP-Platform");
if (platformsValue != null && !platformsValue.isEmpty()) {
ArrayList newPlatformsList = new ArrayList();
String[] myPlatforms = platformsValue.split(",");
for (String platform : myPlatforms) {
platform = platform.trim();
if (!platform.isEmpty()) {
newPlatformsList.add(platform);
}
}
if (!newPlatformsList.isEmpty())
resource.setPlatforms(newPlatformsList);
}

resource.setShortName(shortName);

// Calculate which features this relies on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,11 @@ public interface EsaResource extends RepositoryResource, ApplicableToProduct {
* @return The AppliesToFilter header property
*/
public Collection<AppliesToFilterInfo> getAppliesToFilterInfo();

/**
* Returns a collection of platform Strings this feature "belongs" in
*
* @return a collection of platform Strings this feature "belongs" in, WLP-Platforms header property
*/
public Collection<String> getPlatforms();
}
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ protected void copyFieldsFrom(RepositoryResourceImpl fromResource, boolean inclu
setShortName(esaRes.getShortName());
setVanityURL(esaRes.getVanityURL());
setSingleton(esaRes.getSingleton());
setPlatforms(esaRes.getPlatforms());
setIBMInstallTo(esaRes.getIBMInstallTo());
}

Expand Down Expand Up @@ -826,4 +827,16 @@ public void setIBMInstallTo(String ibmInstallTo) {
_asset.getWlpInformation().setIbmInstallTo(ibmInstallTo);
}

/** {@inheritDoc} */
@Override
public Collection<String> getPlatforms() {
return _asset.getWlpInformation().getPlatforms();
}

/** {@inheritDoc} */
@Override
public void setPlatforms(Collection<String> platforms) {
_asset.getWlpInformation().setPlatforms(platforms);
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2015 IBM Corporation and others.
* Copyright (c) 2015, 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
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand Down Expand Up @@ -67,6 +67,13 @@ public interface EsaResourceWritable extends WebDisplayable, ApplicableToProduct
*/
public void addRequireFeatureWithTolerates(String feature, Collection<String> tolerates);

/**
* Sets the collection of platforms for this feature
*
* @param platforms The collection of platforms for this feature
*/
public void setPlatforms(Collection<String> platforms);

/**
* Add the supplied fix to the list of required fixes
*
Expand Down Expand Up @@ -126,7 +133,7 @@ public interface EsaResourceWritable extends WebDisplayable, ApplicableToProduct
* Sets the ibmProvisionCapability field.
*
* @param ibmProvisionCapability
* The new ibmProvisionCapability to be used
* The new ibmProvisionCapability to be used
*/
public void setProvisionCapability(String provisionCapability);

Expand All @@ -144,10 +151,10 @@ public interface EsaResourceWritable extends WebDisplayable, ApplicableToProduct
* Specify the minimum/maximum Java version needed by this ESA, and the Require-Capability headers from each contained bundle which have led to the requirement. All fields are
* allowed to be null.
*
* @param minimum an OSGI version string representing the minimum Java version required.
* @param maximum an OSGI version string representing the minimum Java version required.
* @param displayMinimum An alternative representation of the minimum version for display purposes
* @param displayMaximum An alternative representation of the maximum version for display purposes
* @param minimum an OSGI version string representing the minimum Java version required.
* @param maximum an OSGI version string representing the minimum Java version required.
* @param displayMinimum An alternative representation of the minimum version for display purposes
* @param displayMaximum An alternative representation of the maximum version for display purposes
* @param rawBundleRequirements The Require-Capability headers from all the bundles contained in this ESA
*/
public void setJavaSEVersionRequirements(String minimum, String maximum, Collection<String> rawBundleRequirements);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2023 IBM Corporation and others.
* Copyright (c) 2015, 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 @@ -66,6 +66,7 @@ public class WlpInformation extends AbstractJSON implements VersionableContent,
private String vanityRelativeURL;
private String featuredWeight;
private Collection<String> supersededBy;
private Collection<String> platforms;
private Collection<String> supersededByOptional;
private JavaSEVersionRequirements javaSEVersionRequirements;
private String mainAttachmentSHA256;
Expand Down Expand Up @@ -107,6 +108,7 @@ public WlpInformation(WlpInformation other) {
vanityRelativeURL = other.vanityRelativeURL;
featuredWeight = other.featuredWeight;
supersededBy = copyCollection(other.supersededBy);
platforms = copyCollection(other.platforms);
supersededByOptional = copyCollection(other.supersededByOptional);
javaSEVersionRequirements = copyObject(other.javaSEVersionRequirements, JavaSEVersionRequirements::new);
mainAttachmentSHA256 = other.mainAttachmentSHA256;
Expand Down Expand Up @@ -427,6 +429,14 @@ public void setSupersededBy(Collection<String> supersededBy) {
this.supersededBy = supersededBy;
}

public Collection<String> getPlatforms() {
return this.platforms;
}

public void setPlatforms(Collection<String> myPlatforms) {
this.platforms = myPlatforms;
}

public Collection<String> getSupersededByOptional() {
return this.supersededByOptional;
}
Expand Down Expand Up @@ -799,6 +809,14 @@ boolean equivalent(Object obj) {
} else if (!ibmInstallTo.equals(other.ibmInstallTo))
return false;

if (platforms == null) {
if (other.platforms != null) {
return false;
}
} else if (!platforms.equals(other.platforms)) {
return false;
}

return true;
}

Expand Down