use of org.glassfish.ejb.spi.CMPService in project Payara by payara.
the class EjbDeployer method load.
@Override
public EjbApplication load(EjbContainerStarter containerStarter, DeploymentContext dc) {
super.load(containerStarter, dc);
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "EjbDeployer Loading app from: " + dc.getSourceDir());
}
// Register the EjbSecurityComponentInvocationHandler
RegisteredComponentInvocationHandler handler = habitat.getService(RegisteredComponentInvocationHandler.class, "ejbSecurityCIH");
handler.register();
EjbBundleDescriptorImpl ejbBundle = dc.getModuleMetaData(EjbBundleDescriptorImpl.class);
if (ejbBundle == null) {
throw new RuntimeException("Unable to load EJB module. DeploymentContext does not contain any EJB " + " Check archive to ensure correct packaging for " + dc.getSourceDir());
}
ejbBundle.setClassLoader(dc.getClassLoader());
ejbBundle.setupDataStructuresForRuntime();
if (ejbBundle.containsCMPEntity()) {
CMPService cmpService = cmpServiceProvider.get();
if (cmpService == null) {
throw new RuntimeException("CMP Module is not available");
} else if (!cmpService.isReady()) {
throw new RuntimeException("CMP Module is not initialized");
}
}
EjbApplication ejbApp = new EjbApplication(ejbBundle, dc, dc.getClassLoader(), habitat);
try {
compEnvManager.bindToComponentNamespace(ejbBundle);
// If within .war, also bind dependencies declared by web application. There is
// a single naming environment for the entire .war module. Yhis is necessary
// in order for eagerly initialized ejb components to have visibility to all the
// dependencies b/c the web container does not bind to the component namespace until
// its start phase, which comes after the ejb start phase.
Object rootDesc = ejbBundle.getModuleDescriptor().getDescriptor();
if ((rootDesc != ejbBundle) && (rootDesc instanceof WebBundleDescriptor)) {
WebBundleDescriptor webBundle = (WebBundleDescriptor) rootDesc;
compEnvManager.bindToComponentNamespace(webBundle);
}
} catch (Exception e) {
throw new RuntimeException("Exception registering ejb bundle level resources", e);
}
ejbApp.loadContainers(dc);
return ejbApp;
}
Aggregations