public void addGBeans(EARContext earContext, Module module, Bundle bundle, Collection collection) throws DeploymentException {
if (module.getType() != ConfigurationModuleType.EJB || !JAX_RPC_SERVER_SUPPORT) {
return;
}
EjbModule ejbModule = (EjbModule) module;
Map<String, WebServiceBinding> wsBindingMap = createWebServiceBindingMap(ejbModule);
for (EnterpriseBeanInfo bean : ejbModule.getEjbJarInfo().enterpriseBeans) {
//JAX-WS will be handled in JAXWSEJBModuleBuilderExtension
if (isJAXWSWebService(bean, bundle)) {
continue;
}
String j2eeType = null;
if (bean.type == EnterpriseBeanInfo.STATELESS) {
j2eeType = NameFactory.STATELESS_SESSION_BEAN;
} else if (bean.type == EnterpriseBeanInfo.SINGLETON) {
j2eeType = NameFactory.SINGLETON_BEAN;
} else {
continue;
}
String ejbName = bean.ejbName;
AbstractName sessionName = earContext.getNaming().createChildName(module.getModuleName(), ejbName, j2eeType);
assert sessionName != null: "StatelesSessionBean/SingletionBean object name is null";
AbstractName ejbWebServiceName = earContext.getNaming().createChildName(sessionName, ejbName, NameFactory.WEB_SERVICE_LINK);
GBeanData ejbWebServiceGBean = new GBeanData(ejbWebServiceName, EjbWebServiceGBean.class);
ejbWebServiceGBean.setAttribute("ejbName", ejbName);
ejbWebServiceGBean.setAttribute("ejbClass", bean.ejbClass);
WebServiceBinding wsBinding = wsBindingMap.get(ejbName);
if (wsBinding != null) {
List<String> ddVirtualHosts = wsBinding.getWebServiceVirtualHost();
if (ddVirtualHosts != null) {
String[] virtualHosts = new String[ddVirtualHosts.size()];
for (int i=0; i<ddVirtualHosts.size(); i++) {
virtualHosts[i] = ddVirtualHosts.get(i).trim();
}
ejbWebServiceGBean.setAttribute("virtualHosts", virtualHosts);
}
WebServiceSecurityType wsSecurity = wsBinding.getWebServiceSecurity();
if (wsSecurity != null) {
ejbWebServiceGBean.setReferencePattern("ConfigurationFactory",
new AbstractNameQuery(null, Collections.singletonMap("name", wsSecurity.getSecurityRealmName().trim()),
ConfigurationFactory.class.getName()));
ejbWebServiceGBean.setAttribute("authMethod", wsSecurity.getAuthMethod().value());
if (wsSecurity.getRealmName() != null) {
ejbWebServiceGBean.setAttribute("realmName", wsSecurity.getRealmName().trim());
}
Properties properties = wsSecurity.getProperties();
ejbWebServiceGBean.setAttribute("properties", properties);
String policyContextID = sessionName.toString();
ejbWebServiceGBean.setAttribute("policyContextID", policyContextID);
}
}
ejbWebServiceGBean.addDependency(module.getModuleName());
if (axisBuilder.configureEJB(ejbWebServiceGBean, ejbName, ejbModule,
ejbModule.getSharedContext(), bundle)) {
try {
earContext.addGBean(ejbWebServiceGBean);
} catch (GBeanAlreadyExistsException e) {
throw new DeploymentException(