}
}
public void addGBeans(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
J2eeContext earJ2eeContext = earContext.getJ2eeContext();
J2eeContext moduleJ2eeContext = J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, NameFactory.RESOURCE_ADAPTER_MODULE, module.getName());
J2eeContext resourceJ2eeContext = J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, NameFactory.JCA_RESOURCE, module.getName());
XmlObject specDD = module.getSpecDD();
// build the objectName
ObjectName resourceAdapterModuleName = null;
try {
resourceAdapterModuleName = NameFactory.getModuleName(null, null, null, null, null, moduleJ2eeContext);
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct module name", e);
}
GBeanData resourceAdapterModuleData = earContext.getRefContext().getResourceAdapterModuleData(resourceAdapterModuleName);
ObjectName resourceAdapterjsr77Name = null;
try {
resourceAdapterjsr77Name = NameFactory.getComponentName(null, null, null, null, null, resourceJ2eeContext.getJ2eeModuleName(), NameFactory.RESOURCE_ADAPTER, moduleJ2eeContext);
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct resource adapter placeholder name", e);
}
resourceAdapterModuleData.setAttribute("resourceAdapter", resourceAdapterjsr77Name.getCanonicalName());
// add it
earContext.addGBean(resourceAdapterModuleData);
//construct the bogus resource adapter and jca resource placeholders
GBeanData resourceAdapterData = new GBeanData(resourceAdapterjsr77Name, ResourceAdapterImpl.GBEAN_INFO);
ObjectName jcaResourcejsr77Name = null;
try {
//TODO double check the module type is correct.
jcaResourcejsr77Name = NameFactory.getComponentName(null, null, null, NameFactory.RESOURCE_ADAPTER, null, resourceJ2eeContext.getJ2eeModuleName(), NameFactory.JCA_RESOURCE, moduleJ2eeContext);
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct jca resource placeholder name", e);
}
resourceAdapterData.setAttribute("JCAResource", jcaResourcejsr77Name.getCanonicalName());
earContext.addGBean(resourceAdapterData);