Author: lmandel
Date: Fri Jan 26 12:48:23 2007
New Revision: 500337
URL: http://svn.apache.org/viewvc?view=rev&rev=500337
Log:
[WODEN-132] Refactored the validateInterfaces method into separate methods for
each WSDL element.
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
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?view=diff&rev=500337&r1=500336&r2=500337
==============================================================================
---
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
Fri Jan 26 12:48:23 2007
@@ -153,42 +153,59 @@
if(!testAssertionInterface0031(interfaceElem, errorReporter))
isValid = false;
- InterfaceFaultElement[] faultElements =
interfaceElem.getInterfaceFaultElements();
- int numFaultElements = faultElements.length;
- for(int j = 0; j < numFaultElements; j++)
- {
- InterfaceFaultElement faultElement = faultElements[j];
- if(!testAssertionSchema0020b(descElement, faultElement,
errorReporter))
- isValid = false;
- if(!testAssertionSchema0016(descElement,
faultElement.getElementName().getNamespaceURI(), errorReporter))
- isValid = false;
- }
+
if(!validateInterfaceFaults(interfaceElem.getInterfaceFaultElements(),
descElement, errorReporter))
+ isValid = false;
+
if(!validateInterfaceOperations(interfaceElem.getInterfaceOperationElements(),
descElement, errorReporter))
+ isValid = false;
+ }
+
+ return isValid;
+ }
+
+ /**
+ * Validate the InterfaceFault elements.
+ *
+ * @param faultElements An array of fault elements.
+ * @param descElement The root description element.
+ * @param errorReporter An error reporter.
+ * @return True if the interface fault elements are all valid, false
otherwise.
+ * @throws WSDLException
+ */
+ protected boolean validateInterfaceFaults(InterfaceFaultElement[]
faultElements, DescriptionElement descElement, ErrorReporter errorReporter)
throws WSDLException
+ {
+ boolean isValid = true;
+ int numFaultElements = faultElements.length;
+ for(int j = 0; j < numFaultElements; j++)
+ {
+ InterfaceFaultElement faultElement = faultElements[j];
+ if(!testAssertionSchema0020b(descElement, faultElement, errorReporter))
+ isValid = false;
+ if(!testAssertionSchema0016(descElement,
faultElement.getElementName().getNamespaceURI(), errorReporter))
+ isValid = false;
+ }
+ return isValid;
+ }
+
+ /**
+ * Validate the InterfaceOperation elements.
+ *
+ * @param interfaceOperations An array of interface operation elements.
+ * @param descElement The root description element.
+ * @param errorReporter An error reporter.
+ * @return True if the interface operation elements are all valid, false
otherwise.
+ * @throws WSDLException
+ */
+ protected boolean validateInterfaceOperations(InterfaceOperationElement[]
interfaceOperations, DescriptionElement descElement, ErrorReporter
errorReporter) throws WSDLException
+ {
+ boolean isValid = true;
+ int numInterfaceOperations = interfaceOperations.length;
+ for(int j = 0; j < numInterfaceOperations; j++)
+ {
+ InterfaceOperationElement interfaceOperation = interfaceOperations[j];
- InterfaceOperationElement[] interfaceOperations =
interfaceElem.getInterfaceOperationElements();
- int numInterfaceOperations = interfaceOperations.length;
- for(int j = 0; j < numInterfaceOperations; j++)
- {
- InterfaceOperationElement interfaceOperation =
interfaceOperations[j];
- InterfaceMessageReferenceElement[] messageReferences =
interfaceOperation.getInterfaceMessageReferenceElements();
- int numMessageReferences = messageReferences.length;
- for(int k = 0; k < numMessageReferences; k++)
- {
- InterfaceMessageReferenceElement messageReference =
messageReferences[k];
- if(!testAssertionSchema0020(descElement, messageReference,
errorReporter))
- isValid = false;
-
- // Only call the namespace assertion if the referenced element
name is not null.
- QName elementName = messageReference.getElementName();
- if(elementName != null)
- {
- if(!testAssertionSchema0016(descElement,
elementName.getNamespaceURI(), errorReporter))
- isValid = false;
-
- }
-
- }
-
+
if(!validateInterfaceMessageReferences(interfaceOperation.getInterfaceMessageReferenceElements(),
descElement, errorReporter))
+ isValid = false;
// FaultReferenceElement[] faultReferences =
interfaceOperation.getFaultReferenceElements();
// int numFaultReferences = faultReferences.length;
// for(int k = 0; k < numFaultReferences; k++)
@@ -197,33 +214,40 @@
// if(!testAssertionSchema0020b(descElement, faultReference,
errorReporter))
// isValid = false;
// }
- }
}
-
- // The message label assertions use MEP definitions.
-// MessageLabel-0004 =
-// MessageLabel-0004.assertion = The messageLabel attribute information
item of an interface message reference element information item MUST be present
if the message exchange pattern has more than one placeholder message with
{direction} equal to the message direction.
- //
-// MessageLabel-0005 =
-// MessageLabel-0005.assertion = The messageLabel attribute information
item of an interface fault reference element information item MUST be present
if the message exchange pattern has more than one placeholder message with
{direction} equal to the message direction.
- //
-
-// MessageLabel-0008 =
-// MessageLabel-0008.assertion = If the messageLabel attribute
information item of an interface message reference element information item
is present then its actual value MUST match the {message label} of some
placeholder message with {direction} equal to the message direction.
- //
-// MessageLabel-0009 =
-// MessageLabel-0009.assertion = If the messageLabel attribute
information item of an interface fault reference element information item is
present then its actual value MUST match the {message label} of some
placeholder message with {direction} equal to the message direction.
- //
-
-// MessageLabel-0012 =
-// MessageLabel-0012.assertion = If the messageLabel attribute
information item of an interface message reference element information item
is absent then there MUST be a unique placeholder message with {direction}
equal to the message direction.
- //
-// MessageLabel-0013 =
-// MessageLabel-0013.assertion = If the messageLabel attribute
information item of an interface fault reference element information item is
absent then there MUST be a unique placeholder message with {direction} equal
to the message direction.
- //
-
+ return isValid;
+ }
+
+ /**
+ * Validate the InterfaceMessageReference elements.
+ *
+ * @param messageReferences An array of interface message reference elements.
+ * @param descElement The root description element.
+ * @param errorReporter An error reporter.
+ * @return True if the interface message reference elements are all valid,
false otherwise.
+ * @throws WSDLException
+ */
+ protected boolean
validateInterfaceMessageReferences(InterfaceMessageReferenceElement[]
messageReferences, DescriptionElement descElement, ErrorReporter errorReporter)
throws WSDLException
+ {
+ boolean isValid = true;
+ int numMessageReferences = messageReferences.length;
+ for(int k = 0; k < numMessageReferences; k++)
+ {
+ InterfaceMessageReferenceElement messageReference =
messageReferences[k];
+ if(!testAssertionSchema0020(descElement, messageReference,
errorReporter))
+ isValid = false;
+
+ // Only call the namespace assertion if the referenced element name
is not null.
+ QName elementName = messageReference.getElementName();
+ if(elementName != null)
+ {
+ if(!testAssertionSchema0016(descElement,
elementName.getNamespaceURI(), errorReporter))
+ isValid = false;
+ }
+ }
return isValid;
}
+
/**
* Test assertion Description-0025. Tests whether the target namespace
* specified is an absolute IRI.
@@ -500,52 +524,4 @@
}
return true;
}
-
- // # may also be needed for binding.
- //Schema-0016 = A component in the XML Schema namespace '{0}' has been
referenced but this namespace is not available. In order to reference
components from a XML Schema namespace the namespace must be imported or
defined inline.
-// Schema-0016.ref = 3.1
-// Schema-0016.assertion = A WSDL 2.0 document MUST NOT refer to XML
Schema components in a given namespace unless an xs:import or xs:schema element
information item for that namespace is present or the namespace is the XML
Schema namespace which contains built-in types as defined in XML Schema Part 2:
Datatypes Second Edition [XML Schema: Datatypes].
-
-
-// Schema-0021 = The alternative schema language makes use of the XML
Schema namespace.
-// Schema-0021.ref = 3.2
-// Schema-0021.assertion = A specification of extension syntax for an
alternative schema language MUST use a namespace that is different than the
namespace of XML Schema.
-//
-// Schema-0022 = The binding '{0}' specified is not consistent with the
interface '{1}' specified. The binding must refer to the same interface as is
specified by the interace attribute.
-// Schema-0022.ref = 3.3.3
-// Schema-0022.assertion = If wsdlx:interface and wsdlx:binding are used
together then they MUST satisfy the same consistency rules that apply to the
{interface} property of a Service component and the {binding} property of a
nested Endpoint component, that is either the binding refers the interface of
the service or the binding refers to no interface.
-//
-// Schema-0053 = The namespace '{0}' specified is not an absolute IRI.
-// Schema-0053.assertion = The namespace used for an alternate schema
language MUST be an absolute IRI.
-//
-// Types-0023 = The alternate schema language does not include a
declaration of an element information item to appear as a child of the types
element.
-// Types-0023.ref = 3.2
-// Types-0023.assertion = A specification of extension syntax for an
alternative schema language MUST include the declaration of an element
information item, intended to appear as a child of the wsdl:types element
information item, which references, names, and locates the schema instance (an
"import" element information item).
-
-//Import-0001 = The component '{0}' is in the namespace '{1}', which has not
been imported. A namespace must be imported before components from it can be
referenced in this document.
-//Import-0001.assertion = However, any WSDL 2.0 document that contains
component definitions that refer by QName to WSDL 2.0 components that belong to
a different namespace MUST contain a wsdl:import element information item for
that namespace (see 4.2 Importing Descriptions).
-//
-//Import-0003 = The imported document located at '{0}' has the same namespace
as this document. An imported document's target namespace must be different
than the target namespace of the document that imports it. If the target
namespaces are the same a WSDL include should be used instead of a WSDL import.
-//Import-0003.assertion = Imported components have different target namespace
values from the WSDL 2.0 document that is importing them.
-//
-
-//MessageLabel-0006 =
-//MessageLabel-0006.assertion = The messageLabel attribute information item
of a binding message reference element information item MUST be present if the
message exchange pattern has more than one placeholder message with {direction}
equal to the message direction.
-//
-//MessageLabel-0007 =
-//MessageLabel-0007.assertion = The messageLabel attribute information item
of a binding fault reference element information item MUST be present if the
message exchange pattern has more than one placeholder message with {direction}
equal to the message direction.
-//
-//MessageLabel-0010 =
-//MessageLabel-0010.assertion = If the messageLabel attribute information
item of a binding message reference element information item is present then
its actual value MUST match the {message label} of some placeholder message
with {direction} equal to the message direction.
-//
-//MessageLabel-0011 =
-//MessageLabel-0011.assertion = If the messageLabel attribute information
item of a binding fault reference element information item is present then
its actual value MUST match the {message label} of some placeholder message
with {direction} equal to the message direction.
-//
-//MessageLabel-0014 =
-//MessageLabel-0014.assertion = If the messageLabel attribute information
item of a binding message reference element information item is absent then
there MUST be a unique placeholder message with {direction} equal to the
message direction.
-//
-//MessageLabel-0015 =
-//MessageLabel-0015.assertion = If the messageLabel attribute information
item of a binding fault reference element information item is absent then
there MUST be a unique placeholder message with {direction} equal to the
message direction.
-
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]