Author: jkaputin
Date: Wed Aug 1 07:20:25 2007
New Revision: 561808
URL: http://svn.apache.org/viewvc?view=rev&rev=561808
Log:
WODEN-172
Corrected handling of namespace prefix and derived
faults/operations with interface extension.
Also, added Flickr test to the W3Ctests.catalog file.
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java
incubator/woden/trunk/java/src/org/apache/woden/internal/OMXMLElement.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
incubator/woden/trunk/java/test/org/apache/woden/resolver/resources/W3Ctests.catalog
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java?view=diff&rev=561808&r1=561807&r2=561808
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java
(original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java
Wed Aug 1 07:20:25 2007
@@ -131,27 +131,19 @@
String localPart = prefixedValue.substring(index + 1);
String namespaceURI = getNamespaceFromPrefix(el, prefix);
- if (namespaceURI != null) {
- return new QName(namespaceURI,localPart,
- prefix != null ? prefix : "");
- }
- else{
- String faultCode = (prefix == null)
- ? WSDLException.NO_PREFIX_SPECIFIED
- : WSDLException.UNBOUND_PREFIX;
-
- String msg = fErrorReporter.getFormattedMessage(
- "WSDL513",
- new Object[] {prefixedValue,
DOMQNameUtils.newQName(el)});
-
- WSDLException wsdlExc = new WSDLException(
- faultCode,
- msg);
-
- wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
-
- throw wsdlExc;
- }
+ if(prefix != null && namespaceURI == null) {
+ String faultCode = WSDLException.UNBOUND_PREFIX;
+ String msg = fErrorReporter.getFormattedMessage(
+ "WSDL513",
+ new Object[] {prefixedValue, DOMQNameUtils.newQName(el)});
+ WSDLException wsdlExc = new WSDLException(
+ faultCode,
+ msg);
+ wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
+ throw wsdlExc;
+ }
+
+ return new QName(namespaceURI, localPart, (prefix != null ? prefix :
""));
}
protected XMLElement doGetFirstChildElement() {
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/OMXMLElement.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/OMXMLElement.java?view=diff&rev=561808&r1=561807&r2=561808
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/OMXMLElement.java
(original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/OMXMLElement.java
Wed Aug 1 07:20:25 2007
@@ -26,6 +26,7 @@
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
import org.apache.woden.ErrorReporter;
import org.apache.woden.WSDLException;
import org.apache.woden.XMLElement;
@@ -115,31 +116,22 @@
? prefixedValue.substring(0, index)
: null;
String localPart = prefixedValue.substring(index + 1);
- String namespaceURI;
+ OMNamespace OMns = elem.findNamespaceURI(prefix);
+ String namespaceURI = OMns != null ? OMns.getNamespaceURI() : null;
- if (prefix != null){
- namespaceURI = elem.findNamespaceURI(prefix).getNamespaceURI();
- return new QName(namespaceURI,localPart,
- prefix);
- }
- else{
- String faultCode = (prefix == null)
- ? WSDLException.NO_PREFIX_SPECIFIED
- : WSDLException.UNBOUND_PREFIX;
-
+ if(prefix != null && namespaceURI == null) {
+ String faultCode = WSDLException.UNBOUND_PREFIX;
String msg = fErrorReporter.getFormattedMessage(
"WSDL513",
new Object[] {prefixedValue, elem.getQName()});
-
WSDLException wsdlExc = new WSDLException(
faultCode,
msg);
-
//TODO wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
-
throw wsdlExc;
}
+ return new QName(namespaceURI, localPart, (prefix != null ? prefix :
""));
}
protected XMLElement doGetFirstChildElement() {
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java?view=diff&rev=561808&r1=561807&r2=561808
==============================================================================
---
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
(original)
+++
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
Wed Aug 1 07:20:25 2007
@@ -136,8 +136,8 @@
public InterfaceFault[] getAllInterfaceFaults()
{
List allInterfaceFaults = new Vector();
- allInterfaceFaults.addAll(fInterfaceFaultElements);
- allInterfaceFaults.addAll(getDerivedInterfaceFaults());
+ getAllInterfaceFaults(this, allInterfaceFaults);
+
InterfaceFault[] array = new InterfaceFault[allInterfaceFaults.size()];
allInterfaceFaults.toArray(array);
return array;
@@ -187,8 +187,8 @@
public InterfaceOperation[] getAllInterfaceOperations()
{
List allInterfaceOperations = new Vector();
- allInterfaceOperations.addAll(fInterfaceOperationElements);
- allInterfaceOperations.addAll(getDerivedInterfaceOperations());
+ getAllInterfaceOperations(this, allInterfaceOperations);
+
InterfaceOperation[] array = new
InterfaceOperation[allInterfaceOperations.size()];
allInterfaceOperations.toArray(array);
return array;
@@ -466,123 +466,47 @@
* ************************************************************/
/*
- * This method searches for the QName-specified operation across all
operations
- * available (or in-scope) to this interface. i.e. it searches the
directly declared
- * operations and the operations derived from any extended interfaces.
- *
- * TODO consider whether this is needed on the API (currently just used by
validator)
- * TODO also consider whether getInScopeInterfaceOperations() is needed.
- *
- * TODO remove this method, made redundant by new API method
getFromAllInterfaceOperations(QN)
- */
- private InterfaceOperation getInScopeInterfaceOperation(QName qname)
- {
- InterfaceOperation oper = null;
-
- if(qname != null)
- {
- //First, try the operations declared directly in this interface
- oper = getInterfaceOperation(qname);
-
- //Next, try any operations derived from extended interfaces
- if(oper == null)
- {
- List derivedOperations = getDerivedInterfaceOperations();
- InterfaceOperation tempOper = null;
- for(Iterator j=derivedOperations.iterator(); j.hasNext(); )
- {
- tempOper = (InterfaceOperation)j.next();
- if(qname.equals(tempOper.getName()))
- {
- oper = tempOper;
- break;
- }
- }
- }
- }
- return oper;
- }
-
- /*
- * Return the interface operations derived from extended interfaces.
- */
- private List getDerivedInterfaceOperations()
- {
- List derivedOperations = new Vector();
- Interface[] interfaces = getExtendedInterfaces();
- for(int i=0; i<interfaces.length; i++)
- {
- Interface interfac = (Interface)interfaces[i];
- InterfaceOperation[] opers = interfac.getInterfaceOperations();
- for(int j=0; j<opers.length; j++)
- {
- InterfaceOperation oper = opers[j];
- if(!containsComponent(oper, derivedOperations)) {
- derivedOperations.add(oper);
- }
+ * Retrieve all the interface operations declared by a specified interface
or derived
+ * from interfaces that it extends, directly or indirectly, and accumulate
them in
+ * the specified List. Eliminate duplicate operations.
+ */
+ private void getAllInterfaceOperations(Interface interfac, List allOpers) {
+ //get the declared operations for the specified Interface
+ InterfaceOperation[] declaredOpers = interfac.getInterfaceOperations();
+ for(int i=0; i<declaredOpers.length; i++) {
+ InterfaceOperation oper = declaredOpers[i];
+ if(!containsComponent(oper, allOpers)) {
+ allOpers.add(oper);
}
}
- return derivedOperations;
- }
-
- /*
- * This method searches for the QName-specified fault across all faults
- * available (or in-scope) to this interface. i.e. it searches the
directly declared
- * faults and the faults derived from any extended interfaces.
- *
- * TODO consider whether this is needed on the API (currently just used by
validator)
- * TODO also consider whether getInScopeInterfaceFaults() is needed.
- *
- * TODO remove this method, made redundant by new API method
getFromAllInterfaceFaults(QN)
- */
- private InterfaceFault getInScopeInterfaceFault(QName qname)
- {
- InterfaceFault fault = null;
- if(qname != null)
- {
- //First, try the faults declared directly in this interface
- fault = getInterfaceFault(qname);
-
- //Next, try any faults derived from extended interfaces
- if(fault == null)
- {
- List derivedFaults = getDerivedInterfaceFaults();
- InterfaceFault tempFault = null;
- for(Iterator j=derivedFaults.iterator(); j.hasNext(); )
- {
- tempFault = (InterfaceFault)j.next();
- if(qname.equals(tempFault.getName()))
- {
- fault = tempFault;
- break;
- }
- }
- }
+ //get the derived operations from each extended interface
+ Interface[] extInts = interfac.getExtendedInterfaces();
+ for(int j=0; j<extInts.length; j++) {
+ getAllInterfaceOperations(extInts[j], allOpers);
}
- return fault;
}
/*
- * Return the interface faults derived from extended interfaces.
- */
- private List getDerivedInterfaceFaults()
- {
- List derivedFaults = new Vector();
- Interface[] interfaces = getExtendedInterfaces();
- for(int i=0; i<interfaces.length; i++)
- {
- Interface interfac = (Interface)interfaces[i];
- InterfaceFault[] faults = interfac.getInterfaceFaults();
- for(int j=0; j<faults.length; j++)
- {
- InterfaceFault fault = faults[j];
- if(!containsComponent(fault, derivedFaults)) {
- derivedFaults.add(fault);
- }
+ * Retrieve all the interface faults declared by a specified interface or
derived
+ * from interfaces that it extends, directly or indirectly, and accumulate
them in
+ * the specified List. Eliminate duplicate faults.
+ */
+ private void getAllInterfaceFaults(Interface interfac, List allFaults) {
+ //get the declared faults for the specified Interface
+ InterfaceFault[] declaredFaults = interfac.getInterfaceFaults();
+ for(int i=0; i<declaredFaults.length; i++) {
+ InterfaceFault fault = declaredFaults[i];
+ if(!containsComponent(fault, allFaults)) {
+ allFaults.add(fault);
}
}
- return derivedFaults;
+
+ //get the derived faults from each extended interface
+ Interface[] extInts = interfac.getExtendedInterfaces();
+ for(int j=0; j<extInts.length; j++) {
+ getAllInterfaceFaults(extInts[j], allFaults);
+ }
}
/*
Modified:
incubator/woden/trunk/java/test/org/apache/woden/resolver/resources/W3Ctests.catalog
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/resolver/resources/W3Ctests.catalog?view=diff&rev=561808&r1=561807&r2=561808
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/resolver/resources/W3Ctests.catalog
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/resolver/resources/W3Ctests.catalog
Wed Aug 1 07:20:25 2007
@@ -50,6 +50,7 @@
http\://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/Echo-1G/echo.wsdl=documents/good/Echo-1G/echo.wsdl
http\://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/Echo-2G/echo.wsdl=documents/good/Echo-2G/echo.wsdl
http\://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/EchoComplexDocLit-1G/Axis2SampleDocLit.wsdl=documents/good/EchoComplexDocLit-1G/Axis2SampleDocLit.wsdl
+http\://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/FlickrHTTP-1G/flickr.wsdl=documents/good/FlickrHTTP-1G/flickr.wsdl
http\://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/GreatH-1G/primer-hotelReservationService.wsdl=documents/good/GreatH-1G/primer-hotelReservationService.wsdl
http\://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/GreatH-2G/primer-hotelReservationService.wsdl=documents/good/GreatH-2G/primer-hotelReservationService.wsdl
http\://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/GreatH-3G/primer-hotelReservationService.wsdl=documents/good/GreatH-3G/primer-hotelReservationService.wsdl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]