You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/11/28 19:47:48 UTC

svn commit: r599089 - in /incubator/woden/trunk/java/src/org/apache/woden/internal: Messages.properties wsdl20/validation/WSDLDocumentValidator.java

Author: jkaputin
Date: Wed Nov 28 10:47:47 2007
New Revision: 599089

URL: http://svn.apache.org/viewvc?rev=599089&view=rev
Log:
WODEN-74
Fixed qname resolution validation for interface
fault reference.

Modified:
    incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties?rev=599089&r1=599088&r2=599089&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/Messages.properties Wed Nov 28 10:47:47 2007
@@ -268,8 +268,9 @@
 MessageLabel-1024.ref = 2.5.1
 MessageLabel-1024.assertion = The value of this property MUST match the name of a placeholder message defined by the message exchange pattern.
 
-QName-0002 = 
-QName-0002.assertion = Furthermore, all QName references, whether to the same of to difference namespace MUST resolve to components (see 2.1.9 QName resolution).
+QName-resolution-1064 = The QName ''{0}'' referred to in a ''{1}'' could not be resolved to a ''{2}''.
+QName-resolution-1064.ref = 2.17 
+QName-resolution-1064.assertion = A Description component MUST NOT have such broken references.
 
 # For each Service  component in the {services} property of a Description component, the {name} property MUST be unique.
 Service-1060 = A service with the name ''{0}'' has already been defined for the description component. All services defined in the description component must have unique names.

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java?rev=599089&r1=599088&r2=599089&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java Wed Nov 28 10:47:47 2007
@@ -35,6 +35,7 @@
 import org.apache.woden.wsdl20.xml.ImportElement;
 import org.apache.woden.wsdl20.xml.InterfaceElement;
 import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
 import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
 import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
 import org.apache.woden.wsdl20.xml.TypesElement;
@@ -204,6 +205,9 @@
 	  
 	  if(!validateInterfaceMessageReferences(descElement, interfaceOperation.getInterfaceMessageReferenceElements(), errorReporter))
 		isValid = false;
+	  
+	  if(!validateInterfaceFaultReferences(descElement, interfaceOperation.getInterfaceFaultReferenceElements(), errorReporter))
+			isValid = false;
 	}
     return isValid;
   }
@@ -224,6 +228,30 @@
 	return isValid;
   }
   
+   /**
+     * Validate the InterfaceFaultReference elements.
+     * 
+     * @param descElement The root description element.
+     * @param faultReferences An array of interface fault reference elements.
+     * @param errorReporter An error reporter.
+     * @return True if the interface fault reference elements are all valid, false otherwise.
+     * @throws WSDLException
+     */
+  protected boolean validateInterfaceFaultReferences(DescriptionElement descElement, InterfaceFaultReferenceElement[] faultReferences, ErrorReporter errorReporter) throws WSDLException
+  {
+     boolean isValid = true;
+     
+     int numFaultReferences = faultReferences.length;
+     for(int k = 0; k < numFaultReferences; k++)
+     {
+        InterfaceFaultReferenceElement faultReference = faultReferences[k];
+        if(!testAssertionQNameResolution1064ForInterfaceFaultReference(faultReference, errorReporter))
+          isValid = false;
+     }
+     
+     return isValid;
+  }
+  
   /**
    * Test assertion Description-1006. Tests whether the target namespace
    * specified is an absolute IRI.
@@ -453,5 +481,32 @@
       } 
     }
     return true;
+  }
+  
+  /**
+   * Test assertion QName-resolution-1064 for an InterfaceFaultReference element. \
+   * A Description component must not contain broken QName references.
+   * 
+   * @param faultReference The interface fault reference to check for a broken reference.
+   * @param errorReporter An error reporter.
+   * @return True if the assertion passes, false otherwise. 
+   * @throws WSDLException
+   */
+  protected boolean testAssertionQNameResolution1064ForInterfaceFaultReference(InterfaceFaultReferenceElement faultReference, ErrorReporter errorReporter) throws WSDLException
+  {
+	QName ref = faultReference.getRef();
+	if(ref != null)
+	{
+	  InterfaceFaultElement fault = faultReference.getInterfaceFaultElement();
+	  if(fault == null)
+	  {
+	    errorReporter.reportError(new ErrorLocatorImpl(), 
+	            "QName-resolution-1064", 
+	            new Object[]{ref.toString(), "interface fault reference", "interface fault"}, 
+	            ErrorReporter.SEVERITY_ERROR);
+	    return false;
+	  }
+	}
+	return true;
   }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org