Author: thomas.diesler(a)jboss.com
Date: 2007-04-12 05:11:42 -0400 (Thu, 12 Apr 2007)
New Revision: 2825
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
Log:
<port-component-ref> handling. Fix QName handling
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java 2007-04-12
08:41:55 UTC (rev 2824)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java 2007-04-12
09:11:42 UTC (rev 2825)
@@ -103,9 +103,7 @@
}
else if (localName.equals("service-qname"))
{
- if (value.indexOf("{") != -1)
- ref.setServiceQName(QName.valueOf(value));
- else ref.setServiceQName(navigator.resolveQName(value));
+ ref.setServiceQName(getQNameValue(navigator, value));
}
/* JBoss properties */
@@ -137,6 +135,7 @@
if (localName.equals("port-component-ref"))
{
child = new UnifiedPortComponentRefMetaData(ref);
+ ref.addPortComponentRef((UnifiedPortComponentRefMetaData)child);
}
else if (localName.equals("handler"))
{
@@ -169,11 +168,9 @@
private void setValue(UnifiedPortComponentRefMetaData pcref, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
{
- UnifiedServiceRefMetaData srefMetaData = pcref.getServiceRefMetaData();
if (localName.equals("service-endpoint-interface"))
{
pcref.setServiceEndpointInterface(value);
- srefMetaData.addPortComponentRef(pcref);
}
else if (localName.equals("enable-mtom"))
{
@@ -185,16 +182,7 @@
}
else if (localName.equals("port-qname"))
{
- QName portQName = QName.valueOf(value);
- pcref.setPortQName(portQName);
-
- String seiName = pcref.getServiceEndpointInterface();
- UnifiedPortComponentRefMetaData portComponentRef =
srefMetaData.getPortComponentRef(seiName, portQName);
-
- if (portComponentRef == null)
- srefMetaData.addPortComponentRef(pcref);
- else
- portComponentRef.setPortQName(portQName);
+ pcref.setPortQName(getQNameValue(navigator, value));
}
else if (localName.equals("config-name"))
{
@@ -226,11 +214,11 @@
{
if (localName.equals("service-name-pattern"))
{
- ref.setServiceNamePattern(QName.valueOf(value));
+ ref.setServiceNamePattern(getQNameValue(navigator, value));
}
else if (localName.equals("port-name-pattern"))
{
- ref.setPortNamePattern(QName.valueOf(value));
+ ref.setPortNamePattern(getQNameValue(navigator, value));
}
else if (localName.equals("protocol-binding"))
{
@@ -250,7 +238,7 @@
}
else if (localName.equals("soap-header"))
{
- ref.addSoapHeader(navigator.resolveQName(value));
+ ref.addSoapHeader(getQNameValue(navigator, value));
}
else if (localName.equals("soap-role"))
{
@@ -308,4 +296,10 @@
ref.setPropValue(value);
}
}
+
+ private QName getQNameValue(UnmarshallingContext navigator, String value)
+ {
+ QName qname = (value.startsWith("{") ? QName.valueOf(value) :
navigator.resolveQName(value));
+ return qname;
+ }
}
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java 2007-04-12
08:41:55 UTC (rev 2824)
+++
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java 2007-04-12
09:11:42 UTC (rev 2825)
@@ -23,13 +23,14 @@
// $Id$
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
import org.jboss.ws.integration.ServiceRefElement;
import org.w3c.dom.Element;
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.List;
-
/** The metdata data from service-ref/port-component-ref element in web.xml, ejb-jar.xml,
and application-client.xml.
*
* @author Thomas.Diesler(a)jboss.org
@@ -67,7 +68,7 @@
configName = pcref.configName;
configFile = pcref.configFile;
callProperties = pcref.callProperties;
- stubProperties = pcref.stubProperties;
+ stubProperties = pcref.stubProperties;
}
public UnifiedServiceRefMetaData getServiceRefMetaData()
@@ -140,7 +141,7 @@
{
callProperties.add(callProp);
}
-
+
public List<UnifiedStubPropertyMetaData> getStubProperties()
{
return stubProperties;
@@ -155,7 +156,7 @@
{
stubProperties.add(stubProp);
}
-
+
public String getConfigFile()
{
return configFile;
@@ -188,23 +189,22 @@
public boolean matches(String seiName, QName portName)
{
- if(seiName==null && portName == null)
- throw new IllegalArgumentException("Cannot match " + this + "
against seiName=null && portName=null."+
- "Looks like a broken service-ref setup");
+ if (seiName == null && portName == null)
+ throw new IllegalArgumentException("Cannot match against seiName=null
&& portName=null.");
boolean match = false;
// match against portName first
- if(portName!=null)
+ if (portName != null)
match = portName.equals(getPortQName());
// if it fails try seiName
- if (!match)
+ if (match == false)
match = seiName.equals(getServiceEndpointInterface());
return match;
}
-
+
public String toString()
{
StringBuilder str = new StringBuilder();
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java 2007-04-12
08:41:55 UTC (rev 2824)
+++
trunk/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java 2007-04-12
09:11:42 UTC (rev 2825)
@@ -117,17 +117,12 @@
for (UnifiedPortComponentRefMetaData pcref : sourceRef.getPortComponentRefs())
{
String seiName = pcref.getServiceEndpointInterface();
- if (seiName == null)
- {
- log.warn("*** Ignore <port-component-ref> with null
<service-endpoint-interface>");
- //continue;
- }
+ QName portQName = pcref.getPortQName();
+ UnifiedPortComponentRefMetaData targetPCRef = getPortComponentRef(seiName,
portQName);
- UnifiedPortComponentRefMetaData targetPCRef = getPortComponentRef(seiName,
pcref.getPortQName());
-
if (targetPCRef == null)
{
- log.warn("Cannot find port component ref with SEI name: " +
seiName);
+ log.warn("Cannot find port component ref: [sei=" + seiName +
",port=" + portQName + "]");
addPortComponentRef(pcref);
targetPCRef = pcref;
}
@@ -191,13 +186,14 @@
public UnifiedPortComponentRefMetaData getPortComponentRef(String seiName, QName
portName)
{
UnifiedPortComponentRefMetaData matchingRef = null;
-
for (UnifiedPortComponentRefMetaData ref : portComponentRefs)
{
if (ref.matches(seiName, portName))
{
+ if (matchingRef != null)
+ log.warn("Multiple matching port component ref: [sei=" + seiName
+ ",port=" + portName + "]");
+
matchingRef = ref;
- break;
}
}
return matchingRef;