JBossWS SVN: r1476 - in branches/tdiesler/trunk/src: main/java/org/jboss/ws/annotation main/java/org/jboss/ws/deployment main/java/org/jboss/ws/integration/jboss50 main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/jaxws/handler main/java/org/jboss/ws/metadata main/java/org/jboss/ws/server test/java/org/jboss/test/ws/jaxws/jbws1178 test/resources/jaxws/jbws1178/WEB-INF
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-20 17:48:06 -0500 (Mon, 20 Nov 2006)
New Revision: 1476
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
Log:
[JBWS-864] soap:address in wsdl ignores <url-pattern>
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -47,6 +47,13 @@
String contextRoot() default "";
/**
+ * The virtual hosts that the web service endpoint is deployed to.
+ *
+ * Applies to server side port components only.
+ */
+ String[] virtualHosts() default {};
+
+ /**
* Relative path that is appended to the contextRoot to form fully qualified
* endpoint address for the web service endpoint.
*
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -27,9 +27,9 @@
import org.jboss.logging.Logger;
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.j2ee.UnifiedWebMetaData;
/** An abstract annotation meta data builder.
*
@@ -55,81 +55,77 @@
}
}
- protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData sepMetaData)
+ protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData epMetaData)
{
+ // Setting the defaults
+ String contextRoot = "/" + udi.shortName.substring(0, udi.shortName.indexOf('.'));
+ String urlPattern = "/" + linkName;
+
+ // Init contextRoot from jboss-web.xml
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ if (webMetaData.getContextRoot() != null)
+ contextRoot = webMetaData.getContextRoot();
+
+ urlPattern = webMetaData.getServletMappings().get(linkName);
+
+ epMetaData.setTransportGuarantee(getTransportGuarantee(webMetaData, linkName));
+ }
+
+ // Process @PortComponent
PortComponent anPortComponent = (PortComponent)wsClass.getAnnotation(PortComponent.class);
if (anPortComponent != null)
{
// setup config name
- if (anPortComponent.configName().length() > 0)
- {
- String configName = anPortComponent.configName();
- sepMetaData.setConfigName(configName);
- }
+ String configName = anPortComponent.configName();
+ if (configName.length() > 0)
+ epMetaData.setConfigName(configName);
// setup config file
- if (anPortComponent.configFile().length() > 0)
- {
- String configFile = anPortComponent.configFile();
- sepMetaData.setConfigFile(configFile);
- }
+ String configFile = anPortComponent.configFile();
+ if (configFile.length() > 0)
+ epMetaData.setConfigFile(configFile);
- boolean isJSEEndpoint = udi.type == DeploymentType.JSR181_JSE || udi.type == DeploymentType.JAXWS_PROVIDER_JSE;
-
- // context-root
if (anPortComponent.contextRoot().length() > 0)
{
- if (isJSEEndpoint)
- log.warn("@PortComponent.contextRoot is only valid on EJB endpoints");
-
- if (isJSEEndpoint == false)
- {
- String contextRoot = anPortComponent.contextRoot();
- if (contextRoot.startsWith("/") == false)
- contextRoot = "/" + contextRoot;
-
- sepMetaData.setContextRoot(contextRoot);
- }
+ contextRoot = anPortComponent.contextRoot();
}
-
- // url-pattern
- if (anPortComponent.urlPattern().length() > 0)
+
+ String[] virtualHosts = anPortComponent.virtualHosts();
+ if (virtualHosts != null & virtualHosts.length > 0)
{
- if (isJSEEndpoint)
- log.warn("@PortComponent.urlPattern is only valid on EJB endpoints");
-
- if (isJSEEndpoint == false)
- {
- String urlPattern = anPortComponent.urlPattern();
- sepMetaData.setURLPattern(urlPattern);
- }
+ epMetaData.setVirtualHosts(virtualHosts);
}
- // auth-method
- if (anPortComponent.authMethod().length() > 0)
+ if (anPortComponent.urlPattern().length() > 0)
{
- if (isJSEEndpoint)
- log.warn("@PortComponent.authMethod is only valid on EJB endpoints");
-
- if (isJSEEndpoint == false)
- {
- String authMethod = anPortComponent.authMethod();
- sepMetaData.setAuthMethod(authMethod);
- }
+ urlPattern = anPortComponent.urlPattern();
}
- // transport-guarantee
- if (anPortComponent.transportGuarantee().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("@PortComponent.transportGuarantee is only valid on EJB endpoints");
+ // setup authetication method
+ String authMethod = anPortComponent.authMethod();
+ if (authMethod.length() > 0)
+ epMetaData.setAuthMethod(authMethod);
- if (isJSEEndpoint == false)
+ if (epMetaData.getTransportGuarantee() == null || epMetaData.getTransportGuarantee().length() == 0)
+ {
+ // setup transport guarantee
+ String transportGuarantee = anPortComponent.transportGuarantee();
+ if (transportGuarantee.length() > 0)
{
- String transportGuarantee = anPortComponent.transportGuarantee();
- sepMetaData.setTransportGuarantee(transportGuarantee);
+ epMetaData.setTransportGuarantee(transportGuarantee);
}
}
}
+
+ epMetaData.setContextRoot(contextRoot);
+ epMetaData.setURLPattern(urlPattern);
+
+ String servicePath = contextRoot + urlPattern;
+ epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+
+ // replace the SOAP address
+ replaceAddressLocation(epMetaData);
}
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -22,11 +22,7 @@
// $Id$
package org.jboss.ws.deployment;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
import javax.management.ObjectName;
@@ -54,8 +50,6 @@
import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
import org.jboss.ws.metadata.wsdl.WSDLService;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
/**
* A server side meta data builder that is based on webservices.xml.
@@ -111,8 +105,7 @@
{
QName portName = pcMetaData.getWsdlPort();
- // JBWS-722
- // <wsdl-port> in webservices.xml should be qualified
+ // JBWS-722] <wsdl-port> in webservices.xml should be qualified
if (portName.getNamespaceURI().length() == 0)
{
String nsURI = wsdlDefinitions.getTargetNamespace();
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -68,7 +68,7 @@
sepMetaData.setConfigName(configName);
sepMetaData.setConfigFile(configFile);
- List<HandlerMetaData> sepHandlers = sepMetaData.getHandlers(HandlerType.ENDPOINT);
+ List<HandlerMetaData> sepHandlers = sepMetaData.getHandlerMetaData(HandlerType.ENDPOINT);
sepMetaData.clearHandlers();
// Add pre handlers
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -302,7 +302,7 @@
Set<String> handlerRoles = new HashSet<String>();
ArrayList handlerInfos = new ArrayList();
- for (HandlerMetaData handlerMetaData : epMetaData.getHandlers(HandlerType.ALL))
+ for (HandlerMetaData handlerMetaData : epMetaData.getHandlerMetaData(HandlerType.ALL))
{
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -148,7 +148,7 @@
List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
- for (HandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
+ for (HandlerMetaData handlerMetaData : sepMetaData.getHandlerMetaData(type))
{
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -131,7 +131,7 @@
public void initHandlerChain(EndpointMetaData epMetaData, HandlerType type)
{
log.debug("initHandlerChain: " + type);
- for (HandlerMetaData handlerMetaData : epMetaData.getHandlers(type))
+ for (HandlerMetaData handlerMetaData : epMetaData.getHandlerMetaData(type))
{
HandlerMetaDataJAXWS jaxwsMetaData = (HandlerMetaDataJAXWS)handlerMetaData;
String handlerName = jaxwsMetaData.getHandlerName();
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -168,7 +168,7 @@
{
buffer.append("\n" + opMetaData);
}
- for (HandlerMetaData hdlMetaData : getHandlers(HandlerType.ALL))
+ for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
{
buffer.append("\n" + hdlMetaData);
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -438,7 +438,7 @@
handlersInitialized = false;
}
- public List<HandlerMetaData> getHandlers(HandlerType type)
+ public List<HandlerMetaData> getHandlerMetaData(HandlerType type)
{
List<HandlerMetaData> typeHandlers = new ArrayList<HandlerMetaData>();
for (HandlerMetaData hmd : handlers)
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -64,6 +64,8 @@
private ObjectName sepID;
// The HTTP context root
private String contextRoot;
+ // The HTTP virtual hosts
+ private String[] virtualHosts;
// The HTTP url parttern
private String urlPattern;
// The bean that registers with the ServiceEndpointManager
@@ -139,6 +141,16 @@
this.contextRoot = contextRoot;
}
+ public String[] getVirtualHosts()
+ {
+ return virtualHosts;
+ }
+
+ public void setVirtualHosts(String[] virtualHosts)
+ {
+ this.virtualHosts = virtualHosts;
+ }
+
public String getURLPattern()
{
return urlPattern;
@@ -267,7 +279,7 @@
{
buffer.append("\n" + opMetaData);
}
- for (HandlerMetaData hdlMetaData : getHandlers(HandlerType.ALL))
+ for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
{
buffer.append("\n" + hdlMetaData);
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -508,7 +508,7 @@
if (wsEndpoint != null)
{
ServerEndpointMetaData sepMetaData = wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- handlers = sepMetaData.getHandlers(HandlerType.ALL);
+ handlers = sepMetaData.getHandlerMetaData(HandlerType.ALL);
}
return handlers;
}
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-20 22:48:06 UTC (rev 1476)
@@ -37,9 +37,8 @@
import org.jboss.ws.jaxrpc.CallImpl;
/**
- * Multiple virtual host and soap:address problem
- *
- * http://jira.jboss.org/jira/browse/JBWS-1178
+ * [JBWS-1178] Multiple virtual host and soap:address problem
+ * [JBWS-864] soap:address in wsdl ignores <url-pattern>
*
* @author Thomas.Diesler(a)jboss.com
* @since 05-Oct-2006
@@ -70,7 +69,7 @@
public void testHostAddress() throws Exception
{
InetAddress inetAddr = InetAddress.getByName(getServerHost());
- URL wsdlURL = new URL("http://" + inetAddr.getHostAddress() + ":8080/jaxws-jbws1178?wsdl");
+ URL wsdlURL = new URL("http://" + inetAddr.getHostAddress() + ":8080/jaxws-jbws1178/testpattern?wsdl");
ServiceFactory factory = ServiceFactory.newInstance();
QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
@@ -85,7 +84,7 @@
public void testHostName() throws Exception
{
InetAddress inetAddr = InetAddress.getByName(getServerHost());
- URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178?wsdl");
+ URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178/testpattern?wsdl");
ServiceFactory factory = ServiceFactory.newInstance();
QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
Modified: branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-11-20 22:22:10 UTC (rev 1475)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-11-20 22:48:06 UTC (rev 1476)
@@ -10,6 +10,7 @@
<servlet-mapping>
<servlet-name>TestEndpoint</servlet-name>
- <url-pattern>/*</url-pattern>
+ <!-- [JBWS-864] soap:address in wsdl ignores <url-pattern> -->
+ <url-pattern>/testpattern</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
18 years, 1 month
JBossWS SVN: r1475 - in branches/tdiesler/trunk: . src/main/java/org/jboss/ws/server src/main/resources/jbossws.beans/META-INF src/test/ant src/test/java/org/jboss/test/ws/jaxws src/test/java/org/jboss/test/ws/jaxws/jbws1178 src/test/resources/jaxws src/test/resources/jaxws/jbws1178 src/test/resources/jaxws/jbws1178/WEB-INF
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-20 17:22:10 -0500 (Mon, 20 Nov 2006)
New Revision: 1475
Added:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java
branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/
branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/
branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
Removed:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java
branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/
branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
Modified:
branches/tdiesler/trunk/.classpath
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java
branches/tdiesler/trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
branches/tdiesler/trunk/src/test/ant/build-jars-jaxws.xml
branches/tdiesler/trunk/version.properties
Log:
[JBWS-1178] Multiple virtual host and soap:address problem
Modified: branches/tdiesler/trunk/.classpath
===================================================================
--- branches/tdiesler/trunk/.classpath 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/.classpath 2006-11-20 22:22:10 UTC (rev 1475)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry excluding="org/jboss/ws/integration/jboss50/ServiceRefHandler.java" kind="src" path="src/main/java"/>
<classpathentry excluding="org/jboss/test/ws/interop/" kind="src" path="src/test/java"/>
<classpathentry kind="lib" path="thirdparty/activation.jar"/>
<classpathentry kind="lib" path="thirdparty/mailapi.jar"/>
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-20 22:22:10 UTC (rev 1475)
@@ -36,6 +36,7 @@
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
+import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.binding.BindingException;
@@ -123,17 +124,23 @@
/** Handle a WSDL request or a request for an included resource
*/
- public void handleWSDLRequest(OutputStream outStream, URL requestURL, String resourcePath) throws IOException
+ public void handleWSDLRequest(OutputStream outStream, URL reqURL, String resPath) throws IOException
{
ServiceEndpointInfo sepInfo = getServiceEndpointInfo();
EndpointMetaData epMetaData = sepInfo.getServerEndpointMetaData();
- String urlString = requestURL.toExternalForm();
- String requestURI = requestURL.getPath();
- String hostPath = urlString.substring(0, urlString.indexOf(requestURI));
-
+ String wsdlHost = reqURL.getHost();
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ if (epManager.getWebServiceHost().equals(ServiceEndpointManager.UNDEFINED_HOSTNAME) == false)
+ {
+ wsdlHost = epManager.getWebServiceHost();
+ }
+ log.debug("WSDL request, using host: " + wsdlHost);
+
WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
- Document document = wsdlRequestHandler.getDocumentForPath(hostPath, requestURI, resourcePath);
+ Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
OutputStreamWriter writer = new OutputStreamWriter(outStream);
new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-20 22:22:10 UTC (rev 1475)
@@ -85,14 +85,16 @@
// provide logging
private static final Logger log = Logger.getLogger(ServiceEndpointManager.class);
- // default bean name
+ // Default bean name
public static final String BEAN_NAME = "ServiceEndpointManager";
+ // The host name that is returned if there is no other defined
+ public static String UNDEFINED_HOSTNAME = "jbossws.undefined.host";
// maps serviceID to EndpointInfo
private Map<ObjectName, ServiceEndpoint> registry = new ConcurrentHashMap<ObjectName, ServiceEndpoint>();
// The webservice host name that will be used when updating the wsdl
- private String webServiceHost;
+ private String webServiceHost = UNDEFINED_HOSTNAME;
// The webservice port that will be used when updating the wsdl
private int webServicePort;
// The webservice port that will be used when updating the wsdl
@@ -128,21 +130,19 @@
return alwaysModifySOAPAddress;
}
- public void setWebServiceHost(String host)
+ public void setWebServiceHost(String host) throws UnknownHostException
{
+ if (host == null || host.trim().length() == 0)
+ {
+ log.debug("Using undefined host: " + UNDEFINED_HOSTNAME);
+ host = UNDEFINED_HOSTNAME;
+ }
if ("0.0.0.0".equals(host))
{
- try
- {
- InetAddress localHost = InetAddress.getLocalHost();
- host = localHost.getHostName();
- }
- catch (UnknownHostException e)
- {
- log.error("Cannot map host: " + host, e);
- }
+ InetAddress localHost = InetAddress.getLocalHost();
+ log.debug("Using local host: " + localHost.getHostName());
+ host = localHost.getHostName();
}
-
this.webServiceHost = host;
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java 2006-11-20 22:22:10 UTC (rev 1475)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.server;
+import java.net.UnknownHostException;
import java.util.List;
import javax.management.ObjectName;
@@ -38,7 +39,7 @@
static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=ServiceEndpointManager");
String getWebServiceHost();
- void setWebServiceHost(String host);
+ void setWebServiceHost(String host) throws UnknownHostException;
int getWebServicePort();
void setWebServicePort(int port);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java 2006-11-20 22:22:10 UTC (rev 1475)
@@ -25,11 +25,12 @@
import java.io.File;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -64,10 +65,10 @@
* <p/>
* Use path value of null to get the root document
*
- * @param resourcePath The wsdl resource to get, can be null for the top level wsdl
+ * @param resPath The wsdl resource to get, can be null for the top level wsdl
* @return A wsdl document, or null if it cannot be found
*/
- public Document getDocumentForPath(String hostPath, String requestURI, String resourcePath) throws IOException
+ public Document getDocumentForPath(URL reqURL, String wsdlHost, String resPath) throws IOException
{
String wsdlLocation = epMetaData.getServiceMetaData().getWsdlFile();
if (wsdlLocation == null)
@@ -79,7 +80,7 @@
URL wsdlURL = new URL(wsdlLocation);
// get the root wsdl
- if (resourcePath == null)
+ if (resPath == null)
{
Element wsdlElement = DOMUtils.parse(wsdlURL.openStream());
wsdlDoc = wsdlElement.getOwnerDocument();
@@ -88,21 +89,21 @@
// get some imported resource
else
{
- String resPath = new File(wsdlURL.getPath()).getParent() + File.separatorChar + resourcePath;
- File resFile = new File(resPath);
+ String impResourcePath = new File(wsdlURL.getPath()).getParent() + File.separatorChar + resPath;
+ File impResourceFile = new File(impResourcePath);
- Element wsdlElement = DOMUtils.parse(resFile.toURL().openStream());
+ Element wsdlElement = DOMUtils.parse(impResourceFile.toURL().openStream());
wsdlDoc = wsdlElement.getOwnerDocument();
}
- modifyImportLocations(hostPath, requestURI, resourcePath, wsdlDoc.getDocumentElement());
+ modifyAddressReferences(reqURL, wsdlHost, resPath, wsdlDoc.getDocumentElement());
return wsdlDoc;
}
/**
* Modify the location of wsdl and schema imports
*/
- private void modifyImportLocations(String hostPath, String requestURI, String resourcePath, Element element)
+ private void modifyAddressReferences(URL reqURL, String wsdlHost, String resPath, Element element) throws MalformedURLException
{
// map wsdl definition imports
NodeList nlist = element.getChildNodes();
@@ -123,23 +124,50 @@
{
String orgLocation = locationAttr.getNodeValue();
boolean isAbsolute = orgLocation.startsWith("http://") || orgLocation.startsWith("https://");
- if (isAbsolute == false && orgLocation.startsWith(requestURI) == false)
+ if (isAbsolute == false && orgLocation.startsWith(reqURL.getPath()) == false)
{
String newResourcePath = orgLocation;
- if (resourcePath != null && resourcePath.indexOf("/") > 0)
- newResourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1) + orgLocation;
+ if (resPath != null && resPath.indexOf("/") > 0)
+ newResourcePath = resPath.substring(0, resPath.lastIndexOf("/") + 1) + orgLocation;
- String newLocation = hostPath + requestURI + "?wsdl&resource=" + newResourcePath;
+ String reqProtocol = reqURL.getProtocol();
+ int reqPort = reqURL.getPort();
+ String hostAndPort = wsdlHost + (reqPort > 0 ? ":" + reqPort : "");
+ String reqPath = reqURL.getPath();
+
+ String newLocation = reqProtocol + "://" + hostAndPort + reqPath + "?wsdl&resource=" + newResourcePath;
locationAttr.setNodeValue(newLocation);
log.debug("Mapping import from '" + orgLocation + "' to '" + newLocation + "'");
}
}
}
+ else if ("address".equals(nodeName))
+ {
+ Attr locationAttr = childElement.getAttributeNode("location");
+ if (locationAttr != null)
+ {
+ String orgLocation = locationAttr.getNodeValue();
+
+ URL locURL = new URL(orgLocation);
+ String locProtocol = locURL.getProtocol();
+ String locPath = locURL.getPath();
+ if (reqURL.getProtocol().equals(locProtocol) && reqURL.getPath().equals(locPath))
+ {
+ int locPort = locURL.getPort();
+ String hostAndPort = wsdlHost + (locPort > 0 ? ":" + locPort : "");
+
+ String newLocation = locProtocol + "://" + hostAndPort + locPath;
+ locationAttr.setNodeValue(newLocation);
+
+ log.debug("Mapping address from '" + orgLocation + "' to '" + newLocation + "'");
+ }
+ }
+ }
else
{
- modifyImportLocations(hostPath, requestURI, resourcePath, childElement);
+ modifyAddressReferences(reqURL, wsdlHost, resPath, childElement);
}
}
}
Modified: branches/tdiesler/trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- branches/tdiesler/trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-11-20 22:22:10 UTC (rev 1475)
@@ -7,11 +7,13 @@
<bean name="ServiceEndpointManager" class="org.jboss.ws.server.ServiceEndpointManager">
<!--
- The WSDL, that is a required deployment artifact for an endpoint, has a <soap:address>
- element which points to the location of the endpoint. JBoss supports rewriting of that SOAP address.
-
- If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless AlwaysModifySOAPAddress is true.
- If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
+ The WSDL, that is a required deployment artifact for an endpoint, has a <soap:address>
+ element which points to the location of the endpoint. JBoss supports rewriting of that SOAP address.
+
+ If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless 'alwaysModifySOAPAddress' is true.
+ If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
+
+ If 'webServiceHost' is an empty string, JBossWS uses requesters host when rewriting the <soap:address>.
-->
<property name="webServiceHost">${jboss.bind.address}</property>
<property name="webServiceSecurePort">8443</property>
Modified: branches/tdiesler/trunk/src/test/ant/build-jars-jaxws.xml
===================================================================
--- branches/tdiesler/trunk/src/test/ant/build-jars-jaxws.xml 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/src/test/ant/build-jars-jaxws.xml 2006-11-20 22:22:10 UTC (rev 1475)
@@ -106,6 +106,13 @@
</fileset>
</jar>
+ <!-- jaxws-jbws1178 -->
+ <war destfile="${build.test.dir}/libs/jaxws-jbws1178.war" webxml="${build.test.dir}/resources/jaxws/jbws1178/WEB-INF/web.xml">
+ <classes dir="${build.test.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.class"/>
+ </classes>
+ </war>
+
<!-- jaxws-jsr181-complex -->
<war warfile="${build.test.dir}/libs/jaxws-jsr181-complex.war" webxml="${build.test.dir}/resources/jaxws/jsr181/complex/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
Copied: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178 (from rev 1149, branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1178)
Deleted: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-10-05 20:45:43 UTC (rev 1149)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-20 22:22:10 UTC (rev 1475)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.jbws1178;
-
-import java.net.InetAddress;
-import java.net.URL;
-
-import javax.management.Attribute;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.Service;
-import javax.xml.rpc.ServiceFactory;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.jaxrpc.CallImpl;
-
-/**
- * Multiple virtual host and soap:address problem
- *
- * http://jira.jboss.org/jira/browse/JBWS-1178
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 05-Oct-2006
- */
-public class JBWS1178TestCase extends JBossWSTest
-{
- String webServiceHost;
-
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(JBWS1178TestCase.class, "jaxws-jbws1178.war");
- }
-
- public void setUp() throws Exception
- {
- ObjectName objectName = new ObjectName("jboss.ws:service=ServiceEndpointManager");
- webServiceHost = (String)getServer().getAttribute(objectName, "WebServiceHost");
- // Setting the WebServiceHost to an empty string, causes the request host to be used
- getServer().setAttribute(objectName, new Attribute("WebServiceHost", ""));
- }
-
- public void tearDown() throws Exception
- {
- ObjectName objectName = new ObjectName("jboss.ws:service=ServiceEndpointManager");
- getServer().setAttribute(objectName, new Attribute("WebServiceHost", webServiceHost));
- }
-
- public void testHostAddress() throws Exception
- {
- InetAddress inetAddr = InetAddress.getByName(getServerHost());
- System.out.println(inetAddr.getHostAddress());
- URL wsdlURL = new URL("http://" + inetAddr.getHostAddress() + ":8080/jaxws-jbws1178?wsdl");
-
- ServiceFactory factory = ServiceFactory.newInstance();
- QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
- QName portName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointPort");
- Service service = factory.createService(wsdlURL, serviceName);
- CallImpl call = (CallImpl)service.createCall(portName);
- URL epURL = new URL(call.getEndpointMetaData().getEndpointAddress());
-
- assertEquals(wsdlURL.getHost(), epURL.getHost());
- }
-
- public void testHostName() throws Exception
- {
- InetAddress inetAddr = InetAddress.getByName(getServerHost());
- URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178?wsdl");
-
- ServiceFactory factory = ServiceFactory.newInstance();
- QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
- QName portName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointPort");
- Service service = factory.createService(wsdlURL, serviceName);
- CallImpl call = (CallImpl)service.createCall(portName);
- URL epURL = new URL(call.getEndpointMetaData().getEndpointAddress());
-
- assertEquals(wsdlURL.getHost(), epURL.getHost());
- }
-}
Copied: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java (from rev 1149, branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java)
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-10-05 20:45:43 UTC (rev 1149)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-20 22:22:10 UTC (rev 1475)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1178;
+
+import java.net.InetAddress;
+import java.net.URL;
+
+import javax.management.Attribute;
+import javax.management.ObjectName;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.jaxrpc.CallImpl;
+
+/**
+ * Multiple virtual host and soap:address problem
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1178
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 05-Oct-2006
+ */
+public class JBWS1178TestCase extends JBossWSTest
+{
+ String webServiceHost;
+
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(JBWS1178TestCase.class, "jaxws-jbws1178.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ ObjectName objectName = new ObjectName("jboss.ws:service=ServiceEndpointManager");
+ webServiceHost = (String)getServer().getAttribute(objectName, "WebServiceHost");
+ // Setting the WebServiceHost to an empty string, causes the request host to be used
+ getServer().setAttribute(objectName, new Attribute("WebServiceHost", ""));
+ }
+
+ public void tearDown() throws Exception
+ {
+ ObjectName objectName = new ObjectName("jboss.ws:service=ServiceEndpointManager");
+ getServer().setAttribute(objectName, new Attribute("WebServiceHost", webServiceHost));
+ }
+
+ public void testHostAddress() throws Exception
+ {
+ InetAddress inetAddr = InetAddress.getByName(getServerHost());
+ URL wsdlURL = new URL("http://" + inetAddr.getHostAddress() + ":8080/jaxws-jbws1178?wsdl");
+
+ ServiceFactory factory = ServiceFactory.newInstance();
+ QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
+ QName portName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointPort");
+ Service service = factory.createService(wsdlURL, serviceName);
+ CallImpl call = (CallImpl)service.createCall(portName);
+ URL epURL = new URL(call.getEndpointMetaData().getEndpointAddress());
+
+ assertEquals(wsdlURL.getHost(), epURL.getHost());
+ }
+
+ public void testHostName() throws Exception
+ {
+ InetAddress inetAddr = InetAddress.getByName(getServerHost());
+ URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178?wsdl");
+
+ ServiceFactory factory = ServiceFactory.newInstance();
+ QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
+ QName portName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointPort");
+ Service service = factory.createService(wsdlURL, serviceName);
+ CallImpl call = (CallImpl)service.createCall(portName);
+ URL epURL = new URL(call.getEndpointMetaData().getEndpointAddress());
+
+ assertEquals(wsdlURL.getHost(), epURL.getHost());
+ }
+}
Deleted: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java 2006-10-05 20:45:43 UTC (rev 1149)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java 2006-11-20 22:22:10 UTC (rev 1475)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.jbws1178;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-
-@WebService(name = "TestEndpoint", targetNamespace = "http://org.jboss.ws/jbws1178")
-@SOAPBinding(style = SOAPBinding.Style.RPC)
-public class TestEndpoint
-{
- @WebMethod
- public String echo(String input)
- {
- return input;
- }
-}
Copied: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java (from rev 1149, branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java)
Copied: branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178 (from rev 1149, branches/jbossws-1.0/src/test/resources/jaxws/jbws1178)
Copied: branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF (from rev 1149, branches/jbossws-1.0/src/test/resources/jaxws/jbws1178/WEB-INF)
Deleted: branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
===================================================================
--- branches/jbossws-1.0/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-10-05 20:45:43 UTC (rev 1149)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-11-20 22:22:10 UTC (rev 1475)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <servlet>
- <servlet-name>TestEndpoint</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.jbws1178.TestEndpoint</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>TestEndpoint</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-</web-app>
\ No newline at end of file
Copied: branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml (from rev 1149, branches/jbossws-1.0/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml)
Modified: branches/tdiesler/trunk/version.properties
===================================================================
--- branches/tdiesler/trunk/version.properties 2006-11-20 19:11:07 UTC (rev 1474)
+++ branches/tdiesler/trunk/version.properties 2006-11-20 22:22:10 UTC (rev 1475)
@@ -5,7 +5,7 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.0.0.CR2.DEV
+version.id=2.0.0.CR3.DEV
repository.id=snapshot
implementation.title=JBoss Web Services (JBossWS)
18 years, 1 month
JBossWS SVN: r1474 - in branches/tdiesler/trunk/src/main: etc resources/dist
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-20 14:11:07 -0500 (Mon, 20 Nov 2006)
New Revision: 1474
Added:
branches/tdiesler/trunk/src/main/etc/JBossORG-EULA.txt
branches/tdiesler/trunk/src/main/resources/dist/Install.txt
Modified:
branches/tdiesler/trunk/src/main/etc/jbossws-component-info.xml
Log:
add EULA, Install
Added: branches/tdiesler/trunk/src/main/etc/JBossORG-EULA.txt
===================================================================
--- branches/tdiesler/trunk/src/main/etc/JBossORG-EULA.txt 2006-11-20 12:15:01 UTC (rev 1473)
+++ branches/tdiesler/trunk/src/main/etc/JBossORG-EULA.txt 2006-11-20 19:11:07 UTC (rev 1474)
@@ -0,0 +1,107 @@
+LICENSE AGREEMENT
+JBOSS(r)
+
+This License Agreement governs the use of the Software Packages and any updates to the Software
+Packages, regardless of the delivery mechanism. Each Software Package is a collective work
+under U.S. Copyright Law. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to
+the user ("Client") a license to the applicable collective work(s) pursuant to the
+GNU Lesser General Public License v. 2.1 except for the following Software Packages:
+(a) JBoss Portal Forums and JBoss Transactions JTS, each of which is licensed pursuant to the
+GNU General Public License v.2;
+
+(b) JBoss Rules, which is licensed pursuant to the Apache License v.2.0;
+
+(c) an optional download for JBoss Cache for the Berkeley DB for Java database, which is licensed under the
+(open source) Sleepycat License (if Client does not wish to use the open source version of this database,
+it may purchase a license from Sleepycat Software);
+
+and (d) the BPEL extension for JBoss jBPM, which is licensed under the Common Public License v.1,
+and, pursuant to the OASIS BPEL4WS standard, requires parties wishing to redistribute to enter various
+royalty-free patent licenses.
+
+Each of the foregoing licenses is available at http://www.opensource.org/licenses/index.php.
+
+1. The Software. "Software Packages" refer to the various software modules that are created and made available
+for distribution by the JBoss.org open source community at http://www.jboss.org. Each of the Software Packages
+may be comprised of hundreds of software components. The end user license agreement for each component is located in
+the component's source code. With the exception of certain image files identified in Section 2 below,
+the license terms for the components permit Client to copy, modify, and redistribute the component,
+in both source code and binary code forms. This agreement does not limit Client's rights under,
+or grant Client rights that supersede, the license terms of any particular component.
+
+2. Intellectual Property Rights. The Software Packages are owned by Red Hat and others and are protected under copyright
+and other laws. Title to the Software Packages and any component, or to any copy, modification, or merged portion shall
+remain with the aforementioned, subject to the applicable license. The "JBoss" trademark, "Red Hat" trademark, the
+individual Software Package trademarks, and the "Shadowman" logo are registered trademarks of Red Hat and its affiliates
+in the U.S. and other countries. This agreement permits Client to distribute unmodified copies of the Software Packages
+using the Red Hat trademarks that Red Hat has inserted in the Software Packages on the condition that Client follows Red Hat's
+trademark guidelines for those trademarks located at http://www.redhat.com/about/corporate/trademark/. Client must abide by
+these trademark guidelines when distributing the Software Packages, regardless of whether the Software Packages have been modified.
+If Client modifies the Software Packages, then Client must replace all Red Hat trademarks and logos identified at
+http://www.jboss.com/company/logos, unless a separate agreement with Red Hat is executed or other permission granted.
+Merely deleting the files containing the Red Hat trademarks may corrupt the Software Packages.
+
+3. Limited Warranty. Except as specifically stated in this Paragraph 3 or a license for a particular
+component, to the maximum extent permitted under applicable law, the Software Packages and the
+components are provided and licensed "as is" without warranty of any kind, expressed or implied,
+including the implied warranties of merchantability, non-infringement or fitness for a particular purpose.
+Red Hat warrants that the media on which Software Packages may be furnished will be free from defects in
+materials and manufacture under normal use for a period of 30 days from the date of delivery to Client.
+Red Hat does not warrant that the functions contained in the Software Packages will meet Client's requirements
+or that the operation of the Software Packages will be entirely error free or appear precisely as described
+in the accompanying documentation. This warranty extends only to the party that purchases the Services
+pertaining to the Software Packages from Red Hat or a Red Hat authorized distributor.
+
+4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, the remedies
+described below are accepted by Client as its only remedies. Red Hat's entire liability, and Client's
+exclusive remedies, shall be: If the Software media is defective, Client may return it within 30 days of
+delivery along with a copy of Client's payment receipt and Red Hat, at its option, will replace it or
+refund the money paid by Client for the Software. To the maximum extent permitted by applicable law,
+Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential
+damages, including lost profits or lost savings arising out of the use or inability to use the Software,
+even if Red Hat or such dealer has been advised of the possibility of such damages. In no event shall
+Red Hat's liability under this agreement exceed the amount that Client paid to Red Hat under this
+Agreement during the twelve months preceding the action.
+
+5. Export Control. As required by U.S. law, Client represents and warrants that it:
+(a) understands that the Software Packages are subject to export controls under the
+U.S. Commerce Department's Export Administration Regulations ("EAR");
+
+(b) is not located in a prohibited destination country under the EAR or U.S. sanctions regulations
+(currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria);
+
+(c) will not export, re-export, or transfer the Software Packages to any prohibited destination, entity,
+or individual without the necessary export license(s) or authorizations(s) from the U.S. Government;
+
+(d) will not use or transfer the Software Packages for use in any sensitive nuclear, chemical or
+biological weapons, or missile technology end-uses unless authorized by the U.S. Government by
+regulation or specific license;
+
+(e) understands and agrees that if it is in the United States and exports or transfers the Software
+Packages to eligible end users, it will, as required by EAR Section 740.17(e), submit semi-annual
+reports to the Commerce Department's Bureau of Industry & Security (BIS), which include the name and
+address (including country) of each transferee;
+
+and (f) understands that countries other than the United States may restrict the import, use, or
+export of encryption products and that it shall be solely responsible for compliance with any such
+import, use, or export restrictions.
+
+6. Third Party Programs. Red Hat may distribute third party software programs with the Software Packages
+that are not part of the Software Packages and which Client must install separately. These third party
+programs are subject to their own license terms. The license terms either accompany the programs or
+can be viewed at http://www.redhat.com/licenses/. If Client does not agree to abide by the applicable
+license terms for such programs, then Client may not install them. If Client wishes to install the programs
+on more than one system or transfer the programs to another party, then Client must contact the licensor
+of the programs.
+
+7. General. If any provision of this agreement is held to be unenforceable, that shall not affect the
+enforceability of the remaining provisions. This License Agreement shall be governed by the laws of the
+State of North Carolina and of the United States, without regard to any conflict of laws provisions,
+except that the United Nations Convention on the International Sale of Goods shall not apply.
+
+Copyright 2006 Red Hat, Inc. All rights reserved.
+"JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc.
+All other trademarks are the property of their respective owners.
+
+ Page 1 of 1 18 October 2006
+
Property changes on: branches/tdiesler/trunk/src/main/etc/JBossORG-EULA.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/tdiesler/trunk/src/main/etc/jbossws-component-info.xml
===================================================================
--- branches/tdiesler/trunk/src/main/etc/jbossws-component-info.xml 2006-11-20 12:15:01 UTC (rev 1473)
+++ branches/tdiesler/trunk/src/main/etc/jbossws-component-info.xml 2006-11-20 19:11:07 UTC (rev 1474)
@@ -5,11 +5,11 @@
version="@repository.id@"
description="JBossWS an implementation of J2EE Web Services">
+ <artifact id="jbossws.sar"/>
+ <artifact id="jbossws-client.jar"/>
<artifact id="jboss-jaxrpc.jar"/>
<artifact id="jboss-jaxws.jar"/>
<artifact id="jboss-saaj.jar"/>
- <artifact id="jbossws-client.jar"/>
- <artifact id="jbossws.sar"/>
<import componentref="apache-xmlsec">
<compatible version="@apache-xmlsec@"/>
@@ -31,11 +31,11 @@
</import>
<export>
+ <include input="jbossws.sar"/>
+ <include input="jbossws-client.jar"/>
<include input="jboss-jaxrpc.jar"/>
<include input="jboss-jaxws.jar"/>
<include input="jboss-saaj.jar"/>
- <include input="jbossws-client.jar"/>
- <include input="jbossws.sar"/>
</export>
</component>
Added: branches/tdiesler/trunk/src/main/resources/dist/Install.txt
===================================================================
--- branches/tdiesler/trunk/src/main/resources/dist/Install.txt 2006-11-20 12:15:01 UTC (rev 1473)
+++ branches/tdiesler/trunk/src/main/resources/dist/Install.txt 2006-11-20 19:11:07 UTC (rev 1474)
@@ -0,0 +1,29 @@
+
+(a)implementation.title@
+(a)implementation.url@
+
+Version: jbossws-(a)version.id@
+
+Installation instructions
+=========================
+
+This distribution ships with JBoss binaries for JDK1.4 and JDK1.5.
+Please make sure your chose the right distribution that fits your target JDK.
+
+In order to install JBossWS the following steps are necessary:
+
+1.) Copy lib/jbossws-client.jar to $JBOSS_HOME/client/
+2.) Unzip lib/jbossws.sar to $JBOSS_HOME/server/default/deploy/
+3.) Replacing jboss-xml-binding.jar
+
+You need to manually replace the jboss-xml-binding.jar in the $JBOSS_HOME/client and $JBOSS_HOME/lib directories.
+The compatible release can be found here: http://repository.jboss.com/jboss/jbossxb/1.0.0.CR7
+
+After the jbossws.sar is deployed you should be able to access JBossWS under
+http://localhost:8080/jbossws
+
+If you have any questions, please post to the userforum:
+http://www.jboss.org/index.html?module=bb&op=viewforum&f=200
+
+Enjoy,
+The JBossWS Team
\ No newline at end of file
Property changes on: branches/tdiesler/trunk/src/main/resources/dist/Install.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
18 years, 1 month
JBossWS SVN: r1473 - branches/tdiesler
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-20 07:15:01 -0500 (Mon, 20 Nov 2006)
New Revision: 1473
Added:
branches/tdiesler/jbossws-1.0/
Log:
recreate userbranch from -r1465
Copied: branches/tdiesler/jbossws-1.0 (from rev 1472, branches/jbossws-1.0)
18 years, 1 month
JBossWS SVN: r1472 - branches/tdiesler
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-20 07:14:34 -0500 (Mon, 20 Nov 2006)
New Revision: 1472
Removed:
branches/tdiesler/jbossws-1.0/
Log:
recreate userbranch from -r1465
18 years, 1 month
JBossWS SVN: r1471 - in trunk/src/main/java/org/jboss/ws/metadata/builder: . jaxws
by jbossws-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2006-11-20 00:40:40 -0500 (Mon, 20 Nov 2006)
New Revision: 1471
Added:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
Removed:
trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java
Modified:
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
Log:
Fix package
Deleted: trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java 2006-11-20 05:36:07 UTC (rev 1470)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java 2006-11-20 05:40:40 UTC (rev 1471)
@@ -1,32 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.metadata.builder;
-
-/**
- * Abstract class that represents a JAX-WS metadata builder.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
- * @version $Revision$
- */
-public class JAXWSMetaDataBuilder extends MetaDataBuilder
-{
-}
Modified: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2006-11-20 05:36:07 UTC (rev 1470)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2006-11-20 05:40:40 UTC (rev 1471)
@@ -38,7 +38,6 @@
import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.builder.JAXWSMetaDataBuilder;
import org.jboss.ws.metadata.wsdl.NCName;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java (from rev 1468, trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2006-11-20 05:40:40 UTC (rev 1471)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.builder.jaxws;
+
+import org.jboss.ws.metadata.builder.MetaDataBuilder;
+
+/**
+ * Abstract class that represents a JAX-WS metadata builder.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public class JAXWSMetaDataBuilder extends MetaDataBuilder
+{
+}
Modified: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2006-11-20 05:36:07 UTC (rev 1470)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2006-11-20 05:40:40 UTC (rev 1471)
@@ -30,7 +30,6 @@
import org.jboss.ws.deployment.JAXWSDeployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.builder.JAXWSMetaDataBuilder;
/** An abstract annotation meta data builder.
*
18 years, 1 month
JBossWS SVN: r1470 - trunk
by jbossws-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2006-11-20 00:36:07 -0500 (Mon, 20 Nov 2006)
New Revision: 1470
Modified:
trunk/version.properties
Log:
Update version
Modified: trunk/version.properties
===================================================================
--- trunk/version.properties 2006-11-20 05:33:36 UTC (rev 1469)
+++ trunk/version.properties 2006-11-20 05:36:07 UTC (rev 1470)
@@ -5,7 +5,7 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.0.0.CR2.DEV
+version.id=2.0.0.CR3.DEV
repository.id=snapshot
implementation.title=JBoss Web Services (JBossWS)
@@ -16,7 +16,7 @@
# thirdparty library versions that are referenced in component-info.xml
apache-xmlsec=1.3.0
ibm-wsdl4j=1.5.2jboss
-javassist=3.3.0.GA
+javassist=3.4.GA
jboss-common-core=2.0.2.CR1
jboss-common-logging=2.0.1.GA
jboss-jbossxb=1.0.0.CR7
18 years, 1 month
JBossWS SVN: r1469 - tags/jbossws-2.0.0.CR2
by jbossws-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2006-11-20 00:33:36 -0500 (Mon, 20 Nov 2006)
New Revision: 1469
Modified:
tags/jbossws-2.0.0.CR2/version.properties
Log:
Correct version.properties
Modified: tags/jbossws-2.0.0.CR2/version.properties
===================================================================
--- tags/jbossws-2.0.0.CR2/version.properties 2006-11-20 04:58:20 UTC (rev 1468)
+++ tags/jbossws-2.0.0.CR2/version.properties 2006-11-20 05:33:36 UTC (rev 1469)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.0.0.CR2.DEV
-repository.id=snapshot
+version.id=2.0.0.CR2
+repository.id=2.0.0.CR2
implementation.title=JBoss Web Services (JBossWS)
implementation.url=http://www.jboss.org/products/jbossws
@@ -16,7 +16,7 @@
# thirdparty library versions that are referenced in component-info.xml
apache-xmlsec=1.3.0
ibm-wsdl4j=1.5.2jboss
-javassist=3.3.0.GA
+javassist=3.4.GA
jboss-common-core=2.0.2.CR1
jboss-common-logging=2.0.1.GA
jboss-jbossxb=1.0.0.CR7
18 years, 1 month
JBossWS SVN: r1468 - in trunk/src/main/java/org/jboss/ws: deployment integration/jboss50 integration/tomcat jaxrpc jaxws/spi metadata metadata/builder metadata/builder/jaxrpc metadata/builder/jaxws server
by jbossws-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2006-11-19 23:58:20 -0500 (Sun, 19 Nov 2006)
New Revision: 1468
Added:
trunk/src/main/java/org/jboss/ws/metadata/builder/
trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
Removed:
trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientDeployment.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181Deployment.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
Modified:
trunk/src/main/java/org/jboss/ws/deployment/JAXWSDeployment.java
trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerEJB3.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java
trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java
trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java
Log:
Refactor metadata builders to support JBCTS-414
Take steps towards a clean SPI
Deleted: trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-// $Id:AnnotationsMetaDataBuilder.java 732 2006-08-12 18:40:21Z thomas.diesler(a)jboss.com $
-
-import javax.xml.ws.BindingType;
-
-import org.jboss.logging.Logger;
-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;
-
-/** An abstract annotation meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 27-Jun-2005
- */
-public abstract class AnnotationsMetaDataBuilder extends MetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(AnnotationsMetaDataBuilder.class);
-
- public AnnotationsMetaDataBuilder()
- {
- }
-
- protected void processBindingType(EndpointMetaData epMetaData, Class wsClass)
- {
- BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
- String uri = anBindingType.value();
- if (uri.length() > 0)
- {
- epMetaData.setBindingId(uri);
- }
- }
-
- protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData sepMetaData)
- {
- PortComponent anPortComponent = (PortComponent)wsClass.getAnnotation(PortComponent.class);
- if (anPortComponent != null)
- {
- // setup config name
- if (anPortComponent.configName().length() > 0)
- {
- String configName = anPortComponent.configName();
- sepMetaData.setConfigName(configName);
- }
-
- // setup config file
- if (anPortComponent.configFile().length() > 0)
- {
- String configFile = anPortComponent.configFile();
- sepMetaData.setConfigFile(configFile);
- }
-
- boolean isJSEEndpoint = udi.type == DeploymentType.JSR181_JSE || udi.type == DeploymentType.JAXWS_PROVIDER_JSE;
-
- // context-root
- if (anPortComponent.contextRoot().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("@PortComponent.contextRoot is only valid on EJB endpoints");
-
- if (isJSEEndpoint == false)
- {
- String contextRoot = anPortComponent.contextRoot();
- if (contextRoot.startsWith("/") == false)
- contextRoot = "/" + contextRoot;
-
- sepMetaData.setContextRoot(contextRoot);
- }
- }
-
- // url-pattern
- if (anPortComponent.urlPattern().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("@PortComponent.urlPattern is only valid on EJB endpoints");
-
- if (isJSEEndpoint == false)
- {
- String urlPattern = anPortComponent.urlPattern();
- sepMetaData.setURLPattern(urlPattern);
- }
- }
-
- // auth-method
- if (anPortComponent.authMethod().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("@PortComponent.authMethod is only valid on EJB endpoints");
-
- if (isJSEEndpoint == false)
- {
- String authMethod = anPortComponent.authMethod();
- sepMetaData.setAuthMethod(authMethod);
- }
- }
-
- // transport-guarantee
- if (anPortComponent.transportGuarantee().length() > 0)
- {
- if (isJSEEndpoint)
- log.warn("@PortComponent.transportGuarantee is only valid on EJB endpoints");
-
- if (isJSEEndpoint == false)
- {
- String transportGuarantee = anPortComponent.transportGuarantee();
- sepMetaData.setTransportGuarantee(transportGuarantee);
- }
- }
- }
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,320 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.encoding.TypeMappingRegistry;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
-import org.jboss.ws.metadata.ClientEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypeMappingMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.wsdl.NCName;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-
-/**
- * A client side meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public class JAXWSClientMetaDataBuilder extends JAXWSMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSClientMetaDataBuilder.class);
-
- /** Build from WSDL and jaxrpc-mapping.xml
- */
- public ServiceMetaData buildMetaData(QName serviceName, URL wsdlURL)
- {
- if (wsdlURL == null)
- throw new IllegalArgumentException("Invalid wsdlURL: " + wsdlURL);
-
- log.debug("START buildMetaData: [service=" + serviceName + "]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setClassLoader(classLoader);
-
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceName);
- wsMetaData.addService(serviceMetaData);
-
- serviceMetaData.setWsdlFile(wsdlURL.toExternalForm());
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
-
- buildMetaDataInternal(serviceMetaData, wsdlDefinitions);
-
- // Read the WSDL and initialize the schema model
- // This should only be needed for debuging purposes of the UMDM
- JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
-
- log.debug("END buildMetaData: " + wsMetaData);
- return serviceMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-
- private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions) throws IOException
- {
- QName serviceName = serviceMetaData.getServiceName();
-
- // Get the WSDL service
- WSDLService wsdlService = null;
- if (serviceName == null)
- {
- if (wsdlDefinitions.getServices().length != 1)
- throw new IllegalArgumentException("Expected a single service element");
-
- wsdlService = wsdlDefinitions.getServices()[0];
- serviceMetaData.setServiceName(wsdlService.getQName());
- }
- else
- {
- wsdlService = wsdlDefinitions.getService(new NCName(serviceName.getLocalPart()));
- }
- if (wsdlService == null)
- throw new IllegalArgumentException("Cannot obtain wsdl service: " + serviceName);
-
- // Build endpoint meta data
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName portName = wsdlEndpoint.getQName();
- QName interfaceQName = wsdlEndpoint.getInterface().getQName();
- ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXWS);
- epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
- serviceMetaData.addEndpoint(epMetaData);
-
- // Init the endpoint binding
- initEndpointBinding(wsdlEndpoint, epMetaData);
-
- // Init the service encoding style
- initEndpointEncodingStyle(epMetaData);
-
- processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
- setupOperationsFromWSDL(epMetaData, wsdlEndpoint);
- }
- }
-
- protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint wsdlEndpoint)
- {
- WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getInterface().getWsdlDefinitions();
-
- // For every WSDL interface operation build the OperationMetaData
- WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
- for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
- {
- String opName = wsdlOperation.getName().toString();
- QName opQName = wsdlOperation.getQName();
-
- // Set java method name
- String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
-
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName, javaName);
- epMetaData.addOperation(opMetaData);
-
- // Set the operation style
- String style = wsdlOperation.getStyle();
- epMetaData.setStyle((Constants.URI_STYLE_IRI.equals(style) ? Style.DOCUMENT : Style.RPC));
-
- // Set the operation MEP
- if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
- opMetaData.setOneWayOperation(true);
-
- // Set the operation SOAPAction
- WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
- WSDLBindingOperation wsdlBindingOperation = wsdlBinding.getOperationByRef(opQName);
- if (wsdlBindingOperation != null)
- opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
-
- // Get the type mapping for the encoding style
- String encStyle = epMetaData.getEncodingStyle().toURI();
- TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
- TypeMappingImpl typeMapping = (TypeMappingImpl)tmRegistry.getTypeMapping(encStyle);
-//
-// // Build the parameter meta data
-// if (opMetaData.getStyle() == Style.RPC)
-// {
-// buildParameterMetaDataRpc(opMetaData, wsdlOperation, typeMapping);
-// }
-// else
-// {
-// buildParameterMetaDataDoc(opMetaData, wsdlOperation, typeMapping);
-// }
-//
-// // Build operation faults
-// buildFaultMetaData(opMetaData, wsdlOperation);
-
- // process further operation extensions
- processOpMetaExtensions(opMetaData, wsdlOperation);
- }
- }
-
- private void buildParameterMetaDataRpc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, TypeMappingImpl typeMapping)
- {
- log.trace("buildParameterMetaDataRpc: " + opMetaData.getQName());
-
- TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
-
- for (WSDLInterfaceOperationInput opInput : wsdlOperation.getInputs())
- {
- QName xmlName = opInput.getElement();
- QName xmlType = opInput.getXMLType();
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- ParameterMetaData inMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- opMetaData.addParameter(inMetaData);
-
- boolean inHeader = opInput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) != null;
- inMetaData.setInHeader(inHeader);
- }
-
- for (WSDLInterfaceOperationOutput opOutput : wsdlOperation.getOutputs())
- {
- String partName = opOutput.getProperty(Constants.WSDL_PROPERTY_PART_NAME).getValue();
- QName xmlName = opOutput.getElement();
-
- ParameterMetaData outMetaData = opMetaData.getParameter(xmlName);
- if (outMetaData != null && wsdlOperation.getInputByPartName(partName) != null)
- {
- outMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlType = opOutput.getXMLType();
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- boolean inHeader = opOutput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) != null;
- boolean hasReturnMapping = (inHeader == false);
-
- if (hasReturnMapping)
- {
- outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- opMetaData.setReturnParameter(outMetaData);
- }
- else
- {
- outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- outMetaData.setMode(ParameterMode.OUT);
- opMetaData.addParameter(outMetaData);
-
- outMetaData.setInHeader(inHeader);
- }
- }
- }
- }
-
- private void buildParameterMetaDataDoc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, TypeMappingImpl typeMapping)
- {
- log.trace("buildParameterMetaDataDoc: " + opMetaData.getQName());
-
- EndpointMetaData epMetaData = opMetaData.getEndpointMetaData();
- ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
- TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
-
- for (WSDLInterfaceOperationInput opInput : wsdlOperation.getInputs())
- {
- QName xmlName = opInput.getElement();
- QName xmlType = opInput.getXMLType();
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- TypeMappingMetaData typeMetaData = typesMetaData.getTypeMappingByXMLType(xmlType);
- if (typeMetaData != null)
- javaTypeName = typeMetaData.getJavaTypeName();
-
- ParameterMetaData inMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- inMetaData.setInHeader(opInput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) != null);
- opMetaData.addParameter(inMetaData);
- }
-
- for (WSDLInterfaceOperationOutput opOutput : wsdlOperation.getOutputs())
- {
- String partName = opOutput.getProperty(Constants.WSDL_PROPERTY_PART_NAME).getValue();
- QName xmlName = opOutput.getElement();
-
- ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
- if (paramMetaData != null && wsdlOperation.getInputByPartName(partName) != null)
- {
- paramMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlType = opOutput.getXMLType();
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- boolean inHeader = opOutput.getProperty(Constants.WSDL_PROPERTY_APPLICATION_DATA) != null;
- boolean hasReturnMapping = (inHeader == false);
-
- if (typesMetaData.getTypeMappingByXMLType(xmlType) != null)
- javaTypeName = typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName();
-
- if (hasReturnMapping)
- {
- ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- opMetaData.setReturnParameter(retMetaData);
- }
- else
- {
- ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- opMetaData.addParameter(outMetaData);
- outMetaData.setMode(ParameterMode.OUT);
-
- outMetaData.setInHeader(inHeader);
- }
- }
- }
- }
-}
Modified: trunk/src/main/java/org/jboss/ws/deployment/JAXWSDeployment.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JAXWSDeployment.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JAXWSDeployment.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -25,14 +25,13 @@
// $Id$
/**
- * The container independent deployment info.
+ * The container independent deployment info.
*
* @author Thomas.Diesler(a)jboss.org
* @since 29-Jun-2006
*/
public class JAXWSDeployment extends UnifiedDeploymentInfo
{
-
public JAXWSDeployment(DeploymentType type)
{
super(type);
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-
-/** An abstract annotation meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 27-Jun-2006
- */
-public abstract class JAXWSMetaDataBuilder extends AnnotationsMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSMetaDataBuilder.class);
-
- public JAXWSMetaDataBuilder()
- {
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,222 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-// $Id$
-package org.jboss.ws.deployment;
-
-import java.util.Map;
-
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.Source;
-import javax.xml.ws.Provider;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.utils.JavaUtils;
-
-/**
- * A server side meta data builder that is based on JSR-181 annotations
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
- * @since 23-Jul-2005
- */
-public class JAXWSProviderMetaDataBuilderJSE extends JAXWSMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JAXWSProviderMetaDataBuilderJSE.class);
-
- /** Build from annotations
- */
- public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(classLoader);
-
- if (udi.classLoader == null)
- throw new WSException("Deployment class loader not initialized");
-
- // For every bean
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- Map<String, String> servletClassMap = webMetaData.getServletClassNames();
- for (String servletName : servletClassMap.keySet())
- {
- String servletClassName = servletClassMap.get(servletName);
- try
- {
- Class beanClass = udi.classLoader.loadClass(servletClassName);
- if (beanClass.isAnnotationPresent(WebServiceProvider.class))
- {
- setupEndpointFromAnnotations(wsMetaData, udi, beanClass, servletName);
- }
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load service endpoint class: " + servletClassName);
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-
- private ServerEndpointMetaData setupEndpointFromAnnotations(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo udi, Class sepClass, String linkName)
- throws ClassNotFoundException, SecurityException, NoSuchMethodException
- {
- // 5.3 Conformance (Provider implementation): A Provider based service endpoint implementation MUST
- // implement a typed Provider interface.
- if (JavaUtils.isAssignableFrom(Provider.class, sepClass) == false)
- throw new WebServiceException("Endpoint implementation does not implement javax.xml.ws.Provider: " + sepClass.getName());
-
- // 5.4 Conformance (WebServiceProvider annotation): A Provider based service endpoint implementation
- // MUST carry a WebServiceProvider annotation
- WebServiceProvider anWebServiceProvider = (WebServiceProvider)sepClass.getAnnotation(WebServiceProvider.class);
- if (anWebServiceProvider == null)
- throw new WebServiceException("Cannot obtain @WebServiceProvider annotation from: " + sepClass.getName());
-
- // 7.3 Conformance (WebServiceProvider and WebService): A class annotated with the WebServiceProvider
- // annotation MUST NOT carry a WebService annotation
- if (sepClass.isAnnotationPresent(WebService.class))
- throw new WebServiceException("Provider cannot carry @WebService annotation: " + sepClass.getName());
-
- WSDLUtils wsdlUtils = WSDLUtils.getInstance();
-
- String name = wsdlUtils.getJustClassName(sepClass);
-
- String serviceName = anWebServiceProvider.serviceName();
- if (serviceName.length() == 0)
- serviceName = name + "Service";
-
- String targetNS = anWebServiceProvider.targetNamespace();
- if (targetNS.length() == 0)
- targetNS = wsdlUtils.getTypeNamespace(sepClass);
-
- String portName = anWebServiceProvider.portName();
- if (portName.length() == 0)
- portName = name + "Port";
-
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName));
- wsMetaData.addService(serviceMetaData);
-
- // Setup the ServerEndpointMetaData
- QName portQName = new QName(targetNS, portName);
- QName portTypeQName = new QName(targetNS, name);
- ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portQName, portTypeQName, Type.JAXWS);
- sepMetaData.setLinkName(linkName);
-
- sepMetaData.setStyle(Style.DOCUMENT);
- sepMetaData.setParameterStyle(ParameterStyle.BARE);
-
- sepMetaData.setServiceEndpointImplName(sepClass.getName());
- sepMetaData.setServiceEndpointInterfaceName(sepClass.getName());
-
- ServiceMode anServiceMode = (ServiceMode)sepClass.getAnnotation(ServiceMode.class);
- if (anServiceMode != null)
- sepMetaData.setServiceMode(anServiceMode.value());
- else sepMetaData.setServiceMode(Mode.PAYLOAD);
-
- serviceMetaData.addEndpoint(sepMetaData);
-
- // Process invoke method
- processInvokeMethod(sepMetaData);
-
- // Process WSDL
- String wsdlLocation = anWebServiceProvider.wsdlLocation();
- if (wsdlLocation != null)
- serviceMetaData.setWsdlFile(wsdlLocation);
-
- // 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);
-
- return sepMetaData;
- }
-
- @Override
- protected void replaceAddressLocation(ServerEndpointMetaData epMetaData)
- {
- // A provider may not have a WSDL file
- if (epMetaData.getServiceMetaData().getWsdlFile() != null)
- super.replaceAddressLocation(epMetaData);
- }
-
- private void processInvokeMethod(ServerEndpointMetaData epMetaData) throws SecurityException, NoSuchMethodException
- {
- String javaName = "invoke";
- String targetNS = epMetaData.getQName().getNamespaceURI();
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, javaName), javaName);
- epMetaData.addOperation(opMetaData);
-
- Mode serviceMode = epMetaData.getServiceMode();
- Class paramType = (serviceMode == Mode.MESSAGE ? SOAPMessage.class : Source.class);
-
- // Setup invoke param
- QName xmlName = new QName("invokeParam");
- QName xmlType = Constants.TYPE_LITERAL_ANYTYPE;
- ParameterMetaData pmd = new ParameterMetaData(opMetaData, xmlName, xmlType, paramType.getName());
- opMetaData.addParameter(pmd);
-
- // Setup invoke return
- xmlName = new QName("invokeReturn");
- ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, paramType.getName());
- opMetaData.setReturnParameter(retMetaData);
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientDeployment.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientDeployment.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientDeployment.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-
-// $Id: UnifiedDeploymentInfo.java 312 2006-05-11 10:49:22Z thomas.diesler(a)jboss.com $
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class JSR109ClientDeployment extends UnifiedDeploymentInfo
-{
-
- public JSR109ClientDeployment(DeploymentType type)
- {
- super(type);
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,259 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.ClientEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.config.jaxrpc.WSClientConfigJAXRPC;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-import org.jboss.ws.metadata.wsdl.NCName;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
-
-/**
- * A client side meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public class JSR109ClientMetaDataBuilder extends JSR109MetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JSR109ClientMetaDataBuilder.class);
-
- /** Build from WSDL and jaxrpc-mapping.xml
- */
- public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, URL mappingURL, URL securityURL, UnifiedServiceRefMetaData serviceRefMetaData)
- {
- try
- {
- JavaWsdlMapping javaWsdlMapping = null;
- if (mappingURL != null)
- {
- JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance();
- javaWsdlMapping = mappingFactory.parse(mappingURL);
- }
-
- WSSecurityConfiguration securityConfig = null;
- if (securityURL != null)
- {
- securityConfig = WSSecurityConfigurationFactory.newInstance().parse(securityURL);
- }
-
- return buildMetaData(serviceQName, wsdlURL, javaWsdlMapping, securityConfig, serviceRefMetaData);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-
- /** Build from WSDL and jaxrpc-mapping.xml
- */
- public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, JavaWsdlMapping javaWsdlMapping, WSSecurityConfiguration securityConfig,
- UnifiedServiceRefMetaData serviceRefMetaData)
- {
- log.debug("START buildMetaData: [service=" + serviceQName + "]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setClassLoader(classLoader);
-
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceQName);
- wsMetaData.addService(serviceMetaData);
-
- serviceMetaData.setWsdlFile(wsdlURL.toExternalForm());
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
-
- URL mappingURL = null;
- if (javaWsdlMapping != null)
- {
- mappingURL = new URL(Constants.NS_JBOSSWS_URI + "/dummy-mapping-url");
- wsMetaData.addMappingDefinition(mappingURL.toExternalForm(), javaWsdlMapping);
- serviceMetaData.setJaxrpcMappingFile(mappingURL.toExternalForm());
- }
-
- if (securityConfig != null)
- {
- serviceMetaData.setSecurityConfiguration(securityConfig);
- setupSecurity(securityConfig);
- }
-
- buildMetaDataInternal(serviceMetaData, wsdlDefinitions, javaWsdlMapping, serviceRefMetaData);
-
- // eagerly initialize
- wsMetaData.eagerInitialize();
-
- log.debug("END buildMetaData: " + wsMetaData);
- return serviceMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-
- private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions, JavaWsdlMapping javaWsdlMapping,
- UnifiedServiceRefMetaData serviceRefMetaData) throws IOException
- {
- QName serviceQName = serviceMetaData.getServiceName();
-
- // Get the WSDL service
- WSDLService wsdlService = null;
- if (serviceQName == null)
- {
- if (wsdlDefinitions.getServices().length != 1)
- throw new IllegalArgumentException("Expected a single service element");
-
- wsdlService = wsdlDefinitions.getServices()[0];
- serviceMetaData.setServiceName(wsdlService.getQName());
- }
- else
- {
- wsdlService = wsdlDefinitions.getService(new NCName(serviceQName.getLocalPart()));
- }
- if (wsdlService == null)
- throw new IllegalArgumentException("Cannot obtain wsdl service: " + serviceQName);
-
- // Build type mapping meta data
- setupTypesMetaData(serviceMetaData);
-
- // Build endpoint meta data
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName portName = wsdlEndpoint.getQName();
- QName interfaceQName = wsdlEndpoint.getInterface().getQName();
- ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC);
- epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
- serviceMetaData.addEndpoint(epMetaData);
-
- // config-name, config-file
- if (serviceRefMetaData != null)
- {
- String configName = serviceRefMetaData.getConfigName();
- if (configName != null)
- epMetaData.setConfigName(configName);
-
- String configFile = serviceRefMetaData.getConfigFile();
- if (configFile != null)
- epMetaData.setConfigFile(configFile);
- }
-
- // Init the endpoint binding
- initEndpointBinding(wsdlEndpoint, epMetaData);
-
- // Init the service encoding style
- initEndpointEncodingStyle(epMetaData);
-
- ServiceEndpointInterfaceMapping seiMapping = null;
- if (javaWsdlMapping != null)
- {
- QName portType = wsdlEndpoint.getInterface().getQName();
- seiMapping = javaWsdlMapping.getServiceEndpointInterfaceMappingByPortType(portType);
- if (seiMapping != null)
- {
- epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
- }
- else
- {
- log.warn("Cannot obtain the SEI mapping for: " + portType);
- }
- }
-
- processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
- setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping);
- setupHandlers(serviceRefMetaData, portName, epMetaData);
- }
- }
-
- private void setupHandlers(UnifiedServiceRefMetaData serviceRefMetaData, QName portName, EndpointMetaData epMetaData)
- {
- // Add pre handlers
- WSClientConfigJAXRPC jaxrpcConfig = (WSClientConfigJAXRPC)epMetaData.getEndpointConfig();
- epMetaData.addHandlers(jaxrpcConfig.getHandlers(epMetaData, HandlerType.PRE));
-
- // Setup the endpoint handlers
- if (serviceRefMetaData != null)
- {
- for (UnifiedHandlerMetaData uhmd : serviceRefMetaData.getHandlers())
- {
- Set<String> portNames = uhmd.getPortNames();
- if (portNames.size() == 0 || portNames.contains(portName.getLocalPart()))
- {
- epMetaData.addHandler(uhmd.getHandlerMetaDataJAXRPC(epMetaData, HandlerType.ENDPOINT));
- }
- }
- }
-
- // Add post handlers
- epMetaData.addHandlers(jaxrpcConfig.getHandlers(epMetaData, HandlerType.POST));
- }
-
- private void setupSecurity(WSSecurityConfiguration securityConfig)
- {
- if (securityConfig.getKeyStoreFile() != null)
- {
- URL location = classLoader.getResource(securityConfig.getKeyStoreFile());
- if (location != null)
- securityConfig.setKeyStoreURL(location);
- }
-
- if (securityConfig.getTrustStoreFile() != null)
- {
- URL location = classLoader.getResource(securityConfig.getTrustStoreFile());
- if (location != null)
- securityConfig.setTrustStoreURL(location);
- }
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.ws.metadata.jsr109.WebservicesFactory;
-import org.jboss.ws.metadata.jsr109.WebservicesMetaData;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-// $Id: UnifiedDeploymentInfo.java 312 2006-05-11 10:49:22Z thomas.diesler(a)jboss.com $
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class JSR109Deployment extends UnifiedDeploymentInfo
-{
- private WebservicesMetaData jsr109MetaData;
-
- public JSR109Deployment(DeploymentType type, URL webservicesURL)
- {
- super(type);
-
- try
- {
- // Unmarshall webservices.xml
- InputStream is = webservicesURL.openStream();
- try
- {
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
- jsr109MetaData = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
- }
- finally
- {
- is.close();
- }
- }
- catch (Exception ex)
- {
- throw new RuntimeException(ex);
- }
- }
-
- public WebservicesMetaData getWebservicesMetaData()
- {
- return jsr109MetaData;
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,866 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.encoding.TypeMappingRegistry;
-import javax.xml.ws.addressing.AddressingConstants;
-
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.addressing.AddressingConstantsImpl;
-import org.jboss.ws.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.jaxrpc.TypeMappingImpl;
-import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
-import org.jboss.ws.jaxrpc.Use;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypeMappingMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.metadata.WrappedParameter;
-import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLMIMEPart;
-import org.jboss.ws.metadata.wsdl.WSDLProperty;
-import org.jboss.ws.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem;
-import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader;
-import org.jboss.ws.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.ws.xop.XOPScanner;
-
-/**
- * A meta data builder that is based on webservices.xml.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @authoer <a href="mailto:jason.greene@jboss.org">Jason T. Greene</a>
- * @since 19-Oct-2005
- */
-public abstract class JSR109MetaDataBuilder extends MetaDataBuilder
-{
- // provide logging
- final Logger log = Logger.getLogger(JSR109MetaDataBuilder.class);
-
- private AddressingConstants ADDR = new AddressingConstantsImpl();
-
- protected QName lookupSchemaType(WSDLInterfaceOperation operation, QName element)
- {
- WSDLDefinitions wsdlDefinitions = operation.getWsdlInterface().getWsdlDefinitions();
- WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- return wsdlTypes.getXMLType(element);
- }
-
- protected void setupTypesMetaData(ServiceMetaData serviceMetaData)
- {
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping();
- TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
-
- // Copy the schema locations to the types meta data
- if (wsdlDefinitions != null)
- {
- WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- typesMetaData.setSchemaModel(WSDLUtils.getSchemaModel(wsdlTypes));
- }
-
- // Copy the type mappings to the types meta data
- if (javaWsdlMapping != null)
- {
- for (JavaXmlTypeMapping xmlTypeMapping : javaWsdlMapping.getJavaXmlTypeMappings())
- {
- String javaTypeName = xmlTypeMapping.getJavaType();
- String qnameScope = xmlTypeMapping.getQnameScope();
-
- QName xmlType = xmlTypeMapping.getRootTypeQName();
- QName anonymousXMLType = xmlTypeMapping.getAnonymousTypeQName();
- if (xmlType == null && anonymousXMLType != null)
- xmlType = anonymousXMLType;
-
- String nsURI = xmlType.getNamespaceURI();
- if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false)
- {
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
- tmMetaData.setQNameScope(qnameScope);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
-
- for (ExceptionMapping exceptionMapping : javaWsdlMapping.getExceptionMappings())
- {
- QName xmlType = exceptionMapping.getWsdlMessage();
- String javaTypeName = exceptionMapping.getExceptionType();
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
- }
-
- protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint wsdlEndpoint, ServiceEndpointInterfaceMapping seiMapping)
- {
- WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getInterface().getWsdlDefinitions();
-
- // For every WSDL interface operation build the OperationMetaData
- WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
- for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
- {
- String opName = wsdlOperation.getName().toString();
- QName opQName = wsdlOperation.getQName();
-
- // Set java method name
- String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
- ServiceEndpointMethodMapping seiMethodMapping = null;
- if (seiMapping != null)
- {
- epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
-
- seiMethodMapping = seiMapping.getServiceEndpointMethodMappingByWsdlOperation(opName);
- if (seiMethodMapping == null)
- throw new WSException("Cannot obtain method mapping for: " + opName);
-
- javaName = seiMethodMapping.getJavaMethodName();
- }
-
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName, javaName);
- epMetaData.addOperation(opMetaData);
-
- // Set the operation style
- String style = wsdlOperation.getStyle();
- epMetaData.setStyle((Constants.URI_STYLE_IRI.equals(style) ? Style.DOCUMENT : Style.RPC));
-
- // Set the operation MEP
- if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
- opMetaData.setOneWayOperation(true);
-
- // Set the operation SOAPAction
- WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
- WSDLBindingOperation wsdlBindingOperation = wsdlBinding.getOperationByRef(opQName);
- if (wsdlBindingOperation != null)
- opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
-
- // Get the type mapping for the encoding style
- String encStyle = epMetaData.getEncodingStyle().toURI();
- TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
- TypeMappingImpl typeMapping = (TypeMappingImpl)tmRegistry.getTypeMapping(encStyle);
-
- // Build the parameter meta data
- if (opMetaData.getStyle() == Style.RPC)
- {
- buildParameterMetaDataRpc(opMetaData, wsdlOperation, seiMethodMapping, typeMapping);
- }
- else
- {
- buildParameterMetaDataDoc(opMetaData, wsdlOperation, seiMethodMapping, typeMapping);
- }
-
- // Build operation faults
- buildFaultMetaData(opMetaData, wsdlOperation);
-
- // process further operation extensions
- processOpMetaExtensions(opMetaData, wsdlOperation);
- }
- }
-
- private ParameterMetaData buildInputParameter(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, String partName, QName xmlName, QName xmlType, int pos)
- {
- WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName);
- if (item != null)
- pos = item.getPosition();
-
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping paramMapping = seiMethodMapping.getMethodParamPartsMappingByPartName(partName);
- if (paramMapping == null)
- throw new WSException("Cannot obtain method parameter mapping for message part '" + partName + "' in wsdl operation: "
- + seiMethodMapping.getWsdlOperation());
-
- javaTypeName = paramMapping.getParamType();
- pos = paramMapping.getParamPosition();
- }
-
- JavaWsdlMapping javaWsdlMapping = opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping();
- if (javaTypeName == null && javaWsdlMapping != null)
- {
- String packageName = javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI());
- if (packageName != null)
- {
- javaTypeName = packageName + "." + xmlType.getLocalPart();
- log.warn("Guess java type from package mapping: [xmlType=" + xmlType + ",javaType=" + javaTypeName + "]");
- }
- }
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java type mapping for: " + xmlType);
-
- ParameterMetaData inMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- inMetaData.setPartName(partName);
- inMetaData.setIndex(pos);
- opMetaData.addParameter(inMetaData);
-
- TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- // In arrays of user types, wscompile does not generate a mapping in jaxrpc-mapping.xml
- if (typesMetaData.getTypeMappingByXMLType(xmlType) == null)
- {
- String nsURI = xmlType.getNamespaceURI();
- if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false)
- {
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
-
- return inMetaData;
- }
-
- private ParameterMetaData buildOutputParameter(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, int pos, String partName, QName xmlName, QName xmlType, TypeMappingImpl typeMapping)
- {
- // Default is first listed output
- boolean hasReturnMapping = opMetaData.getReturnParameter() == null;
-
- WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName);
- if (item != null)
- {
- hasReturnMapping = item.getDirection() == Direction.RETURN;
- pos = item.getPosition();
- }
-
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping paramMapping = seiMethodMapping.getMethodParamPartsMappingByPartName(partName);
- if (paramMapping != null)
- {
- javaTypeName = paramMapping.getParamType();
- pos = paramMapping.getParamPosition();
- hasReturnMapping = false;
- }
- else
- {
- WsdlReturnValueMapping returnMapping = seiMethodMapping.getWsdlReturnValueMapping();
- String mappingPart = returnMapping.getWsdlMessagePartName();
- if (returnMapping != null && mappingPart != null && partName.equals(mappingPart));
- {
- javaTypeName = returnMapping.getMethodReturnValue();
- hasReturnMapping = true;
- }
- }
- }
-
- JavaWsdlMapping javaWsdlMapping = opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping();
- if (javaTypeName == null && javaWsdlMapping != null)
- {
- String packageName = javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI());
- if (packageName != null)
- {
- javaTypeName = packageName + "." + xmlType.getLocalPart();
- log.warn("Guess java type from package mapping: [xmlType=" + xmlType + ",javaType=" + javaTypeName + "]");
- }
- }
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java type mapping for: " + xmlType);
-
- ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- outMetaData.setPartName(partName);
-
- if (hasReturnMapping)
- {
- opMetaData.setReturnParameter(outMetaData);
- }
- else
- {
- outMetaData.setIndex(pos);
- outMetaData.setMode(ParameterMode.OUT);
- opMetaData.addParameter(outMetaData);
- }
-
- TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- // In arrays of user types, wscompile does not generate a mapping in jaxrpc-mapping.xml
- if (typesMetaData.getTypeMappingByXMLType(xmlType) == null)
- {
- String nsURI = xmlType.getNamespaceURI();
- if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false)
- {
- TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
- typesMetaData.addTypeMapping(tmMetaData);
- }
- }
-
- return outMetaData;
- }
-
- private int processBindingParameters(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
- {
- WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0];
- for (WSDLSOAPHeader header : bindingInput.getSoapHeaders())
- {
- QName xmlName = header.getElement();
- QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
- String partName = header.getPartName();
-
- ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
- pmd.setInHeader(true);
- }
-
- for (WSDLMIMEPart mimePart : bindingInput.getMimeParts())
- {
- String partName = mimePart.getPartName();
- QName xmlName = new QName(partName);
- QName xmlType = mimePart.getXmlType();
-
- ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
- pmd.setSwA(true);
- pmd.setMimeTypes(mimePart.getMimeTypes());
- }
-
- return wsdlPosition;
- }
-
- private int processBindingOutputParameters(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
- {
- WSDLBindingOperationOutput bindingOutput = bindingOperation.getOutputs()[0];
- for (WSDLSOAPHeader header : bindingOutput.getSoapHeaders())
- {
- String partName = header.getPartName();
- QName xmlName = header.getElement();
-
- ParameterMetaData outMetaData = opMetaData.getParameter(xmlName);
- if (outMetaData != null)
- {
- outMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
-
- ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
- pmd.setInHeader(true);
-
- if (opMetaData.getReturnParameter() != pmd)
- wsdlPosition++;
- }
- }
-
- for (WSDLMIMEPart mimePart : bindingOutput.getMimeParts())
- {
- String partName = mimePart.getPartName();
- QName xmlName = new QName(partName);
-
- ParameterMetaData outMetaData = opMetaData.getParameter(xmlName);
- if (outMetaData != null)
- {
- outMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlType = mimePart.getXmlType();
-
- ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
- pmd.setSwA(true);
- pmd.setMimeTypes(mimePart.getMimeTypes());
-
- if (opMetaData.getReturnParameter() != pmd)
- wsdlPosition++;
- }
- }
-
- return wsdlPosition;
- }
-
- /* SOAP-ENC:Array
- *
- * FIXME: This hack should be removed as soon as we can reliably get the
- * soapenc:arrayType from wsdl + schema.
- */
- private void setupSOAPArrayParameter(ParameterMetaData paramMetaData)
- {
- Use use = paramMetaData.getOperationMetaData().getUse();
- String xmlTypeLocalPart = paramMetaData.getXmlType().getLocalPart();
- if (use == Use.ENCODED && xmlTypeLocalPart.indexOf("ArrayOf") >= 0)
- {
- paramMetaData.setSOAPArrayParam(true);
- try
- {
- String javaTypeName = paramMetaData.getJavaTypeName();
- // This approach determins the array component type from the javaTypeName.
- // It will not work for user defined types, nor will the array dimension be
- // initialized properly. Ideally the array parameter meta data should be initialized
- // from the XSModel or wherever it is defined in WSDL.
- Class javaType = JavaUtils.loadJavaType(javaTypeName);
- Class compJavaType = javaType.getComponentType();
-
- if (xmlTypeLocalPart.indexOf("ArrayOfArrayOf") >= 0)
- compJavaType = compJavaType.getComponentType();
-
- QName compXMLType = new LiteralTypeMapping().getXMLType(compJavaType);
- paramMetaData.setSOAPArrayCompType(compXMLType);
- }
- catch (ClassNotFoundException e)
- {
- // ignore that user defined types cannot be loaded yet
- }
- }
- }
-
- private void setupXOPAttachmentParameter(WSDLInterfaceOperation operation, ParameterMetaData paramMetaData)
- {
- QName xmlType = paramMetaData.getXmlType();
-
- // An XOP parameter is detected if it is a complex type that derives from xsd:base64Binary
- WSDLTypes wsdlTypes = operation.getWsdlInterface().getWsdlDefinitions().getWsdlTypes();
- JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlTypes);
- String localPart = xmlType.getLocalPart() != null ? xmlType.getLocalPart() : "";
- String ns = xmlType.getNamespaceURI() != null ? xmlType.getNamespaceURI() : "";
- XSTypeDefinition xsType = schemaModel.getTypeDefinition(localPart, ns);
- XOPScanner scanner = new XOPScanner();
- if(scanner.findXOPTypeDef(xsType)!=null | (localPart.equals("base64Binary")&&ns.equals(Constants.NS_SCHEMA_XSD)))
- {
- // FIXME: read the xmime:contentType from the element declaration
- // See SchemaUtils#findXOPTypeDef(XSTypeDefinition typeDef) for details
-
- /*
- FIXME: the classloader is not set yet
- paramMetaData.setXopContentType(
- MimeUtils.resolveMimeType(paramMetaData.getJavaType())
- );
- */
-
- paramMetaData.setXOP(true);
-
- }
- }
-
- /*
- * Perhaps the JAX-RPC mapping model should be hash based. For now we optimize just this case.
- */
- private Map<String, String> createVariableMappingMap(VariableMapping[] mappings)
- {
- HashMap<String, String> map = new HashMap<String, String>();
- if (mappings != null)
- for (VariableMapping mapping : mappings)
- map.put(mapping.getXmlElementName(), mapping.getJavaVariableName());
-
- return map;
- }
-
- private void buildParameterMetaDataRpc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
- TypeMappingImpl typeMapping)
- {
- log.trace("buildParameterMetaDataRpc: " + opMetaData.getQName());
-
- WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation();
- if (bindingOperation == null)
- throw new WSException("Could not locate binding operation for:" + opMetaData.getQName());
-
- // RPC has one input
- WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
- int wsdlPosition = 0;
- for (WSDLRPCPart part : input.getChildParts())
- {
- QName xmlType = part.getType();
- String partName = part.getName();
- QName xmlName = new QName(partName);
-
- ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
-
- setupXOPAttachmentParameter(wsdlOperation, pmd);
- setupSOAPArrayParameter(pmd);
- }
-
- wsdlPosition = processBindingParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
-
- WSDLInterfaceOperationOutput[] outputs = wsdlOperation.getOutputs();
- if (outputs.length > 0)
- {
- WSDLInterfaceOperationOutput output = outputs[0];
- for (WSDLRPCPart part : output.getChildParts())
- {
- String partName = part.getName();
-
- ParameterMetaData outMetaData = opMetaData.getParameter(new QName(partName));
- if (outMetaData != null)
- {
- outMetaData.setMode(ParameterMode.INOUT);
- }
- else
- {
- QName xmlName = new QName(partName);
- QName xmlType = part.getType();
-
- ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
- if (opMetaData.getReturnParameter() != pmd)
- wsdlPosition++;
-
- setupXOPAttachmentParameter(wsdlOperation, pmd);
- setupSOAPArrayParameter(pmd);
- }
- }
-
- processBindingOutputParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
- }
- else if (wsdlOperation.getPattern() != Constants.WSDL20_PATTERN_IN_ONLY)
- {
- throw new WSException("RPC style was missing an output, and was not an IN-ONLY MEP.");
- }
- }
-
- private int processDocElement(OperationMetaData operation, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, List<WrappedParameter> wrappedParameters, List<WrappedParameter> wrappedResponseParameters)
- {
- WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
- int wsdlPosition;
-
- QName xmlName = input.getElement();
- QName xmlType = input.getXMLType();
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- TypesMetaData typesMetaData = operation.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- TypeMappingMetaData typeMetaData = typesMetaData.getTypeMappingByXMLType(xmlType);
- if (typeMetaData != null)
- javaTypeName = typeMetaData.getJavaTypeName();
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java type mapping for: " + xmlType);
-
- // Check if we need to wrap the parameters
- boolean isWrapped = isWrapped(seiMethodMapping, javaTypeName);
- operation.getEndpointMetaData().setParameterStyle(isWrapped ? ParameterStyle.WRAPPED : ParameterStyle.BARE);
-
- ParameterMetaData inMetaData = new ParameterMetaData(operation, xmlName, xmlType, javaTypeName);
- operation.addParameter(inMetaData);
-
-
- // Set the variable names
- if (inMetaData.getOperationMetaData().isDocumentWrapped())
- {
- if (seiMethodMapping == null)
- throw new IllegalArgumentException("Cannot wrap parameters without SEI method mapping");
-
- ServiceEndpointInterfaceMapping seiMapping = seiMethodMapping.getServiceEndpointInterfaceMapping();
- JavaXmlTypeMapping javaXmlTypeMapping = seiMapping.getJavaWsdlMapping().getTypeMappingForQName(xmlType);
- if (javaXmlTypeMapping == null)
- throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType);
-
-
- Map<String, String> variableMap = createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
- for (MethodParamPartsMapping partMapping : seiMethodMapping.getMethodParamPartsMappings())
- {
- WsdlMessageMapping wsdlMessageMapping = partMapping.getWsdlMessageMapping();
- if (wsdlMessageMapping == null)
- throw new IllegalArgumentException("wsdl-message-message mapping required for document/literal wrapped");
-
- String elementName = wsdlMessageMapping.getWsdlMessagePartName();
- String variable = variableMap.get(wsdlMessageMapping.getWsdlMessagePartName());
- if (variable == null)
- throw new IllegalArgumentException("Could not determine variable name for element: " + elementName);
-
- WrappedParameter wrapped = new WrappedParameter(new QName(elementName), partMapping.getParamType(), variable,
- partMapping.getParamPosition());
-
-
- String parameterMode = wsdlMessageMapping.getParameterMode();
- if (parameterMode == null || parameterMode.length() < 2)
- throw new IllegalArgumentException("Invalid parameter mode for element: " + elementName);
-
- if (! "OUT".equals(parameterMode))
- wrappedParameters.add(wrapped);
- if (! "IN".equals(parameterMode))
- wrappedResponseParameters.add(wrapped);
- }
- inMetaData.setWrappedParameters(wrappedParameters);
- wsdlPosition = wrappedParameters.size();
- }
- else
- {
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping part = seiMethodMapping.getMethodParamPartsMappingByPartName(input.getPartName());
- if (part != null)
- {
- inMetaData.setJavaTypeName(part.getParamType());
- inMetaData.setIndex(part.getParamPosition());
- }
- }
-
- setupXOPAttachmentParameter(wsdlOperation, inMetaData);
- wsdlPosition = 1;
- }
-
- return wsdlPosition;
- }
-
- private boolean isWrapped(ServiceEndpointMethodMapping seiMethodMapping, String javaTypeName)
- {
- boolean isWrapParameters = (seiMethodMapping != null ? seiMethodMapping.isWrappedElement() : false);
- log.trace("isWrapParameters based on wrapped-element: " + isWrapParameters);
- if (isWrapParameters == false && seiMethodMapping != null)
- {
-
- MethodParamPartsMapping[] partsMappings = seiMethodMapping.getMethodParamPartsMappings();
- if (partsMappings.length > 0)
- {
- boolean matchingPartFound = false;
- for (MethodParamPartsMapping partsMapping : partsMappings)
- {
- String paramTypeName = partsMapping.getParamType();
- if (paramTypeName.equals(javaTypeName))
- {
- matchingPartFound = true;
- break;
- }
- else
- {
- // Check assignability,
- // JavaUtils.isAssignableFrom("org.w3c.dom.Element",
- // "javax.xml.soap.SOAPElement")
- try
- {
- Class paramType = JavaUtils.loadJavaType(paramTypeName);
- Class javaType = JavaUtils.loadJavaType(javaTypeName);
-
- // If it is assignable the explict mapping takes presedence
- // and we don't wrap
- if (JavaUtils.isAssignableFrom(javaType, paramType))
- {
- // javaTypeName = paramTypeName;
- matchingPartFound = true;
- break;
- }
- }
- catch (ClassNotFoundException e)
- {
- // Ignore. For simple types this should work, others should
- // be lexically equal
- // if it is not wrapped.
- }
- }
- }
- // Do we really want to continue to handle invalid mappings?
- isWrapParameters = (matchingPartFound == false);
- log.trace("isWrapParameters based on matching parts: " + isWrapParameters);
- }
- }
- return isWrapParameters;
- }
-
- private int processOutputDocElement(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation,
- ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, List<WrappedParameter> wrappedResponseParameters,
- int wsdlPosition)
- {
- WSDLInterfaceOperationOutput opOutput = wsdlOperation.getOutputs()[0];
- QName xmlName = opOutput.getElement();
- QName xmlType = opOutput.getXMLType();
-
- String javaTypeName = typeMapping.getJavaTypeName(xmlType);
-
- TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- if (typesMetaData.getTypeMappingByXMLType(xmlType) != null)
- javaTypeName = typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName();
-
- if (javaTypeName == null)
- throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType);
-
- ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
-
- boolean hasReturnMapping = true;
- if (opMetaData.isDocumentWrapped())
- {
- if (seiMethodMapping == null)
- throw new IllegalArgumentException("Cannot wrap parameters without SEI method mapping");
-
- WsdlReturnValueMapping returnValueMapping = seiMethodMapping.getWsdlReturnValueMapping();
- if (returnValueMapping != null)
- {
- ServiceEndpointInterfaceMapping seiMapping = seiMethodMapping.getServiceEndpointInterfaceMapping();
- JavaWsdlMapping javaWsdlMapping = seiMapping.getJavaWsdlMapping();
- JavaXmlTypeMapping javaXmlTypeMapping = javaWsdlMapping.getTypeMappingForQName(xmlType);
- if (javaXmlTypeMapping == null)
- throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType);
-
- Map<String, String> map = createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
- String elementName = returnValueMapping.getWsdlMessagePartName();
- String variable = map.get(elementName);
- if (variable == null)
- throw new IllegalArgumentException("Could not determine variable name for element: " + elementName);
-
- String wrappedType = returnValueMapping.getMethodReturnValue();
- QName element = new QName(elementName);
- WrappedParameter wrappedParameter = new WrappedParameter(element, wrappedType, variable, WrappedParameter.RETURN);
- wrappedResponseParameters.add(0, wrappedParameter);
- }
-
- outMetaData.setWrappedParameters(wrappedResponseParameters);
- }
- else
- {
- if (seiMethodMapping != null)
- {
- MethodParamPartsMapping part = seiMethodMapping.getMethodParamPartsMappingByPartName(opOutput.getPartName());
- String mode = null;
- if (part != null)
- {
- WsdlMessageMapping wsdlMessageMapping = part.getWsdlMessageMapping();
- mode = wsdlMessageMapping.getParameterMode();
- }
- if ("INOUT".equals(mode))
- {
- ParameterMetaData inMetaData = opMetaData.getParameter(xmlName);
- if (inMetaData != null)
- {
- inMetaData.setMode(ParameterMode.INOUT);
- return wsdlPosition;
- }
-
- throw new WSException("Could not update IN parameter to be INOUT, as indicated in the mapping: " + opOutput.getPartName());
- }
- // It's potentialy possible that an input parameter could exist with the same part name
- else if ("OUT".equals(mode))
- {
- hasReturnMapping = false;
- javaTypeName = part.getParamType();
- outMetaData.setIndex(part.getParamPosition());
- outMetaData.setJavaTypeName(javaTypeName);
- }
- else
- {
- WsdlReturnValueMapping returnValueMapping = seiMethodMapping.getWsdlReturnValueMapping();
- if (returnValueMapping != null)
- {
- javaTypeName = returnValueMapping.getMethodReturnValue();
- outMetaData.setJavaTypeName(javaTypeName);
- }
- }
- }
-
- setupXOPAttachmentParameter(wsdlOperation, outMetaData);
- }
-
- if (hasReturnMapping)
- {
- opMetaData.setReturnParameter(outMetaData);
- }
- else
- {
- opMetaData.addParameter(outMetaData);
- outMetaData.setMode(ParameterMode.OUT);
- wsdlPosition++;
- }
-
- return wsdlPosition;
- }
-
- private void buildParameterMetaDataDoc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
- TypeMappingImpl typeMapping)
- {
- log.trace("buildParameterMetaDataDoc: " + opMetaData.getQName());
-
- WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation();
- if (bindingOperation == null)
- throw new WSException("Could not locate binding operation for:" + bindingOperation);
-
- List<WrappedParameter> wrappedParameters = new ArrayList<WrappedParameter>();
- List<WrappedParameter> wrappedResponseParameters = new ArrayList<WrappedParameter>();
-
- int wsdlPosition = 0;
- // WS-I BP 1.0 allows document/literal bare to have zero message parts
- if (wsdlOperation.getInputs().length > 0)
- {
- wsdlPosition = processDocElement(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, wrappedParameters, wrappedResponseParameters);
- wsdlPosition = processBindingParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
- }
- else
- {
- // Set the default to bare in case there isn't an input object, revisit this
- opMetaData.getEndpointMetaData().setParameterStyle(ParameterStyle.BARE);
- }
-
- if (wsdlOperation.getOutputs().length > 0)
- {
- wsdlPosition = processOutputDocElement(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, wrappedResponseParameters, wsdlPosition);
- wsdlPosition = processBindingOutputParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
- }
- }
-
- /**
- * Build default action according to the pattern described in
- * http://www.w3.org/Submission/2004/SUBM-ws-addressing-20040810/
- * Section 3.3.2 'Default Action Pattern'<br>
- * [target namespace]/[port type name]/[input|output name]
- *
- * @param wsdlOperation
- * @return action value
- */
- private String buildWsaActionValue(WSDLInterfaceOperation wsdlOperation)
- {
- WSDLProperty wsaAction = wsdlOperation.getProperty(Constants.WSDL_ATTRIBUTE_WSA_ACTION.toString());
- String actionValue = null;
-
- if (null == wsaAction)
- {
-
- String tns = wsdlOperation.getQName().getNamespaceURI();
- String portTypeName = wsdlOperation.getQName().getLocalPart();
- WSDLProperty messageName = wsdlOperation.getProperty("http://www.jboss.org/jbossws/messagename/in");
-
- actionValue = new String(tns + "/" + portTypeName + "/" + messageName.getValue());
- }
- else
- {
- actionValue = wsaAction.getValue();
- }
-
- return actionValue;
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR109ServerMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,280 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-// $Id$
-package org.jboss.ws.deployment;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-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.EndpointMetaData.Type;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.config.jaxrpc.WSEndpointConfigJAXRPC;
-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.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-import org.jboss.ws.metadata.jsr109.PortComponentMetaData;
-import org.jboss.ws.metadata.jsr109.WebserviceDescriptionMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * A server side meta data builder that is based on webservices.xml.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public class JSR109ServerMetaDataBuilder extends JSR109MetaDataBuilder
-{
- // provide logging
- final Logger log = Logger.getLogger(JSR109ServerMetaDataBuilder.class);
-
- /**
- * Build from webservices.xml
- */
- public UnifiedMetaData buildMetaData(JSR109Deployment udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
- try
- {
- // For every webservice-description build the ServiceMetaData
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(classLoader);
-
- WebserviceDescriptionMetaData[] wsDescriptionArr = udi.getWebservicesMetaData().getWebserviceDescriptions();
- for (WebserviceDescriptionMetaData wsdMetaData : wsDescriptionArr)
- {
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, null);
- serviceMetaData.setWebserviceDescriptionName(wsdMetaData.getWebserviceDescriptionName());
- wsMetaData.addService(serviceMetaData);
-
- // Unmarshall the WSDL
- serviceMetaData.setWsdlFile(wsdMetaData.getWsdlFile());
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
-
- // Unmarshall the jaxrpc-mapping.xml
- serviceMetaData.setJaxrpcMappingFile(wsdMetaData.getJaxrpcMappingFile());
- JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping();
- if (javaWsdlMapping == null)
- throw new WSException("jaxrpc-mapping-file not configured from webservices.xml");
-
- // Build type mapping meta data
- setupTypesMetaData(serviceMetaData);
-
- // Assign the WS-Security configuration,
- WSSecurityConfiguration securityConfiguration = getWsSecurityConfiguration(udi);
- serviceMetaData.setSecurityConfiguration(securityConfiguration);
-
- // For every port-component build the EndpointMetaData
- PortComponentMetaData[] pcMetaDataArr = wsdMetaData.getPortComponents();
- for (PortComponentMetaData pcMetaData : pcMetaDataArr)
- {
- QName portName = pcMetaData.getWsdlPort();
-
- // JBWS-722
- // <wsdl-port> in webservices.xml should be qualified
- if (portName.getNamespaceURI().length() == 0)
- {
- String nsURI = wsdlDefinitions.getTargetNamespace();
- portName = new QName(nsURI, portName.getLocalPart());
- log.warn("Adding wsdl targetNamespace to: " + portName);
- pcMetaData.setWsdlPort(portName);
- }
-
- WSDLEndpoint wsdlEndpoint = getWsdlEndpoint(wsdlDefinitions, portName);
- if (wsdlEndpoint == null)
- throw new WSException("Cannot find port in wsdl: " + portName);
-
- // set service name
- serviceMetaData.setServiceName(wsdlEndpoint.getWsdlService().getQName());
- QName interfaceQName = wsdlEndpoint.getInterface().getQName();
-
- ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC);
- sepMetaData.setPortComponentName(pcMetaData.getPortComponentName());
- String linkName = pcMetaData.getEjbLink() != null ? pcMetaData.getEjbLink() : pcMetaData.getServletLink();
- sepMetaData.setLinkName(linkName);
- serviceMetaData.addEndpoint(sepMetaData);
-
- initEndpointEncodingStyle(sepMetaData);
-
- initEndpointAddress(udi, sepMetaData, linkName);
-
- if (udi.metaData instanceof UnifiedApplicationMetaData)
- {
- UnifiedApplicationMetaData apMetaData = (UnifiedApplicationMetaData)udi.metaData;
- wsMetaData.setSecurityDomain(apMetaData.getSecurityDomain());
-
- // Copy the wsdl publish location from jboss.xml
- String wsdName = serviceMetaData.getWebserviceDescriptionName();
- String wsdlPublishLocation = apMetaData.getWsdlPublishLocationByName(wsdName);
- serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
-
- // Copy <port-component> meta data
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)apMetaData.getBeanByEjbName(linkName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain UnifiedBeanMetaData for: " + linkName);
-
- String configName = apMetaData.getConfigName();
- if (configName != null)
- sepMetaData.setConfigName(configName);
-
- String configFile = apMetaData.getConfigFile();
- if (configFile != null)
- sepMetaData.setConfigFile(configFile);
-
- UnifiedEjbPortComponentMetaData bpcMetaData = beanMetaData.getPortComponent();
- if (bpcMetaData != null)
- {
- if (bpcMetaData.getAuthMethod() != null)
- {
- String authMethod = bpcMetaData.getAuthMethod();
- sepMetaData.setAuthMethod(authMethod);
- }
- if (bpcMetaData.getTransportGuarantee() != null)
- {
- String transportGuarantee = bpcMetaData.getTransportGuarantee();
- sepMetaData.setTransportGuarantee(transportGuarantee);
- }
-
- sepMetaData.setURLPattern(bpcMetaData.getURLPattern());
- }
- }
- else if (udi.metaData instanceof UnifiedWebMetaData)
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- wsMetaData.setSecurityDomain(webMetaData.getSecurityDomain());
-
- String targetBean = webMetaData.getServletClassNames().get(linkName);
- sepMetaData.setServiceEndpointImplName(targetBean);
-
- // Copy the wsdl publish location from jboss-web.xml
- String wsdName = serviceMetaData.getWebserviceDescriptionName();
- String wsdlPublishLocation = webMetaData.getWsdlPublishLocationByName(wsdName);
- serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
-
- String configName = webMetaData.getConfigName();
- if (configName != null)
- sepMetaData.setConfigName(configName);
-
- String configFile = webMetaData.getConfigFile();
- if (configFile != null)
- sepMetaData.setConfigFile(configFile);
-
- initTransportGuaranteeJSE(udi, sepMetaData, linkName);
- }
-
- // init service endpoint id
- ObjectName sepID = getServiceEndpointID(udi, sepMetaData);
- sepMetaData.setServiceEndpointID(sepID);
-
- replaceAddressLocation(sepMetaData);
-
- String seiName = pcMetaData.getServiceEndpointInterface();
- sepMetaData.setServiceEndpointInterfaceName(seiName);
-
- ServiceEndpointInterfaceMapping seiMapping = javaWsdlMapping.getServiceEndpointInterfaceMapping(seiName);
- if (seiMapping == null)
- log.warn("Cannot obtain SEI mapping for: " + seiName);
-
- // process endpoint meta extension
- processEndpointMetaDataExtensions(sepMetaData, wsdlDefinitions);
-
- // Setup the endpoint operations
- setupOperationsFromWSDL(sepMetaData, wsdlEndpoint, seiMapping);
-
- // Add pre handlers
- WSEndpointConfigJAXRPC jaxrpcConfig = (WSEndpointConfigJAXRPC)sepMetaData.getEndpointConfig();
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.PRE));
-
- // Setup the endpoint handlers
- for (UnifiedHandlerMetaData uhmd : pcMetaData.getHandlers())
- {
- Set<String> portNames = uhmd.getPortNames();
- if (portNames.size() == 0 || portNames.contains(portName.getLocalPart()))
- {
- sepMetaData.addHandler(uhmd.getHandlerMetaDataJAXRPC(sepMetaData, HandlerType.ENDPOINT));
- }
- }
-
- // Add post handlers
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.POST));
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-
- private WSDLEndpoint getWsdlEndpoint(WSDLDefinitions wsdlDefinitions, QName portName)
- {
- WSDLEndpoint wsdlEndpoint = null;
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- WSDLEndpoint auxEndpoint = wsdlService.getEndpoint(portName);
- if (auxEndpoint != null)
- {
- wsdlEndpoint = auxEndpoint;
- break;
- }
- }
- return wsdlEndpoint;
- }
-
- /**
- * Read the transport guarantee from web.xml
- */
- protected void initTransportGuaranteeJSE(UnifiedDeploymentInfo udi, EndpointMetaData epMetaData, String servletLink) throws IOException
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- epMetaData.setTransportGuarantee(getTransportGuarantee(webMetaData, servletLink));
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,89 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-// $Id$
-package org.jboss.ws.deployment;
-
-import javax.jws.HandlerChain;
-import javax.jws.soap.SOAPBinding;
-import javax.xml.ws.BindingType;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.config.jaxws.WSClientConfigJAXWS;
-
-/**
- * A client side meta data builder that is based on JSR-181 annotations
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 9-Aug-2006
- */
-public class JSR181ClientMetaDataBuilder extends JSR181MetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JSR181ClientMetaDataBuilder.class);
-
- public void rebuildEndpointMetaData(EndpointMetaData epMetaData, Class wsClass)
- {
- log.debug("START: rebuildMetaData");
-
- // Clear the java types, etc.
- resetMetaDataBuilder(epMetaData.getClassLoader());
-
- // Nuke parameterStyle
- epMetaData.setParameterStyle(null);
-
- // Process an optional @BindingType annotation
- if (wsClass.isAnnotationPresent(BindingType.class))
- processBindingType(epMetaData, wsClass);
-
- // Process @SOAPBinding
- if (wsClass.isAnnotationPresent(SOAPBinding.class))
- processSOAPBinding(epMetaData, wsClass);
-
- // Clear handlers
- epMetaData.clearHandlers();
-
- // Add pre handlers
- WSClientConfigJAXWS jaxwsConfig = (WSClientConfigJAXWS)epMetaData.getEndpointConfig();
- epMetaData.addHandlers(jaxwsConfig.getHandlers(epMetaData, HandlerType.PRE));
-
- // Process an optional @HandlerChain annotation
- if (wsClass.isAnnotationPresent(HandlerChain.class))
- processHandlerChain(epMetaData, wsClass);
-
- // Add post handlers
- epMetaData.addHandlers(jaxwsConfig.getHandlers(epMetaData, HandlerType.POST));
-
- // Process @WebMethod
- processWebMethods(epMetaData, wsClass, true);
-
- // Initialize types
- createJAXBContext(epMetaData);
- populateXmlTypes(epMetaData);
-
- // Eager initialization
- epMetaData.eagerInitialize();
-
- log.debug("END: rebuildMetaData\n" + epMetaData.getServiceMetaData());
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR181Deployment.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181Deployment.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181Deployment.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-
-// $Id: UnifiedDeploymentInfo.java 312 2006-05-11 10:49:22Z thomas.diesler(a)jboss.com $
-
-/**
- * The container independent deployment info.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 05-May-2006
- */
-public class JSR181Deployment extends UnifiedDeploymentInfo
-{
-
- public JSR181Deployment(DeploymentType type)
- {
- super(type);
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,1008 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-// $Id$
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Writer;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.jws.HandlerChain;
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-import javax.jws.soap.SOAPMessageHandlers;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.management.ObjectName;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-import javax.xml.ws.WebFault;
-import javax.xml.ws.addressing.AddressingProperties;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.jaxrpc.Use;
-import org.jboss.ws.jaxws.DynamicWrapperGenerator;
-import org.jboss.ws.jaxws.WrapperGenerator;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.TypeMappingMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.WrappedParameter;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.acessor.JAXBAccessor;
-import org.jboss.ws.metadata.config.jaxws.WSEndpointConfigJAXWS;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.jsr181.HandlerChainFactory;
-import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
-import org.jboss.ws.metadata.jsr181.HandlerChainsMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
-import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
-import org.jboss.ws.tools.jaxws.WSDLGenerator;
-import org.jboss.ws.utils.HolderUtils;
-import org.jboss.ws.utils.IOUtils;
-import org.jboss.ws.utils.JBossWSEntityResolver;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-import com.sun.xml.bind.api.JAXBRIContext;
-import com.sun.xml.bind.api.TypeReference;
-
-/** An abstract annotation meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
- * @since 15-Oct-2005
- */
-public abstract class JSR181MetaDataBuilder extends AnnotationsMetaDataBuilder
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JSR181MetaDataBuilder.class);
-
- private WrapperGenerator wrapperGenerator;
- private List<Class> javaTypes = new ArrayList<Class>();
- private List<TypeReference> typeRefs = new ArrayList<TypeReference>();
- private JAXBRIContext jaxbCtx;
-
- public JSR181MetaDataBuilder()
- {
- }
-
- protected ServerEndpointMetaData setupEndpointFromAnnotations(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName)
- throws ClassNotFoundException
- {
- WebService anWebService = (WebService)sepClass.getAnnotation(WebService.class);
- if (anWebService == null)
- throw new WSException("Cannot obtain @WebService annotation from: " + sepClass.getName());
-
- try
- {
- Class seiClass = null;
- String seiName = null;
-
- if (anWebService.endpointInterface().length() > 0)
- {
- seiName = anWebService.endpointInterface();
- seiClass = udi.classLoader.loadClass(seiName);
- anWebService = (WebService)seiClass.getAnnotation(WebService.class);
-
- if (anWebService == null)
- throw new WSException("Interface does not have a @WebService annotation: " + seiName);
- }
- else
- {
-
- WebService seiAnnotation = null;
-
- for(Class potentialSEI : sepClass.getInterfaces())
- {
- if(potentialSEI.isAnnotationPresent(WebService.class))
- {
- seiClass = potentialSEI;
- seiName = seiClass.getName();
- seiAnnotation = sepClass.getAnnotation(WebService.class);
- break;
- }
- }
-
- if(seiAnnotation!=null)
- anWebService = seiAnnotation;
- }
-
- // Clear the java types, etc.
- resetMetaDataBuilder(udi.classLoader);
-
- Class wsClass = (seiClass != null ? seiClass : sepClass);
-
- WSDLUtils wsdlUtils = WSDLUtils.getInstance();
-
- String name = anWebService.name();
- if (name.length() == 0)
- name = wsdlUtils.getJustClassName(wsClass);
-
- String serviceName = anWebService.serviceName();
- if (serviceName.length() == 0)
- serviceName = name + "Service";
-
- String targetNS = anWebService.targetNamespace();
- if (targetNS.length() == 0)
- targetNS = wsdlUtils.getTypeNamespace(wsClass);
-
- String portName = anWebService.portName();
- if (portName.length() == 0)
- portName = name + "Port";
-
- ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName));
- wsMetaData.addService(serviceMetaData);
-
- // Setup the ServerEndpointMetaData
- QName portQName = new QName(targetNS, portName);
- QName portTypeQName = new QName(targetNS, name);
- ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portQName, portTypeQName, EndpointMetaData.Type.JAXWS);
- sepMetaData.setLinkName(linkName);
-
- // Assign the WS-Security configuration,
- WSSecurityConfiguration securityConfiguration = getWsSecurityConfiguration(udi);
- serviceMetaData.setSecurityConfiguration(securityConfiguration);
-
- sepMetaData.setServiceEndpointImplName(sepClass.getName());
- sepMetaData.setServiceEndpointInterfaceName(wsClass.getName());
-
- serviceMetaData.addEndpoint(sepMetaData);
-
- // Process an optional @SOAPBinding annotation
- if (wsClass.isAnnotationPresent(SOAPBinding.class))
- processSOAPBinding(sepMetaData, wsClass);
-
- // Process an optional @BindingType annotation
- if (wsClass.isAnnotationPresent(BindingType.class))
- processBindingType(sepMetaData, wsClass);
-
- boolean includeAllMethods = (wsClass == seiClass);
- processWebMethods(sepMetaData, wsClass, includeAllMethods);
-
- // Initialize types
- createJAXBContext(sepMetaData);
- populateXmlTypes(sepMetaData);
-
- // Process or generate WSDL
- String wsdlLocation = anWebService.wsdlLocation();
- processOrGenerateWSDL(wsClass, serviceMetaData, wsdlLocation, sepMetaData);
-
- // Read the generated WSDL and initialize the schema model
- // FIXME - This should be removed
- WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
- JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
-
- // 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.");
-
- // Add pre handlers
- WSEndpointConfigJAXWS jaxrpcConfig = (WSEndpointConfigJAXWS)sepMetaData.getEndpointConfig();
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.PRE));
-
- // Process an optional @HandlerChain annotation
- if (sepClass.isAnnotationPresent(HandlerChain.class))
- processHandlerChain(sepMetaData, sepClass);
- else if (wsClass.isAnnotationPresent(HandlerChain.class))
- processHandlerChain(sepMetaData, wsClass);
-
- // Add post handlers
- sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.POST));
-
- // init service endpoint id
- ObjectName sepID = getServiceEndpointID(udi, sepMetaData);
- sepMetaData.setServiceEndpointID(sepID);
-
- return sepMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-
- protected void resetMetaDataBuilder(ClassLoader loader)
- {
- wrapperGenerator = new DynamicWrapperGenerator(loader);
- javaTypes.clear();
- typeRefs.clear();
- jaxbCtx = null;
- }
-
- protected void createJAXBContext(EndpointMetaData epMetaData)
- {
- try
- {
- String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
- log.debug("JAXBContext [types=" + javaTypes + ",tns=" + targetNS + "]");
- jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs, targetNS, false);
- }
- catch (JAXBException ex)
- {
- throw new IllegalStateException("Cannot build JAXB context", ex);
- }
- }
-
- protected void populateXmlTypes(EndpointMetaData epMetaData)
- {
- for (OperationMetaData operation : epMetaData.getOperations())
- {
- // parameters
- for (ParameterMetaData paramMetaData : operation.getParameters())
- {
- populateXmlType(paramMetaData);
- }
-
- // return value
- ParameterMetaData returnParameter = operation.getReturnParameter();
- if (returnParameter != null)
- populateXmlType(returnParameter);
-
- // faults
- for (FaultMetaData faultMetaData : operation.getFaults())
- {
- populateXmlType(faultMetaData);
- }
- }
- }
-
- private void populateXmlType(ParameterMetaData paramMetaData)
- {
- EndpointMetaData epMetaData = paramMetaData.getOperationMetaData().getEndpointMetaData();
- TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
-
- QName xmlName = paramMetaData.getXmlName();
- QName xmlType = paramMetaData.getXmlType();
- Class javaType = paramMetaData.getJavaType();
- String javaName = paramMetaData.getJavaTypeName();
-
- if (xmlType == null)
- {
- try
- {
- xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
- }
- catch (IllegalArgumentException e)
- {
- throw new IllegalStateException("Cannot obtain xml type for: [xmlName=" + xmlName + ",javaName=" + javaName + "]");
- }
-
- /* Anonymous type.
- *
- * Currently the design of our stack is based on the
- * notion of their always being a unique type. In order to lookup the
- * appropriate (de)serializer you must have a type. So we use a fake
- * name. This is an illegal NCName, so it shouldn't collide.
- */
- if (xmlType == null)
- xmlType = new QName(xmlName.getNamespaceURI(), ">" + xmlName.getLocalPart());
-
- paramMetaData.setXmlType(xmlType);
- }
-
- types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
- }
-
- private void populateXmlType(FaultMetaData faultMetaData)
- {
- EndpointMetaData epMetaData = faultMetaData.getOperationMetaData().getEndpointMetaData();
- TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
-
- QName xmlType = faultMetaData.getXmlType();
- String faultBeanName = faultMetaData.getFaultBeanName();
-
- types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName));
- }
-
- protected void processSOAPBinding(EndpointMetaData epMetaData, Class wsClass)
- {
- SOAPBinding anSoapBinding = (SOAPBinding)wsClass.getAnnotation(SOAPBinding.class);
-
- SOAPBinding.Style attrStyle = anSoapBinding.style();
- Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC : Style.DOCUMENT);
- epMetaData.setStyle(style);
-
- SOAPBinding.Use attrUse = anSoapBinding.use();
- if (attrUse == SOAPBinding.Use.ENCODED)
- throw new WSException("SOAP encoding is not supported for JSR-181 deployments");
-
- epMetaData.setEncodingStyle(Use.LITERAL);
-
- ParameterStyle paramStyle = anSoapBinding.parameterStyle();
- epMetaData.setParameterStyle(paramStyle);
- }
-
- private WebParam getWebParamAnnotation(Method method, int pos)
- {
- for (Annotation annotation : method.getParameterAnnotations()[pos])
- if (annotation instanceof WebParam)
- return (WebParam)annotation;
-
- return null;
- }
-
- protected void processWebMethods(EndpointMetaData epMetaData, Class wsClass, boolean includeAllMethods)
- {
- epMetaData.clearOperations();
-
- // Process an @WebMethod annotations
- int webMethodCount = 0;
- for (Method method : wsClass.getMethods())
- {
- if (includeAllMethods || method.isAnnotationPresent(WebMethod.class))
- {
- processWebMethod(epMetaData, method);
- webMethodCount++;
- }
- }
-
- // @WebService should expose all inherited methods if @WebMethod is never specified
- // http://jira.jboss.org/jira/browse/JBWS-754
- if (webMethodCount == 0)
- {
- Class superClass = wsClass.getSuperclass();
-
- while (superClass != null)
- {
- boolean isJDKClass = superClass.getPackage().getName().startsWith("java");
-
- if(!isJDKClass)
- {
- for (Method method : superClass.getMethods())
- {
- processWebMethod(epMetaData, method);
- webMethodCount++;
- }
-
- superClass = superClass.getSuperclass();
-
- }
- }
- }
-
- if (webMethodCount == 0)
- throw new WSException("At least one @WebMethod annotation is required");
- }
-
- private void processWebMethod(EndpointMetaData epMetaData, Method method)
- {
- String javaName = method.getName();
-
- // skip asnyc methods, they dont need meta data representation
- if(method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
- return;
-
- ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
- TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
- String targetNS = epMetaData.getQName().getNamespaceURI();
-
- // reflection defaults
- String soapAction = "";
- String operationName = method.getName();
-
- // annotation values that override defaults
- if (method.isAnnotationPresent(WebMethod.class))
- {
- WebMethod anWebMethod = method.getAnnotation(WebMethod.class);
- soapAction = anWebMethod.action();
- if (anWebMethod.operationName().length() > 0)
- {
- operationName = anWebMethod.operationName();
- }
- }
-
- OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, operationName), javaName);
- opMetaData.setOneWayOperation(method.isAnnotationPresent(Oneway.class));
- opMetaData.setSOAPAction(soapAction);
- epMetaData.addOperation(opMetaData);
-
- // Build parameter meta data
- Class[] parameterTypes = method.getParameterTypes();
- Type[] genericTypes = method.getGenericParameterTypes();
- Annotation[][] parameterAnnotations = method.getParameterAnnotations();
- ParameterMetaData wrapperParameter = null, wrapperOutputParameter = null;
- List<WrappedParameter> wrappedParameters = null, wrappedOutputParameters = null;
-
- // Force paramter style to wrapped
- if (method.isAnnotationPresent(RequestWrapper.class) || method.isAnnotationPresent(ResponseWrapper.class))
- {
- epMetaData.setParameterStyle(ParameterStyle.WRAPPED);
- }
-
- if (opMetaData.isDocumentWrapped())
- {
- wrapperParameter = createRequestWrapper(opMetaData, method);
- wrappedParameters = new ArrayList<WrappedParameter>(parameterTypes.length);
- wrapperParameter.setWrappedParameters(wrappedParameters);
-
- if (!opMetaData.isOneWay())
- {
- wrapperOutputParameter = createResponseWrapper(opMetaData, method);
- wrappedOutputParameters = new ArrayList<WrappedParameter>(parameterTypes.length + 1);
- wrapperOutputParameter.setWrappedParameters(wrappedOutputParameters);
- }
- }
-
- for (int i = 0; i < parameterTypes.length; i++)
- {
- Class javaType = parameterTypes[i];
- Type genericType = genericTypes[i];
- String javaTypeName = javaType.getName();
- WebParam anWebParam = getWebParamAnnotation(method, i);
- boolean isHeader = anWebParam != null && anWebParam.header();
- boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
- ParameterMode mode = getParameterMode(anWebParam, javaType);
-
- // Assert one-way
- if (opMetaData.isOneWay() && mode != ParameterMode.IN)
- throw new IllegalArgumentException("A one-way operation can not have output parameters [" + "method = " + method.getName() + ", parameter = " + i + "]");
-
- if (HolderUtils.isHolderType(javaType))
- {
- genericType = HolderUtils.getGenericValueType(genericType);
- javaType = JavaUtils.erasure(genericType);
- javaTypeName = javaType.getName();
- }
-
- if (isWrapped)
- {
- QName wrappedElementName = getWebParamName(opMetaData, i, javaType, anWebParam);
- String variable = convertToVariable(wrappedElementName.getLocalPart());
-
- WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName, javaTypeName, variable, i);
- wrappedParameter.setTypeArguments(convertTypeArguments(javaType, genericType));
-
- if (mode != ParameterMode.OUT)
- wrappedParameters.add(wrappedParameter);
- if (mode != ParameterMode.IN)
- {
- wrappedOutputParameters.add(wrappedParameter);
- wrappedParameter.setHolder(true);
- }
- }
- else
- {
- QName xmlName = getWebParamName(opMetaData, i, javaType, anWebParam);
-
- ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, javaTypeName);
- paramMetaData.setInHeader(isHeader);
- paramMetaData.setIndex(i);
- paramMetaData.setMode(mode);
-
- opMetaData.addParameter(paramMetaData);
- javaTypes.add(javaType);
- typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));
- }
- }
-
- // Build result meta data
- Class returnType = method.getReturnType();
- Type genericReturnType = method.getGenericReturnType();
- String returnTypeName = returnType.getName();
- if ((returnType == void.class) == false)
- {
- if (opMetaData.isOneWay())
- throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");
-
- WebResult anWebResult = method.getAnnotation(WebResult.class);
- boolean isHeader = anWebResult != null && anWebResult.header();
- boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
- QName xmlName = getWebResultName(opMetaData, returnType, anWebResult);
-
- if (isWrapped)
- {
- WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
- wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));
-
- // insert at the beginning just for prettiness
- wrappedOutputParameters.add(0, wrapped);
- }
- else
- {
- ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName);
- retMetaData.setInHeader(isHeader);
- opMetaData.setReturnParameter(retMetaData);
-
- javaTypes.add(returnType);
- typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations()));
- }
- }
-
- // Generate wrapper beans
- if (opMetaData.isDocumentWrapped())
- {
- wrapperGenerator.generate(wrapperParameter);
- Class wrapperClass = wrapperParameter.getJavaType();
- javaTypes.add(wrapperClass);
- // In case there is no @XmlRootElement
- typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
- if (!opMetaData.isOneWay())
- {
- wrapperGenerator.generate(wrapperOutputParameter);
- wrapperClass = wrapperOutputParameter.getJavaType();
- javaTypes.add(wrapperClass);
- // In case there is no @XmlRootElement
- typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(), wrapperClass));
- }
- }
-
- // Add faults
- for (Class exClass : method.getExceptionTypes())
- if (!RemoteException.class.isAssignableFrom(exClass))
- addFault(opMetaData, exClass);
-
- // process op meta data extension
- processMetaExtensions(epMetaData, opMetaData);
- }
-
- private ParameterMode getParameterMode(WebParam anWebParam, Class javaType)
- {
- if (anWebParam != null)
- {
- if (anWebParam.mode() == WebParam.Mode.INOUT)
- return ParameterMode.INOUT;
- if (anWebParam.mode() == WebParam.Mode.OUT)
- return ParameterMode.OUT;
- }
-
- return HolderUtils.isHolderType(javaType) ? ParameterMode.INOUT : ParameterMode.IN;
- }
-
- private ParameterMetaData createResponseWrapper(OperationMetaData operation, Method method)
- {
- QName operationQName = operation.getQName();
- QName xmlName = new QName(operationQName.getNamespaceURI(), operationQName.getLocalPart() + "Response");
- QName xmlType = xmlName;
-
- String responseWrapperType = null;
- if (method.isAnnotationPresent(ResponseWrapper.class))
- {
- ResponseWrapper anResWrapper = method.getAnnotation(ResponseWrapper.class);
-
- String localName = anResWrapper.localName().length() > 0 ? anResWrapper.localName() : xmlName.getLocalPart();
- String targetNamespace = anResWrapper.targetNamespace().length() > 0 ? anResWrapper.targetNamespace() : xmlName.getNamespaceURI();
- xmlName = new QName(targetNamespace, localName);
-
- if (anResWrapper.className().length() > 0)
- responseWrapperType = anResWrapper.className();
- }
-
- if (responseWrapperType == null)
- {
- String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) + ".jaxws";
- responseWrapperType = packageName + "." + JavaUtils.capitalize(method.getName()) + "Response";
- }
-
- ParameterMetaData retMetaData = new ParameterMetaData(operation, xmlName, xmlType, responseWrapperType);
- retMetaData.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
- operation.setReturnParameter(retMetaData);
-
- return retMetaData;
- }
-
- private ParameterMetaData createRequestWrapper(OperationMetaData operation, Method method)
- {
- String requestWrapperType = null;
- QName xmlName = operation.getQName();
- QName xmlType = xmlName;
- if (method.isAnnotationPresent(RequestWrapper.class))
- {
- RequestWrapper anReqWrapper = method.getAnnotation(RequestWrapper.class);
-
- String localName = anReqWrapper.localName().length() > 0 ? anReqWrapper.localName() : xmlName.getLocalPart();
- String targetNamespace = anReqWrapper.targetNamespace().length() > 0 ? anReqWrapper.targetNamespace() : xmlName.getNamespaceURI();
- xmlName = new QName(targetNamespace, localName);
-
- if (anReqWrapper.className().length() > 0)
- requestWrapperType = anReqWrapper.className();
- }
-
- // Conformance 3.18, the default value must be the same as the method name
- if (requestWrapperType == null)
- {
- String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) + ".jaxws";
- requestWrapperType = packageName + "." + JavaUtils.capitalize(method.getName());
- }
-
- // JAX-WS p.37 pg.1, the annotation only affects the element name, not the type name
- ParameterMetaData wrapperParameter = new ParameterMetaData(operation, xmlName, xmlType, requestWrapperType);
- wrapperParameter.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
- operation.addParameter(wrapperParameter);
-
- return wrapperParameter;
- }
-
- private String convertToVariable(String localName)
- {
- return JAXBRIContext.mangleNameToVariableName(localName);
- }
-
- /**
- * Process an optional @HandlerChain annotation
- *
- * Location of the handler chain file. The location supports 2 formats.
- *
- * 1. An absolute java.net.URL in externalForm.
- * (ex: http://myhandlers.foo.com/handlerfile1.xml)
- *
- * 2. A relative path from the source file or class file.
- * (ex: bar/handlerfile1.xml)
- */
- protected void processHandlerChain(EndpointMetaData epMetaData, Class wsClass)
- {
- if (wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
- throw new WSException("Cannot combine @HandlerChain with @SOAPMessageHandlers");
-
- HandlerChain anHandlerChain = (HandlerChain)wsClass.getAnnotation(HandlerChain.class);
-
- URL fileURL = null;
- String filename = anHandlerChain.file();
-
- // Try the filename as URL
- try
- {
- fileURL = new URL(filename);
- }
- catch (MalformedURLException ex)
- {
- // ignore
- }
-
- // Try the filename as File
- if (fileURL == null)
- {
- try
- {
- File file = new File(filename);
- if (file.exists())
- fileURL = file.toURL();
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- }
-
- // Try the filename as Resource
- if (fileURL == null)
- {
- fileURL = epMetaData.getClassLoader().getResource(filename);
- }
-
- // Try the filename relative to class
- if (fileURL == null)
- {
- String packagePath = wsClass.getPackage().getName().replace('.', '/');
- fileURL = epMetaData.getClassLoader().getResource(packagePath + "/" + filename);
- }
-
- if (fileURL == null)
- throw new WSException("Cannot resolve handler file '" + filename + "' on " + wsClass.getName());
-
- try
- {
- HandlerChainsMetaData handlerChainsMetaData = null;
- InputStream is = fileURL.openStream();
- try
- {
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setValidation(true);
- unmarshaller.setSchemaValidation(true);
- unmarshaller.setEntityResolver(new JBossWSEntityResolver());
- ObjectModelFactory factory = new HandlerChainFactory();
- handlerChainsMetaData = (HandlerChainsMetaData)unmarshaller.unmarshal(is, factory, null);
- }
- finally
- {
- is.close();
- }
-
- // Setup the endpoint handlers
- for (HandlerChainMetaData handlerChainMetaData : handlerChainsMetaData.getHandlerChains())
- {
- for (UnifiedHandlerMetaData uhmd : handlerChainMetaData.getHandlers())
- {
- epMetaData.addHandler(uhmd.getHandlerMetaDataJAXWS(epMetaData, HandlerType.ENDPOINT));
- }
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot process handler chain: " + filename, ex);
- }
- }
-
- private QName getWebParamName(OperationMetaData opMetaData, int index, Class javaType, WebParam webParam)
- {
- String namespace = null ;
- String name = null;
- boolean header = false;
-
- if (webParam != null)
- {
- if (webParam.targetNamespace().length() > 0)
- namespace = webParam.targetNamespace();
-
- if (webParam.name().length() > 0)
- name = webParam.name();
-
- header = webParam.header();
- }
-
- // Bare and headers must be qualified
- if (namespace == null && (opMetaData.isDocumentBare() || header))
- namespace = opMetaData.getQName().getNamespaceURI();
-
- // RPC body parts must have no namespace
- else if (opMetaData.isRPCLiteral() && !header)
- namespace = null;
-
- // Bare uses the operation name as the default, everything else is generated
- if (name == null)
- name = opMetaData.isDocumentBare() && !header ? opMetaData.getQName().getLocalPart() : "arg" + index;
-
- return (namespace != null) ? new QName(namespace, name) : new QName(name);
- }
-
- private QName getWebResultName(OperationMetaData opMetaData, Class javaType, WebResult anWebResult)
- {
- String name = null;
- String namespace = null;
- boolean header = false;
-
- if (anWebResult != null)
- {
- if (anWebResult.targetNamespace().length() > 0)
- namespace = anWebResult.targetNamespace();
-
- if (anWebResult.name().length() > 0)
- name = anWebResult.name();
-
- header = anWebResult.header();
- }
-
- // Bare and headers must be qualified
- if (namespace == null && (opMetaData.isDocumentBare() || header))
- namespace = opMetaData.getQName().getNamespaceURI();
-
- // RPC body parts must have no namespace
- else if (opMetaData.isRPCLiteral() && !header)
- namespace = null;
-
- // Bare uses the operation name as the default, everything else is generated
- if (name == null)
- name = opMetaData.isDocumentBare() && !header ? opMetaData.getResponseName().getLocalPart() : "return";
-
- return (namespace != null) ? new QName(namespace, name) : new QName(name);
- }
-
- private void addFault(OperationMetaData omd, Class<?> exception)
- {
- if (omd.isOneWay())
- throw new IllegalStateException("JSR-181 4.3.1 - A JSR-181 processor is REQUIRED to report an error if an operation marked "
- + "@Oneway has a return value, declares any checked exceptions or has any INOUT or OUT parameters.");
-
- WebFault annotation = exception.getAnnotation(WebFault.class);
-
- String name;
- String namespace;
- String faultBeanName = null;
-
- // Only the element name is effected by @WebFault, the type uses the same convention
- QName xmlType = new QName(omd.getQName().getNamespaceURI(), exception.getSimpleName());
-
- /*
- * If @WebFault is present, and the exception contains getFaultInfo, the
- * return value should be used. Otherwise we need to generate the bean.
- */
- boolean generate = true;
- if (annotation != null)
- {
- name = annotation.name();
- namespace = annotation.targetNamespace();
- if (namespace.length() == 0)
- namespace = omd.getQName().getNamespaceURI();
-
- Class<?> faultBean = getFaultInfo(exception);
- if (faultBean != null)
- {
- generate = false;
- faultBeanName = faultBean.getName();
- }
- }
- else
- {
- name = xmlType.getLocalPart();
- namespace = xmlType.getNamespaceURI();
- }
-
- if (faultBeanName == null)
- faultBeanName = JavaUtils.getPackageName(omd.getEndpointMetaData().getServiceEndpointInterface()) + ".jaxws." + exception.getSimpleName() + "Bean";
-
- QName xmlName = new QName(namespace, name);
-
- FaultMetaData fmd = new FaultMetaData(omd, xmlName, xmlType, exception.getName());
- fmd.setFaultBeanName(faultBeanName);
-
- if (generate)
- wrapperGenerator.generate(fmd);
-
- javaTypes.add(fmd.getFaultBean());
- typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));
-
- omd.addFault(fmd);
- }
-
- private Class<?> getFaultInfo(Class<?> exception)
- {
- try
- {
- Method method = exception.getMethod("getFaultInfo");
- Class<?> returnType = method.getReturnType();
- if (returnType == void.class)
- return null;
-
- return returnType;
- }
- catch (SecurityException e)
- {
- throw new WSException("Unexpected security exception: " + e.getMessage(), e);
- }
- catch (NoSuchMethodException e)
- {
- return null;
- }
- }
-
- private String[] convertTypeArguments(Class rawType, Type type)
- {
- if (!Collection.class.isAssignableFrom(rawType) && !Map.class.isAssignableFrom(rawType))
- return null;
-
- if (!(type instanceof ParameterizedType))
- return null;
-
- ParameterizedType paramType = (ParameterizedType)type;
- Type[] arguments = paramType.getActualTypeArguments();
- String[] ret = new String[arguments.length];
- for (int i = 0; i < arguments.length; i++)
- ret[i] = JavaUtils.erasure(arguments[i]).getName();
-
- return ret;
- }
-
- /**
- * Process operation meta data extensions.
- */
- private void processMetaExtensions(EndpointMetaData epMetaData, OperationMetaData opMetaData)
- {
- // Until there is a addressing annotion we fallback to implicit action asosciation
- // TODO: figure out a way to assign message name instead of IN and OUT
- String tns = epMetaData.getQName().getNamespaceURI();
- String portTypeName = epMetaData.getQName().getLocalPart();
-
- AddressingProperties ADDR = new AddressingPropertiesImpl();
- AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
- addrExt.setInboundAction(tns + "/" + portTypeName + "/IN");
-
- if (!opMetaData.isOneWay())
- addrExt.setOutboundAction(tns + "/" + portTypeName + "/OUT");
-
- opMetaData.addExtension(addrExt);
- }
-
- protected void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, String wsdlLocation, EndpointMetaData epMetaData)
- {
- if (wsdlLocation.length() > 0)
- {
- serviceMetaData.setWsdlFile(wsdlLocation);
- }
- else
- {
- try
- {
- String serviceName = serviceMetaData.getServiceName().getLocalPart();
-
- WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
- WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
-
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig config = factory.getServerConfig();
- File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws");
- tmpdir.mkdirs();
-
- File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl", tmpdir);
- wsdlTmpFile.deleteOnExit();
-
- Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile, Constants.DEFAULT_XML_CHARSET);
- wsdlDefinitions.write(writer, Constants.DEFAULT_XML_CHARSET);
- writer.close();
-
- serviceMetaData.setWsdlFile(wsdlTmpFile.toURL().toExternalForm());
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (IOException e)
- {
- throw new WSException("Cannot write generated wsdl", e);
- }
- }
- }
-}
\ No newline at end of file
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB21.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,90 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-// $Id$
-package org.jboss.ws.deployment;
-
-import java.util.Iterator;
-
-import javax.jws.WebService;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-
-/**
- * A server side meta data builder that is based on JSR-181 annotations
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
- * @since 19-May-2005
- */
-public class JSR181MetaDataBuilderEJB21 extends JSR181MetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JSR181MetaDataBuilderEJB21.class);
-
- /** Build from annotations
- */
- public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(classLoader);
-
- if (udi.classLoader == null)
- throw new WSException("Deployment class loader not initialized");
-
- // For every bean
- UnifiedApplicationMetaData appMetaData = (UnifiedApplicationMetaData)udi.metaData;
- Iterator it = appMetaData.getEnterpriseBeans();
- while (it.hasNext())
- {
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)it.next();
-
- String ejbName = beanMetaData.getEjbName();
- String ejbClassName = beanMetaData.getEjbClass();
- Class beanClass = udi.classLoader.loadClass(ejbClassName);
- if (beanClass.isAnnotationPresent(WebService.class))
- {
- setupEndpointFromAnnotations(wsMetaData, udi, beanClass, ejbName);
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderEJB3.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-// $Id$
-package org.jboss.ws.deployment;
-
-import java.util.Iterator;
-
-import javax.jws.WebService;
-
-import org.jboss.annotation.security.SecurityDomain;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-
-/**
- * A server side meta data builder that is based on JSR-181 annotations
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
- * @since 19-May-2005
- */
-public class JSR181MetaDataBuilderEJB3 extends JSR181MetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JSR181MetaDataBuilderEJB3.class);
-
- protected Class annotatedClass;
-
- /** Build from webservices.xml
- */
- public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(classLoader);
-
- if (udi.classLoader == null)
- throw new WSException("Deployment class loader not initialized");
-
- // The container objects below provide access to all of the ejb metadata
- UnifiedApplicationMetaData appMetaData = (UnifiedApplicationMetaData)udi.metaData;
- Iterator<UnifiedBeanMetaData> it = appMetaData.getEnterpriseBeans();
- while (it.hasNext())
- {
- UnifiedBeanMetaData beanMetaData = it.next();
- String ejbClassName = beanMetaData.getEjbClass();
- Class beanClass = udi.classLoader.loadClass(ejbClassName);
- if (beanClass.isAnnotationPresent(WebService.class))
- {
- String ejbLink = beanMetaData.getEjbName();
- setupEndpointFromAnnotations(wsMetaData, udi, beanClass, ejbLink);
-
- // setup the security domain
- if (beanClass.isAnnotationPresent(SecurityDomain.class))
- {
- SecurityDomain anSecurityDomain = (SecurityDomain)beanClass.getAnnotation(SecurityDomain.class);
- String lastDomain = wsMetaData.getSecurityDomain();
- String securityDomain = anSecurityDomain.value();
- if (lastDomain != null && lastDomain.equals(securityDomain) == false)
- throw new IllegalStateException("Multiple security domains not supported: " + securityDomain);
-
- wsMetaData.setSecurityDomain(securityDomain);
- }
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-// $Id$
-package org.jboss.ws.deployment;
-
-import java.util.Map;
-
-import javax.jws.WebService;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-
-/**
- * A server side meta data builder that is based on JSR-181 annotations
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
- * @since 23-Jul-2005
- */
-public class JSR181MetaDataBuilderJSE extends JSR181MetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(JSR181MetaDataBuilderJSE.class);
-
- /** Build from annotations
- */
- public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
- {
- log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
- try
- {
- UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setDeploymentName(udi.getCanonicalName());
- wsMetaData.setClassLoader(classLoader);
-
- if (udi.classLoader == null)
- throw new WSException("Deployment class loader not initialized");
-
- // For every bean
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- Map<String, String> servletClassMap = webMetaData.getServletClassNames();
- for (String servletName : servletClassMap.keySet())
- {
- String servletClassName = servletClassMap.get(servletName);
- try
- {
- Class beanClass = udi.classLoader.loadClass(servletClassName);
- if (beanClass.isAnnotationPresent(WebService.class))
- {
- setupEndpointFromAnnotations(wsMetaData, udi, beanClass, servletName);
- }
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load service endpoint class: " + servletClassName);
- }
- }
-
- log.debug("END buildMetaData: " + wsMetaData);
- return wsMetaData;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
- }
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -1,583 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-// $Id: $
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.ObjectName;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.xml.namespace.QName;
-import javax.xml.ws.addressing.AddressingProperties;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.common.CommonSOAPBinding;
-import org.jboss.ws.eventing.EventingConstants;
-import org.jboss.ws.eventing.deployment.EventingEndpoint;
-import org.jboss.ws.eventing.metadata.EventingEpMetaExt;
-import org.jboss.ws.jaxrpc.UnqualifiedFaultException;
-import org.jboss.ws.jaxrpc.Use;
-import org.jboss.ws.metadata.ClientEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.TypeMappingMetaData;
-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.j2ee.UnifiedWebSecurityMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
-import org.jboss.ws.metadata.wsdl.NCName;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
-import org.jboss.ws.metadata.wsdl.WSDLProperty;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
-import org.jboss.ws.utils.ObjectNameFactory;
-import org.w3c.dom.Element;
-
-/** An abstract meta data builder.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-May-2005
- */
-public abstract class MetaDataBuilder
-{
- // provide logging
- private final static Logger log = Logger.getLogger(MetaDataBuilder.class);
-
- protected ClassLoader classLoader;
-
- public void setClassLoader(ClassLoader classLoader)
- {
- this.classLoader = classLoader;
- }
-
- protected WSSecurityConfiguration getWsSecurityConfiguration(UnifiedDeploymentInfo udi) throws IOException
- {
- WSSecurityConfiguration config = null;
-
- String resource = WSSecurityConfigurationFactory.SERVER_RESOURCE_NAME;
- if (udi.metaData instanceof UnifiedWebMetaData)
- {
- resource = "WEB-INF/" + resource;
- }
- else
- {
- resource = "META-INF/" + resource;
- }
-
- URL location = classLoader.getResource(resource);
- if (location != null)
- {
- config = WSSecurityConfigurationFactory.newInstance().parse(location);
-
- // Get and set deployment path to the keystore file
- if (config.getKeyStoreFile() != null)
- {
- location = classLoader.getResource(config.getKeyStoreFile());
- if (location != null)
- config.setKeyStoreURL(location);
- }
-
- if (config.getTrustStoreFile() != null)
- {
- location = classLoader.getResource(config.getTrustStoreFile());
- if (location != null)
- config.setTrustStoreURL(location);
- }
- }
-
- return config;
- }
-
- /** Inititialize the endpoint binding */
- protected void initEndpointBinding(WSDLEndpoint wsdlEndpoint, ClientEndpointMetaData epMetaData)
- {
- WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getWsdlService().getWsdlDefinitions();
- WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
- WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
- String bindingType = wsdlBinding.getType();
- if (Constants.NS_SOAP11.equals(bindingType))
- epMetaData.setBindingId(CommonSOAPBinding.SOAP11HTTP_BINDING);
- else if (Constants.NS_SOAP12.equals(bindingType))
- epMetaData.setBindingId(CommonSOAPBinding.SOAP12HTTP_BINDING);
- }
-
- /** Initialize the endpoint encoding style from the binding operations
- */
- protected void initEndpointEncodingStyle(EndpointMetaData epMetaData)
- {
- WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
- {
- QName bindQName = wsdlEndpoint.getBinding();
- NCName ncName = new NCName(bindQName.getLocalPart());
- WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(ncName);
- if (wsdlBinding == null)
- throw new WSException("Cannot obtain binding: " + ncName);
-
- for (WSDLBindingOperation wsdlBindingOperation : wsdlBinding.getOperations())
- {
- String encStyle = wsdlBindingOperation.getEncodingStyle();
- epMetaData.setEncodingStyle(Use.valueOf(encStyle));
- }
- }
- }
- }
- }
-
- protected void processEndpointMetaDataExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
- {
- for (WSDLInterface wsdlInterface : wsdlDefinitions.getInterfaces())
- {
- WSDLProperty eventSourceProp = wsdlInterface.getProperty(Constants.WSDL_PROPERTY_EVENTSOURCE);
- if (eventSourceProp != null && epMetaData instanceof ServerEndpointMetaData)
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String eventSourceNS = wsdlInterface.getQName().getNamespaceURI() + "/" + wsdlInterface.getQName().getLocalPart();
- Object notificationSchema = null; // todo: resolve schema from operation message
-
- EventingEpMetaExt ext = new EventingEpMetaExt(EventingConstants.NS_EVENTING);
- ext.setEventSourceNS(eventSourceNS);
- ext.setNotificationSchema(notificationSchema);
-
- sepMetaData.addExtension(ext);
- sepMetaData.setManagedEndpointBean(EventingEndpoint.class.getName());
- }
- }
- }
-
- 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 (contextRoot.startsWith("/") == false)
- contextRoot = "/" + contextRoot;
- 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 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 + "=" + linkName);
-
- // Add JMS destination JNDI name for MDB endpoints
- if (udi.metaData instanceof UnifiedApplicationMetaData)
- {
- String ejbName = sepMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
-
- if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
- {
- UnifiedMessageDrivenMetaData mdMetaData = (UnifiedMessageDrivenMetaData)beanMetaData;
- String jndiName = mdMetaData.getDestinationJndiName();
- idstr.append(",jms=" + jndiName);
- }
- }
-
- return ObjectNameFactory.create(idstr.toString());
- }
-
- protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
- {
- TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
-
- WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
- for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
- {
- QName ref = outFault.getRef();
-
- WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(new NCName(ref.getLocalPart()));
- QName xmlName = wsdlFault.getElement();
- QName xmlType = wsdlFault.getXmlType();
- String javaTypeName = null;
-
- if (xmlType == null)
- {
- log.warn("Cannot obtain fault type for element: " + xmlName);
- xmlType = xmlName;
- }
-
- TypeMappingMetaData tmMetaData = typesMetaData.getTypeMappingByXMLType(xmlType);
- if (tmMetaData != null)
- javaTypeName = tmMetaData.getJavaTypeName();
-
- if (javaTypeName == null)
- {
- log.warn("Cannot obtain java type mapping for: " + xmlType);
- javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
- }
-
- FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- opMetaData.addFault(faultMetaData);
- }
- }
-
- /** Process operation meta data extensions. */
- protected void processOpMetaExtensions(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
- {
-
- String tns = wsdlOperation.getQName().getNamespaceURI();
- String portTypeName = wsdlOperation.getQName().getLocalPart();
-
- AddressingProperties ADDR = new AddressingPropertiesImpl();
- AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
-
- // inbound action
- WSDLProperty wsaInAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN);
- if (wsaInAction != null)
- {
- addrExt.setInboundAction(wsaInAction.getValue());
- }
- else
- {
- WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
- addrExt.setInboundAction(tns + "/" + portTypeName + "/" + messageName);
- }
-
- // outbound action
- WSDLProperty wsaOutAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT);
- if (wsaOutAction != null)
- {
- addrExt.setOutboundAction(wsaOutAction.getValue());
- }
- else
- {
- WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
- addrExt.setOutboundAction(tns + "/" + portTypeName + "/" + messageName);
- }
-
- opMetaData.addExtension(addrExt);
- }
-
- /** Get the web service address for a given path
- */
- public String getServiceEndpointAddress(String uriScheme, String servicePath)
- {
- if (servicePath == null || servicePath.length() == 0)
- throw new WSException("Service path cannot be null");
-
- if (servicePath.endsWith("/*"))
- servicePath = servicePath.substring(0, servicePath.length() - 2);
-
- if (uriScheme == null)
- uriScheme = "http";
-
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- String host = epManager.getWebServiceHost();
- int port = epManager.getWebServicePort();
- if ("https".equals(uriScheme))
- port = epManager.getWebServiceSecurePort();
-
- String urlStr = uriScheme + "://" + host + ":" + port + servicePath;
- try
- {
- return new URL(urlStr).toExternalForm();
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + urlStr);
- }
- }
-
- protected String getTransportGuarantee(final UnifiedWebMetaData webMetaData, final String servletLink)
- {
- String transportGuarantee = "";
-
- Map<String, String> servletMappings = webMetaData.getServletMappings();
- String urlPattern = servletMappings.get(servletLink);
-
- if (urlPattern == null)
- throw new WSException("Cannot find <url-pattern> for servlet-name: " + servletLink);
-
- List<UnifiedWebSecurityMetaData> securityList = webMetaData.getSecurityMetaData();
- for (UnifiedWebSecurityMetaData currentSecurity : securityList)
- {
- if (currentSecurity.getTransportGuarantee() != null && currentSecurity.getTransportGuarantee().length() > 0)
- {
- for (UnifiedWebResourceCollection currentCollection : currentSecurity.getWebResources())
- {
- for (String currentUrlPattern : currentCollection.getUrlPatterns())
- {
- if (urlPattern.equals(currentUrlPattern))
- {
- transportGuarantee = currentSecurity.getTransportGuarantee();
- }
- }
- }
- }
- }
-
- return transportGuarantee;
- }
-
- /** Replace the address locations for a given port component.
- */
- protected void replaceAddressLocation(ServerEndpointMetaData epMetaData)
- {
- WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
- QName portName = epMetaData.getQName();
-
- boolean endpointFound = false;
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName wsdlPortName = wsdlEndpoint.getQName();
- if (wsdlPortName.equals(portName))
- {
- endpointFound = true;
-
- String orgAddress = wsdlEndpoint.getAddress();
- String uriScheme = getUriScheme(orgAddress);
-
- String transportGuarantee = epMetaData.getTransportGuarantee();
- if ("CONFIDENTIAL".equals(transportGuarantee))
- uriScheme = "https";
-
- String servicePath = epMetaData.getContextRoot() + epMetaData.getURLPattern();
- String serviceEndpointURL = getServiceEndpointAddress(uriScheme, servicePath);
-
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
-
- if (alwaysModify || uriScheme == null || orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
- {
- log.debug("Replace service endpoint address '" + orgAddress + "' with '" + serviceEndpointURL + "'");
- wsdlEndpoint.setAddress(serviceEndpointURL);
- epMetaData.setEndpointAddress(serviceEndpointURL);
-
- // modify the wsdl-1.1 definition
- if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
- replaceWSDL11SOAPAddress(wsdlDefinitions, portName, serviceEndpointURL);
- }
- else
- {
- log.debug("Don't replace service endpoint address '" + orgAddress + "'");
- try
- {
- epMetaData.setEndpointAddress(new URL(orgAddress).toExternalForm());
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + orgAddress);
- }
- }
- }
- }
- }
-
- if (endpointFound == false)
- throw new WSException("Cannot find port in wsdl: " + portName);
- }
-
- private void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
- {
- Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
- String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
-
- // search for matching portElement and replace the address URI
- Port wsdlOneOnePort = modifySOAPAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices());
-
- // recursivly process imports if none can be found
- if (wsdlOneOnePort == null && !wsdlOneOneDefinition.getImports().isEmpty())
- {
-
- Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
- while (imports.hasNext())
- {
- List l = (List)imports.next();
- Iterator importsByNS = l.iterator();
- while (importsByNS.hasNext())
- {
- Import anImport = (Import)importsByNS.next();
- wsdlOneOnePort = modifySOAPAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices());
- }
- }
- }
-
- // if it still doesn't exist something is wrong
- if (wsdlOneOnePort == null)
- throw new IllegalArgumentException("Cannot find port with name '" + portQName + "' in wsdl document");
- }
-
- private Port modifySOAPAddress(String tnsURI, QName portQName, String serviceEndpointURL, Map services)
- {
- QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
-
- Port wsdlOneOnePort = null;
- Iterator itServices = services.values().iterator();
- while (itServices.hasNext())
- {
- Service wsdlOneOneService = (Service)itServices.next();
- Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
- Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
- while (itPorts.hasNext())
- {
- String portLocalName = (String)itPorts.next();
- if (portQName.equals(new QName(tnsURI, portLocalName)))
- {
- wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
- List<ExtensibilityElement> extElements = wsdlOneOnePort.getExtensibilityElements();
- for (ExtensibilityElement extElement : extElements)
- {
- QName elementType = extElement.getElementType();
- if (extElement instanceof SOAPAddress)
- {
- SOAPAddress address = (SOAPAddress)extElement;
- address.setLocationURI(serviceEndpointURL);
- }
- else if (SOAP12_ADDRESS.equals(elementType))
- {
- Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
- domElement.setAttribute("location", serviceEndpointURL);
- }
- }
- }
- }
- }
-
- return wsdlOneOnePort;
- }
-
- private String getUriScheme(String addrStr)
- {
- try
- {
- URI addrURI = new URI(addrStr);
- String scheme = addrURI.getScheme();
- return scheme;
- }
- catch (URISyntaxException e)
- {
- return null;
- }
- }
-}
Modified: trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -32,18 +32,24 @@
import org.jboss.ws.metadata.ServerEndpointMetaData;
import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB21;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSProviderMetaDataBuilder;
import org.jboss.ws.server.ServiceEndpointInfo;
import org.jboss.ws.server.ServiceEndpointManager;
import org.jboss.ws.server.WSDLFilePublisher;
/**
- * The POJO deployer for web service endpoints. This Deployer is already decoupled from the target
+ * The POJO deployer for web service endpoints. This Deployer is already decoupled from the target
* container (i.e. JBoss, Tomcat). The containers deployer architecture should be used to populate
* the UnifiedDeploymentInfo object.
- *
+ *
* @deprecated
* This functionality should be handled by the ServiceEndpointManager
- *
+ *
* @author Thomas.Diesler(a)jboss.org
* @since 12-May-2006
*/
@@ -76,42 +82,26 @@
try
{
UnifiedMetaData wsMetaData;
- if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR109_JSE)
+ if (udi.type == UnifiedDeploymentInfo.DeploymentType.JAXRPC_JSE)
{
- JSR109ServerMetaDataBuilder builder = new JSR109ServerMetaDataBuilder();
- builder.setClassLoader(udi.classLoader);
- wsMetaData = builder.buildMetaData((JSR109Deployment)udi);
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ wsMetaData = builder.buildMetaData((JAXRPCDeployment)udi);
}
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR109_EJB21)
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JAXRPC_EJB21)
{
- JSR109ServerMetaDataBuilder builder = new JSR109ServerMetaDataBuilder();
- builder.setClassLoader(udi.classLoader);
- wsMetaData = builder.buildMetaData((JSR109Deployment)udi);
+ JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder();
+ wsMetaData = builder.buildMetaData((JAXRPCDeployment)udi);
}
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_JSE)
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JAXWS_JSE)
{
- JSR181MetaDataBuilderJSE builder = new JSR181MetaDataBuilderJSE();
- builder.setClassLoader(udi.classLoader);
+ JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE();
wsMetaData = builder.buildMetaData(udi);
}
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_EJB21)
+ else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JAXWS_EJB3)
{
- JSR181MetaDataBuilderEJB21 builder = new JSR181MetaDataBuilderEJB21();
- builder.setClassLoader(udi.classLoader);
+ JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3();
wsMetaData = builder.buildMetaData(udi);
}
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JSR181_EJB3)
- {
- JSR181MetaDataBuilderEJB3 builder = new JSR181MetaDataBuilderEJB3();
- builder.setClassLoader(udi.classLoader);
- wsMetaData = builder.buildMetaData(udi);
- }
- else if (udi.type == UnifiedDeploymentInfo.DeploymentType.JAXWS_PROVIDER_JSE)
- {
- JAXWSProviderMetaDataBuilderJSE builder = new JAXWSProviderMetaDataBuilderJSE();
- builder.setClassLoader(udi.classLoader);
- wsMetaData = builder.buildMetaData(udi);
- }
else
{
throw new IllegalStateException("Invalid type: " + udi.type);
Modified: trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -28,7 +28,7 @@
import java.util.Map;
/**
- * The container independent deployment info.
+ * The container independent deployment info.
*
* @author Thomas.Diesler(a)jboss.org
* @since 05-May-2006
@@ -37,7 +37,7 @@
{
public enum DeploymentType
{
- JSR109_Client, JSR109_JSE, JSR109_EJB21, JSR181_JSE, JSR181_EJB21, JSR181_EJB3, JAXWS_PROVIDER_JSE, JAXWS_PROVIDER_EJB21, JAXWS_PROVIDER_EJB3
+ JAXRPC_Client, JAXRPC_JSE, JAXRPC_EJB21, JAXRPC_EJB3, JAXWS_JSE, JAXWS_EJB21, JAXWS_EJB3
};
public UnifiedDeploymentInfo(DeploymentType type)
@@ -70,7 +70,7 @@
name = parent.getCanonicalName() + "/" + name;
return name;
}
-
+
public String toString()
{
StringBuilder builder = new StringBuilder();
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerJSE.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -29,9 +29,9 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.metadata.WebMetaData;
import org.jboss.virtual.VirtualFile;
-import org.jboss.ws.deployment.JSR109Deployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
/**
* A deployer JAXRPC JSE Endpoints
@@ -44,7 +44,7 @@
@Override
protected DeploymentType getDeploymentType()
{
- return DeploymentType.JSR109_JSE;
+ return DeploymentType.JAXRPC_JSE;
}
@Override
@@ -58,7 +58,7 @@
protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit unit)
{
URL webservicesUrl = getWebServicesURL(unit);
- UnifiedDeploymentInfo udi = new JSR109Deployment(getDeploymentType(), webservicesUrl);
+ UnifiedDeploymentInfo udi = new JAXRPCDeployment(getDeploymentType(), webservicesUrl);
DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
return udi;
}
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerEJB3.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerEJB3.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerEJB3.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -26,12 +26,13 @@
import java.util.Iterator;
import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.ws.deployment.JSR181Deployment;
+import org.jboss.ws.deployment.JAXWSDeployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
@@ -46,13 +47,13 @@
@Override
protected DeploymentType getDeploymentType()
{
- return DeploymentType.JSR181_EJB3;
+ return DeploymentType.JAXWS_EJB3;
}
-
+
@Override
protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit unit)
{
- UnifiedDeploymentInfo udi = new JSR181Deployment(getDeploymentType());
+ UnifiedDeploymentInfo udi = new JAXWSDeployment(getDeploymentType());
DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
return udi;
}
@@ -69,7 +70,7 @@
while (it.hasNext())
{
EJBContainer container = (EJBContainer)it.next();
- if (container instanceof StatelessContainer && container.resolveAnnotation(WebService.class) != null)
+ if (isJAXWSBean(container))
{
isWebServiceDeployment = true;
break;
@@ -79,4 +80,10 @@
return isWebServiceDeployment;
}
-}
+
+ private boolean isJAXWSBean(EJBContainer container)
+ {
+ return container instanceof StatelessContainer && (container.resolveAnnotation(WebService.class) != null
+ || container.resolveAnnotation(WebServiceProvider.class) != null);
+ }
+}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerJSE.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -32,7 +32,7 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
-import org.jboss.ws.deployment.JSR181Deployment;
+import org.jboss.ws.deployment.JAXWSDeployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
@@ -44,12 +44,10 @@
*/
public class JAXWSDeployerJSE extends AbstractJSEDeployer
{
- private DeploymentType deploymentType;
-
@Override
protected DeploymentType getDeploymentType()
{
- return deploymentType;
+ return DeploymentType.JAXWS_JSE;
}
@Override
@@ -75,18 +73,11 @@
String beanName = servlet.getServletClass();
Class<?> servletClass = anLoader.loadClass(beanName);
- if (servletClass.isAnnotationPresent(WebService.class))
+ if (servletClass.isAnnotationPresent(WebService.class) || servletClass.isAnnotationPresent(WebServiceProvider.class))
{
- deploymentType = DeploymentType.JSR181_JSE;
isWebServiceDeployment = true;
break;
}
- if (servletClass.isAnnotationPresent(WebServiceProvider.class))
- {
- deploymentType = DeploymentType.JAXWS_PROVIDER_JSE;
- isWebServiceDeployment = true;
- break;
- }
}
}
catch (Exception ex)
@@ -101,8 +92,8 @@
@Override
protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentUnit unit)
{
- UnifiedDeploymentInfo udi = new JSR181Deployment(getDeploymentType());
+ UnifiedDeploymentInfo udi = new JAXWSDeployment(getDeploymentType());
DeploymentInfoAdaptor.buildDeploymentInfo(udi, unit);
return udi;
}
-}
+}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefHandler.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -38,9 +38,9 @@
import org.jboss.naming.Util;
import org.jboss.webservice.metadata.serviceref.ServiceRefMetaData;
import org.jboss.ws.WSException;
-import org.jboss.ws.deployment.JSR109ClientDeployment;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
import org.jboss.ws.jaxrpc.ServiceReferenceable;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientDeployment;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
@@ -88,7 +88,7 @@
wsServiceRef.setWsdlDefinition(wsdlDefinition);
// build the container independent deployment info
- UnifiedDeploymentInfo udi = new JSR109ClientDeployment(UnifiedDeploymentInfo.DeploymentType.JSR109_Client);
+ UnifiedDeploymentInfo udi = new JAXRPCClientDeployment(UnifiedDeploymentInfo.DeploymentType.JAXRPC_Client);
DeploymentInfoAdaptor.buildDeploymentInfo(udi, (DeploymentUnit)deployment);
ServiceReferenceable ref = new ServiceReferenceable(wsServiceRef, udi);
Modified: trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/integration/tomcat/TomcatServiceEndpointServlet.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -37,12 +37,12 @@
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.deployment.JSR109Deployment;
-import org.jboss.ws.deployment.JSR181Deployment;
+import org.jboss.ws.deployment.JAXWSDeployment;
import org.jboss.ws.deployment.ServiceEndpointDeployer;
import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCDeployment;
+import org.jboss.ws.server.AbstractServiceEndpointServlet;
import org.jboss.ws.server.KernelLocator;
-import org.jboss.ws.server.AbstractServiceEndpointServlet;
/**
* A servlet that is installed for every web service endpoint.
@@ -62,7 +62,7 @@
{
CrossContextLoader jbwsLoader = CrossContextLoader.newInstance(config.getServletContext());
Thread.currentThread().setContextClassLoader(jbwsLoader);
-
+
super.init(config);
deployServiceEndpoints(getServletContext());
}
@@ -87,7 +87,7 @@
{
CrossContextLoader jbwsLoader = CrossContextLoader.newInstance(getServletContext());
Thread.currentThread().setContextClassLoader(jbwsLoader);
- }
+ }
super.service(req, res);
}
finally
@@ -96,7 +96,7 @@
}
}
- /**
+ /**
* Bootstrap the Microkernel and initialize the
* ServiceEndpointManager
*/
@@ -158,11 +158,11 @@
URL webservices109URL = ctxLoader.findResource("WEB-INF/webservices.xml");
if (webservices109URL != null)
{
- udi = new JSR109Deployment(UnifiedDeploymentInfo.DeploymentType.JSR109_JSE, webservices109URL);
+ udi = new JAXRPCDeployment(UnifiedDeploymentInfo.DeploymentType.JAXRPC_JSE, webservices109URL);
}
else
{
- udi = new JSR181Deployment(UnifiedDeploymentInfo.DeploymentType.JSR181_JSE);
+ udi = new JAXWSDeployment(UnifiedDeploymentInfo.DeploymentType.JAXWS_JSE);
}
DeploymentInfoAdaptor.buildDeploymentInfo(udi, ctxLoader, servletContext);
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -39,11 +39,11 @@
import javax.xml.rpc.handler.HandlerChain;
import javax.xml.rpc.handler.HandlerRegistry;
-import org.jboss.ws.deployment.JSR109ClientMetaDataBuilder;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
@@ -56,7 +56,7 @@
* remote operation on the target service endpoint.
* <li>Instance of a generated stub class
* </ul>
- *
+ *
* @author Thomas.Diesler(a)jboss.org
* @since 10-Oct-2004
*/
@@ -87,12 +87,11 @@
ServiceImpl(QName serviceName, URL wsdlURL, URL mappingURL, URL securityURL)
{
this.wsdlLocation = wsdlURL;
- JSR109ClientMetaDataBuilder builder = new JSR109ClientMetaDataBuilder();
+ JAXRPCClientMetaDataBuilder builder = new JAXRPCClientMetaDataBuilder();
ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- builder.setClassLoader(ctxClassLoader);
- serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, mappingURL, securityURL, null);
+ serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, mappingURL, securityURL, null, ctxClassLoader);
handlerRegistry = new HandlerRegistryImpl();
}
@@ -102,15 +101,14 @@
ServiceImpl(QName serviceName, URL wsdlURL, JavaWsdlMapping mappingURL, WSSecurityConfiguration securityConfig, UnifiedServiceRefMetaData serviceRefMetaData)
{
this.wsdlLocation = wsdlURL;
- JSR109ClientMetaDataBuilder builder = new JSR109ClientMetaDataBuilder();
+ JAXRPCClientMetaDataBuilder builder = new JAXRPCClientMetaDataBuilder();
ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- builder.setClassLoader(ctxClassLoader);
- serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, mappingURL, securityConfig, serviceRefMetaData);
+ serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, mappingURL, securityConfig, serviceRefMetaData, ctxClassLoader);
handlerRegistry = new HandlerRegistryImpl();
}
-
+
public ServiceMetaData getServiceMetaData()
{
return serviceMetaData;
@@ -118,7 +116,7 @@
/**
* Gets the location of the WSDL document for this Service.
- *
+ *
* @return URL for the location of the WSDL document for this service
*/
public URL getWSDLDocumentLocation()
@@ -128,7 +126,7 @@
/**
* Gets the name of this service.
- *
+ *
* @return Qualified name of this service
*/
public QName getServiceName()
@@ -138,7 +136,7 @@
/**
* Creates a Call instance.
- *
+ *
* @param portName
* Qualified name for the target service endpoint
* @return Call instance
@@ -154,7 +152,7 @@
/**
* Creates a Call instance.
- *
+ *
* @param portName
* Qualified name for the target service endpoint
* @param operationName
@@ -174,7 +172,7 @@
/**
* Creates a Call instance.
- *
+ *
* @param portName
* Qualified name for the target service endpoint
* @param opName
@@ -195,7 +193,7 @@
* Creates a Call object not associated with specific operation or target
* service endpoint. This Call object needs to be configured using the
* setter methods on the Call interface.
- *
+ *
* @return Call object
* @throws javax.xml.rpc.ServiceException
* If any error in the creation of the Call object
@@ -213,7 +211,7 @@
* interface. <p/> Each invocation of the getCalls method returns a new
* array of preconfigured Call objects <p/> This method requires the Service
* implementation class to have access to the WSDL related metadata.
- *
+ *
* @param portName
* Qualified name for the target service endpoint
* @return Call[] Array of pre-configured Call objects
@@ -273,7 +271,7 @@
/**
* Returns an Iterator for the list of QNames of service endpoints grouped
* by this service
- *
+ *
* @return Returns java.util.Iterator with elements of type
* javax.xml.namespace.QName
* @throws javax.xml.rpc.ServiceException
Modified: trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -45,8 +45,6 @@
import javax.xml.ws.spi.ServiceDelegate;
import org.jboss.ws.Constants;
-import org.jboss.ws.deployment.JAXWSClientMetaDataBuilder;
-import org.jboss.ws.deployment.JSR181ClientMetaDataBuilder;
import org.jboss.ws.jaxrpc.MetaDataSynchronization;
import org.jboss.ws.jaxws.client.ClientImpl;
import org.jboss.ws.jaxws.client.DispatchImpl;
@@ -57,6 +55,8 @@
import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.EndpointMetaData.Type;
import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSClientEndpointMetaDataBuilder;
+import org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder;
/**
* Service delegates are used internally by Service objects to allow pluggability of JAX-WS implementations.
@@ -71,7 +71,7 @@
{
// The executor service
private static ExecutorService defaultExecutor = Executors.newCachedThreadPool();
-
+
// The service meta data that is associated with this JAXWS Service
private ServiceMetaData serviceMetaData;
// The ports known by this service
@@ -89,10 +89,8 @@
JAXWSClientMetaDataBuilder builder = new JAXWSClientMetaDataBuilder();
ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
- builder.setClassLoader(ctxClassLoader);
+ serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, ctxClassLoader);
- serviceMetaData = builder.buildMetaData(serviceName, wsdlURL);
-
for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
{
QName portName = epMetaData.getQName();
@@ -159,7 +157,7 @@
// Adjust the endpoint meta data according to the annotations
if (annotatedPorts.contains(portName) == false)
{
- JSR181ClientMetaDataBuilder metaDataBuilder = new JSR181ClientMetaDataBuilder();
+ JAXWSClientEndpointMetaDataBuilder metaDataBuilder = new JAXWSClientEndpointMetaDataBuilder();
metaDataBuilder.rebuildEndpointMetaData(epMetaData, seiClass);
}
}
@@ -267,7 +265,7 @@
{
if ((executor instanceof ExecutorService) == false)
throw new IllegalArgumentException("Supported executors must implement " + ExecutorService.class.getName());
-
+
this.executor = (ExecutorService)executor;
}
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.builder;
+
+/**
+ * Abstract class that represents a JAX-WS metadata builder.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public class JAXWSMetaDataBuilder extends MetaDataBuilder
+{
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/JAXWSMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java (from rev 1460, trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-11-17 16:50:33 UTC (rev 1460)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,438 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder;
+
+// $Id$
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.ObjectName;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.common.CommonSOAPBinding;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.jaxrpc.Use;
+import org.jboss.ws.metadata.ClientEndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+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;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
+import org.jboss.ws.server.ServiceEndpointManager;
+import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.utils.ObjectNameFactory;
+import org.w3c.dom.Element;
+
+/** An abstract meta data builder.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2005
+ */
+public abstract class MetaDataBuilder
+{
+ // provide logging
+ private final static Logger log = Logger.getLogger(MetaDataBuilder.class);
+
+ public static WSSecurityConfiguration getWsSecurityConfiguration(UnifiedDeploymentInfo udi) throws IOException
+ {
+ WSSecurityConfiguration config = null;
+
+ String resource = WSSecurityConfigurationFactory.SERVER_RESOURCE_NAME;
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ resource = "WEB-INF/" + resource;
+ }
+ else
+ {
+ resource = "META-INF/" + resource;
+ }
+
+ URL location = udi.classLoader.getResource(resource);
+ if (location != null)
+ {
+ config = WSSecurityConfigurationFactory.newInstance().parse(location);
+
+ // Get and set deployment path to the keystore file
+ if (config.getKeyStoreFile() != null)
+ {
+ location = udi.classLoader.getResource(config.getKeyStoreFile());
+ if (location != null)
+ config.setKeyStoreURL(location);
+ }
+
+ if (config.getTrustStoreFile() != null)
+ {
+ location = udi.classLoader.getResource(config.getTrustStoreFile());
+ if (location != null)
+ config.setTrustStoreURL(location);
+ }
+ }
+
+ return config;
+ }
+
+ /** Inititialize the endpoint binding */
+ protected void initEndpointBinding(WSDLEndpoint wsdlEndpoint, ClientEndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getWsdlService().getWsdlDefinitions();
+ WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
+ String bindingType = wsdlBinding.getType();
+ if (Constants.NS_SOAP11.equals(bindingType))
+ epMetaData.setBindingId(CommonSOAPBinding.SOAP11HTTP_BINDING);
+ else if (Constants.NS_SOAP12.equals(bindingType))
+ epMetaData.setBindingId(CommonSOAPBinding.SOAP12HTTP_BINDING);
+ }
+
+ /** Initialize the endpoint encoding style from the binding operations
+ */
+ protected void initEndpointEncodingStyle(EndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
+ {
+ QName bindQName = wsdlEndpoint.getBinding();
+ NCName ncName = new NCName(bindQName.getLocalPart());
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(ncName);
+ if (wsdlBinding == null)
+ throw new WSException("Cannot obtain binding: " + ncName);
+
+ for (WSDLBindingOperation wsdlBindingOperation : wsdlBinding.getOperations())
+ {
+ String encStyle = wsdlBindingOperation.getEncodingStyle();
+ epMetaData.setEncodingStyle(Use.valueOf(encStyle));
+ }
+ }
+ }
+ }
+ }
+
+
+ public static 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 (contextRoot.startsWith("/") == false)
+ contextRoot = "/" + contextRoot;
+ 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));
+ }
+
+ public static ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi, ServerEndpointMetaData sepMetaData)
+ {
+ 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 + "=" + linkName);
+
+ // Add JMS destination JNDI name for MDB endpoints
+ if (udi.metaData instanceof UnifiedApplicationMetaData)
+ {
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
+
+ if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
+ {
+ UnifiedMessageDrivenMetaData mdMetaData = (UnifiedMessageDrivenMetaData)beanMetaData;
+ String jndiName = mdMetaData.getDestinationJndiName();
+ idstr.append(",jms=" + jndiName);
+ }
+ }
+
+ return ObjectNameFactory.create(idstr.toString());
+ }
+
+
+ /** Get the web service address for a given path
+ */
+ public static String getServiceEndpointAddress(String uriScheme, String servicePath)
+ {
+ if (servicePath == null || servicePath.length() == 0)
+ throw new WSException("Service path cannot be null");
+
+ if (servicePath.endsWith("/*"))
+ servicePath = servicePath.substring(0, servicePath.length() - 2);
+
+ if (uriScheme == null)
+ uriScheme = "http";
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ String host = epManager.getWebServiceHost();
+ int port = epManager.getWebServicePort();
+ if ("https".equals(uriScheme))
+ port = epManager.getWebServiceSecurePort();
+
+ String urlStr = uriScheme + "://" + host + ":" + port + servicePath;
+ try
+ {
+ return new URL(urlStr).toExternalForm();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + urlStr);
+ }
+ }
+
+ /** Replace the address locations for a given port component.
+ */
+ public static void replaceAddressLocation(ServerEndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
+ QName portName = epMetaData.getQName();
+
+ boolean endpointFound = false;
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ QName wsdlPortName = wsdlEndpoint.getQName();
+ if (wsdlPortName.equals(portName))
+ {
+ endpointFound = true;
+
+ String orgAddress = wsdlEndpoint.getAddress();
+ String uriScheme = getUriScheme(orgAddress);
+
+ String transportGuarantee = epMetaData.getTransportGuarantee();
+ if ("CONFIDENTIAL".equals(transportGuarantee))
+ uriScheme = "https";
+
+ String servicePath = epMetaData.getContextRoot() + epMetaData.getURLPattern();
+ String serviceEndpointURL = getServiceEndpointAddress(uriScheme, servicePath);
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
+
+ if (alwaysModify || uriScheme == null || orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
+ {
+ log.debug("Replace service endpoint address '" + orgAddress + "' with '" + serviceEndpointURL + "'");
+ wsdlEndpoint.setAddress(serviceEndpointURL);
+ epMetaData.setEndpointAddress(serviceEndpointURL);
+
+ // modify the wsdl-1.1 definition
+ if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
+ replaceWSDL11SOAPAddress(wsdlDefinitions, portName, serviceEndpointURL);
+ }
+ else
+ {
+ log.debug("Don't replace service endpoint address '" + orgAddress + "'");
+ try
+ {
+ epMetaData.setEndpointAddress(new URL(orgAddress).toExternalForm());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + orgAddress);
+ }
+ }
+ }
+ }
+ }
+
+ if (endpointFound == false)
+ throw new WSException("Cannot find port in wsdl: " + portName);
+ }
+
+ private static void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
+ {
+ Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
+ String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
+
+ // search for matching portElement and replace the address URI
+ Port wsdlOneOnePort = modifySOAPAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices());
+
+ // recursivly process imports if none can be found
+ if (wsdlOneOnePort == null && !wsdlOneOneDefinition.getImports().isEmpty())
+ {
+
+ Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
+ while (imports.hasNext())
+ {
+ List l = (List)imports.next();
+ Iterator importsByNS = l.iterator();
+ while (importsByNS.hasNext())
+ {
+ Import anImport = (Import)importsByNS.next();
+ wsdlOneOnePort = modifySOAPAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices());
+ }
+ }
+ }
+
+ // if it still doesn't exist something is wrong
+ if (wsdlOneOnePort == null)
+ throw new IllegalArgumentException("Cannot find port with name '" + portQName + "' in wsdl document");
+ }
+
+ private static Port modifySOAPAddress(String tnsURI, QName portQName, String serviceEndpointURL, Map services)
+ {
+ QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
+
+ Port wsdlOneOnePort = null;
+ Iterator itServices = services.values().iterator();
+ while (itServices.hasNext())
+ {
+ Service wsdlOneOneService = (Service)itServices.next();
+ Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
+ Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
+ while (itPorts.hasNext())
+ {
+ String portLocalName = (String)itPorts.next();
+ if (portQName.equals(new QName(tnsURI, portLocalName)))
+ {
+ wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
+ List extElements = wsdlOneOnePort.getExtensibilityElements();
+ for (Object extElement : extElements)
+ {
+ QName elementType = ((ExtensibilityElement)extElement).getElementType();
+ if (extElement instanceof SOAPAddress)
+ {
+ SOAPAddress address = (SOAPAddress)extElement;
+ address.setLocationURI(serviceEndpointURL);
+ }
+ else if (SOAP12_ADDRESS.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ domElement.setAttribute("location", serviceEndpointURL);
+ }
+ }
+ }
+ }
+ }
+
+ return wsdlOneOnePort;
+ }
+
+ private static String getUriScheme(String addrStr)
+ {
+ try
+ {
+ URI addrURI = new URI(addrStr);
+ String scheme = addrURI.getScheme();
+ return scheme;
+ }
+ catch (URISyntaxException e)
+ {
+ return null;
+ }
+ }
+}
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxrpc;
+
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
+
+
+// $Id$
+
+/**
+ * The container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class JAXRPCClientDeployment extends UnifiedDeploymentInfo
+{
+
+ public JAXRPCClientDeployment(DeploymentType type)
+ {
+ super(type);
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientDeployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,260 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxrpc;
+
+//$Id$
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.ClientEndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.jaxrpc.WSClientConfigJAXRPC;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
+import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
+import org.jboss.ws.metadata.wsdl.NCName;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigurationFactory;
+
+/**
+ * A client side meta data builder.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2005
+ */
+public class JAXRPCClientMetaDataBuilder extends JAXRPCMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXRPCClientMetaDataBuilder.class);
+
+ /** Build from WSDL and jaxrpc-mapping.xml
+ */
+ public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, URL mappingURL, URL securityURL,
+ UnifiedServiceRefMetaData serviceRefMetaData, ClassLoader loader)
+ {
+ try
+ {
+ JavaWsdlMapping javaWsdlMapping = null;
+ if (mappingURL != null)
+ {
+ JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance();
+ javaWsdlMapping = mappingFactory.parse(mappingURL);
+ }
+
+ WSSecurityConfiguration securityConfig = null;
+ if (securityURL != null)
+ {
+ securityConfig = WSSecurityConfigurationFactory.newInstance().parse(securityURL);
+ }
+
+ return buildMetaData(serviceQName, wsdlURL, javaWsdlMapping, securityConfig, serviceRefMetaData, loader);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+
+ /** Build from WSDL and jaxrpc-mapping.xml
+ */
+ public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, JavaWsdlMapping javaWsdlMapping, WSSecurityConfiguration securityConfig,
+ UnifiedServiceRefMetaData serviceRefMetaData, ClassLoader loader)
+ {
+ log.debug("START buildMetaData: [service=" + serviceQName + "]");
+ try
+ {
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setClassLoader(loader);
+
+ ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceQName);
+ wsMetaData.addService(serviceMetaData);
+
+ serviceMetaData.setWsdlFile(wsdlURL.toExternalForm());
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+
+ URL mappingURL = null;
+ if (javaWsdlMapping != null)
+ {
+ mappingURL = new URL(Constants.NS_JBOSSWS_URI + "/dummy-mapping-url");
+ wsMetaData.addMappingDefinition(mappingURL.toExternalForm(), javaWsdlMapping);
+ serviceMetaData.setJaxrpcMappingFile(mappingURL.toExternalForm());
+ }
+
+ if (securityConfig != null)
+ {
+ serviceMetaData.setSecurityConfiguration(securityConfig);
+ setupSecurity(securityConfig, loader);
+ }
+
+ buildMetaDataInternal(serviceMetaData, wsdlDefinitions, javaWsdlMapping, serviceRefMetaData);
+
+ // eagerly initialize
+ wsMetaData.eagerInitialize();
+
+ log.debug("END buildMetaData: " + wsMetaData);
+ return serviceMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+
+ private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions, JavaWsdlMapping javaWsdlMapping,
+ UnifiedServiceRefMetaData serviceRefMetaData) throws IOException
+ {
+ QName serviceQName = serviceMetaData.getServiceName();
+
+ // Get the WSDL service
+ WSDLService wsdlService = null;
+ if (serviceQName == null)
+ {
+ if (wsdlDefinitions.getServices().length != 1)
+ throw new IllegalArgumentException("Expected a single service element");
+
+ wsdlService = wsdlDefinitions.getServices()[0];
+ serviceMetaData.setServiceName(wsdlService.getQName());
+ }
+ else
+ {
+ wsdlService = wsdlDefinitions.getService(new NCName(serviceQName.getLocalPart()));
+ }
+ if (wsdlService == null)
+ throw new IllegalArgumentException("Cannot obtain wsdl service: " + serviceQName);
+
+ // Build type mapping meta data
+ setupTypesMetaData(serviceMetaData);
+
+ // Build endpoint meta data
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ QName portName = wsdlEndpoint.getQName();
+ QName interfaceQName = wsdlEndpoint.getInterface().getQName();
+ ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC);
+ epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
+ serviceMetaData.addEndpoint(epMetaData);
+
+ // config-name, config-file
+ if (serviceRefMetaData != null)
+ {
+ String configName = serviceRefMetaData.getConfigName();
+ if (configName != null)
+ epMetaData.setConfigName(configName);
+
+ String configFile = serviceRefMetaData.getConfigFile();
+ if (configFile != null)
+ epMetaData.setConfigFile(configFile);
+ }
+
+ // Init the endpoint binding
+ initEndpointBinding(wsdlEndpoint, epMetaData);
+
+ // Init the service encoding style
+ initEndpointEncodingStyle(epMetaData);
+
+ ServiceEndpointInterfaceMapping seiMapping = null;
+ if (javaWsdlMapping != null)
+ {
+ QName portType = wsdlEndpoint.getInterface().getQName();
+ seiMapping = javaWsdlMapping.getServiceEndpointInterfaceMappingByPortType(portType);
+ if (seiMapping != null)
+ {
+ epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
+ }
+ else
+ {
+ log.warn("Cannot obtain the SEI mapping for: " + portType);
+ }
+ }
+
+ processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
+ setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping);
+ setupHandlers(serviceRefMetaData, portName, epMetaData);
+ }
+ }
+
+ private void setupHandlers(UnifiedServiceRefMetaData serviceRefMetaData, QName portName, EndpointMetaData epMetaData)
+ {
+ // Add pre handlers
+ WSClientConfigJAXRPC jaxrpcConfig = (WSClientConfigJAXRPC)epMetaData.getEndpointConfig();
+ epMetaData.addHandlers(jaxrpcConfig.getHandlers(epMetaData, HandlerType.PRE));
+
+ // Setup the endpoint handlers
+ if (serviceRefMetaData != null)
+ {
+ for (UnifiedHandlerMetaData uhmd : serviceRefMetaData.getHandlers())
+ {
+ Set<String> portNames = uhmd.getPortNames();
+ if (portNames.size() == 0 || portNames.contains(portName.getLocalPart()))
+ {
+ epMetaData.addHandler(uhmd.getHandlerMetaDataJAXRPC(epMetaData, HandlerType.ENDPOINT));
+ }
+ }
+ }
+
+ // Add post handlers
+ epMetaData.addHandlers(jaxrpcConfig.getHandlers(epMetaData, HandlerType.POST));
+ }
+
+ private void setupSecurity(WSSecurityConfiguration securityConfig, ClassLoader loader)
+ {
+ if (securityConfig.getKeyStoreFile() != null)
+ {
+ URL location = loader.getResource(securityConfig.getKeyStoreFile());
+ if (location != null)
+ securityConfig.setKeyStoreURL(location);
+ }
+
+ if (securityConfig.getTrustStoreFile() != null)
+ {
+ URL location = loader.getResource(securityConfig.getTrustStoreFile());
+ if (location != null)
+ securityConfig.setTrustStoreURL(location);
+ }
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxrpc;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
+import org.jboss.ws.metadata.jsr109.WebservicesFactory;
+import org.jboss.ws.metadata.jsr109.WebservicesMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+// $Id$
+
+/**
+ * The container independent deployment info.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2006
+ */
+public class JAXRPCDeployment extends UnifiedDeploymentInfo
+{
+ private WebservicesMetaData jsr109MetaData;
+
+ public JAXRPCDeployment(DeploymentType type, URL webservicesURL)
+ {
+ super(type);
+
+ try
+ {
+ // Unmarshall webservices.xml
+ InputStream is = webservicesURL.openStream();
+ try
+ {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new WebservicesFactory(webservicesURL);
+ jsr109MetaData = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null);
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ public WebservicesMetaData getWebservicesMetaData()
+ {
+ return jsr109MetaData;
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCDeployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,970 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxrpc;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.encoding.TypeMappingRegistry;
+import javax.xml.ws.addressing.AddressingConstants;
+import javax.xml.ws.addressing.AddressingProperties;
+
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.addressing.AddressingConstantsImpl;
+import org.jboss.ws.addressing.AddressingPropertiesImpl;
+import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.eventing.EventingConstants;
+import org.jboss.ws.eventing.deployment.EventingEndpoint;
+import org.jboss.ws.eventing.metadata.EventingEpMetaExt;
+import org.jboss.ws.jaxrpc.LiteralTypeMapping;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.jaxrpc.TypeMappingImpl;
+import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
+import org.jboss.ws.jaxrpc.UnqualifiedFaultException;
+import org.jboss.ws.jaxrpc.Use;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.FaultMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.TypeMappingMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.WrappedParameter;
+import org.jboss.ws.metadata.builder.MetaDataBuilder;
+import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping;
+import org.jboss.ws.metadata.wsdl.NCName;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
+import org.jboss.ws.metadata.wsdl.WSDLMIMEPart;
+import org.jboss.ws.metadata.wsdl.WSDLProperty;
+import org.jboss.ws.metadata.wsdl.WSDLRPCPart;
+import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem;
+import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader;
+import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.ws.xop.XOPScanner;
+
+/**
+ * A meta data builder that is based on webservices.xml.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @authoer <a href="mailto:jason.greene@jboss.org">Jason T. Greene</a>
+ * @since 19-Oct-2005
+ */
+public abstract class JAXRPCMetaDataBuilder extends MetaDataBuilder
+{
+ // provide logging
+ final Logger log = Logger.getLogger(JAXRPCMetaDataBuilder.class);
+
+ protected QName lookupSchemaType(WSDLInterfaceOperation operation, QName element)
+ {
+ WSDLDefinitions wsdlDefinitions = operation.getWsdlInterface().getWsdlDefinitions();
+ WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
+ return wsdlTypes.getXMLType(element);
+ }
+
+ protected void setupTypesMetaData(ServiceMetaData serviceMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+ JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping();
+ TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
+
+ // Copy the schema locations to the types meta data
+ if (wsdlDefinitions != null)
+ {
+ WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
+ typesMetaData.setSchemaModel(WSDLUtils.getSchemaModel(wsdlTypes));
+ }
+
+ // Copy the type mappings to the types meta data
+ if (javaWsdlMapping != null)
+ {
+ for (JavaXmlTypeMapping xmlTypeMapping : javaWsdlMapping.getJavaXmlTypeMappings())
+ {
+ String javaTypeName = xmlTypeMapping.getJavaType();
+ String qnameScope = xmlTypeMapping.getQnameScope();
+
+ QName xmlType = xmlTypeMapping.getRootTypeQName();
+ QName anonymousXMLType = xmlTypeMapping.getAnonymousTypeQName();
+ if (xmlType == null && anonymousXMLType != null)
+ xmlType = anonymousXMLType;
+
+ String nsURI = xmlType.getNamespaceURI();
+ if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false)
+ {
+ TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
+ tmMetaData.setQNameScope(qnameScope);
+ typesMetaData.addTypeMapping(tmMetaData);
+ }
+ }
+
+ for (ExceptionMapping exceptionMapping : javaWsdlMapping.getExceptionMappings())
+ {
+ QName xmlType = exceptionMapping.getWsdlMessage();
+ String javaTypeName = exceptionMapping.getExceptionType();
+ TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
+ typesMetaData.addTypeMapping(tmMetaData);
+ }
+ }
+ }
+
+ protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint wsdlEndpoint, ServiceEndpointInterfaceMapping seiMapping)
+ {
+ WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getInterface().getWsdlDefinitions();
+
+ // For every WSDL interface operation build the OperationMetaData
+ WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
+ for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
+ {
+ String opName = wsdlOperation.getName().toString();
+ QName opQName = wsdlOperation.getQName();
+
+ // Set java method name
+ String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
+ ServiceEndpointMethodMapping seiMethodMapping = null;
+ if (seiMapping != null)
+ {
+ epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface());
+
+ seiMethodMapping = seiMapping.getServiceEndpointMethodMappingByWsdlOperation(opName);
+ if (seiMethodMapping == null)
+ throw new WSException("Cannot obtain method mapping for: " + opName);
+
+ javaName = seiMethodMapping.getJavaMethodName();
+ }
+
+ OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName, javaName);
+ epMetaData.addOperation(opMetaData);
+
+ // Set the operation style
+ String style = wsdlOperation.getStyle();
+ epMetaData.setStyle((Constants.URI_STYLE_IRI.equals(style) ? Style.DOCUMENT : Style.RPC));
+
+ // Set the operation MEP
+ if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
+ opMetaData.setOneWayOperation(true);
+
+ // Set the operation SOAPAction
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
+ WSDLBindingOperation wsdlBindingOperation = wsdlBinding.getOperationByRef(opQName);
+ if (wsdlBindingOperation != null)
+ opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
+
+ // Get the type mapping for the encoding style
+ String encStyle = epMetaData.getEncodingStyle().toURI();
+ TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl();
+ TypeMappingImpl typeMapping = (TypeMappingImpl)tmRegistry.getTypeMapping(encStyle);
+
+ // Build the parameter meta data
+ if (opMetaData.getStyle() == Style.RPC)
+ {
+ buildParameterMetaDataRpc(opMetaData, wsdlOperation, seiMethodMapping, typeMapping);
+ }
+ else
+ {
+ buildParameterMetaDataDoc(opMetaData, wsdlOperation, seiMethodMapping, typeMapping);
+ }
+
+ // Build operation faults
+ buildFaultMetaData(opMetaData, wsdlOperation);
+
+ // process further operation extensions
+ processOpMetaExtensions(opMetaData, wsdlOperation);
+ }
+ }
+
+ private ParameterMetaData buildInputParameter(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, String partName, QName xmlName, QName xmlType, int pos)
+ {
+ WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName);
+ if (item != null)
+ pos = item.getPosition();
+
+ String javaTypeName = typeMapping.getJavaTypeName(xmlType);
+ if (seiMethodMapping != null)
+ {
+ MethodParamPartsMapping paramMapping = seiMethodMapping.getMethodParamPartsMappingByPartName(partName);
+ if (paramMapping == null)
+ throw new WSException("Cannot obtain method parameter mapping for message part '" + partName + "' in wsdl operation: "
+ + seiMethodMapping.getWsdlOperation());
+
+ javaTypeName = paramMapping.getParamType();
+ pos = paramMapping.getParamPosition();
+ }
+
+ JavaWsdlMapping javaWsdlMapping = opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping();
+ if (javaTypeName == null && javaWsdlMapping != null)
+ {
+ String packageName = javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI());
+ if (packageName != null)
+ {
+ javaTypeName = packageName + "." + xmlType.getLocalPart();
+ log.warn("Guess java type from package mapping: [xmlType=" + xmlType + ",javaType=" + javaTypeName + "]");
+ }
+ }
+
+ if (javaTypeName == null)
+ throw new WSException("Cannot obtain java type mapping for: " + xmlType);
+
+ ParameterMetaData inMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
+ inMetaData.setPartName(partName);
+ inMetaData.setIndex(pos);
+ opMetaData.addParameter(inMetaData);
+
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ // In arrays of user types, wscompile does not generate a mapping in jaxrpc-mapping.xml
+ if (typesMetaData.getTypeMappingByXMLType(xmlType) == null)
+ {
+ String nsURI = xmlType.getNamespaceURI();
+ if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false)
+ {
+ TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
+ typesMetaData.addTypeMapping(tmMetaData);
+ }
+ }
+
+ return inMetaData;
+ }
+
+ private ParameterMetaData buildOutputParameter(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, int pos, String partName, QName xmlName, QName xmlType, TypeMappingImpl typeMapping)
+ {
+ // Default is first listed output
+ boolean hasReturnMapping = opMetaData.getReturnParameter() == null;
+
+ WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName);
+ if (item != null)
+ {
+ hasReturnMapping = item.getDirection() == Direction.RETURN;
+ pos = item.getPosition();
+ }
+
+ String javaTypeName = typeMapping.getJavaTypeName(xmlType);
+ if (seiMethodMapping != null)
+ {
+ MethodParamPartsMapping paramMapping = seiMethodMapping.getMethodParamPartsMappingByPartName(partName);
+ if (paramMapping != null)
+ {
+ javaTypeName = paramMapping.getParamType();
+ pos = paramMapping.getParamPosition();
+ hasReturnMapping = false;
+ }
+ else
+ {
+ WsdlReturnValueMapping returnMapping = seiMethodMapping.getWsdlReturnValueMapping();
+ String mappingPart = returnMapping.getWsdlMessagePartName();
+ if (returnMapping != null && mappingPart != null && partName.equals(mappingPart));
+ {
+ javaTypeName = returnMapping.getMethodReturnValue();
+ hasReturnMapping = true;
+ }
+ }
+ }
+
+ JavaWsdlMapping javaWsdlMapping = opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping();
+ if (javaTypeName == null && javaWsdlMapping != null)
+ {
+ String packageName = javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI());
+ if (packageName != null)
+ {
+ javaTypeName = packageName + "." + xmlType.getLocalPart();
+ log.warn("Guess java type from package mapping: [xmlType=" + xmlType + ",javaType=" + javaTypeName + "]");
+ }
+ }
+
+ if (javaTypeName == null)
+ throw new WSException("Cannot obtain java type mapping for: " + xmlType);
+
+ ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
+ outMetaData.setPartName(partName);
+
+ if (hasReturnMapping)
+ {
+ opMetaData.setReturnParameter(outMetaData);
+ }
+ else
+ {
+ outMetaData.setIndex(pos);
+ outMetaData.setMode(ParameterMode.OUT);
+ opMetaData.addParameter(outMetaData);
+ }
+
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ // In arrays of user types, wscompile does not generate a mapping in jaxrpc-mapping.xml
+ if (typesMetaData.getTypeMappingByXMLType(xmlType) == null)
+ {
+ String nsURI = xmlType.getNamespaceURI();
+ if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false)
+ {
+ TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName);
+ typesMetaData.addTypeMapping(tmMetaData);
+ }
+ }
+
+ return outMetaData;
+ }
+
+ private int processBindingParameters(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
+ {
+ WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0];
+ for (WSDLSOAPHeader header : bindingInput.getSoapHeaders())
+ {
+ QName xmlName = header.getElement();
+ QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
+ String partName = header.getPartName();
+
+ ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
+ pmd.setInHeader(true);
+ }
+
+ for (WSDLMIMEPart mimePart : bindingInput.getMimeParts())
+ {
+ String partName = mimePart.getPartName();
+ QName xmlName = new QName(partName);
+ QName xmlType = mimePart.getXmlType();
+
+ ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
+ pmd.setSwA(true);
+ pmd.setMimeTypes(mimePart.getMimeTypes());
+ }
+
+ return wsdlPosition;
+ }
+
+ private int processBindingOutputParameters(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition)
+ {
+ WSDLBindingOperationOutput bindingOutput = bindingOperation.getOutputs()[0];
+ for (WSDLSOAPHeader header : bindingOutput.getSoapHeaders())
+ {
+ String partName = header.getPartName();
+ QName xmlName = header.getElement();
+
+ ParameterMetaData outMetaData = opMetaData.getParameter(xmlName);
+ if (outMetaData != null)
+ {
+ outMetaData.setMode(ParameterMode.INOUT);
+ }
+ else
+ {
+ QName xmlType = lookupSchemaType(wsdlOperation, xmlName);
+
+ ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
+ pmd.setInHeader(true);
+
+ if (opMetaData.getReturnParameter() != pmd)
+ wsdlPosition++;
+ }
+ }
+
+ for (WSDLMIMEPart mimePart : bindingOutput.getMimeParts())
+ {
+ String partName = mimePart.getPartName();
+ QName xmlName = new QName(partName);
+
+ ParameterMetaData outMetaData = opMetaData.getParameter(xmlName);
+ if (outMetaData != null)
+ {
+ outMetaData.setMode(ParameterMode.INOUT);
+ }
+ else
+ {
+ QName xmlType = mimePart.getXmlType();
+
+ ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
+ pmd.setSwA(true);
+ pmd.setMimeTypes(mimePart.getMimeTypes());
+
+ if (opMetaData.getReturnParameter() != pmd)
+ wsdlPosition++;
+ }
+ }
+
+ return wsdlPosition;
+ }
+
+ /* SOAP-ENC:Array
+ *
+ * FIXME: This hack should be removed as soon as we can reliably get the
+ * soapenc:arrayType from wsdl + schema.
+ */
+ private void setupSOAPArrayParameter(ParameterMetaData paramMetaData)
+ {
+ Use use = paramMetaData.getOperationMetaData().getUse();
+ String xmlTypeLocalPart = paramMetaData.getXmlType().getLocalPart();
+ if (use == Use.ENCODED && xmlTypeLocalPart.indexOf("ArrayOf") >= 0)
+ {
+ paramMetaData.setSOAPArrayParam(true);
+ try
+ {
+ String javaTypeName = paramMetaData.getJavaTypeName();
+ // This approach determins the array component type from the javaTypeName.
+ // It will not work for user defined types, nor will the array dimension be
+ // initialized properly. Ideally the array parameter meta data should be initialized
+ // from the XSModel or wherever it is defined in WSDL.
+ Class javaType = JavaUtils.loadJavaType(javaTypeName);
+ Class compJavaType = javaType.getComponentType();
+
+ if (xmlTypeLocalPart.indexOf("ArrayOfArrayOf") >= 0)
+ compJavaType = compJavaType.getComponentType();
+
+ QName compXMLType = new LiteralTypeMapping().getXMLType(compJavaType);
+ paramMetaData.setSOAPArrayCompType(compXMLType);
+ }
+ catch (ClassNotFoundException e)
+ {
+ // ignore that user defined types cannot be loaded yet
+ }
+ }
+ }
+
+ private void setupXOPAttachmentParameter(WSDLInterfaceOperation operation, ParameterMetaData paramMetaData)
+ {
+ QName xmlType = paramMetaData.getXmlType();
+
+ // An XOP parameter is detected if it is a complex type that derives from xsd:base64Binary
+ WSDLTypes wsdlTypes = operation.getWsdlInterface().getWsdlDefinitions().getWsdlTypes();
+ JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlTypes);
+ String localPart = xmlType.getLocalPart() != null ? xmlType.getLocalPart() : "";
+ String ns = xmlType.getNamespaceURI() != null ? xmlType.getNamespaceURI() : "";
+ XSTypeDefinition xsType = schemaModel.getTypeDefinition(localPart, ns);
+ XOPScanner scanner = new XOPScanner();
+ if(scanner.findXOPTypeDef(xsType)!=null | (localPart.equals("base64Binary")&&ns.equals(Constants.NS_SCHEMA_XSD)))
+ {
+ // FIXME: read the xmime:contentType from the element declaration
+ // See SchemaUtils#findXOPTypeDef(XSTypeDefinition typeDef) for details
+
+ /*
+ FIXME: the classloader is not set yet
+ paramMetaData.setXopContentType(
+ MimeUtils.resolveMimeType(paramMetaData.getJavaType())
+ );
+ */
+
+ paramMetaData.setXOP(true);
+
+ }
+ }
+
+ /*
+ * Perhaps the JAX-RPC mapping model should be hash based. For now we optimize just this case.
+ */
+ private Map<String, String> createVariableMappingMap(VariableMapping[] mappings)
+ {
+ HashMap<String, String> map = new HashMap<String, String>();
+ if (mappings != null)
+ for (VariableMapping mapping : mappings)
+ map.put(mapping.getXmlElementName(), mapping.getJavaVariableName());
+
+ return map;
+ }
+
+ private void buildParameterMetaDataRpc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
+ TypeMappingImpl typeMapping)
+ {
+ log.trace("buildParameterMetaDataRpc: " + opMetaData.getQName());
+
+ WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation();
+ if (bindingOperation == null)
+ throw new WSException("Could not locate binding operation for:" + opMetaData.getQName());
+
+ // RPC has one input
+ WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
+ int wsdlPosition = 0;
+ for (WSDLRPCPart part : input.getChildParts())
+ {
+ QName xmlType = part.getType();
+ String partName = part.getName();
+ QName xmlName = new QName(partName);
+
+ ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++);
+
+ setupXOPAttachmentParameter(wsdlOperation, pmd);
+ setupSOAPArrayParameter(pmd);
+ }
+
+ wsdlPosition = processBindingParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
+
+ WSDLInterfaceOperationOutput[] outputs = wsdlOperation.getOutputs();
+ if (outputs.length > 0)
+ {
+ WSDLInterfaceOperationOutput output = outputs[0];
+ for (WSDLRPCPart part : output.getChildParts())
+ {
+ String partName = part.getName();
+
+ ParameterMetaData outMetaData = opMetaData.getParameter(new QName(partName));
+ if (outMetaData != null)
+ {
+ outMetaData.setMode(ParameterMode.INOUT);
+ }
+ else
+ {
+ QName xmlName = new QName(partName);
+ QName xmlType = part.getType();
+
+ ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping);
+ if (opMetaData.getReturnParameter() != pmd)
+ wsdlPosition++;
+
+ setupXOPAttachmentParameter(wsdlOperation, pmd);
+ setupSOAPArrayParameter(pmd);
+ }
+ }
+
+ processBindingOutputParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
+ }
+ else if (wsdlOperation.getPattern() != Constants.WSDL20_PATTERN_IN_ONLY)
+ {
+ throw new WSException("RPC style was missing an output, and was not an IN-ONLY MEP.");
+ }
+ }
+
+ private int processDocElement(OperationMetaData operation, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, List<WrappedParameter> wrappedParameters, List<WrappedParameter> wrappedResponseParameters)
+ {
+ WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0];
+ int wsdlPosition;
+
+ QName xmlName = input.getElement();
+ QName xmlType = input.getXMLType();
+ String javaTypeName = typeMapping.getJavaTypeName(xmlType);
+
+ TypesMetaData typesMetaData = operation.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ TypeMappingMetaData typeMetaData = typesMetaData.getTypeMappingByXMLType(xmlType);
+ if (typeMetaData != null)
+ javaTypeName = typeMetaData.getJavaTypeName();
+
+ if (javaTypeName == null)
+ throw new WSException("Cannot obtain java type mapping for: " + xmlType);
+
+ // Check if we need to wrap the parameters
+ boolean isWrapped = isWrapped(seiMethodMapping, javaTypeName);
+ operation.getEndpointMetaData().setParameterStyle(isWrapped ? ParameterStyle.WRAPPED : ParameterStyle.BARE);
+
+ ParameterMetaData inMetaData = new ParameterMetaData(operation, xmlName, xmlType, javaTypeName);
+ operation.addParameter(inMetaData);
+
+
+ // Set the variable names
+ if (inMetaData.getOperationMetaData().isDocumentWrapped())
+ {
+ if (seiMethodMapping == null)
+ throw new IllegalArgumentException("Cannot wrap parameters without SEI method mapping");
+
+ ServiceEndpointInterfaceMapping seiMapping = seiMethodMapping.getServiceEndpointInterfaceMapping();
+ JavaXmlTypeMapping javaXmlTypeMapping = seiMapping.getJavaWsdlMapping().getTypeMappingForQName(xmlType);
+ if (javaXmlTypeMapping == null)
+ throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType);
+
+
+ Map<String, String> variableMap = createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
+ for (MethodParamPartsMapping partMapping : seiMethodMapping.getMethodParamPartsMappings())
+ {
+ WsdlMessageMapping wsdlMessageMapping = partMapping.getWsdlMessageMapping();
+ if (wsdlMessageMapping == null)
+ throw new IllegalArgumentException("wsdl-message-message mapping required for document/literal wrapped");
+
+ String elementName = wsdlMessageMapping.getWsdlMessagePartName();
+ String variable = variableMap.get(wsdlMessageMapping.getWsdlMessagePartName());
+ if (variable == null)
+ throw new IllegalArgumentException("Could not determine variable name for element: " + elementName);
+
+ WrappedParameter wrapped = new WrappedParameter(new QName(elementName), partMapping.getParamType(), variable,
+ partMapping.getParamPosition());
+
+
+ String parameterMode = wsdlMessageMapping.getParameterMode();
+ if (parameterMode == null || parameterMode.length() < 2)
+ throw new IllegalArgumentException("Invalid parameter mode for element: " + elementName);
+
+ if (! "OUT".equals(parameterMode))
+ wrappedParameters.add(wrapped);
+ if (! "IN".equals(parameterMode))
+ wrappedResponseParameters.add(wrapped);
+ }
+ inMetaData.setWrappedParameters(wrappedParameters);
+ wsdlPosition = wrappedParameters.size();
+ }
+ else
+ {
+ if (seiMethodMapping != null)
+ {
+ MethodParamPartsMapping part = seiMethodMapping.getMethodParamPartsMappingByPartName(input.getPartName());
+ if (part != null)
+ {
+ inMetaData.setJavaTypeName(part.getParamType());
+ inMetaData.setIndex(part.getParamPosition());
+ }
+ }
+
+ setupXOPAttachmentParameter(wsdlOperation, inMetaData);
+ wsdlPosition = 1;
+ }
+
+ return wsdlPosition;
+ }
+
+ private boolean isWrapped(ServiceEndpointMethodMapping seiMethodMapping, String javaTypeName)
+ {
+ boolean isWrapParameters = (seiMethodMapping != null ? seiMethodMapping.isWrappedElement() : false);
+ log.trace("isWrapParameters based on wrapped-element: " + isWrapParameters);
+ if (isWrapParameters == false && seiMethodMapping != null)
+ {
+
+ MethodParamPartsMapping[] partsMappings = seiMethodMapping.getMethodParamPartsMappings();
+ if (partsMappings.length > 0)
+ {
+ boolean matchingPartFound = false;
+ for (MethodParamPartsMapping partsMapping : partsMappings)
+ {
+ String paramTypeName = partsMapping.getParamType();
+ if (paramTypeName.equals(javaTypeName))
+ {
+ matchingPartFound = true;
+ break;
+ }
+ else
+ {
+ // Check assignability,
+ // JavaUtils.isAssignableFrom("org.w3c.dom.Element",
+ // "javax.xml.soap.SOAPElement")
+ try
+ {
+ Class paramType = JavaUtils.loadJavaType(paramTypeName);
+ Class javaType = JavaUtils.loadJavaType(javaTypeName);
+
+ // If it is assignable the explict mapping takes presedence
+ // and we don't wrap
+ if (JavaUtils.isAssignableFrom(javaType, paramType))
+ {
+ // javaTypeName = paramTypeName;
+ matchingPartFound = true;
+ break;
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ // Ignore. For simple types this should work, others should
+ // be lexically equal
+ // if it is not wrapped.
+ }
+ }
+ }
+ // Do we really want to continue to handle invalid mappings?
+ isWrapParameters = (matchingPartFound == false);
+ log.trace("isWrapParameters based on matching parts: " + isWrapParameters);
+ }
+ }
+ return isWrapParameters;
+ }
+
+ private int processOutputDocElement(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation,
+ ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, List<WrappedParameter> wrappedResponseParameters,
+ int wsdlPosition)
+ {
+ WSDLInterfaceOperationOutput opOutput = wsdlOperation.getOutputs()[0];
+ QName xmlName = opOutput.getElement();
+ QName xmlType = opOutput.getXMLType();
+
+ String javaTypeName = typeMapping.getJavaTypeName(xmlType);
+
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ if (typesMetaData.getTypeMappingByXMLType(xmlType) != null)
+ javaTypeName = typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName();
+
+ if (javaTypeName == null)
+ throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType);
+
+ ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName);
+
+ boolean hasReturnMapping = true;
+ if (opMetaData.isDocumentWrapped())
+ {
+ if (seiMethodMapping == null)
+ throw new IllegalArgumentException("Cannot wrap parameters without SEI method mapping");
+
+ WsdlReturnValueMapping returnValueMapping = seiMethodMapping.getWsdlReturnValueMapping();
+ if (returnValueMapping != null)
+ {
+ ServiceEndpointInterfaceMapping seiMapping = seiMethodMapping.getServiceEndpointInterfaceMapping();
+ JavaWsdlMapping javaWsdlMapping = seiMapping.getJavaWsdlMapping();
+ JavaXmlTypeMapping javaXmlTypeMapping = javaWsdlMapping.getTypeMappingForQName(xmlType);
+ if (javaXmlTypeMapping == null)
+ throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType);
+
+ Map<String, String> map = createVariableMappingMap(javaXmlTypeMapping.getVariableMappings());
+ String elementName = returnValueMapping.getWsdlMessagePartName();
+ String variable = map.get(elementName);
+ if (variable == null)
+ throw new IllegalArgumentException("Could not determine variable name for element: " + elementName);
+
+ String wrappedType = returnValueMapping.getMethodReturnValue();
+ QName element = new QName(elementName);
+ WrappedParameter wrappedParameter = new WrappedParameter(element, wrappedType, variable, WrappedParameter.RETURN);
+ wrappedResponseParameters.add(0, wrappedParameter);
+ }
+
+ outMetaData.setWrappedParameters(wrappedResponseParameters);
+ }
+ else
+ {
+ if (seiMethodMapping != null)
+ {
+ MethodParamPartsMapping part = seiMethodMapping.getMethodParamPartsMappingByPartName(opOutput.getPartName());
+ String mode = null;
+ if (part != null)
+ {
+ WsdlMessageMapping wsdlMessageMapping = part.getWsdlMessageMapping();
+ mode = wsdlMessageMapping.getParameterMode();
+ }
+ if ("INOUT".equals(mode))
+ {
+ ParameterMetaData inMetaData = opMetaData.getParameter(xmlName);
+ if (inMetaData != null)
+ {
+ inMetaData.setMode(ParameterMode.INOUT);
+ return wsdlPosition;
+ }
+
+ throw new WSException("Could not update IN parameter to be INOUT, as indicated in the mapping: " + opOutput.getPartName());
+ }
+ // It's potentialy possible that an input parameter could exist with the same part name
+ else if ("OUT".equals(mode))
+ {
+ hasReturnMapping = false;
+ javaTypeName = part.getParamType();
+ outMetaData.setIndex(part.getParamPosition());
+ outMetaData.setJavaTypeName(javaTypeName);
+ }
+ else
+ {
+ WsdlReturnValueMapping returnValueMapping = seiMethodMapping.getWsdlReturnValueMapping();
+ if (returnValueMapping != null)
+ {
+ javaTypeName = returnValueMapping.getMethodReturnValue();
+ outMetaData.setJavaTypeName(javaTypeName);
+ }
+ }
+ }
+
+ setupXOPAttachmentParameter(wsdlOperation, outMetaData);
+ }
+
+ if (hasReturnMapping)
+ {
+ opMetaData.setReturnParameter(outMetaData);
+ }
+ else
+ {
+ opMetaData.addParameter(outMetaData);
+ outMetaData.setMode(ParameterMode.OUT);
+ wsdlPosition++;
+ }
+
+ return wsdlPosition;
+ }
+
+ private void buildParameterMetaDataDoc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping,
+ TypeMappingImpl typeMapping)
+ {
+ log.trace("buildParameterMetaDataDoc: " + opMetaData.getQName());
+
+ WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation();
+ if (bindingOperation == null)
+ throw new WSException("Could not locate binding operation for:" + bindingOperation);
+
+ List<WrappedParameter> wrappedParameters = new ArrayList<WrappedParameter>();
+ List<WrappedParameter> wrappedResponseParameters = new ArrayList<WrappedParameter>();
+
+ int wsdlPosition = 0;
+ // WS-I BP 1.0 allows document/literal bare to have zero message parts
+ if (wsdlOperation.getInputs().length > 0)
+ {
+ wsdlPosition = processDocElement(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, wrappedParameters, wrappedResponseParameters);
+ wsdlPosition = processBindingParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
+ }
+ else
+ {
+ // Set the default to bare in case there isn't an input object, revisit this
+ opMetaData.getEndpointMetaData().setParameterStyle(ParameterStyle.BARE);
+ }
+
+ if (wsdlOperation.getOutputs().length > 0)
+ {
+ wsdlPosition = processOutputDocElement(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, wrappedResponseParameters, wsdlPosition);
+ wsdlPosition = processBindingOutputParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition);
+ }
+ }
+
+ /**
+ * Build default action according to the pattern described in
+ * http://www.w3.org/Submission/2004/SUBM-ws-addressing-20040810/
+ * Section 3.3.2 'Default Action Pattern'<br>
+ * [target namespace]/[port type name]/[input|output name]
+ *
+ * @param wsdlOperation
+ * @return action value
+ */
+ private String buildWsaActionValue(WSDLInterfaceOperation wsdlOperation)
+ {
+ WSDLProperty wsaAction = wsdlOperation.getProperty(Constants.WSDL_ATTRIBUTE_WSA_ACTION.toString());
+ String actionValue = null;
+
+ if (null == wsaAction)
+ {
+
+ String tns = wsdlOperation.getQName().getNamespaceURI();
+ String portTypeName = wsdlOperation.getQName().getLocalPart();
+ WSDLProperty messageName = wsdlOperation.getProperty("http://www.jboss.org/jbossws/messagename/in");
+
+ actionValue = new String(tns + "/" + portTypeName + "/" + messageName.getValue());
+ }
+ else
+ {
+ actionValue = wsaAction.getValue();
+ }
+
+ return actionValue;
+ }
+
+ protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
+ {
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+
+ WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
+ for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
+ {
+ QName ref = outFault.getRef();
+
+ WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(new NCName(ref.getLocalPart()));
+ QName xmlName = wsdlFault.getElement();
+ QName xmlType = wsdlFault.getXmlType();
+ String javaTypeName = null;
+
+ if (xmlType == null)
+ {
+ log.warn("Cannot obtain fault type for element: " + xmlName);
+ xmlType = xmlName;
+ }
+
+ TypeMappingMetaData tmMetaData = typesMetaData.getTypeMappingByXMLType(xmlType);
+ if (tmMetaData != null)
+ javaTypeName = tmMetaData.getJavaTypeName();
+
+ if (javaTypeName == null)
+ {
+ log.warn("Cannot obtain java type mapping for: " + xmlType);
+ javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
+ }
+
+ FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType, javaTypeName);
+ opMetaData.addFault(faultMetaData);
+ }
+ }
+
+ protected void processEndpointMetaDataExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
+ {
+ for (WSDLInterface wsdlInterface : wsdlDefinitions.getInterfaces())
+ {
+ WSDLProperty eventSourceProp = wsdlInterface.getProperty(Constants.WSDL_PROPERTY_EVENTSOURCE);
+ if (eventSourceProp != null && epMetaData instanceof ServerEndpointMetaData)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String eventSourceNS = wsdlInterface.getQName().getNamespaceURI() + "/" + wsdlInterface.getQName().getLocalPart();
+ Object notificationSchema = null; // todo: resolve schema from operation message
+
+ EventingEpMetaExt ext = new EventingEpMetaExt(EventingConstants.NS_EVENTING);
+ ext.setEventSourceNS(eventSourceNS);
+ ext.setNotificationSchema(notificationSchema);
+
+ sepMetaData.addExtension(ext);
+ sepMetaData.setManagedEndpointBean(EventingEndpoint.class.getName());
+ }
+ }
+ }
+
+ /** Process operation meta data extensions. */
+ protected void processOpMetaExtensions(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
+ {
+
+ String tns = wsdlOperation.getQName().getNamespaceURI();
+ String portTypeName = wsdlOperation.getQName().getLocalPart();
+
+ AddressingProperties ADDR = new AddressingPropertiesImpl();
+ AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
+
+ // inbound action
+ WSDLProperty wsaInAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN);
+ if (wsaInAction != null)
+ {
+ addrExt.setInboundAction(wsaInAction.getValue());
+ }
+ else
+ {
+ WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
+ addrExt.setInboundAction(tns + "/" + portTypeName + "/" + messageName);
+ }
+
+ // outbound action
+ WSDLProperty wsaOutAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT);
+ if (wsaOutAction != null)
+ {
+ addrExt.setOutboundAction(wsaOutAction.getValue());
+ }
+ else
+ {
+ WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
+ addrExt.setOutboundAction(tns + "/" + portTypeName + "/" + messageName);
+ }
+
+ opMetaData.addExtension(addrExt);
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,311 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+// $Id$
+package org.jboss.ws.metadata.builder.jaxrpc;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+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.EndpointMetaData.Type;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.jaxrpc.WSEndpointConfigJAXRPC;
+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.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
+import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
+import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
+import org.jboss.ws.metadata.jsr109.PortComponentMetaData;
+import org.jboss.ws.metadata.jsr109.WebserviceDescriptionMetaData;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+
+/**
+ * A server side meta data builder that is based on webservices.xml.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2005
+ */
+public class JAXRPCServerMetaDataBuilder extends JAXRPCMetaDataBuilder
+{
+ // provide logging
+ final Logger log = Logger.getLogger(JAXRPCServerMetaDataBuilder.class);
+
+ /**
+ * Build from webservices.xml
+ */
+ public UnifiedMetaData buildMetaData(JAXRPCDeployment udi)
+ {
+ log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
+ try
+ {
+ // For every webservice-description build the ServiceMetaData
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
+ wsMetaData.setClassLoader(udi.classLoader);
+
+ WebserviceDescriptionMetaData[] wsDescriptionArr = udi.getWebservicesMetaData().getWebserviceDescriptions();
+ for (WebserviceDescriptionMetaData wsdMetaData : wsDescriptionArr)
+ {
+ ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, null);
+ serviceMetaData.setWebserviceDescriptionName(wsdMetaData.getWebserviceDescriptionName());
+ wsMetaData.addService(serviceMetaData);
+
+ // Unmarshall the WSDL
+ serviceMetaData.setWsdlFile(wsdMetaData.getWsdlFile());
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+
+ // Unmarshall the jaxrpc-mapping.xml
+ serviceMetaData.setJaxrpcMappingFile(wsdMetaData.getJaxrpcMappingFile());
+ JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping();
+ if (javaWsdlMapping == null)
+ throw new WSException("jaxrpc-mapping-file not configured from webservices.xml");
+
+ // Build type mapping meta data
+ setupTypesMetaData(serviceMetaData);
+
+ // Assign the WS-Security configuration,
+ WSSecurityConfiguration securityConfiguration = getWsSecurityConfiguration(udi);
+ serviceMetaData.setSecurityConfiguration(securityConfiguration);
+
+ // For every port-component build the EndpointMetaData
+ PortComponentMetaData[] pcMetaDataArr = wsdMetaData.getPortComponents();
+ for (PortComponentMetaData pcMetaData : pcMetaDataArr)
+ {
+ QName portName = pcMetaData.getWsdlPort();
+
+ // JBWS-722
+ // <wsdl-port> in webservices.xml should be qualified
+ if (portName.getNamespaceURI().length() == 0)
+ {
+ String nsURI = wsdlDefinitions.getTargetNamespace();
+ portName = new QName(nsURI, portName.getLocalPart());
+ log.warn("Adding wsdl targetNamespace to: " + portName);
+ pcMetaData.setWsdlPort(portName);
+ }
+
+ WSDLEndpoint wsdlEndpoint = getWsdlEndpoint(wsdlDefinitions, portName);
+ if (wsdlEndpoint == null)
+ throw new WSException("Cannot find port in wsdl: " + portName);
+
+ // set service name
+ serviceMetaData.setServiceName(wsdlEndpoint.getWsdlService().getQName());
+ QName interfaceQName = wsdlEndpoint.getInterface().getQName();
+
+ ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC);
+ sepMetaData.setPortComponentName(pcMetaData.getPortComponentName());
+ String linkName = pcMetaData.getEjbLink() != null ? pcMetaData.getEjbLink() : pcMetaData.getServletLink();
+ sepMetaData.setLinkName(linkName);
+ serviceMetaData.addEndpoint(sepMetaData);
+
+ initEndpointEncodingStyle(sepMetaData);
+
+ initEndpointAddress(udi, sepMetaData, linkName);
+
+ if (udi.metaData instanceof UnifiedApplicationMetaData)
+ {
+ UnifiedApplicationMetaData apMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ wsMetaData.setSecurityDomain(apMetaData.getSecurityDomain());
+
+ // Copy the wsdl publish location from jboss.xml
+ String wsdName = serviceMetaData.getWebserviceDescriptionName();
+ String wsdlPublishLocation = apMetaData.getWsdlPublishLocationByName(wsdName);
+ serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
+
+ // Copy <port-component> meta data
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)apMetaData.getBeanByEjbName(linkName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain UnifiedBeanMetaData for: " + linkName);
+
+ String configName = apMetaData.getConfigName();
+ if (configName != null)
+ sepMetaData.setConfigName(configName);
+
+ String configFile = apMetaData.getConfigFile();
+ if (configFile != null)
+ sepMetaData.setConfigFile(configFile);
+
+ UnifiedEjbPortComponentMetaData bpcMetaData = beanMetaData.getPortComponent();
+ if (bpcMetaData != null)
+ {
+ if (bpcMetaData.getAuthMethod() != null)
+ {
+ String authMethod = bpcMetaData.getAuthMethod();
+ sepMetaData.setAuthMethod(authMethod);
+ }
+ if (bpcMetaData.getTransportGuarantee() != null)
+ {
+ String transportGuarantee = bpcMetaData.getTransportGuarantee();
+ sepMetaData.setTransportGuarantee(transportGuarantee);
+ }
+
+ sepMetaData.setURLPattern(bpcMetaData.getURLPattern());
+ }
+ }
+ else if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ wsMetaData.setSecurityDomain(webMetaData.getSecurityDomain());
+
+ String targetBean = webMetaData.getServletClassNames().get(linkName);
+ sepMetaData.setServiceEndpointImplName(targetBean);
+
+ // Copy the wsdl publish location from jboss-web.xml
+ String wsdName = serviceMetaData.getWebserviceDescriptionName();
+ String wsdlPublishLocation = webMetaData.getWsdlPublishLocationByName(wsdName);
+ serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation);
+
+ String configName = webMetaData.getConfigName();
+ if (configName != null)
+ sepMetaData.setConfigName(configName);
+
+ String configFile = webMetaData.getConfigFile();
+ if (configFile != null)
+ sepMetaData.setConfigFile(configFile);
+
+ initTransportGuaranteeJSE(udi, sepMetaData, linkName);
+ }
+
+ // init service endpoint id
+ ObjectName sepID = getServiceEndpointID(udi, sepMetaData);
+ sepMetaData.setServiceEndpointID(sepID);
+
+ replaceAddressLocation(sepMetaData);
+
+ String seiName = pcMetaData.getServiceEndpointInterface();
+ sepMetaData.setServiceEndpointInterfaceName(seiName);
+
+ ServiceEndpointInterfaceMapping seiMapping = javaWsdlMapping.getServiceEndpointInterfaceMapping(seiName);
+ if (seiMapping == null)
+ log.warn("Cannot obtain SEI mapping for: " + seiName);
+
+ // process endpoint meta extension
+ processEndpointMetaDataExtensions(sepMetaData, wsdlDefinitions);
+
+ // Setup the endpoint operations
+ setupOperationsFromWSDL(sepMetaData, wsdlEndpoint, seiMapping);
+
+ // Add pre handlers
+ WSEndpointConfigJAXRPC jaxrpcConfig = (WSEndpointConfigJAXRPC)sepMetaData.getEndpointConfig();
+ sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.PRE));
+
+ // Setup the endpoint handlers
+ for (UnifiedHandlerMetaData uhmd : pcMetaData.getHandlers())
+ {
+ Set<String> portNames = uhmd.getPortNames();
+ if (portNames.size() == 0 || portNames.contains(portName.getLocalPart()))
+ {
+ sepMetaData.addHandler(uhmd.getHandlerMetaDataJAXRPC(sepMetaData, HandlerType.ENDPOINT));
+ }
+ }
+
+ // Add post handlers
+ sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.POST));
+ }
+ }
+
+ log.debug("END buildMetaData: " + wsMetaData);
+ return wsMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+
+ private WSDLEndpoint getWsdlEndpoint(WSDLDefinitions wsdlDefinitions, QName portName)
+ {
+ WSDLEndpoint wsdlEndpoint = null;
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ WSDLEndpoint auxEndpoint = wsdlService.getEndpoint(portName);
+ if (auxEndpoint != null)
+ {
+ wsdlEndpoint = auxEndpoint;
+ break;
+ }
+ }
+ return wsdlEndpoint;
+ }
+
+ /**
+ * Read the transport guarantee from web.xml
+ */
+ protected void initTransportGuaranteeJSE(UnifiedDeploymentInfo udi, EndpointMetaData epMetaData, String servletLink) throws IOException
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ epMetaData.setTransportGuarantee(getTransportGuarantee(webMetaData, servletLink));
+ }
+
+
+ protected String getTransportGuarantee(final UnifiedWebMetaData webMetaData, final String servletLink)
+ {
+ String transportGuarantee = "";
+
+ Map<String, String> servletMappings = webMetaData.getServletMappings();
+ String urlPattern = servletMappings.get(servletLink);
+
+ if (urlPattern == null)
+ throw new WSException("Cannot find <url-pattern> for servlet-name: " + servletLink);
+
+ List<UnifiedWebSecurityMetaData> securityList = webMetaData.getSecurityMetaData();
+ for (UnifiedWebSecurityMetaData currentSecurity : securityList)
+ {
+ if (currentSecurity.getTransportGuarantee() != null && currentSecurity.getTransportGuarantee().length() > 0)
+ {
+ for (UnifiedWebResourceCollection currentCollection : currentSecurity.getWebResources())
+ {
+ for (String currentUrlPattern : currentCollection.getUrlPatterns())
+ {
+ if (urlPattern.equals(currentUrlPattern))
+ {
+ transportGuarantee = currentSecurity.getTransportGuarantee();
+ }
+ }
+ }
+ }
+ }
+
+ return transportGuarantee;
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+// $Id$
+package org.jboss.ws.metadata.builder.jaxws;
+
+import javax.jws.HandlerChain;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.BindingType;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.config.jaxws.WSClientConfigJAXWS;
+
+/**
+ * A client side meta data builder that is based on JSR-181 annotations
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 9-Aug-2006
+ */
+public class JAXWSClientEndpointMetaDataBuilder extends JAXWSWebServiceMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXWSClientEndpointMetaDataBuilder.class);
+
+ public void rebuildEndpointMetaData(EndpointMetaData epMetaData, Class<?> wsClass)
+ {
+ log.debug("START: rebuildMetaData");
+
+ // Clear the java types, etc.
+ resetMetaDataBuilder(epMetaData.getClassLoader());
+
+ // Nuke parameterStyle
+ epMetaData.setParameterStyle(null);
+
+ // Process an optional @BindingType annotation
+ if (wsClass.isAnnotationPresent(BindingType.class))
+ processBindingType(epMetaData, wsClass);
+
+ // Process @SOAPBinding
+ if (wsClass.isAnnotationPresent(SOAPBinding.class))
+ processSOAPBinding(epMetaData, wsClass);
+
+ // Clear handlers
+ epMetaData.clearHandlers();
+
+ // Add pre handlers
+ WSClientConfigJAXWS jaxwsConfig = (WSClientConfigJAXWS)epMetaData.getEndpointConfig();
+ epMetaData.addHandlers(jaxwsConfig.getHandlers(epMetaData, HandlerType.PRE));
+
+ // Process an optional @HandlerChain annotation
+ if (wsClass.isAnnotationPresent(HandlerChain.class))
+ processHandlerChain(epMetaData, wsClass);
+
+ // Add post handlers
+ epMetaData.addHandlers(jaxwsConfig.getHandlers(epMetaData, HandlerType.POST));
+
+ // Process @WebMethod
+ processWebMethods(epMetaData, wsClass, true);
+
+ // Initialize types
+ createJAXBContext(epMetaData);
+ populateXmlTypes(epMetaData);
+
+ // Eager initialization
+ epMetaData.eagerInitialize();
+
+ log.debug("END: rebuildMetaData\n" + epMetaData.getServiceMetaData());
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientEndpointMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxws;
+
+//$Id$
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.metadata.ClientEndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.metadata.builder.JAXWSMetaDataBuilder;
+import org.jboss.ws.metadata.wsdl.NCName;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+
+/**
+ * A client side meta data builder.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-May-2005
+ */
+public class JAXWSClientMetaDataBuilder extends JAXWSMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXWSClientMetaDataBuilder.class);
+
+ /** Build from WSDL and jaxrpc-mapping.xml
+ */
+ public ServiceMetaData buildMetaData(QName serviceName, URL wsdlURL, ClassLoader loader)
+ {
+ if (wsdlURL == null)
+ throw new IllegalArgumentException("Invalid wsdlURL: " + wsdlURL);
+
+ log.debug("START buildMetaData: [service=" + serviceName + "]");
+ try
+ {
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+
+ ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceName);
+ wsMetaData.addService(serviceMetaData);
+
+ serviceMetaData.setWsdlFile(wsdlURL.toExternalForm());
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+
+ buildMetaDataInternal(serviceMetaData, wsdlDefinitions);
+
+ // Read the WSDL and initialize the schema model
+ // This should only be needed for debuging purposes of the UMDM
+ JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
+ serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
+
+ log.debug("END buildMetaData: " + wsMetaData);
+ return serviceMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+
+ private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions) throws IOException
+ {
+ QName serviceName = serviceMetaData.getServiceName();
+
+ // Get the WSDL service
+ WSDLService wsdlService = null;
+ if (serviceName == null)
+ {
+ if (wsdlDefinitions.getServices().length != 1)
+ throw new IllegalArgumentException("Expected a single service element");
+
+ wsdlService = wsdlDefinitions.getServices()[0];
+ serviceMetaData.setServiceName(wsdlService.getQName());
+ }
+ else
+ {
+ wsdlService = wsdlDefinitions.getService(new NCName(serviceName.getLocalPart()));
+ }
+ if (wsdlService == null)
+ throw new IllegalArgumentException("Cannot obtain wsdl service: " + serviceName);
+
+ // Build endpoint meta data
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ QName portName = wsdlEndpoint.getQName();
+ QName interfaceQName = wsdlEndpoint.getInterface().getQName();
+ ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXWS);
+ epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
+ serviceMetaData.addEndpoint(epMetaData);
+
+ // Init the endpoint binding
+ initEndpointBinding(wsdlEndpoint, epMetaData);
+
+ // Init the service encoding style
+ initEndpointEncodingStyle(epMetaData);
+
+ setupOperationsFromWSDL(epMetaData, wsdlEndpoint);
+ }
+ }
+
+ protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint wsdlEndpoint)
+ {
+ WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getInterface().getWsdlDefinitions();
+
+ // For every WSDL interface operation build the OperationMetaData
+ WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
+ for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations())
+ {
+ String opName = wsdlOperation.getName().toString();
+ QName opQName = wsdlOperation.getQName();
+
+ // Set java method name
+ String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1);
+
+ OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName, javaName);
+ epMetaData.addOperation(opMetaData);
+
+ // Set the operation style
+ String style = wsdlOperation.getStyle();
+ epMetaData.setStyle((Constants.URI_STYLE_IRI.equals(style) ? Style.DOCUMENT : Style.RPC));
+
+ // Set the operation MEP
+ if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern()))
+ opMetaData.setOneWayOperation(true);
+
+ // Set the operation SOAPAction
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
+ WSDLBindingOperation wsdlBindingOperation = wsdlBinding.getOperationByRef(opQName);
+ if (wsdlBindingOperation != null)
+ opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction());
+ }
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,134 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.builder.jaxws;
+
+import javax.xml.ws.BindingType;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.annotation.PortComponent;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo.DeploymentType;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+
+/**
+ * Builds ServiceEndpointMetaData for a JAX-WS endpoint.
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public abstract class JAXWSEndpointMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXWSEndpointMetaDataBuilder.class);
+
+ public abstract ServerEndpointMetaData buildEndpoint(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName);
+
+ protected void processBindingType(EndpointMetaData epMetaData, Class<?> wsClass)
+ {
+ BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
+ String uri = anBindingType.value();
+ if (uri.length() > 0)
+ {
+ epMetaData.setBindingId(uri);
+ }
+ }
+
+ protected void processPortComponent(UnifiedDeploymentInfo udi, Class<?> wsClass, String linkName, ServerEndpointMetaData sepMetaData)
+ {
+ PortComponent anPortComponent = (PortComponent)wsClass.getAnnotation(PortComponent.class);
+ if (anPortComponent != null)
+ {
+ // setup config name
+ if (anPortComponent.configName().length() > 0)
+ {
+ String configName = anPortComponent.configName();
+ sepMetaData.setConfigName(configName);
+ }
+
+ // setup config file
+ if (anPortComponent.configFile().length() > 0)
+ {
+ String configFile = anPortComponent.configFile();
+ sepMetaData.setConfigFile(configFile);
+ }
+
+ boolean isJSEEndpoint = udi.type == DeploymentType.JAXWS_JSE;
+
+ // context-root
+ if (anPortComponent.contextRoot().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.contextRoot is only valid on EJB endpoints");
+
+ if (isJSEEndpoint == false)
+ {
+ String contextRoot = anPortComponent.contextRoot();
+ if (contextRoot.startsWith("/") == false)
+ contextRoot = "/" + contextRoot;
+
+ sepMetaData.setContextRoot(contextRoot);
+ }
+ }
+
+ // url-pattern
+ if (anPortComponent.urlPattern().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.urlPattern is only valid on EJB endpoints");
+
+ if (isJSEEndpoint == false)
+ {
+ String urlPattern = anPortComponent.urlPattern();
+ sepMetaData.setURLPattern(urlPattern);
+ }
+ }
+
+ // auth-method
+ if (anPortComponent.authMethod().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.authMethod is only valid on EJB endpoints");
+
+ if (isJSEEndpoint == false)
+ {
+ String authMethod = anPortComponent.authMethod();
+ sepMetaData.setAuthMethod(authMethod);
+ }
+ }
+
+ // transport-guarantee
+ if (anPortComponent.transportGuarantee().length() > 0)
+ {
+ if (isJSEEndpoint)
+ log.warn("@PortComponent.transportGuarantee is only valid on EJB endpoints");
+
+ if (isJSEEndpoint == false)
+ {
+ String transportGuarantee = anPortComponent.transportGuarantee();
+ sepMetaData.setTransportGuarantee(transportGuarantee);
+ }
+ }
+ }
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+// $Id$
+package org.jboss.ws.metadata.builder.jaxws;
+
+import java.util.Iterator;
+
+import javax.jws.WebService;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.JAXWSDeployment;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+
+/**
+ * A server side meta data builder that is based on JSR-181 annotations
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @since 19-May-2005
+ */
+public class JAXWSMetaDataBuilderEJB21 extends JAXWSServerMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderEJB21.class);
+
+ /** Build from annotations
+ */
+ public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
+ {
+ log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
+ try
+ {
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
+ wsMetaData.setClassLoader(udi.classLoader);
+
+ if (udi.classLoader == null)
+ throw new WSException("Deployment class loader not initialized");
+
+ // For every bean
+ UnifiedApplicationMetaData appMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ Iterator it = appMetaData.getEnterpriseBeans();
+ while (it.hasNext())
+ {
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)it.next();
+
+ String ejbName = beanMetaData.getEjbName();
+ String ejbClassName = beanMetaData.getEjbClass();
+ Class beanClass = udi.classLoader.loadClass(ejbClassName);
+ setupEndpoint(wsMetaData, udi, beanClass, ejbName);
+ }
+
+ log.debug("END buildMetaData: " + wsMetaData);
+ return wsMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+// $Id$
+package org.jboss.ws.metadata.builder.jaxws;
+
+import java.util.Iterator;
+
+import javax.jws.WebService;
+
+import org.jboss.annotation.security.SecurityDomain;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.JAXWSDeployment;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+
+/**
+ * A server side meta data builder that is based on JSR-181 annotations
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @since 19-May-2005
+ */
+public class JAXWSMetaDataBuilderEJB3 extends JAXWSServerMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderEJB3.class);
+
+ protected Class annotatedClass;
+
+ /** Build from webservices.xml
+ */
+ public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
+ {
+ log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
+ try
+ {
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
+ wsMetaData.setClassLoader(udi.classLoader);
+
+ if (udi.classLoader == null)
+ throw new WSException("Deployment class loader not initialized");
+
+ // The container objects below provide access to all of the ejb metadata
+ UnifiedApplicationMetaData appMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ Iterator<UnifiedBeanMetaData> it = appMetaData.getEnterpriseBeans();
+ while (it.hasNext())
+ {
+ UnifiedBeanMetaData beanMetaData = it.next();
+ String ejbClassName = beanMetaData.getEjbClass();
+ Class<?> beanClass = udi.classLoader.loadClass(ejbClassName);
+ if (beanClass.isAnnotationPresent(WebService.class))
+ {
+ String ejbLink = beanMetaData.getEjbName();
+ setupEndpoint(wsMetaData, udi, beanClass, ejbLink);
+
+ // setup the security domain
+ if (beanClass.isAnnotationPresent(SecurityDomain.class))
+ {
+ SecurityDomain anSecurityDomain = (SecurityDomain)beanClass.getAnnotation(SecurityDomain.class);
+ String lastDomain = wsMetaData.getSecurityDomain();
+ String securityDomain = anSecurityDomain.value();
+ if (lastDomain != null && lastDomain.equals(securityDomain) == false)
+ throw new IllegalStateException("Multiple security domains not supported: " + securityDomain);
+
+ wsMetaData.setSecurityDomain(securityDomain);
+ }
+ }
+ }
+
+ log.debug("END buildMetaData: " + wsMetaData);
+ return wsMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+// $Id$
+package org.jboss.ws.metadata.builder.jaxws;
+
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+
+/**
+ * A server side meta data builder that is based on JSR-181 annotations
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @since 23-Jul-2005
+ */
+public class JAXWSMetaDataBuilderJSE extends JAXWSServerMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderJSE.class);
+
+ /** Build from annotations
+ */
+ public UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi)
+ {
+ log.debug("START buildMetaData: [name=" + udi.getCanonicalName() + "]");
+ try
+ {
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setDeploymentName(udi.getCanonicalName());
+ wsMetaData.setClassLoader(udi.classLoader);
+
+ if (udi.classLoader == null)
+ throw new WSException("Deployment class loader not initialized");
+
+ // For every bean
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ Map<String, String> servletClassMap = webMetaData.getServletClassNames();
+ for (String servletName : servletClassMap.keySet())
+ {
+ String servletClassName = servletClassMap.get(servletName);
+ try
+ {
+ Class beanClass = udi.classLoader.loadClass(servletClassName);
+ setupEndpoint(wsMetaData, udi, beanClass, servletName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Cannot load service endpoint class: " + servletClassName);
+ }
+ }
+
+ log.debug("END buildMetaData: " + wsMetaData);
+ return wsMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+// $Id$
+package org.jboss.ws.metadata.builder.jaxws;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.management.ObjectName;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.ws.Provider;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
+import org.jboss.ws.metadata.builder.MetaDataBuilder;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.utils.JavaUtils;
+
+/**
+ * A server side meta data builder that is based on JSR-181 annotations
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @since 23-Jul-2005
+ */
+public class JAXWSProviderMetaDataBuilder extends JAXWSEndpointMetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(JAXWSProviderMetaDataBuilder.class);
+
+ /** Build from annotations
+ */
+
+ @Override
+ public ServerEndpointMetaData buildEndpoint(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName)
+ {
+ // 5.3 Conformance (Provider implementation): A Provider based service endpoint implementation MUST
+ // implement a typed Provider interface.
+ if (JavaUtils.isAssignableFrom(Provider.class, sepClass) == false)
+ throw new WebServiceException("Endpoint implementation does not implement javax.xml.ws.Provider: " + sepClass.getName());
+
+ // 5.4 Conformance (WebServiceProvider annotation): A Provider based service endpoint implementation
+ // MUST carry a WebServiceProvider annotation
+ WebServiceProvider anWebServiceProvider = (WebServiceProvider)sepClass.getAnnotation(WebServiceProvider.class);
+ if (anWebServiceProvider == null)
+ throw new WebServiceException("Cannot obtain @WebServiceProvider annotation from: " + sepClass.getName());
+
+ // 7.3 Conformance (WebServiceProvider and WebService): A class annotated with the WebServiceProvider
+ // annotation MUST NOT carry a WebService annotation
+ if (sepClass.isAnnotationPresent(WebService.class))
+ throw new WebServiceException("Provider cannot carry @WebService annotation: " + sepClass.getName());
+
+ WSDLUtils wsdlUtils = WSDLUtils.getInstance();
+
+ String name = wsdlUtils.getJustClassName(sepClass);
+
+ String serviceName = anWebServiceProvider.serviceName();
+ if (serviceName.length() == 0)
+ serviceName = name + "Service";
+
+ String targetNS = anWebServiceProvider.targetNamespace();
+ if (targetNS.length() == 0)
+ targetNS = wsdlUtils.getTypeNamespace(sepClass);
+
+ String portName = anWebServiceProvider.portName();
+ if (portName.length() == 0)
+ portName = name + "Port";
+
+ ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName));
+ wsMetaData.addService(serviceMetaData);
+
+ // Setup the ServerEndpointMetaData
+ QName portQName = new QName(targetNS, portName);
+ QName portTypeQName = new QName(targetNS, name);
+ ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portQName, portTypeQName, Type.JAXWS);
+ sepMetaData.setLinkName(linkName);
+
+ sepMetaData.setStyle(Style.DOCUMENT);
+ sepMetaData.setParameterStyle(ParameterStyle.BARE);
+
+ sepMetaData.setServiceEndpointImplName(sepClass.getName());
+ sepMetaData.setServiceEndpointInterfaceName(sepClass.getName());
+
+ ServiceMode anServiceMode = sepClass.getAnnotation(ServiceMode.class);
+ if (anServiceMode != null)
+ sepMetaData.setServiceMode(anServiceMode.value());
+ else sepMetaData.setServiceMode(Mode.PAYLOAD);
+
+ serviceMetaData.addEndpoint(sepMetaData);
+
+ // Process invoke method
+ processInvokeMethod(sepMetaData);
+
+ // Process WSDL
+ String wsdlLocation = anWebServiceProvider.wsdlLocation();
+ if (wsdlLocation != null)
+ serviceMetaData.setWsdlFile(wsdlLocation);
+
+ // Set the endpoint address
+ processPortComponent(udi, sepClass, linkName, sepMetaData);
+
+ // Init the endpoint address
+ MetaDataBuilder.initEndpointAddress(udi, sepMetaData, linkName);
+
+ // A provider may not have a WSDL file
+ if (sepMetaData.getServiceMetaData().getWsdlFile() != null)
+ MetaDataBuilder.replaceAddressLocation(sepMetaData);
+
+ // init service endpoint id
+ ObjectName sepID = MetaDataBuilder.getServiceEndpointID(udi, sepMetaData);
+ sepMetaData.setServiceEndpointID(sepID);
+
+ return sepMetaData;
+ }
+
+ private void processInvokeMethod(ServerEndpointMetaData epMetaData)
+ {
+ String javaName = "invoke";
+ String targetNS = epMetaData.getQName().getNamespaceURI();
+ OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, javaName), javaName);
+ epMetaData.addOperation(opMetaData);
+
+ Mode serviceMode = epMetaData.getServiceMode();
+ Class paramType = (serviceMode == Mode.MESSAGE ? SOAPMessage.class : Source.class);
+
+ // Setup invoke param
+ QName xmlName = new QName("invokeParam");
+ QName xmlType = Constants.TYPE_LITERAL_ANYTYPE;
+ ParameterMetaData pmd = new ParameterMetaData(opMetaData, xmlName, xmlType, paramType.getName());
+ opMetaData.addParameter(pmd);
+
+ // Setup invoke return
+ xmlName = new QName("invokeReturn");
+ ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, paramType.getName());
+ opMetaData.setReturnParameter(retMetaData);
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxws;
+
+// $Id$
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.deployment.JAXWSDeployment;
+import org.jboss.ws.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.builder.JAXWSMetaDataBuilder;
+
+/** An abstract annotation meta data builder.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 27-Jun-2006
+ */
+public abstract class JAXWSServerMetaDataBuilder extends JAXWSMetaDataBuilder
+{
+ public abstract UnifiedMetaData buildMetaData(UnifiedDeploymentInfo udi);
+
+ protected JAXWSEndpointMetaDataBuilder getEndpointBuilder(Class<?> bean)
+ {
+ if (bean.isAnnotationPresent(WebServiceProvider.class))
+ return new JAXWSProviderMetaDataBuilder();
+
+ if (bean.isAnnotationPresent(WebService.class))
+ return new JAXWSWebServiceMetaDataBuilder();
+
+ return null;
+ }
+
+ protected void setupEndpoint(UnifiedMetaData umd, UnifiedDeploymentInfo udi, Class<?> beanClass, String beanName)
+ throws SecurityException, ClassNotFoundException, NoSuchMethodException
+ {
+ JAXWSEndpointMetaDataBuilder builder = getEndpointBuilder(beanClass);
+ if (builder != null)
+ builder.buildEndpoint(umd, udi, beanClass, beanName);
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -0,0 +1,1011 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxws;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.HandlerChain;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPMessageHandlers;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.management.ObjectName;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+import javax.xml.ws.WebFault;
+import javax.xml.ws.addressing.AddressingProperties;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+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;
+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;
+import org.jboss.ws.jaxws.WrapperGenerator;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.FaultMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.TypeMappingMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.WrappedParameter;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.acessor.JAXBAccessor;
+import org.jboss.ws.metadata.builder.MetaDataBuilder;
+import org.jboss.ws.metadata.config.jaxws.WSEndpointConfigJAXWS;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.jsr181.HandlerChainFactory;
+import org.jboss.ws.metadata.jsr181.HandlerChainMetaData;
+import org.jboss.ws.metadata.jsr181.HandlerChainsMetaData;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.server.ServerConfigFactory;
+import org.jboss.ws.tools.jaxws.JAXBWSDLGenerator;
+import org.jboss.ws.tools.jaxws.WSDLGenerator;
+import org.jboss.ws.utils.HolderUtils;
+import org.jboss.ws.utils.IOUtils;
+import org.jboss.ws.utils.JBossWSEntityResolver;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
+
+/** An abstract annotation meta data builder.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @since 15-Oct-2005
+ */
+public class JAXWSWebServiceMetaDataBuilder extends JAXWSEndpointMetaDataBuilder
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JAXWSWebServiceMetaDataBuilder.class);
+
+ private WrapperGenerator wrapperGenerator;
+ private List<Class> javaTypes = new ArrayList<Class>();
+ private List<TypeReference> typeRefs = new ArrayList<TypeReference>();
+ private JAXBRIContext jaxbCtx;
+
+ public JAXWSWebServiceMetaDataBuilder()
+ {
+ }
+
+ public ServerEndpointMetaData buildEndpoint(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo udi, Class<?> sepClass, String linkName)
+ {
+ WebService anWebService = sepClass.getAnnotation(WebService.class);
+ if (anWebService == null)
+ throw new WSException("Cannot obtain @WebService annotation from: " + sepClass.getName());
+
+ try
+ {
+ Class<?> seiClass = null;
+ String seiName = null;
+
+ if (anWebService.endpointInterface().length() > 0)
+ {
+ seiName = anWebService.endpointInterface();
+ seiClass = udi.classLoader.loadClass(seiName);
+ anWebService = seiClass.getAnnotation(WebService.class);
+
+ if (anWebService == null)
+ throw new WSException("Interface does not have a @WebService annotation: " + seiName);
+ }
+ else
+ {
+
+ WebService seiAnnotation = null;
+
+ for(Class<?> potentialSEI : sepClass.getInterfaces())
+ {
+ if(potentialSEI.isAnnotationPresent(WebService.class))
+ {
+ seiClass = potentialSEI;
+ seiName = seiClass.getName();
+ seiAnnotation = sepClass.getAnnotation(WebService.class);
+ break;
+ }
+ }
+
+ if(seiAnnotation!=null)
+ anWebService = seiAnnotation;
+ }
+
+ // Clear the java types, etc.
+ resetMetaDataBuilder(udi.classLoader);
+
+ Class<?> wsClass = (seiClass != null ? seiClass : sepClass);
+
+ WSDLUtils wsdlUtils = WSDLUtils.getInstance();
+
+ String name = anWebService.name();
+ if (name.length() == 0)
+ name = wsdlUtils.getJustClassName(wsClass);
+
+ String serviceName = anWebService.serviceName();
+ if (serviceName.length() == 0)
+ serviceName = name + "Service";
+
+ String targetNS = anWebService.targetNamespace();
+ if (targetNS.length() == 0)
+ targetNS = wsdlUtils.getTypeNamespace(wsClass);
+
+ String portName = anWebService.portName();
+ if (portName.length() == 0)
+ portName = name + "Port";
+
+ ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName));
+ wsMetaData.addService(serviceMetaData);
+
+ // Setup the ServerEndpointMetaData
+ QName portQName = new QName(targetNS, portName);
+ QName portTypeQName = new QName(targetNS, name);
+ ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portQName, portTypeQName, EndpointMetaData.Type.JAXWS);
+ sepMetaData.setLinkName(linkName);
+
+ // Assign the WS-Security configuration,
+ WSSecurityConfiguration securityConfiguration = MetaDataBuilder.getWsSecurityConfiguration(udi);
+ serviceMetaData.setSecurityConfiguration(securityConfiguration);
+
+ sepMetaData.setServiceEndpointImplName(sepClass.getName());
+ sepMetaData.setServiceEndpointInterfaceName(wsClass.getName());
+
+ serviceMetaData.addEndpoint(sepMetaData);
+
+ // Process an optional @SOAPBinding annotation
+ if (wsClass.isAnnotationPresent(SOAPBinding.class))
+ processSOAPBinding(sepMetaData, wsClass);
+
+ // Process an optional @BindingType annotation
+ if (wsClass.isAnnotationPresent(BindingType.class))
+ processBindingType(sepMetaData, wsClass);
+
+ boolean includeAllMethods = (wsClass == seiClass);
+ processWebMethods(sepMetaData, wsClass, includeAllMethods);
+
+ // Initialize types
+ createJAXBContext(sepMetaData);
+ populateXmlTypes(sepMetaData);
+
+ // Process or generate WSDL
+ String wsdlLocation = anWebService.wsdlLocation();
+ processOrGenerateWSDL(wsClass, serviceMetaData, wsdlLocation, sepMetaData);
+
+ // Read the generated WSDL and initialize the schema model
+ // FIXME - This should be removed
+ WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
+ JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
+ serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel);
+
+ // Set the endpoint address
+ processPortComponent(udi, wsClass, linkName, sepMetaData);
+
+ // Init the endpoint address
+ MetaDataBuilder.initEndpointAddress(udi, sepMetaData, linkName);
+
+ // replace the SOAP address
+ MetaDataBuilder.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.");
+
+ // Add pre handlers
+ WSEndpointConfigJAXWS jaxrpcConfig = (WSEndpointConfigJAXWS)sepMetaData.getEndpointConfig();
+ sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.PRE));
+
+ // Process an optional @HandlerChain annotation
+ if (sepClass.isAnnotationPresent(HandlerChain.class))
+ processHandlerChain(sepMetaData, sepClass);
+ else if (wsClass.isAnnotationPresent(HandlerChain.class))
+ processHandlerChain(sepMetaData, wsClass);
+
+ // Add post handlers
+ sepMetaData.addHandlers(jaxrpcConfig.getHandlers(sepMetaData, HandlerType.POST));
+
+ // init service endpoint id
+ ObjectName sepID = MetaDataBuilder.getServiceEndpointID(udi, sepMetaData);
+ sepMetaData.setServiceEndpointID(sepID);
+
+ return sepMetaData;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot build meta data: " + ex.getMessage(), ex);
+ }
+ }
+
+ protected void resetMetaDataBuilder(ClassLoader loader)
+ {
+ wrapperGenerator = new DynamicWrapperGenerator(loader);
+ javaTypes.clear();
+ typeRefs.clear();
+ jaxbCtx = null;
+ }
+
+ protected void createJAXBContext(EndpointMetaData epMetaData)
+ {
+ try
+ {
+ String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
+ log.debug("JAXBContext [types=" + javaTypes + ",tns=" + targetNS + "]");
+ jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs, targetNS, false);
+ }
+ catch (JAXBException ex)
+ {
+ throw new IllegalStateException("Cannot build JAXB context", ex);
+ }
+ }
+
+ protected void populateXmlTypes(EndpointMetaData epMetaData)
+ {
+ for (OperationMetaData operation : epMetaData.getOperations())
+ {
+ // parameters
+ for (ParameterMetaData paramMetaData : operation.getParameters())
+ {
+ populateXmlType(paramMetaData);
+ }
+
+ // return value
+ ParameterMetaData returnParameter = operation.getReturnParameter();
+ if (returnParameter != null)
+ populateXmlType(returnParameter);
+
+ // faults
+ for (FaultMetaData faultMetaData : operation.getFaults())
+ {
+ populateXmlType(faultMetaData);
+ }
+ }
+ }
+
+ private void populateXmlType(ParameterMetaData paramMetaData)
+ {
+ EndpointMetaData epMetaData = paramMetaData.getOperationMetaData().getEndpointMetaData();
+ TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
+
+ QName xmlName = paramMetaData.getXmlName();
+ QName xmlType = paramMetaData.getXmlType();
+ Class javaType = paramMetaData.getJavaType();
+ String javaName = paramMetaData.getJavaTypeName();
+
+ if (xmlType == null)
+ {
+ try
+ {
+ xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IllegalStateException("Cannot obtain xml type for: [xmlName=" + xmlName + ",javaName=" + javaName + "]");
+ }
+
+ /* Anonymous type.
+ *
+ * Currently the design of our stack is based on the
+ * notion of their always being a unique type. In order to lookup the
+ * appropriate (de)serializer you must have a type. So we use a fake
+ * name. This is an illegal NCName, so it shouldn't collide.
+ */
+ if (xmlType == null)
+ xmlType = new QName(xmlName.getNamespaceURI(), ">" + xmlName.getLocalPart());
+
+ paramMetaData.setXmlType(xmlType);
+ }
+
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
+ }
+
+ private void populateXmlType(FaultMetaData faultMetaData)
+ {
+ EndpointMetaData epMetaData = faultMetaData.getOperationMetaData().getEndpointMetaData();
+ TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
+
+ QName xmlType = faultMetaData.getXmlType();
+ String faultBeanName = faultMetaData.getFaultBeanName();
+
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName));
+ }
+
+ protected void processSOAPBinding(EndpointMetaData epMetaData, Class<?> wsClass)
+ {
+ SOAPBinding anSoapBinding = (SOAPBinding)wsClass.getAnnotation(SOAPBinding.class);
+
+ SOAPBinding.Style attrStyle = anSoapBinding.style();
+ Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC : Style.DOCUMENT);
+ epMetaData.setStyle(style);
+
+ SOAPBinding.Use attrUse = anSoapBinding.use();
+ if (attrUse == SOAPBinding.Use.ENCODED)
+ throw new WSException("SOAP encoding is not supported for JSR-181 deployments");
+
+ epMetaData.setEncodingStyle(Use.LITERAL);
+
+ ParameterStyle paramStyle = anSoapBinding.parameterStyle();
+ epMetaData.setParameterStyle(paramStyle);
+ }
+
+ private WebParam getWebParamAnnotation(Method method, int pos)
+ {
+ for (Annotation annotation : method.getParameterAnnotations()[pos])
+ if (annotation instanceof WebParam)
+ return (WebParam)annotation;
+
+ return null;
+ }
+
+ protected void processWebMethods(EndpointMetaData epMetaData, Class wsClass, boolean includeAllMethods)
+ {
+ epMetaData.clearOperations();
+
+ // Process an @WebMethod annotations
+ int webMethodCount = 0;
+ for (Method method : wsClass.getMethods())
+ {
+ if (includeAllMethods || method.isAnnotationPresent(WebMethod.class))
+ {
+ processWebMethod(epMetaData, method);
+ webMethodCount++;
+ }
+ }
+
+ // @WebService should expose all inherited methods if @WebMethod is never specified
+ // http://jira.jboss.org/jira/browse/JBWS-754
+ if (webMethodCount == 0)
+ {
+ Class superClass = wsClass.getSuperclass();
+
+ while (superClass != null)
+ {
+ boolean isJDKClass = superClass.getPackage().getName().startsWith("java");
+
+ if(!isJDKClass)
+ {
+ for (Method method : superClass.getMethods())
+ {
+ processWebMethod(epMetaData, method);
+ webMethodCount++;
+ }
+
+ superClass = superClass.getSuperclass();
+
+ }
+ }
+ }
+
+ if (webMethodCount == 0)
+ throw new WSException("At least one @WebMethod annotation is required");
+ }
+
+ private void processWebMethod(EndpointMetaData epMetaData, Method method)
+ {
+ String javaName = method.getName();
+
+ // skip asnyc methods, they dont need meta data representation
+ if(method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
+ return;
+
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+ TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData();
+ String targetNS = epMetaData.getQName().getNamespaceURI();
+
+ // reflection defaults
+ String soapAction = "";
+ String operationName = method.getName();
+
+ // annotation values that override defaults
+ if (method.isAnnotationPresent(WebMethod.class))
+ {
+ WebMethod anWebMethod = method.getAnnotation(WebMethod.class);
+ soapAction = anWebMethod.action();
+ if (anWebMethod.operationName().length() > 0)
+ {
+ operationName = anWebMethod.operationName();
+ }
+ }
+
+ OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, operationName), javaName);
+ opMetaData.setOneWayOperation(method.isAnnotationPresent(Oneway.class));
+ opMetaData.setSOAPAction(soapAction);
+ epMetaData.addOperation(opMetaData);
+
+ // Build parameter meta data
+ Class[] parameterTypes = method.getParameterTypes();
+ Type[] genericTypes = method.getGenericParameterTypes();
+ Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+ ParameterMetaData wrapperParameter = null, wrapperOutputParameter = null;
+ List<WrappedParameter> wrappedParameters = null, wrappedOutputParameters = null;
+
+ // Force paramter style to wrapped
+ if (method.isAnnotationPresent(RequestWrapper.class) || method.isAnnotationPresent(ResponseWrapper.class))
+ {
+ epMetaData.setParameterStyle(ParameterStyle.WRAPPED);
+ }
+
+ if (opMetaData.isDocumentWrapped())
+ {
+ wrapperParameter = createRequestWrapper(opMetaData, method);
+ wrappedParameters = new ArrayList<WrappedParameter>(parameterTypes.length);
+ wrapperParameter.setWrappedParameters(wrappedParameters);
+
+ if (!opMetaData.isOneWay())
+ {
+ wrapperOutputParameter = createResponseWrapper(opMetaData, method);
+ wrappedOutputParameters = new ArrayList<WrappedParameter>(parameterTypes.length + 1);
+ wrapperOutputParameter.setWrappedParameters(wrappedOutputParameters);
+ }
+ }
+
+ for (int i = 0; i < parameterTypes.length; i++)
+ {
+ Class javaType = parameterTypes[i];
+ Type genericType = genericTypes[i];
+ String javaTypeName = javaType.getName();
+ WebParam anWebParam = getWebParamAnnotation(method, i);
+ boolean isHeader = anWebParam != null && anWebParam.header();
+ boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
+ ParameterMode mode = getParameterMode(anWebParam, javaType);
+
+ // Assert one-way
+ if (opMetaData.isOneWay() && mode != ParameterMode.IN)
+ throw new IllegalArgumentException("A one-way operation can not have output parameters [" + "method = " + method.getName() + ", parameter = " + i + "]");
+
+ if (HolderUtils.isHolderType(javaType))
+ {
+ genericType = HolderUtils.getGenericValueType(genericType);
+ javaType = JavaUtils.erasure(genericType);
+ javaTypeName = javaType.getName();
+ }
+
+ if (isWrapped)
+ {
+ QName wrappedElementName = getWebParamName(opMetaData, i, javaType, anWebParam);
+ String variable = convertToVariable(wrappedElementName.getLocalPart());
+
+ WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName, javaTypeName, variable, i);
+ wrappedParameter.setTypeArguments(convertTypeArguments(javaType, genericType));
+
+ if (mode != ParameterMode.OUT)
+ wrappedParameters.add(wrappedParameter);
+ if (mode != ParameterMode.IN)
+ {
+ wrappedOutputParameters.add(wrappedParameter);
+ wrappedParameter.setHolder(true);
+ }
+ }
+ else
+ {
+ QName xmlName = getWebParamName(opMetaData, i, javaType, anWebParam);
+
+ ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, javaTypeName);
+ paramMetaData.setInHeader(isHeader);
+ paramMetaData.setIndex(i);
+ paramMetaData.setMode(mode);
+
+ opMetaData.addParameter(paramMetaData);
+ javaTypes.add(javaType);
+ typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i]));
+ }
+ }
+
+ // Build result meta data
+ Class returnType = method.getReturnType();
+ Type genericReturnType = method.getGenericReturnType();
+ String returnTypeName = returnType.getName();
+ if ((returnType == void.class) == false)
+ {
+ if (opMetaData.isOneWay())
+ throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");
+
+ WebResult anWebResult = method.getAnnotation(WebResult.class);
+ boolean isHeader = anWebResult != null && anWebResult.header();
+ boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
+ QName xmlName = getWebResultName(opMetaData, returnType, anWebResult);
+
+ if (isWrapped)
+ {
+ WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1);
+ wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType));
+
+ // insert at the beginning just for prettiness
+ wrappedOutputParameters.add(0, wrapped);
+ }
+ else
+ {
+ ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName);
+ retMetaData.setInHeader(isHeader);
+ opMetaData.setReturnParameter(retMetaData);
+
+ javaTypes.add(returnType);
+ typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations()));
+ }
+ }
+
+ // Generate wrapper beans
+ if (opMetaData.isDocumentWrapped())
+ {
+ wrapperGenerator.generate(wrapperParameter);
+ Class wrapperClass = wrapperParameter.getJavaType();
+ javaTypes.add(wrapperClass);
+ // In case there is no @XmlRootElement
+ typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass));
+ if (!opMetaData.isOneWay())
+ {
+ wrapperGenerator.generate(wrapperOutputParameter);
+ wrapperClass = wrapperOutputParameter.getJavaType();
+ javaTypes.add(wrapperClass);
+ // In case there is no @XmlRootElement
+ typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(), wrapperClass));
+ }
+ }
+
+ // Add faults
+ for (Class exClass : method.getExceptionTypes())
+ if (!RemoteException.class.isAssignableFrom(exClass))
+ addFault(opMetaData, exClass);
+
+ // process op meta data extension
+ processMetaExtensions(epMetaData, opMetaData);
+ }
+
+ private ParameterMode getParameterMode(WebParam anWebParam, Class javaType)
+ {
+ if (anWebParam != null)
+ {
+ if (anWebParam.mode() == WebParam.Mode.INOUT)
+ return ParameterMode.INOUT;
+ if (anWebParam.mode() == WebParam.Mode.OUT)
+ return ParameterMode.OUT;
+ }
+
+ return HolderUtils.isHolderType(javaType) ? ParameterMode.INOUT : ParameterMode.IN;
+ }
+
+ private ParameterMetaData createResponseWrapper(OperationMetaData operation, Method method)
+ {
+ QName operationQName = operation.getQName();
+ QName xmlName = new QName(operationQName.getNamespaceURI(), operationQName.getLocalPart() + "Response");
+ QName xmlType = xmlName;
+
+ String responseWrapperType = null;
+ if (method.isAnnotationPresent(ResponseWrapper.class))
+ {
+ ResponseWrapper anResWrapper = method.getAnnotation(ResponseWrapper.class);
+
+ String localName = anResWrapper.localName().length() > 0 ? anResWrapper.localName() : xmlName.getLocalPart();
+ String targetNamespace = anResWrapper.targetNamespace().length() > 0 ? anResWrapper.targetNamespace() : xmlName.getNamespaceURI();
+ xmlName = new QName(targetNamespace, localName);
+
+ if (anResWrapper.className().length() > 0)
+ responseWrapperType = anResWrapper.className();
+ }
+
+ if (responseWrapperType == null)
+ {
+ String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) + ".jaxws";
+ responseWrapperType = packageName + "." + JavaUtils.capitalize(method.getName()) + "Response";
+ }
+
+ ParameterMetaData retMetaData = new ParameterMetaData(operation, xmlName, xmlType, responseWrapperType);
+ retMetaData.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
+ operation.setReturnParameter(retMetaData);
+
+ return retMetaData;
+ }
+
+ private ParameterMetaData createRequestWrapper(OperationMetaData operation, Method method)
+ {
+ String requestWrapperType = null;
+ QName xmlName = operation.getQName();
+ QName xmlType = xmlName;
+ if (method.isAnnotationPresent(RequestWrapper.class))
+ {
+ RequestWrapper anReqWrapper = method.getAnnotation(RequestWrapper.class);
+
+ String localName = anReqWrapper.localName().length() > 0 ? anReqWrapper.localName() : xmlName.getLocalPart();
+ String targetNamespace = anReqWrapper.targetNamespace().length() > 0 ? anReqWrapper.targetNamespace() : xmlName.getNamespaceURI();
+ xmlName = new QName(targetNamespace, localName);
+
+ if (anReqWrapper.className().length() > 0)
+ requestWrapperType = anReqWrapper.className();
+ }
+
+ // Conformance 3.18, the default value must be the same as the method name
+ if (requestWrapperType == null)
+ {
+ String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) + ".jaxws";
+ requestWrapperType = packageName + "." + JavaUtils.capitalize(method.getName());
+ }
+
+ // JAX-WS p.37 pg.1, the annotation only affects the element name, not the type name
+ ParameterMetaData wrapperParameter = new ParameterMetaData(operation, xmlName, xmlType, requestWrapperType);
+ wrapperParameter.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
+ operation.addParameter(wrapperParameter);
+
+ return wrapperParameter;
+ }
+
+ private String convertToVariable(String localName)
+ {
+ return JAXBRIContext.mangleNameToVariableName(localName);
+ }
+
+ /**
+ * Process an optional @HandlerChain annotation
+ *
+ * Location of the handler chain file. The location supports 2 formats.
+ *
+ * 1. An absolute java.net.URL in externalForm.
+ * (ex: http://myhandlers.foo.com/handlerfile1.xml)
+ *
+ * 2. A relative path from the source file or class file.
+ * (ex: bar/handlerfile1.xml)
+ */
+ protected void processHandlerChain(EndpointMetaData epMetaData, Class<?> wsClass)
+ {
+ if (wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
+ throw new WSException("Cannot combine @HandlerChain with @SOAPMessageHandlers");
+
+ HandlerChain anHandlerChain = (HandlerChain)wsClass.getAnnotation(HandlerChain.class);
+
+ URL fileURL = null;
+ String filename = anHandlerChain.file();
+
+ // Try the filename as URL
+ try
+ {
+ fileURL = new URL(filename);
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+
+ // Try the filename as File
+ if (fileURL == null)
+ {
+ try
+ {
+ File file = new File(filename);
+ if (file.exists())
+ fileURL = file.toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+
+ // Try the filename as Resource
+ if (fileURL == null)
+ {
+ fileURL = epMetaData.getClassLoader().getResource(filename);
+ }
+
+ // Try the filename relative to class
+ if (fileURL == null)
+ {
+ String packagePath = wsClass.getPackage().getName().replace('.', '/');
+ fileURL = epMetaData.getClassLoader().getResource(packagePath + "/" + filename);
+ }
+
+ if (fileURL == null)
+ throw new WSException("Cannot resolve handler file '" + filename + "' on " + wsClass.getName());
+
+ try
+ {
+ HandlerChainsMetaData handlerChainsMetaData = null;
+ InputStream is = fileURL.openStream();
+ try
+ {
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ unmarshaller.setValidation(true);
+ unmarshaller.setSchemaValidation(true);
+ unmarshaller.setEntityResolver(new JBossWSEntityResolver());
+ ObjectModelFactory factory = new HandlerChainFactory();
+ handlerChainsMetaData = (HandlerChainsMetaData)unmarshaller.unmarshal(is, factory, null);
+ }
+ finally
+ {
+ is.close();
+ }
+
+ // Setup the endpoint handlers
+ for (HandlerChainMetaData handlerChainMetaData : handlerChainsMetaData.getHandlerChains())
+ {
+ for (UnifiedHandlerMetaData uhmd : handlerChainMetaData.getHandlers())
+ {
+ epMetaData.addHandler(uhmd.getHandlerMetaDataJAXWS(epMetaData, HandlerType.ENDPOINT));
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot process handler chain: " + filename, ex);
+ }
+ }
+
+ private QName getWebParamName(OperationMetaData opMetaData, int index, Class javaType, WebParam webParam)
+ {
+ String namespace = null ;
+ String name = null;
+ boolean header = false;
+
+ if (webParam != null)
+ {
+ if (webParam.targetNamespace().length() > 0)
+ namespace = webParam.targetNamespace();
+
+ if (webParam.name().length() > 0)
+ name = webParam.name();
+
+ header = webParam.header();
+ }
+
+ // Bare and headers must be qualified
+ if (namespace == null && (opMetaData.isDocumentBare() || header))
+ namespace = opMetaData.getQName().getNamespaceURI();
+
+ // RPC body parts must have no namespace
+ else if (opMetaData.isRPCLiteral() && !header)
+ namespace = null;
+
+ // Bare uses the operation name as the default, everything else is generated
+ if (name == null)
+ name = opMetaData.isDocumentBare() && !header ? opMetaData.getQName().getLocalPart() : "arg" + index;
+
+ return (namespace != null) ? new QName(namespace, name) : new QName(name);
+ }
+
+ private QName getWebResultName(OperationMetaData opMetaData, Class javaType, WebResult anWebResult)
+ {
+ String name = null;
+ String namespace = null;
+ boolean header = false;
+
+ if (anWebResult != null)
+ {
+ if (anWebResult.targetNamespace().length() > 0)
+ namespace = anWebResult.targetNamespace();
+
+ if (anWebResult.name().length() > 0)
+ name = anWebResult.name();
+
+ header = anWebResult.header();
+ }
+
+ // Bare and headers must be qualified
+ if (namespace == null && (opMetaData.isDocumentBare() || header))
+ namespace = opMetaData.getQName().getNamespaceURI();
+
+ // RPC body parts must have no namespace
+ else if (opMetaData.isRPCLiteral() && !header)
+ namespace = null;
+
+ // Bare uses the operation name as the default, everything else is generated
+ if (name == null)
+ name = opMetaData.isDocumentBare() && !header ? opMetaData.getResponseName().getLocalPart() : "return";
+
+ return (namespace != null) ? new QName(namespace, name) : new QName(name);
+ }
+
+ private void addFault(OperationMetaData omd, Class<?> exception)
+ {
+ if (omd.isOneWay())
+ throw new IllegalStateException("JSR-181 4.3.1 - A JSR-181 processor is REQUIRED to report an error if an operation marked "
+ + "@Oneway has a return value, declares any checked exceptions or has any INOUT or OUT parameters.");
+
+ WebFault annotation = exception.getAnnotation(WebFault.class);
+
+ String name;
+ String namespace;
+ String faultBeanName = null;
+
+ // Only the element name is effected by @WebFault, the type uses the same convention
+ QName xmlType = new QName(omd.getQName().getNamespaceURI(), exception.getSimpleName());
+
+ /*
+ * If @WebFault is present, and the exception contains getFaultInfo, the
+ * return value should be used. Otherwise we need to generate the bean.
+ */
+ boolean generate = true;
+ if (annotation != null)
+ {
+ name = annotation.name();
+ namespace = annotation.targetNamespace();
+ if (namespace.length() == 0)
+ namespace = omd.getQName().getNamespaceURI();
+
+ Class<?> faultBean = getFaultInfo(exception);
+ if (faultBean != null)
+ {
+ generate = false;
+ faultBeanName = faultBean.getName();
+ }
+ }
+ else
+ {
+ name = xmlType.getLocalPart();
+ namespace = xmlType.getNamespaceURI();
+ }
+
+ if (faultBeanName == null)
+ faultBeanName = JavaUtils.getPackageName(omd.getEndpointMetaData().getServiceEndpointInterface()) + ".jaxws." + exception.getSimpleName() + "Bean";
+
+ QName xmlName = new QName(namespace, name);
+
+ FaultMetaData fmd = new FaultMetaData(omd, xmlName, xmlType, exception.getName());
+ fmd.setFaultBeanName(faultBeanName);
+
+ if (generate)
+ wrapperGenerator.generate(fmd);
+
+ javaTypes.add(fmd.getFaultBean());
+ typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));
+
+ omd.addFault(fmd);
+ }
+
+ private Class<?> getFaultInfo(Class<?> exception)
+ {
+ try
+ {
+ Method method = exception.getMethod("getFaultInfo");
+ Class<?> returnType = method.getReturnType();
+ if (returnType == void.class)
+ return null;
+
+ return returnType;
+ }
+ catch (SecurityException e)
+ {
+ throw new WSException("Unexpected security exception: " + e.getMessage(), e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ }
+
+ private String[] convertTypeArguments(Class rawType, Type type)
+ {
+ if (!Collection.class.isAssignableFrom(rawType) && !Map.class.isAssignableFrom(rawType))
+ return null;
+
+ if (!(type instanceof ParameterizedType))
+ return null;
+
+ ParameterizedType paramType = (ParameterizedType)type;
+ Type[] arguments = paramType.getActualTypeArguments();
+ String[] ret = new String[arguments.length];
+ for (int i = 0; i < arguments.length; i++)
+ ret[i] = JavaUtils.erasure(arguments[i]).getName();
+
+ return ret;
+ }
+
+ /**
+ * Process operation meta data extensions.
+ */
+ private void processMetaExtensions(EndpointMetaData epMetaData, OperationMetaData opMetaData)
+ {
+ // Until there is a addressing annotion we fallback to implicit action asosciation
+ // TODO: figure out a way to assign message name instead of IN and OUT
+ String tns = epMetaData.getQName().getNamespaceURI();
+ String portTypeName = epMetaData.getQName().getLocalPart();
+
+ AddressingProperties ADDR = new AddressingPropertiesImpl();
+ AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
+ addrExt.setInboundAction(tns + "/" + portTypeName + "/IN");
+
+ if (!opMetaData.isOneWay())
+ addrExt.setOutboundAction(tns + "/" + portTypeName + "/OUT");
+
+ opMetaData.addExtension(addrExt);
+ }
+
+ protected void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, String wsdlLocation, EndpointMetaData epMetaData)
+ {
+ if (wsdlLocation.length() > 0)
+ {
+ serviceMetaData.setWsdlFile(wsdlLocation);
+ }
+ else
+ {
+ try
+ {
+ String serviceName = serviceMetaData.getServiceName().getLocalPart();
+
+ WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
+ WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
+
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws");
+ tmpdir.mkdirs();
+
+ File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl", tmpdir);
+ wsdlTmpFile.deleteOnExit();
+
+ Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile, Constants.DEFAULT_XML_CHARSET);
+ wsdlDefinitions.write(writer, Constants.DEFAULT_XML_CHARSET);
+ writer.close();
+
+ serviceMetaData.setWsdlFile(wsdlTmpFile.toURL().toExternalForm());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot write generated wsdl", e);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java 2006-11-19 21:49:36 UTC (rev 1467)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java 2006-11-20 04:58:20 UTC (rev 1468)
@@ -65,11 +65,11 @@
this.sepMetaData = sepMetaData;
// Set the endpoint type
- if (udi.type == DeploymentType.JSR109_JSE || udi.type == DeploymentType.JSR181_JSE || udi.type == DeploymentType.JAXWS_PROVIDER_JSE)
+ if (udi.type == DeploymentType.JAXRPC_JSE || udi.type == DeploymentType.JAXWS_JSE)
{
this.type = EndpointType.JSE;
}
- else if (udi.type == DeploymentType.JSR109_EJB21 || udi.type == DeploymentType.JSR181_EJB21 || udi.type == DeploymentType.JAXWS_PROVIDER_EJB21)
+ else if (udi.type == DeploymentType.JAXRPC_EJB21 || udi.type == DeploymentType.JAXWS_EJB21)
{
String ejbName = sepMetaData.getLinkName();
if (ejbName == null)
@@ -89,7 +89,7 @@
this.type = EndpointType.MDB21;
}
}
- else if (udi.type == DeploymentType.JSR181_EJB3 || udi.type == DeploymentType.JAXWS_PROVIDER_EJB3)
+ else if (udi.type == DeploymentType.JAXRPC_EJB3 || udi.type == DeploymentType.JAXWS_EJB3)
{
this.type = EndpointType.SLSB30;
}
18 years, 1 month
JBossWS SVN: r1467 - branches/tdiesler
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-19 16:49:36 -0500 (Sun, 19 Nov 2006)
New Revision: 1467
Added:
branches/tdiesler/trunk/
Log:
recreate from -r1466
Copied: branches/tdiesler/trunk (from rev 1466, trunk)
18 years, 1 month