JBossWS SVN: r1326 - in trunk/src: main/java/org/jboss/ws/deployment test/java/org/jboss/test/ws/jaxws/samples/wsaddressing
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-10-27 12:07:39 -0400 (Fri, 27 Oct 2006)
New Revision: 1326
Modified:
trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/StatefulEndpointImpl.java
Log:
Refactor service endpoint address handling.
All JSE endpoints must derive the url-pattern from web.xml
Modified: trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-10-27 15:29:21 UTC (rev 1325)
+++ trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-10-27 16:07:39 UTC (rev 1326)
@@ -23,26 +23,13 @@
// $Id:AnnotationsMetaDataBuilder.java 732 2006-08-12 18:40:21Z thomas.diesler(a)jboss.com $
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-
import javax.xml.ws.BindingType;
import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
import org.jboss.ws.annotation.PortComponent;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
-import org.jboss.ws.tools.JavaToWSDL;
-import org.jboss.ws.utils.IOUtils;
/** An abstract annotation meta data builder.
*
@@ -68,83 +55,78 @@
}
}
- protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData epMetaData)
+ protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData sepMetaData)
{
- String contextRoot = null;
-
- // init contextRoot from jboss-web.xml
- if (udi.metaData instanceof UnifiedWebMetaData)
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- contextRoot = webMetaData.getContextRoot();
- }
-
PortComponent anPortComponent = (PortComponent)wsClass.getAnnotation(PortComponent.class);
if (anPortComponent != null)
{
// setup config name
- String configName = anPortComponent.configName();
- if (configName.length() > 0)
- epMetaData.setConfigName(configName);
+ if (anPortComponent.configName().length() > 0)
+ {
+ String configName = anPortComponent.configName();
+ sepMetaData.setConfigName(configName);
+ }
// setup config file
- String configFile = anPortComponent.configFile();
- if (configFile.length() > 0)
- epMetaData.setConfigFile(configFile);
+ if (anPortComponent.configFile().length() > 0)
+ {
+ String configFile = anPortComponent.configFile();
+ sepMetaData.setConfigFile(configFile);
+ }
- // setup endpoint url
+ boolean isJSEEndpoint = udi.type == DeploymentType.JSR181_JSE || udi.type == DeploymentType.JAXWS_PROVIDER_JSE;
+
+ // context-root
if (anPortComponent.contextRoot().length() > 0)
{
- contextRoot = anPortComponent.contextRoot();
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.contextRoot is only valid on EJB endpoints");
+
+ if (isJSEEndpoint == false)
+ {
+ String contextRoot = anPortComponent.contextRoot();
+ sepMetaData.setContextRoot(contextRoot);
+ }
}
- else
- {
- String shortName = udi.shortName;
- contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
- }
- epMetaData.setContextRoot(contextRoot);
- String urlPattern;
+ // url-pattern
if (anPortComponent.urlPattern().length() > 0)
{
- urlPattern = anPortComponent.urlPattern();
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.urlPattern is only valid on EJB endpoints");
+
+ if (isJSEEndpoint == false)
+ {
+ String urlPattern = anPortComponent.urlPattern();
+ sepMetaData.setURLPattern(urlPattern);
+ }
}
- else
+
+ // auth-method
+ if (anPortComponent.authMethod().length() > 0)
{
- urlPattern = "/" + linkName;
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.authMethod is only valid on EJB endpoints");
+
+ if (isJSEEndpoint == false)
+ {
+ String authMethod = anPortComponent.authMethod();
+ sepMetaData.setAuthMethod(authMethod);
+ }
}
- epMetaData.setURLPattern(urlPattern);
- String servicePath = contextRoot + urlPattern;
- epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
-
- // setup authetication method
- String authMethod = anPortComponent.authMethod();
- if (authMethod.length() > 0)
- epMetaData.setAuthMethod(authMethod);
-
- // setup transport guarantee
- String transportGuarantee = anPortComponent.transportGuarantee();
- if (transportGuarantee.length() > 0)
- epMetaData.setTransportGuarantee(transportGuarantee);
- }
- else
- {
- if (contextRoot == null)
+ // transport-guarantee
+ if (anPortComponent.transportGuarantee().length() > 0)
{
- String shortName = udi.shortName;
- contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
- }
- epMetaData.setContextRoot(contextRoot);
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.transportGuarantee is only valid on EJB endpoints");
- String urlPattern = "/" + linkName;
- epMetaData.setURLPattern(urlPattern);
-
- String servicePath = contextRoot + urlPattern;
- epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+ if (isJSEEndpoint == false)
+ {
+ String transportGuarantee = anPortComponent.transportGuarantee();
+ sepMetaData.setTransportGuarantee(transportGuarantee);
+ }
+ }
}
-
- // replace the SOAP address
- replaceAddressLocation(epMetaData);
}
}
Modified: trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java 2006-10-27 15:29:21 UTC (rev 1325)
+++ trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java 2006-10-27 16:07:39 UTC (rev 1326)
@@ -177,6 +177,12 @@
// Set the endpoint address
processPortComponent(udi, sepClass, linkName, sepMetaData);
+ // Init the endpoint address
+ initEndpointAddress(udi, sepMetaData, linkName);
+
+ // replace the SOAP address
+ replaceAddressLocation(sepMetaData);
+
// init service endpoint id
ObjectName sepID = getServiceEndpointID(udi, sepMetaData);
sepMetaData.setServiceEndpointID(sepID);
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-10-27 15:29:21 UTC (rev 1325)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-10-27 16:07:39 UTC (rev 1326)
@@ -26,7 +26,6 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
import javax.management.ObjectName;
@@ -131,13 +130,13 @@
ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC);
sepMetaData.setPortComponentName(pcMetaData.getPortComponentName());
- String ejbLink = pcMetaData.getEjbLink();
- String servletLink = pcMetaData.getServletLink();
- sepMetaData.setLinkName(servletLink != null ? servletLink : ejbLink);
+ String linkName = pcMetaData.getEjbLink() != null ? pcMetaData.getEjbLink() : pcMetaData.getServletLink();
+ sepMetaData.setLinkName(linkName);
serviceMetaData.addEndpoint(sepMetaData);
- // Init the service encoding style
initEndpointEncodingStyle(sepMetaData);
+
+ initEndpointAddress(udi, sepMetaData, linkName);
if (udi.metaData instanceof UnifiedApplicationMetaData)
{
@@ -150,9 +149,9 @@
serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
// Copy <port-component> meta data
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)apMetaData.getBeanByEjbName(ejbLink);
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)apMetaData.getBeanByEjbName(linkName);
if (beanMetaData == null)
- throw new WSException("Cannot obtain UnifiedBeanMetaData for: " + ejbLink);
+ throw new WSException("Cannot obtain UnifiedBeanMetaData for: " + linkName);
String configName = apMetaData.getConfigName();
if (configName != null)
@@ -178,15 +177,13 @@
sepMetaData.setURLPattern(bpcMetaData.getURLPattern());
}
-
- initServicePathEJB(udi, sepMetaData, ejbLink);
}
else if (udi.metaData instanceof UnifiedWebMetaData)
{
UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
wsMetaData.setSecurityDomain(webMetaData.getSecurityDomain());
- String targetBean = webMetaData.getServletClassMap().get(servletLink);
+ String targetBean = webMetaData.getServletClassMap().get(linkName);
sepMetaData.setServiceEndpointImplName(targetBean);
// Copy the wsdl publish location from jboss-web.xml
@@ -202,8 +199,7 @@
if (configFile != null)
sepMetaData.setConfigFile(configFile);
- initServicePathJSE(udi, sepMetaData, servletLink);
- initTransportGuaranteeJSE(udi, sepMetaData, servletLink);
+ initTransportGuaranteeJSE(udi, sepMetaData, linkName);
}
// init service endpoint id
@@ -272,64 +268,6 @@
return wsdlEndpoint;
}
- private void initServicePathEJB(UnifiedDeploymentInfo udi, ServerEndpointMetaData epMetaData, String ejbLink)
- {
- UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbLink);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain meta data for ejb link: " + ejbLink);
-
- // Use the webservice context root if we have one
- String contextRoot = applMetaData.getWebServiceContextRoot();
-
- // If not, derive the context root from the deployment short name
- if (contextRoot == null)
- {
- String shortName = udi.shortName;
- contextRoot = shortName.substring(0, shortName.indexOf('.'));
- contextRoot = "/" + contextRoot;
- }
- epMetaData.setContextRoot(contextRoot);
-
- String urlPattern;
- UnifiedEjbPortComponentMetaData ejbpcMetaData = beanMetaData.getPortComponent();
- if (ejbpcMetaData != null && ejbpcMetaData.getPortComponentURI() != null)
- {
- urlPattern = ejbpcMetaData.getPortComponentURI();
- }
- else
- {
- urlPattern = "/" + ejbLink;
- }
- epMetaData.setURLPattern(urlPattern);
- }
-
- private void initServicePathJSE(UnifiedDeploymentInfo udi, ServerEndpointMetaData epMetaData, String servletLink)
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- Map<String, String> servletMappings = webMetaData.getServletMappings();
-
- String contextRoot = webMetaData.getContextRoot();
-
- // If not, derive the context root from the deployment short name
- if (contextRoot == null)
- {
- String shortName = udi.shortName;
- contextRoot = shortName.substring(0, shortName.indexOf('.'));
- contextRoot = "/" + contextRoot;
- }
- epMetaData.setContextRoot(contextRoot);
-
- String urlPattern = (String)servletMappings.get(servletLink);
- if (urlPattern == null)
- throw new WSException("Cannot obtain servlet mapping for servlet link: " + servletLink);
-
- if (urlPattern.startsWith("/") == false)
- urlPattern = "/" + urlPattern;
-
- epMetaData.setURLPattern(urlPattern);
- }
-
/**
* Read the transport guarantee from web.xml
*/
Modified: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-10-27 15:29:21 UTC (rev 1325)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-10-27 16:07:39 UTC (rev 1326)
@@ -63,6 +63,8 @@
import org.jboss.ws.WSException;
import org.jboss.ws.addressing.AddressingPropertiesImpl;
import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.annotation.PortComponent;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.jaxws.DynamicWrapperGenerator;
@@ -80,6 +82,7 @@
import org.jboss.ws.metadata.ParameterMetaData.WrappedParameter;
import org.jboss.ws.metadata.config.jaxws.WSEndpointConfigJAXWS;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.jsr181.HandlerChainFactory;
import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
import org.jboss.ws.metadata.jsr181.HandlerChainsMetaData;
@@ -209,6 +212,12 @@
// Set the endpoint address
processPortComponent(udi, wsClass, linkName, sepMetaData);
+ // Init the endpoint address
+ initEndpointAddress(udi, sepMetaData, linkName);
+
+ // replace the SOAP address
+ replaceAddressLocation(sepMetaData);
+
// Process an optional @SOAPMessageHandlers annotation
if (sepClass.isAnnotationPresent(SOAPMessageHandlers.class) || wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
log.warn("@SOAPMessageHandlers is deprecated as of JSR-181 2.0 with no replacement.");
Modified: trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-10-27 15:29:21 UTC (rev 1325)
+++ trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-10-27 16:07:39 UTC (rev 1326)
@@ -64,6 +64,7 @@
import org.jboss.ws.metadata.TypesMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedEjbPortComponentMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.wsdl.NCName;
@@ -206,16 +207,81 @@
}
}
+ protected void initEndpointAddress(UnifiedDeploymentInfo udi, ServerEndpointMetaData sepMetaData, String linkName)
+ {
+ String contextRoot = sepMetaData.getContextRoot();
+ String urlPattern = sepMetaData.getURLPattern();
+
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ String jbwebContextRoot = webMetaData.getContextRoot();
+ if (jbwebContextRoot != null)
+ contextRoot = jbwebContextRoot;
+
+ Map<String, String> servletMappings = webMetaData.getServletMappings();
+ urlPattern = (String)servletMappings.get(linkName);
+ if (urlPattern == null)
+ throw new WSException("Cannot obtain url pattern for servlet name: " + linkName);
+ }
+
+ if (udi.metaData instanceof UnifiedApplicationMetaData)
+ {
+ UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(linkName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain meta data for ejb link: " + linkName);
+
+ String wsContextRoot = applMetaData.getWebServiceContextRoot();
+ if (wsContextRoot != null)
+ contextRoot = wsContextRoot;
+
+ UnifiedEjbPortComponentMetaData ejbpcMetaData = beanMetaData.getPortComponent();
+ if (ejbpcMetaData != null && ejbpcMetaData.getPortComponentURI() != null)
+ {
+ String pcUrlPattern = ejbpcMetaData.getPortComponentURI();
+ if (pcUrlPattern != null)
+ urlPattern = pcUrlPattern;
+ }
+ }
+
+ // If not, derive the context root from the deployment
+ if (contextRoot == null)
+ {
+ contextRoot = "/";
+ if (udi.parent != null)
+ {
+ String shortName = udi.parent.shortName;
+ shortName = shortName.substring(0, shortName.indexOf('.'));
+ contextRoot += shortName + "-";
+ }
+ String shortName = udi.shortName;
+ shortName = shortName.substring(0, shortName.indexOf('.'));
+ contextRoot += shortName;
+ }
+
+ if (urlPattern == null)
+ urlPattern = "/" + linkName;
+ if (urlPattern.startsWith("/") == false)
+ urlPattern = "/" + urlPattern;
+
+ sepMetaData.setContextRoot(contextRoot);
+ sepMetaData.setURLPattern(urlPattern);
+
+ String servicePath = contextRoot + urlPattern;
+ sepMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+ }
+
protected ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi, ServerEndpointMetaData sepMetaData)
{
- String endpoint = sepMetaData.getLinkName();
+ String linkName = sepMetaData.getLinkName();
String context = sepMetaData.getContextRoot();
if (context.startsWith("/"))
context = context.substring(1);
StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN + ":");
idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" + context);
- idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT + "=" + endpoint);
+ idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT + "=" + linkName);
// Add JMS destination JNDI name for MDB endpoints
if (udi.metaData instanceof UnifiedApplicationMetaData)
Modified: trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-10-27 15:29:21 UTC (rev 1325)
+++ trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-10-27 16:07:39 UTC (rev 1326)
@@ -65,135 +65,175 @@
this.epManager = epManager;
}
- public void create(UnifiedDeploymentInfo udi) throws Throwable
+ public void create(UnifiedDeploymentInfo udi)
{
log.debug("create: " + udi.url);
-
- UnifiedMetaData wsMetaData;
- if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR109_JSE)
+ try
{
- JSR109ServerMetaDataBuilder builder = new JSR109ServerMetaDataBuilder();
- builder.setClassLoader(null); // the web context loader is not available yet
- builder.setResourceLoader(udi.localCl);
- wsMetaData = builder.buildMetaData((JSR109Deployment)udi);
- }
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR109_EJB21)
- {
- JSR109ServerMetaDataBuilder builder = new JSR109ServerMetaDataBuilder();
- builder.setClassLoader(udi.ucl);
- builder.setResourceLoader(udi.localCl);
- wsMetaData = builder.buildMetaData((JSR109Deployment)udi);
- }
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_JSE)
- {
- JSR181MetaDataBuilderJSE builder = new JSR181MetaDataBuilderJSE();
- builder.setClassLoader(udi.annotationsCl);
- builder.setResourceLoader(udi.localCl);
- wsMetaData = builder.buildMetaData(udi);
- }
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_EJB21)
- {
- JSR181MetaDataBuilderEJB21 builder = new JSR181MetaDataBuilderEJB21();
- builder.setClassLoader(udi.annotationsCl);
- builder.setResourceLoader(udi.localCl);
- wsMetaData = builder.buildMetaData(udi);
- }
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_EJB3)
- {
- JSR181MetaDataBuilderEJB3 builder = new JSR181MetaDataBuilderEJB3();
- builder.setClassLoader(udi.annotationsCl);
- builder.setResourceLoader(udi.localCl);
- wsMetaData = builder.buildMetaData(udi);
- }
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JAXWS_PROVIDER_JSE)
- {
- JAXWSProviderMetaDataBuilderJSE builder = new JAXWSProviderMetaDataBuilderJSE();
- builder.setClassLoader(udi.annotationsCl);
- builder.setResourceLoader(udi.localCl);
- wsMetaData = builder.buildMetaData(udi);
- }
- else
- {
- throw new WSException("Invalid type: " + udi.type);
- }
+ UnifiedMetaData wsMetaData;
+ if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR109_JSE)
+ {
+ JSR109ServerMetaDataBuilder builder = new JSR109ServerMetaDataBuilder();
+ builder.setClassLoader(null); // the web context loader is not available yet
+ builder.setResourceLoader(udi.localCl);
+ wsMetaData = builder.buildMetaData((JSR109Deployment)udi);
+ }
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR109_EJB21)
+ {
+ JSR109ServerMetaDataBuilder builder = new JSR109ServerMetaDataBuilder();
+ builder.setClassLoader(udi.ucl);
+ builder.setResourceLoader(udi.localCl);
+ wsMetaData = builder.buildMetaData((JSR109Deployment)udi);
+ }
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_JSE)
+ {
+ JSR181MetaDataBuilderJSE builder = new JSR181MetaDataBuilderJSE();
+ builder.setClassLoader(udi.annotationsCl);
+ builder.setResourceLoader(udi.localCl);
+ wsMetaData = builder.buildMetaData(udi);
+ }
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_EJB21)
+ {
+ JSR181MetaDataBuilderEJB21 builder = new JSR181MetaDataBuilderEJB21();
+ builder.setClassLoader(udi.annotationsCl);
+ builder.setResourceLoader(udi.localCl);
+ wsMetaData = builder.buildMetaData(udi);
+ }
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_EJB3)
+ {
+ JSR181MetaDataBuilderEJB3 builder = new JSR181MetaDataBuilderEJB3();
+ builder.setClassLoader(udi.annotationsCl);
+ builder.setResourceLoader(udi.localCl);
+ wsMetaData = builder.buildMetaData(udi);
+ }
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JAXWS_PROVIDER_JSE)
+ {
+ JAXWSProviderMetaDataBuilderJSE builder = new JAXWSProviderMetaDataBuilderJSE();
+ builder.setClassLoader(udi.annotationsCl);
+ builder.setResourceLoader(udi.localCl);
+ wsMetaData = builder.buildMetaData(udi);
+ }
+ else
+ {
+ throw new IllegalStateException("Invalid type: " + udi.type);
+ }
- metaDataMap.put(udi.url.toExternalForm(), wsMetaData);
+ metaDataMap.put(udi.url.toExternalForm(), wsMetaData);
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
{
- ServiceEndpointInfo seInfo = new ServiceEndpointInfo(udi, (ServerEndpointMetaData)epMetaData);
- epManager.createServiceEndpoint(seInfo);
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ServiceEndpointInfo seInfo = new ServiceEndpointInfo(udi, (ServerEndpointMetaData)epMetaData);
+ epManager.createServiceEndpoint(seInfo);
+ }
}
}
+ catch (Exception ex)
+ {
+ log.error("Cannot create service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
}
- public void start(UnifiedDeploymentInfo udi) throws Throwable
+ public void start(UnifiedDeploymentInfo udi)
{
log.debug("start: " + udi.url);
-
- UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
- if (wsMetaData != null)
+ try
{
- // late initialization of the web context loader
- if (wsMetaData.getClassLoader() != udi.ucl)
- wsMetaData.setClassLoader(udi.ucl);
-
- // Publish the WSDL file
- WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
- wsdlfp.publishWsdlFiles(wsMetaData);
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
+ if (wsMetaData != null)
{
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ // late initialization of the web context loader
+ if (wsMetaData.getClassLoader() != udi.ucl)
+ wsMetaData.setClassLoader(udi.ucl);
+
+ // Publish the WSDL file
+ WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
+ wsdlfp.publishWsdlFiles(wsMetaData);
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
{
- ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
- epManager.startServiceEndpoint(sepID);
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
+ epManager.startServiceEndpoint(sepID);
+ }
}
}
- }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot start service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
}
- public void stop(UnifiedDeploymentInfo udi) throws Throwable
+ public void stop(UnifiedDeploymentInfo udi)
{
log.debug("stop: " + udi.url);
-
- UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
- if (wsMetaData != null)
+ try
{
- // Stop the service endpoints
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
+ if (wsMetaData != null)
{
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ // Stop the service endpoints
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
{
- ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
- epManager.stopServiceEndpoint(sepID);
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
+ epManager.stopServiceEndpoint(sepID);
+ }
}
+
+ // Unpublish the WSDL file
+ WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
+ wsdlfp.unpublishWsdlFiles();
}
-
- // Unpublish the WSDL file
- WSDLFilePublisher wsdlfp = new WSDLFilePublisher(udi);
- wsdlfp.unpublishWsdlFiles();
- }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot stop service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
}
- public void destroy(UnifiedDeploymentInfo udi) throws Throwable
+ public void destroy(UnifiedDeploymentInfo udi)
{
log.debug("destroy: " + udi.url);
-
- UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
- if (wsMetaData != null)
+ try
{
- // Destroy the service endpoints
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
+ UnifiedMetaData wsMetaData = getUnifiedMetaData(udi);
+ if (wsMetaData != null)
{
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ // Destroy the service endpoints
+ for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
{
- ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
- epManager.destroyServiceEndpoint(sepID);
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ ObjectName sepID = ((ServerEndpointMetaData)epMetaData).getServiceEndpointID();
+ epManager.destroyServiceEndpoint(sepID);
+ }
}
}
- }
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot destroy service endpoint", ex);
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ throw new WSException(ex);
+ }
}
public UnifiedMetaData getUnifiedMetaData(UnifiedDeploymentInfo udi)
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/StatefulEndpointImpl.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/StatefulEndpointImpl.java 2006-10-27 15:29:21 UTC (rev 1325)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/samples/wsaddressing/StatefulEndpointImpl.java 2006-10-27 16:07:39 UTC (rev 1326)
@@ -31,7 +31,6 @@
import javax.annotation.Resource;
import javax.jws.HandlerChain;
import javax.jws.WebMethod;
-import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;