diff --git a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java index 1ee661538bd..22afbdf17c1 100644 --- a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java +++ b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -// Portions Copyright [2018-2023] Payara Foundation and/or affiliates +// Portions Copyright [2018-2024] Payara Foundation and/or affiliates package org.glassfish.config.support; @@ -48,6 +48,7 @@ import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.stream.Collectors; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -91,7 +92,7 @@ private DomainXmlPreParserException(String s) { private List configNames = new LinkedList<>(); private Map mapServerConfig = new HashMap<>(); private ClusterData cluster; - private DeploymentGroupData deploymentGroup; + private DeploymentGroupData deploymentGroup; // Refers to the FIRST deployment group for this instance. private String instanceName; private String serverConfigRef; private boolean valid = false; @@ -129,14 +130,6 @@ final String getClusterName() { return cluster.name; } - - final String getDeploymentGroupName() { - if(!validDG) { - return null; - } - return deploymentGroup.name; - } - final List getServerNames() { if(!valid) { return null; @@ -146,9 +139,14 @@ final List getServerNames() { final List getDGServerNames() { if(!validDG) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } - return deploymentGroup.dgServerRefs; + + return deploymentGroups + .stream() + .filter(groupData -> groupData.dgServerRefs.contains(instanceName)) + .flatMap(groupData -> groupData.dgServerRefs.stream()) + .collect(Collectors.toList()); } public Map getMapServerConfig() { diff --git a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java index 19305f9be10..d3e87c464d4 100644 --- a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java +++ b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -// Portions Copyright [2018-2023] Payara Foundation and/or affiliates +// Portions Copyright [2018-2024] Payara Foundation and/or affiliates package org.glassfish.config.support; @@ -98,10 +98,6 @@ final boolean filterOut() throws XMLStreamException { if (elementName.equals(CLUSTER)){ return handleCluster(reader); } - - if (elementName.equals(DEPLOYMENT_GROUP)){ - return handleDeploymentGroup(reader); - } // keep everything else return false; @@ -160,19 +156,6 @@ private boolean handleCluster(XMLStreamReader reader) { return !(StringUtils.ok(myCluster) && myCluster.equals(name)); } - /** - * Note that dxpp.getClusterName() will definitely return null - * for stand-alone instances. This is normal. - * - * @return true if we want to filter out this DEPLOYMENT GROUP element - */ - private boolean handleDeploymentGroup(XMLStreamReader reader) { - String name = reader.getAttributeValue(null, NAME); - String myDG = dxpp.getDeploymentGroupName(); - - return !(StringUtils.ok(myDG) && myDG.equals(name)); - } - private final DomainXmlPreParser dxpp; private final String instanceName; }