Skip to content

Commit

Permalink
Merge pull request #6744 from breakponchito/FISH-8309-persistence-con…
Browse files Browse the repository at this point in the history
…text-fix-on-cdi-beans-into-mdb

FISH-8309: Persistence Context is NULL on CDI Injected beans into MDB and tck fix
  • Loading branch information
breakponchito authored Jun 5, 2024
2 parents d0121c1 + ed01e3d commit 9583406
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates]

package com.sun.enterprise.deployment;

Expand Down Expand Up @@ -604,6 +604,14 @@ public void print(StringBuilder toStringBuilder) {
@Override
public abstract ArchiveType getModuleType();

/**
* Processes the bundle descriptor.
* This method should be overridden in subclasses to provide specific processing logic
* for the bundle descriptor.
*/
public void processBundleDescriptor() {
}

/**
* @return the visitor for this bundle descriptor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2020-2021] [Payara Foundation and/or its affiliates.]
// Portions Copyright [2020-2024] [Payara Foundation and/or its affiliates.]

package com.sun.enterprise.deployment.archivist;

Expand Down Expand Up @@ -375,6 +375,7 @@ public void postRuntimeDDsRead(T descriptor,
*/
protected void postOpen(T descriptor, ReadableArchive archive)
throws IOException {
descriptor.processBundleDescriptor();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2019] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates]

package org.glassfish.ejb.deployment.descriptor;

Expand Down Expand Up @@ -355,6 +355,15 @@ public Collection<Long> getDescriptorIds() {
return ejbIDs;
}

/**
* Processes the bundle descriptor by invoking the processing of each EjbDescriptor.
* It is assumed that the ejbs collection is already populated with EjbDescriptor instances.
*/
public void processBundleDescriptor() {
for (EjbDescriptor ejbDescriptor : ejbs) {
ejbDescriptor.processDescriptor();
}
}
public void addEjb(EjbDescriptor ejbDescriptor) {
ejbDescriptor.setEjbBundleDescriptor(this);
ejbs.add(ejbDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2019-2021] [Payara Foundation and/or its affiliates]
// Portions Copyright [2019-2024] [Payara Foundation and/or its affiliates]

package org.glassfish.ejb.deployment.descriptor;

Expand Down Expand Up @@ -2373,6 +2373,43 @@ public void setEjbBundleDescriptor(EjbBundleDescriptorImpl bundleDescriptor) {
this.bundleDescriptor = bundleDescriptor;
}

/**
* Processes the descriptor by adding various descriptors and properties
* from the root bundle descriptor.
* It is expected that the bundle descriptor is already set before calling this method.
*/
public void processDescriptor() {
if (this.bundleDescriptor != null) {
for (Object msgDestRefObj : this.bundleDescriptor.getMessageDestinationReferenceDescriptors()) {
addMessageDestinationReferenceDescriptor((MessageDestinationReferenceDescriptor) msgDestRefObj);
}

for (Object envPropObj : this.bundleDescriptor.getEnvironmentProperties()) {
addOrMergeEnvironmentProperty((EnvironmentProperty) envPropObj);
}

for (Object servRefObj : this.bundleDescriptor.getServiceReferenceDescriptors()) {
addServiceReferenceDescriptor((ServiceReferenceDescriptor) servRefObj);
}

for (Object resRefObj : this.bundleDescriptor.getResourceReferenceDescriptors()) {
addResourceReferenceDescriptor((ResourceReferenceDescriptor) resRefObj);
}

for (Object resourceEnvRefObj : this.bundleDescriptor.getResourceEnvReferenceDescriptors()) {
addResourceEnvReferenceDescriptor((ResourceEnvReferenceDescriptor) resourceEnvRefObj);
}

for (EntityManagerFactoryReferenceDescriptor entMgrFacRef : this.bundleDescriptor.getEntityManagerFactoryReferenceDescriptors()) {
addEntityManagerFactoryReferenceDescriptor(entMgrFacRef);
}

for (EntityManagerReferenceDescriptor entMgrRef : this.bundleDescriptor.getEntityManagerReferenceDescriptors()) {
addEntityManagerReferenceDescriptor(entMgrRef);
}
}
}

/**
* Called by WebArchivist to notify this EjbDescriptor that it has been associated with a web bundle.
*
Expand Down

0 comments on commit 9583406

Please sign in to comment.