You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2011/04/12 08:19:17 UTC
svn commit: r1091304 - in /geronimo/server/trunk/plugins:
axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/
jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/
webservices/geronimo-webservices/...
Author: xuhaihong
Date: Tue Apr 12 06:19:17 2011
New Revision: 1091304
URL: http://svn.apache.org/viewvc?rev=1091304&view=rev
Log:
Initial enablement for ejb webservice
Modified:
geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/JAXWSEJBModuleBuilderExtension.java
geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java
geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java (contents, props changed)
Modified: geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java?rev=1091304&r1=1091303&r2=1091304&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisModuleBuilderExtension.java Tue Apr 12 06:19:17 2011
@@ -69,7 +69,7 @@ public class AxisModuleBuilderExtension
private WebServiceBuilder axisBuilder;
private Environment defaultEnvironment;
- private AbstractNameQuery listener;
+ private AbstractNameQuery listener;
public AxisModuleBuilderExtension() {
this(null, null, null);
@@ -93,9 +93,9 @@ public class AxisModuleBuilderExtension
}
EjbModule ejbModule = (EjbModule) module;
-
+
//overridden web service locations
- Map<String, String> correctedPortLocations = new HashMap<String, String>();
+ Map<String, String> correctedPortLocations = new HashMap<String, String>();
Map<String, WebServiceBinding> wsBindingMap = createWebServiceBindingMap(ejbModule);
for (Map.Entry<String, WebServiceBinding> entry : wsBindingMap.entrySet()) {
String location = entry.getValue().getWebServiceAddress();
@@ -106,13 +106,13 @@ public class AxisModuleBuilderExtension
}
correctedPortLocations.put(entry.getKey(), location);
}
- }
+ }
axisBuilder.findWebServices(module, true, correctedPortLocations, environment, ejbModule.getSharedContext());
-
+
if (this.defaultEnvironment != null) {
EnvironmentBuilder.mergeEnvironments(environment, this.defaultEnvironment);
- }
+ }
}
@Override
@@ -130,15 +130,21 @@ public class AxisModuleBuilderExtension
Map<String, WebServiceBinding> wsBindingMap = createWebServiceBindingMap(ejbModule);
for (EnterpriseBeanInfo bean : ejbModule.getEjbInfo().getEjbJarInfo().enterpriseBeans) {
- if (bean.type != EnterpriseBeanInfo.STATELESS) {
+
+ 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, NameFactory.STATELESS_SESSION_BEAN);
+ AbstractName sessionName = earContext.getNaming().createChildName(module.getModuleName(), ejbName, j2eeType);
- assert sessionName != null: "StatelesSessionBean object name is null";
+ assert sessionName != null: "StatelesSessionBean/Singletion object name is null";
WebServiceBinding wsBinding = wsBindingMap.get(ejbName);
if (wsBinding != null) {
@@ -183,19 +189,25 @@ public class AxisModuleBuilderExtension
}
EjbModule ejbModule = (EjbModule) module;
-
+
Map<String, WebServiceBinding> wsBindingMap = createWebServiceBindingMap(ejbModule);
- AbstractNameQuery ejbModuleName = NameFactory.newTypeNameQuery(module.getEarContext().getConfigID(), NameFactory.EJB_MODULE, module.getName());
for (EnterpriseBeanInfo bean : ejbModule.getEjbInfo().getEjbJarInfo().enterpriseBeans) {
- if (bean.type != EnterpriseBeanInfo.STATELESS) {
+
+ 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, NameFactory.STATELESS_SESSION_BEAN);
+ AbstractName sessionName = earContext.getNaming().createChildName(module.getModuleName(), ejbName, j2eeType);
- assert sessionName != null: "StatelesSessionBean object name is null";
+ assert sessionName != null: "StatelesSessionBean/SingletionBean object name is null";
AbstractName ejbWebServiceName = earContext.getNaming().createChildName(sessionName, ejbName, NameFactory.WEB_SERVICE_LINK);
@@ -203,18 +215,18 @@ public class AxisModuleBuilderExtension
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) {
+ if (ddVirtualHosts != null) {
String[] virtualHosts = new String[ddVirtualHosts.size()];
- for (int i=0; i<ddVirtualHosts.size(); i++) {
+ 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",
@@ -222,7 +234,7 @@ public class AxisModuleBuilderExtension
ConfigurationFactory.class.getName()));
ejbWebServiceGBean.setAttribute("authMethod", wsSecurity.getAuthMethod().value());
if (wsSecurity.getRealmName() != null) {
- ejbWebServiceGBean.setAttribute("realmName", wsSecurity.getRealmName().trim());
+ ejbWebServiceGBean.setAttribute("realmName", wsSecurity.getRealmName().trim());
}
Properties properties = wsSecurity.getProperties();
ejbWebServiceGBean.setAttribute("properties", properties);
@@ -230,34 +242,34 @@ public class AxisModuleBuilderExtension
ejbWebServiceGBean.setAttribute("policyContextID", policyContextID);
}
}
-
- ejbWebServiceGBean.addDependency(ejbModuleName);
+
+ ejbWebServiceGBean.addDependency(module.getModuleName());
if (axisBuilder.configureEJB(ejbWebServiceGBean, ejbName, ejbModule,
ejbModule.getSharedContext(), bundle)) {
-
+
try {
earContext.addGBean(ejbWebServiceGBean);
} catch (GBeanAlreadyExistsException e) {
throw new DeploymentException(
"Could not add axis ejb web service gbean to context", e);
}
-
+
if (this.listener != null) {
ejbWebServiceGBean.setReferencePattern("WebServiceContainer", this.listener);
}
-
+
ejbWebServiceGBean.setReferencePattern("EjbDeployment", sessionName);
}
ejbWebServiceGBean.clearAttribute("ejbName");
ejbWebServiceGBean.clearAttribute("ejbClass");
-
+
}
}
- private Map<String, WebServiceBinding> createWebServiceBindingMap(EjbModule ejbModule) {
+ private Map<String, WebServiceBinding> createWebServiceBindingMap(EjbModule ejbModule) {
Map<String, WebServiceBinding> wsBindingMap = new HashMap<String, WebServiceBinding>();
-
+
Object openejbDD = ejbModule.getEjbModule().getAltDDs().get("openejb-jar.xml");
if (openejbDD instanceof OpenejbJarType) {
OpenejbJarType openejb = (OpenejbJarType) openejbDD;
@@ -265,10 +277,10 @@ public class AxisModuleBuilderExtension
if (bean instanceof SessionBeanType) {
SessionBeanType sessioBean = (SessionBeanType) bean;
wsBindingMap.put(bean.getEjbName(), new WebServiceBinding(sessioBean));
- }
+ }
}
- } else {
- GeronimoEjbJarType geronimoEjbJarType =
+ } else {
+ GeronimoEjbJarType geronimoEjbJarType =
(GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
if (geronimoEjbJarType != null) {
for (WebServiceBindingType bt : geronimoEjbJarType.getWebServiceBinding()) {
@@ -279,19 +291,19 @@ public class AxisModuleBuilderExtension
return wsBindingMap;
}
-
+
private static class WebServiceBinding {
-
+
private String address;
private List<String> virtualHosts;
private WebServiceSecurityType security;
-
+
private WebServiceBinding(SessionBeanType bean) {
address = bean.getWebServiceAddress();
virtualHosts = bean.getWebServiceVirtualHost();
security = bean.getWebServiceSecurity();
}
-
+
private WebServiceBinding(WebServiceBindingType bt) {
address = bt.getWebServiceAddress();
virtualHosts = bt.getWebServiceVirtualHost();
@@ -303,20 +315,20 @@ public class AxisModuleBuilderExtension
security.setTransportGuarantee(bt.getWebServiceSecurity().getTransportGuarantee());
}
}
-
+
public String getWebServiceAddress() {
return address;
}
-
+
public List<String> getWebServiceVirtualHost() {
return virtualHosts;
}
-
+
public WebServiceSecurityType getWebServiceSecurity() {
return security;
}
}
-
+
public static final GBeanInfo GBEAN_INFO;
static {
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java?rev=1091304&r1=1091303&r2=1091304&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/EJBWebServiceFinder.java Tue Apr 12 06:19:17 2011
@@ -37,7 +37,7 @@ public class EJBWebServiceFinder impleme
public Map<String, PortInfo> discoverWebServices(Module module,
boolean isEJB,
- Map correctedPortLocations)
+ Map<String, String> correctedPortLocations)
throws DeploymentException {
Map<String, PortInfo> map = new HashMap<String, PortInfo>();
discoverEJBWebServices(module, correctedPortLocations, map);
@@ -45,21 +45,23 @@ public class EJBWebServiceFinder impleme
}
private void discoverEJBWebServices(Module module,
- Map correctedPortLocations,
+ Map<String, String> correctedPortLocations,
Map<String, PortInfo> map)
throws DeploymentException {
Bundle bundle = module.getEarContext().getDeploymentBundle();
EjbModule ejbModule = (EjbModule) module;
for (EnterpriseBeanInfo bean : ejbModule.getEjbInfo().getEjbJarInfo().enterpriseBeans) {
- if (bean.type != EnterpriseBeanInfo.STATELESS) {
+ if (bean.type != EnterpriseBeanInfo.STATELESS && bean.type != EnterpriseBeanInfo.SINGLETON) {
continue;
}
try {
- Class ejbClass = bundle.loadClass(bean.ejbClass);
+ Class<?> ejbClass = bundle.loadClass(bean.ejbClass);
if (JAXWSUtils.isWebService(ejbClass)) {
- LOG.debug("Found EJB Web Service: " + bean.ejbName);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Found EJB Web Service: " + bean.ejbName);
+ }
PortInfo portInfo = new PortInfo();
- String location = (String) correctedPortLocations.get(bean.ejbName);
+ String location = correctedPortLocations.get(bean.ejbName);
if (location == null) {
// set default location, i.e. /@WebService.serviceName/@WebService.name
location = "/" + JAXWSUtils.getServiceName(ejbClass) + "/" + JAXWSUtils.getName(ejbClass);
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/JAXWSEJBModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/JAXWSEJBModuleBuilderExtension.java?rev=1091304&r1=1091303&r2=1091304&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/JAXWSEJBModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/ejb/builder/JAXWSEJBModuleBuilderExtension.java Tue Apr 12 06:19:17 2011
@@ -129,13 +129,19 @@ public class JAXWSEJBModuleBuilderExtens
jaxwsBuilder.findWebServices(module, true, correctedPortLocations, environment, ejbModule.getSharedContext());
for (EnterpriseBeanInfo bean : ejbModule.getEjbInfo().getEjbJarInfo().enterpriseBeans) {
- if (bean.type != EnterpriseBeanInfo.STATELESS) {
+
+ 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, NameFactory.STATELESS_SESSION_BEAN);
+ AbstractName sessionName = earContext.getNaming().createChildName(module.getModuleName(), ejbName, j2eeType);
assert sessionName != null: "StatelesSessionBean object name is null";
@@ -187,17 +193,21 @@ public class JAXWSEJBModuleBuilderExtens
Map<String, WebServiceBinding> wsBindingMap = createWebServiceBindingMap(ejbModule);
- AbstractNameQuery ejbModuleName = NameFactory.newTypeNameQuery(module.getEarContext().getConfigID(), NameFactory.EJB_MODULE, module.getName());
for (EnterpriseBeanInfo bean : ejbModule.getEjbInfo().getEjbJarInfo().enterpriseBeans) {
- if (bean.type != EnterpriseBeanInfo.STATELESS) {
+ 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, NameFactory.STATELESS_SESSION_BEAN);
+ AbstractName sessionName = earContext.getNaming().createChildName(module.getModuleName(), ejbName, j2eeType);
- assert sessionName != null: "StatelesSessionBean object name is null";
+ assert sessionName != null: "StatelesSessionBean/SingletonBean object name is null";
AbstractName ejbWebServiceName = earContext.getNaming().createChildName(sessionName, ejbName, NameFactory.WEB_SERVICE_LINK);
@@ -235,7 +245,7 @@ public class JAXWSEJBModuleBuilderExtens
}
}
- ejbWebServiceGBean.addDependency(ejbModuleName);
+ ejbWebServiceGBean.addDependency(module.getModuleName());
if (jaxwsBuilder.configureEJB(ejbWebServiceGBean, bean.ejbName, ejbModule,
ejbModule.getSharedContext(), bundle)) {
Modified: geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java?rev=1091304&r1=1091303&r2=1091304&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java (original)
+++ geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java Tue Apr 12 06:19:17 2011
@@ -43,23 +43,23 @@ public interface WebServiceContainer ext
public static final String MESSAGE_CONTEXT = WebServiceContainer.class.getName()+"@MessageContext";
/**
- * Used for JAX-WS MessageContext. MessageContext must expose HttpServletRequest.
+ * Used for JAX-WS MessageContext. MessageContext must expose HttpServletRequest.
*/
- public static final String SERVLET_REQUEST =
+ public static final String SERVLET_REQUEST =
WebServiceContainer.class.getName()+"@ServletRequest";
-
+
/**
* Used for JAX-WS MessageContext. MessageContext must expose HttpServletResponse.
*/
- public static final String SERVLET_RESPONSE =
+ public static final String SERVLET_RESPONSE =
WebServiceContainer.class.getName()+"@ServletResponse";
-
+
/**
* Used for JAX-WS MessageContext. MessageContext must expose ServletContext.
*/
- public static final String SERVLET_CONTEXT =
+ public static final String SERVLET_CONTEXT =
WebServiceContainer.class.getName()+"@ServletContext";
-
+
/**
* Token inserted into wsdl where location should be replaced with the real location
*/
@@ -154,7 +154,7 @@ public interface WebServiceContainer ext
String getContentType();
void setStatusMessage(String responseString);
-
+
void flushBuffer() throws java.io.IOException;
}
Modified: geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java?rev=1091304&r1=1091303&r2=1091304&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java (original)
+++ geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java Tue Apr 12 06:19:17 2011
@@ -19,7 +19,6 @@ package org.apache.geronimo.webservices.
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
public class SAAJGBean implements GBeanLifecycle {
@@ -27,14 +26,14 @@ public class SAAJGBean implements GBeanL
}
public void doStart() throws Exception {
- setProperty("javax.xml.soap.MessageFactory",
+ setProperty("javax.xml.soap.MessageFactory",
"org.apache.geronimo.webservices.saaj.GeronimoMessageFactory");
- setProperty("javax.xml.soap.SOAPFactory",
+ setProperty("javax.xml.soap.SOAPFactory",
"org.apache.geronimo.webservices.saaj.GeronimoSOAPFactory");
- setProperty("javax.xml.soap.SOAPConnectionFactory",
+ setProperty("javax.xml.soap.SOAPConnectionFactory",
"org.apache.geronimo.webservices.saaj.GeronimoSOAPConnectionFactory");
- setProperty("javax.xml.soap.MetaFactory",
- "org.apache.geronimo.webservices.saaj.GeronimoMetaFactory");
+ setProperty("javax.xml.soap.MetaFactory",
+ "org.apache.geronimo.webservices.saaj.GeronimoMetaFactory");
}
private void setProperty(String propertyName, String value) {
@@ -42,10 +41,10 @@ public class SAAJGBean implements GBeanL
// set only if the property is not set
if (propValue == null) {
System.setProperty(propertyName, value);
- }
+ }
}
-
- public void doStop() throws Exception {
+
+ public void doStop() throws Exception {
}
public void doFail() {
@@ -55,7 +54,7 @@ public class SAAJGBean implements GBeanL
static {
GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(SAAJGBean.class, SAAJGBean.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
-
+
GBEAN_INFO = infoFactory.getBeanInfo();
}
Propchange: geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/server/trunk/plugins/webservices/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/saaj/SAAJGBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain