diff --git a/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java b/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java index 404eee795fb..c3ba9161c31 100644 --- a/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java +++ b/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/EsaParser.java @@ -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 @@ -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 diff --git a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/EsaResource.java b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/EsaResource.java index d83c10e8bda..529576846f6 100644 --- a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/EsaResource.java +++ b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/EsaResource.java @@ -132,4 +132,11 @@ public interface EsaResource extends RepositoryResource, ApplicableToProduct { * @return The AppliesToFilter header property */ public Collection 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 getPlatforms(); } diff --git a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/EsaResourceImpl.java b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/EsaResourceImpl.java index 3b8f35babdc..0ca9b7c7ef5 100644 --- a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/EsaResourceImpl.java +++ b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/EsaResourceImpl.java @@ -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()); } @@ -826,4 +827,16 @@ public void setIBMInstallTo(String ibmInstallTo) { _asset.getWlpInformation().setIbmInstallTo(ibmInstallTo); } + /** {@inheritDoc} */ + @Override + public Collection getPlatforms() { + return _asset.getWlpInformation().getPlatforms(); + } + + /** {@inheritDoc} */ + @Override + public void setPlatforms(Collection platforms) { + _asset.getWlpInformation().setPlatforms(platforms); + } + } diff --git a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/writeable/EsaResourceWritable.java b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/writeable/EsaResourceWritable.java index 272bce19abc..f6457f8f1ca 100644 --- a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/writeable/EsaResourceWritable.java +++ b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/writeable/EsaResourceWritable.java @@ -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: @@ -67,6 +67,13 @@ public interface EsaResourceWritable extends WebDisplayable, ApplicableToProduct */ public void addRequireFeatureWithTolerates(String feature, Collection tolerates); + /** + * Sets the collection of platforms for this feature + * + * @param platforms The collection of platforms for this feature + */ + public void setPlatforms(Collection platforms); + /** * Add the supplied fix to the list of required fixes * @@ -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); @@ -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 rawBundleRequirements); diff --git a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/model/WlpInformation.java b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/model/WlpInformation.java index 8bbf97574b9..2b646b62b5a 100644 --- a/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/model/WlpInformation.java +++ b/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/model/WlpInformation.java @@ -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 @@ -66,6 +66,7 @@ public class WlpInformation extends AbstractJSON implements VersionableContent, private String vanityRelativeURL; private String featuredWeight; private Collection supersededBy; + private Collection platforms; private Collection supersededByOptional; private JavaSEVersionRequirements javaSEVersionRequirements; private String mainAttachmentSHA256; @@ -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; @@ -427,6 +429,14 @@ public void setSupersededBy(Collection supersededBy) { this.supersededBy = supersededBy; } + public Collection getPlatforms() { + return this.platforms; + } + + public void setPlatforms(Collection myPlatforms) { + this.platforms = myPlatforms; + } + public Collection getSupersededByOptional() { return this.supersededByOptional; } @@ -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; }