Skip to content

Commit

Permalink
Scattered WAR support fixed
Browse files Browse the repository at this point in the history
- fixes two tests in ejb_group_embedded (Jenkins failure in this branch)
- one test remaining

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Sep 18, 2022
1 parent 2d5172b commit 80420f2
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class ACCPersistenceArchivist extends PersistenceArchivist {

@Override
public boolean supportsModuleType(ArchiveType moduleType) {
return (moduleType != null && moduleType.equals(DOLUtils.carType())) && (env.getProcessType() == ProcessType.ACC) ;
return DOLUtils.carType().equals(moduleType) && env.getProcessType() == ProcessType.ACC ;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class EarPersistenceArchivist extends PersistenceArchivist {

@Override
public boolean supportsModuleType(ArchiveType moduleType) {
return moduleType!=null && moduleType.equals(DOLUtils.earType());
return DOLUtils.earType().equals(moduleType);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -16,12 +17,14 @@

package com.sun.enterprise.deployment.archivist;

import com.sun.enterprise.deployment.util.DOLUtils;

import jakarta.inject.Inject;

import org.glassfish.api.admin.ProcessEnvironment;
import org.glassfish.api.deployment.archive.ArchiveType;
import org.glassfish.api.deployment.archive.ReadableArchive;
import org.glassfish.api.admin.*;
import org.jvnet.hk2.annotations.Service;
import com.sun.enterprise.deployment.util.DOLUtils;
import jakarta.inject.Inject;


/**
Expand All @@ -36,9 +39,9 @@ public class ServerSidePersistenceArchivist extends PersistenceArchivist {
@Override
public boolean supportsModuleType(ArchiveType moduleType) {
// Reads persitence.xml for ejb jars
return moduleType != null && (moduleType.equals(DOLUtils.ejbType()) ||
// Or App client modules if running inside server
(moduleType.equals(DOLUtils.carType()) && env.getProcessType().isServer()));
// Or App client modules if running inside server
return DOLUtils.ejbType().equals(moduleType)
|| (DOLUtils.carType().equals(moduleType) && env.getProcessType().isServer());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package com.sun.enterprise.deployment.archivist;

import com.sun.enterprise.deployment.io.DescriptorConstants;
import com.sun.enterprise.deployment.util.DOLUtils;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -33,15 +32,19 @@
import org.jvnet.hk2.annotations.Service;
import org.xml.sax.SAXException;

import static com.sun.enterprise.deployment.util.DOLUtils.scatteredWarType;
import static com.sun.enterprise.deployment.util.DOLUtils.warType;

@Service
@ExtensionsArchivistFor("jpa")
public class WarPersistenceArchivist extends PersistenceArchivist {

@Override
public boolean supportsModuleType(ArchiveType moduleType) {
return moduleType != null && moduleType.equals(DOLUtils.warType());
return warType().equals(moduleType) || scatteredWarType().equals(moduleType);
}


@Override
public RootDeploymentDescriptor open(Archivist main, ReadableArchive warArchive, RootDeploymentDescriptor descriptor) throws IOException, SAXException {
final String CLASSES_DIR = "WEB-INF/classes/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.sun.enterprise.deployment.node.RootXMLNode;
import com.sun.enterprise.deployment.node.ws.WLDescriptorConstants;
import com.sun.enterprise.deployment.node.ws.WLWebServicesDescriptorNode;
import com.sun.enterprise.deployment.util.DOLUtils;

import java.io.IOException;
import java.io.OutputStream;
Expand All @@ -34,6 +33,9 @@
import org.glassfish.deployment.common.Descriptor;
import org.glassfish.deployment.common.RootDeploymentDescriptor;

import static com.sun.enterprise.deployment.util.DOLUtils.scatteredWarType;
import static com.sun.enterprise.deployment.util.DOLUtils.warType;

/**
* This class is responsible for handling the WebLogic webservices deployment descriptor.
* This file weblogic-webservices.xml complements JSR-109 defined webservices.xml
Expand All @@ -47,8 +49,9 @@ public class WLSWebServicesDeploymentDescriptorFile extends ConfigurationDeploym

public WLSWebServicesDeploymentDescriptorFile(RootDeploymentDescriptor desc) {
if (desc instanceof WebServicesDescriptor) {
descriptorPath = (((WebServicesDescriptor) desc).getBundleDescriptor().getModuleType()
.equals(DOLUtils.warType()))
BundleDescriptor descriptor = ((WebServicesDescriptor) desc).getBundleDescriptor();
descriptorPath = warType().equals(descriptor.getModuleType())
|| scatteredWarType().equals(descriptor.getModuleType())
? WLDescriptorConstants.WL_WEB_WEBSERVICES_JAR_ENTRY
: WLDescriptorConstants.WL_EJB_WEBSERVICES_JAR_ENTRY;
} else if (desc instanceof WebBundleDescriptor) {
Expand All @@ -63,7 +66,7 @@ public String getDeploymentDescriptorPath() {
return descriptorPath;
}

public static Vector getAllDescriptorPaths() {
public static Vector<String> getAllDescriptorPaths() {
Vector<String> allDescPaths = new Vector<>();
allDescPaths.add(WLDescriptorConstants.WL_WEB_WEBSERVICES_JAR_ENTRY);
allDescPaths.add(WLDescriptorConstants.WL_EJB_WEBSERVICES_JAR_ENTRY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.sun.enterprise.deployment.EjbDescriptor;
import com.sun.enterprise.deployment.JndiNameEnvironment;
import com.sun.enterprise.deployment.ManagedBeanDescriptor;
import com.sun.enterprise.deployment.ScatteredWarType;
import com.sun.enterprise.deployment.WebBundleDescriptor;
import com.sun.enterprise.deployment.archivist.Archivist;
import com.sun.enterprise.deployment.archivist.ArchivistFactory;
Expand Down Expand Up @@ -303,6 +304,10 @@ public static ArchiveType rarType() {
return getModuleType("rar");
}

public static ArchiveType scatteredWarType() {
return getModuleType(ScatteredWarType.ARCHIVE_TYPE);
}

/**
* Utility method to retrieve a {@link ArchiveType} from a stringified module type.
* Since {@link ArchiveType} is an extensible abstraction and implementations are plugged in via HK2 service
Expand Down Expand Up @@ -710,7 +715,7 @@ public static boolean setElementValue(XMLElement element, String value, Object o
return false;
}

/*
/**
* Returns a list of the proprietary schema namespaces
*/
public static List<String> getProprietarySchemaNamespaces() {
Expand All @@ -720,7 +725,7 @@ public static List<String> getProprietarySchemaNamespaces() {
return ns;
}

/*
/**
* Returns a list of the proprietary dtd system IDs
*/
public static List<String> getProprietaryDTDStart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
import org.glassfish.hk2.api.ServiceLocator;
import org.jvnet.hk2.annotations.Service;

import static com.sun.enterprise.deployment.util.DOLUtils.scatteredWarType;
import static com.sun.enterprise.deployment.util.DOLUtils.warType;

/**
* @author Mahesh Kannan
*/
Expand Down Expand Up @@ -97,7 +100,7 @@ public ModuleScanner getScanner() {

@Override
public boolean supportsModuleType(ArchiveType moduleType) {
return moduleType != null && moduleType.equals(DOLUtils.warType());
return warType().equals(moduleType) || scatteredWarType().equals(moduleType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -25,6 +26,8 @@
import org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl;
import org.glassfish.ejb.deployment.node.EjbBundleNode;

import static com.sun.enterprise.deployment.util.DOLUtils.warType;

/**
* This class is responsible for handling EJB DeploymentDescriptor files
*
Expand All @@ -37,9 +40,11 @@ public class EjbDeploymentDescriptorFile extends DeploymentDescriptorFile {
* @return the location of the DeploymentDescriptor file for a
* particular type of J2EE Archive
*/
@Override
public String getDeploymentDescriptorPath() {
return DOLUtils.warType().equals(getArchiveType()) ?
DescriptorConstants.EJB_IN_WAR_ENTRY : DescriptorConstants.EJB_JAR_ENTRY;
return warType().equals(getArchiveType()) || DOLUtils.scatteredWarType().equals(getArchiveType())
? DescriptorConstants.EJB_IN_WAR_ENTRY
: DescriptorConstants.EJB_JAR_ENTRY;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import com.sun.enterprise.deployment.io.ConfigurationDeploymentDescriptorFileFor;
import com.sun.enterprise.deployment.io.DescriptorConstants;
import com.sun.enterprise.deployment.node.RootXMLNode;
import com.sun.enterprise.deployment.util.DOLUtils;

import org.glassfish.deployment.common.Descriptor;
import org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl;
import org.glassfish.ejb.deployment.node.runtime.EjbBundleRuntimeNode;
import org.glassfish.hk2.api.PerLookup;

import org.jvnet.hk2.annotations.Service;

import static com.sun.enterprise.deployment.util.DOLUtils.scatteredWarType;
import static com.sun.enterprise.deployment.util.DOLUtils.warType;

/**
* This class is responsible for handling the XML configuration information
Expand All @@ -46,9 +46,11 @@ public class EjbRuntimeDDFile extends ConfigurationDeploymentDescriptorFile {
* @return the location of the DeploymentDescriptor file for a
* particular type of J2EE Archive
*/
@Override
public String getDeploymentDescriptorPath() {
return DOLUtils.warType().equals(getArchiveType()) ?
DescriptorConstants.S1AS_EJB_IN_WAR_ENTRY : DescriptorConstants.S1AS_EJB_JAR_ENTRY;
return warType().equals(getArchiveType()) || scatteredWarType().equals(getArchiveType())
? DescriptorConstants.S1AS_EJB_IN_WAR_ENTRY
: DescriptorConstants.S1AS_EJB_JAR_ENTRY;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -23,12 +24,13 @@

import org.jvnet.hk2.annotations.Service;

import static com.sun.enterprise.deployment.util.DOLUtils.scatteredWarType;
import static com.sun.enterprise.deployment.util.DOLUtils.warType;
import com.sun.ejb.containers.EjbContainerUtil;
import com.sun.enterprise.deployment.io.ConfigurationDeploymentDescriptorFile;
import com.sun.enterprise.deployment.io.ConfigurationDeploymentDescriptorFileFor;
import com.sun.enterprise.deployment.io.DescriptorConstants;
import com.sun.enterprise.deployment.node.RootXMLNode;
import com.sun.enterprise.deployment.util.DOLUtils;

/**
* This class is responsible for handling the XML configuration information
Expand All @@ -42,9 +44,11 @@ public class GFEjbRuntimeDDFile extends ConfigurationDeploymentDescriptorFile {
* @return the location of the DeploymentDescriptor file for a
* particular type of J2EE Archive
*/
@Override
public String getDeploymentDescriptorPath() {
return DOLUtils.warType().equals(getArchiveType()) ?
DescriptorConstants.GF_EJB_IN_WAR_ENTRY : DescriptorConstants.GF_EJB_JAR_ENTRY;
return warType().equals(getArchiveType()) || scatteredWarType().equals(getArchiveType())
? DescriptorConstants.GF_EJB_IN_WAR_ENTRY
: DescriptorConstants.GF_EJB_JAR_ENTRY;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public List<ConfigurationDeploymentDescriptorFile> getConfigurationDDFiles(RootD

@Override
public boolean supportsModuleType(ArchiveType moduleType) {
return (DOLUtils.warType().equals(moduleType) || DOLUtils.ejbType().equals(moduleType));
return DOLUtils.warType().equals(moduleType) || DOLUtils.ejbType().equals(moduleType)
|| DOLUtils.scatteredWarType().equals(moduleType);
}

@Override
Expand Down

0 comments on commit 80420f2

Please sign in to comment.