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 lm...@apache.org on 2005/11/15 08:41:34 UTC

svn commit: r344327 - /incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java

Author: lmandel
Date: Mon Nov 14 23:41:31 2005
New Revision: 344327

URL: http://svn.apache.org/viewcvs?rev=344327&view=rev
Log:
Added initial validation class.

Added:
    incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java

Added: incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java?rev=344327&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java (added)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java Mon Nov 14 23:41:31 2005
@@ -0,0 +1,115 @@
+/**
+ * Copyright 2005 Apached Software Foundation 
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal.wsdl20.validation;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+
+/**
+ * The WSDL validator performs semantic validation of a WSDL 2.0
+ * model. Schema validation will have been performed at an
+ * earlier time so this class handles those constraints
+ * which cannot be enforced with schema.
+ * 
+ * This class also handles extensions allowing others to 
+ * plug-in WSDL validators for other namespaces and validators
+ * for other purposes.
+ * 
+ * In that, there are three phases to validation:
+ * 1. XML schema validation - performed earlier when parsing
+ *    the document in the case of an XML representation of the
+ *    model.
+ * 2. Semantic WSDL validation and extension namespace validation -
+ *    checks against the WSDL specification and other extension
+ *    specs.
+ * 3. Extension validation - extra constraints which may be 
+ *    imposed on a WSDL document. These constraints may be
+ *    from an organization such as the WS-I, naming constraints,
+ *    or any other constraints for which an extension validator
+ *    is registered.
+ *    
+ * A WSDL model is not considered valid unless all the constraints
+ * from all the registered validators pass.
+ *
+ */
+public class WSDLValidator {
+
+	public WSDLValidator()
+	{
+		
+	}
+	public void validate(DescriptionElement descElement, ErrorReporter errorReporter)
+	{
+		// 1. Call the validators for specific namespaces
+		//    - Does this need to be broken up into XML specific and compoent model?
+		// 2. Call post validators
+		validateTypes(descElement.getTypesElement(), errorReporter);
+//		Description descComponent = descElement.getDescriptionComponent();
+//		validateInterfaces(descComponent.getInterfaces(), errorReporter);
+//		
+		// TODO: validate bindings, services, and extension elements
+	}
+	
+	protected void validateTypes(TypesElement typesElement, ErrorReporter errorReporter)
+	{
+		// assertions
+		// - check whether types and elements can be defined with the same name but different descriptions
+		// - should all imports for the same namespace be read or only the first one?
+		// TODO: Determine whether the documentation element needs to be validated.
+		
+//		
+//		Xs:schema-0011
+//		3.1.2
+//		For example, two or more inlined schemas may have the same targetNamespace provided that they do not define the same elements or types.
+
+//		Xs:schema-0015
+//		3.1.3
+//		An element attribute information item MUST NOT refer to a global xs:simpleType or xs:complexType definition.
+
+//		Xs:schema -0017
+//		3.2
+//		A specification of extension syntax for an alternative schema language MUST use a namespace that is different than the namespace of XML Schema. The namespace of the alternative schema language is used for element information items that are children of the wsdl:types element information item and for any extensibility attribute information items that appear on other components. The namespace MUST be an absolute IRI.
+
+//		Xs:schema-0019
+//		3.3.3
+//		The wsdlx:interface and wsdlx:binding attributes may be used either independently or together. If they 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 or the binding refers to no interface.
+
+		
+		
+		// Validate inline schemas.
+		
+		// Validate other inline types.
+		// TODO: Determine how to get access to extensibility elements for other schema languages.
+	}
+	
+	protected void validateInterfaces(Interface[] interfaces, ErrorReporter errorReporter)
+	{
+		// Assertions
+		// 1. 2.2.1 an interface MUST NOT appear as an element of the set of interfaces it extends, either directly or indirectly
+		// 2. Follow MEP. Need to find reference
+		// 3. check that two interfaces in different documents are not defined differently for the same QName. This is the name is
+		// unique check. Schema does not inforce this accross documents.
+		// 4. check interface faults - names unique within an interface.
+		// 5. check interface operations.
+		int numInterfaces = interfaces.length;
+		for(int i = 0; i < numInterfaces; i++)
+		{
+			//interfaces[i].
+		}
+	}
+}



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