Author: jim.ma
Date: 2011-09-09 01:59:20 -0400 (Fri, 09 Sep 2011)
New Revision: 14961
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/ServiceEndpointInvokerDeploymentAspect.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java
Log:
[JBWS-3359]:Refactor to deploy ejb ws in a war file in native stack
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/http/NettyHttpServerAdapter.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -44,9 +44,9 @@
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
import org.jboss.wsf.spi.deployment.HttpEndpoint;
import org.jboss.wsf.stack.jbws.EagerInitializeDeploymentAspect;
import org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect;
@@ -185,9 +185,9 @@
endpoint.setShortName(this.getEndpointRegistryPath(epImpl));
((HttpEndpoint)endpoint).setURLPattern(epImpl.getPathWithoutContext());
dep.getService().addEndpoint(endpoint);
+ endpoint.setType(EndpointType.JAXWS_JSE);
dep.setRootFile(new ResourceLoaderAdapter(loader));
- dep.setRuntimeClassLoader(loader);
- dep.setType(DeploymentType.JAXWS_JSE);
+ dep.setRuntimeClassLoader(loader);
dep.getService().setContextRoot(contextRoot);
// TODO: remove this properties hack
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -73,8 +73,8 @@
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.InvocationHandler;
@@ -324,8 +324,7 @@
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext instanceof SOAPMessageContextJAXWS)
{
- final DeploymentType deploymentType = ep.getService().getDeployment().getType();
- if ((DeploymentType.JAXWS_JSE == deploymentType) || (DeploymentType.JAXWS_EJB3
== deploymentType))
+ if ((EndpointType.JAXWS_JSE == ep.getType()) || (EndpointType.JAXWS_EJB3 ==
ep.getType()))
{
if (msgContext.get(MessageContext.SERVLET_REQUEST) != null)
{
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -46,6 +46,7 @@
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.Constants;
import org.jboss.ws.common.ObjectNameFactory;
+import org.jboss.ws.common.integration.WSHelper;
import org.jboss.ws.core.jaxrpc.UnqualifiedFaultException;
import org.jboss.ws.core.soap.Use;
import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
@@ -72,6 +73,7 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.HttpEndpoint;
+import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.ServerConfigFactory;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
@@ -202,7 +204,8 @@
// Add JMS destination JNDI name for MDB endpoints
EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class);
- if (apMetaData != null)
+ if (apMetaData != null
+ && (EndpointType.JAXWS_EJB3 == sepMetaData.getEndpoint().getType() ||
EndpointType.JAXRPC_EJB21 == sepMetaData.getEndpoint().getType()))
{
String ejbName = sepMetaData.getLinkName();
if (ejbName == null)
@@ -289,7 +292,8 @@
{
String transportGuarantee = null;
JSEArchiveMetaData webMetaData = dep.getAttachment(JSEArchiveMetaData.class);
- if (webMetaData != null)
+ if (webMetaData != null
+ && (EndpointType.JAXWS_JSE == sepMetaData.getEndpoint().getType() ||
EndpointType.JAXRPC_JSE == sepMetaData.getEndpoint().getType()))
{
Map<String, String> servletMappings = webMetaData.getServletMappings();
String urlPattern = servletMappings.get(servletLink);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -139,7 +139,7 @@
serviceMetaData.setServiceName(wsdlEndpoint.getWsdlService().getName());
QName interfaceQName = wsdlEndpoint.getInterface().getName();
- Endpoint ep = dep.getService().getEndpointByName(linkName);
+ Endpoint ep = dep.getService().getEndpointByName(linkName);
ServerEndpointMetaData sepMetaData = new
ServerEndpointMetaData(serviceMetaData, ep, portName, interfaceQName, Type.JAXRPC);
sepMetaData.setPortComponentName(pcMetaData.getPortComponentName());
sepMetaData.setLinkName(linkName);
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -60,14 +60,18 @@
log.debug("START buildMetaData: [name=" + dep.getCanonicalName() +
"]");
try
{
- UnifiedMetaData wsMetaData = new UnifiedMetaData(dep.getRootFile());
- wsMetaData.setDeploymentName(dep.getCanonicalName());
+ UnifiedMetaData wsMetaData = dep.getAttachment(UnifiedMetaData.class);
+ if (wsMetaData == null)
+ {
+ wsMetaData = new UnifiedMetaData(dep.getRootFile());
+ wsMetaData.setDeploymentName(dep.getCanonicalName());
- ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
- if(null == runtimeClassLoader)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"RUNTIME_LOADER_CANNOT_BE_NULL"));
- wsMetaData.setClassLoader(new DelegateClassLoader(runtimeClassLoader,
SecurityActions.getContextClassLoader()));
-
+ ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
+ if (null == runtimeClassLoader)
+ throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"RUNTIME_LOADER_CANNOT_BE_NULL"));
+ wsMetaData.setClassLoader(new DelegateClassLoader(runtimeClassLoader,
SecurityActions
+ .getContextClassLoader()));
+ }
// The container objects below provide access to all of the ejb metadata
EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class);
Iterator<EJBMetaData> it = apMetaData.getEnterpriseBeans();
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -30,6 +30,8 @@
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Endpoint.EndpointType;
+import org.jboss.wsf.spi.deployment.EndpointTypeFilter;
/**
* A server side meta data builder that is based on JSR-181 annotations
@@ -62,9 +64,12 @@
// For every bean
for (Endpoint ep : dep.getService().getEndpoints())
{
- String shortName = ep.getShortName();
- Class beanClass = ep.getTargetBeanClass();
- JAXWSServerMetaDataBuilder.setupProviderOrWebService(dep, wsMetaData,
beanClass, shortName);
+ if (EndpointType.JAXWS_JSE == ep.getType())
+ {
+ String shortName = ep.getShortName();
+ Class beanClass = ep.getTargetBeanClass();
+ JAXWSServerMetaDataBuilder.setupProviderOrWebService(dep, wsMetaData,
beanClass, shortName);
+ }
}
if (log.isDebugEnabled())
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -29,11 +29,11 @@
import org.jboss.ws.api.annotation.EndpointConfig;
import org.jboss.ws.api.annotation.WebContext;
import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.common.integration.WSHelper;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
@@ -104,7 +104,7 @@
if (anWebContext == null)
return;
- boolean isJSEEndpoint = (dep.getType() == DeploymentType.JAXWS_JSE);
+ boolean isJSEEndpoint = WSHelper.isJaxwsJseDeployment(dep);
// context-root
if (anWebContext.contextRoot().length() > 0)
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/ServiceEndpointInvokerDeploymentAspect.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/ServiceEndpointInvokerDeploymentAspect.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/ServiceEndpointInvokerDeploymentAspect.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -24,9 +24,9 @@
import org.jboss.ws.core.server.ServiceEndpointInvoker;
import org.jboss.ws.core.server.ServiceEndpointInvokerEJB21;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+import org.jboss.ws.common.integration.WSHelper;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
/**
* A deployer that associates the ServiceEndpointInvoker with the endpoint
@@ -44,8 +44,8 @@
ServiceEndpointInvoker epInvoker =
ep.getAttachment(ServiceEndpointInvoker.class);
if (epInvoker == null)
{
- DeploymentType depType = ep.getService().getDeployment().getType();
- if (depType == DeploymentType.JAXRPC_EJB21)
+
+ if (WSHelper.isJaxrpcEjbDeployment(dep))
{
epInvoker = new ServiceEndpointInvokerEJB21();
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java 2011-09-09
05:35:43 UTC (rev 14960)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.java 2011-09-09
05:59:20 UTC (rev 14961)
@@ -25,6 +25,7 @@
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
+import org.jboss.ws.common.integration.WSHelper;
import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
@@ -34,7 +35,6 @@
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.Endpoint;
/**
@@ -52,31 +52,27 @@
UnifiedMetaData umd = dep.getAttachment(UnifiedMetaData.class);
if (umd == null)
{
- if (dep.getType() == DeploymentType.JAXRPC_JSE)
+ if (WSHelper.isJaxwsJseDeployment(dep))
{
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
umd = builder.buildMetaData((ArchiveDeployment)dep);
+ dep.addAttachment(UnifiedMetaData.class, umd);
}
- else if (dep.getType() == DeploymentType.JAXRPC_EJB21)
+ if (WSHelper.isJaxwsEjbDeployment(dep))
{
- JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
umd = builder.buildMetaData((ArchiveDeployment)dep);
}
- else if (dep.getType() == DeploymentType.JAXWS_JSE)
+ if (WSHelper.isJaxrpcJseDeployment(dep) &&
!WSHelper.isJaxwsJseDeployment(dep) && !WSHelper.isJaxwsEjbDeployment(dep))
{
- JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
umd = builder.buildMetaData((ArchiveDeployment)dep);
}
- else if (dep.getType() == DeploymentType.JAXWS_EJB3)
+ else if (WSHelper.isJaxrpcEjbDeployment(dep) &&
!WSHelper.isJaxwsJseDeployment(dep) && !WSHelper.isJaxwsEjbDeployment(dep))
{
- JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
umd = builder.buildMetaData((ArchiveDeployment)dep);
}
- else
- {
- throw new IllegalStateException(BundleUtils.getMessage(bundle,
"INVALID_DEPLOYMENT_TYPE", dep.getType()));
- }
-
dep.addAttachment(UnifiedMetaData.class, umd);
}