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 2008/02/12 16:54:46 UTC
svn commit: r620832 - in
/webservices/woden/branches/woden62/src/org/apache/woden:
internal/wsdl20/assertions/ internal/wsdl20/validation/ wsdl20/extensions/
wsdl20/validation/
Author: jkaputin
Date: Tue Feb 12 07:54:41 2008
New Revision: 620832
URL: http://svn.apache.org/viewvc?rev=620832&view=rev
Log:
Retry initial commit of woden62 work in progress.
Added:
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java (with props)
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java (with props)
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java (with props)
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java (with props)
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java (with props)
Modified:
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
Added: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java?rev=620832&view=auto
==============================================================================
--- webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java (added)
+++ webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java Tue Feb 12 07:54:41 2008
@@ -0,0 +1,17 @@
+package org.apache.woden.internal.wsdl20.assertions;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.wsdl20.validation.Assertion;
+
+public class Description1001 implements Assertion {
+
+ public String getAssertionID() {
+ return "Description-1001".intern();
+ }
+
+ public boolean validate(Object target, ErrorReporter errorReporter) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Propchange: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java?rev=620832&view=auto
==============================================================================
--- webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java (added)
+++ webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java Tue Feb 12 07:54:41 2008
@@ -0,0 +1,17 @@
+package org.apache.woden.internal.wsdl20.assertions;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.wsdl20.validation.Assertion;
+
+public class Description1002 implements Assertion {
+
+ public String getAssertionID() {
+ return "Description-1002".intern();
+ }
+
+ public boolean validate(Object target, ErrorReporter errorReporter) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Propchange: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java?rev=620832&view=auto
==============================================================================
--- webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java (added)
+++ webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java Tue Feb 12 07:54:41 2008
@@ -0,0 +1,17 @@
+package org.apache.woden.internal.wsdl20.assertions;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.wsdl20.validation.Assertion;
+
+public class Description1003 implements Assertion {
+
+ public String getAssertionID() {
+ return "Description=1003".intern();
+ }
+
+ public boolean validate(Object target, ErrorReporter errorReporter) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Propchange: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java?rev=620832&view=auto
==============================================================================
--- webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java (added)
+++ webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java Tue Feb 12 07:54:41 2008
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 java.util.List;
+import java.util.Map;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.internal.WSDLContext;
+import org.apache.woden.internal.wsdl20.assertions.Description1001;
+import org.apache.woden.internal.wsdl20.assertions.Description1002;
+import org.apache.woden.internal.wsdl20.assertions.Description1003;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.WSDLComponent;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+
+/**
+ * Validates a WSDL 2.0 Description component by walking the component model
+ * <i>tree</i> and checking the relevant assertions for each component.
+ *
+ * @author John Kaputin (jkaputin@apache.org)
+ *
+ */
+public class WSDLValidator {
+
+ Map fAssertions; //map of assertionID->AssertionInfo
+ Map fTargets; //map of targetClass->list of AssertionInfo
+
+ public boolean validate(Description description, WSDLContext wsdlContext) {
+ boolean result = true;
+
+ //add WSDL 2.0 assertions to fAssertions
+ //TODO do this once per reader, not per document
+ setupWSDL20Assertions();
+
+ //get ExtReg from wsdlCtx and extract registered extension assertions to add to fAssertions
+
+ //create map targetClass->ListOfAssertionInfo, based on fAssertions
+
+ //walk the parts of the xml tree not represented in the component model, calling checkAssertions
+ //method for each element.
+ // - i.e. description(s), import, include, types, documentation?
+
+ //walk the top-level component trees, calling checkAssertions for each component and for each
+ //component.toElement().
+
+ return result;
+ }
+
+ /*
+ * Invoke the validate() method on each assertion mapped to the target component
+ * after first checking for assertions they depend on and verifying that they have
+ * been validated.
+ *
+ * TODO decide if 'warning' failures return true/false (i.e. 'SHOULD', 'MAY')
+ */
+ private boolean checkAssertions(WSDLComponent target, ErrorReporter errReporter) {
+ boolean result = true;
+
+
+
+ return result;
+ }
+
+ private class AssertionInfo {
+ private Assertion assertion;
+ private Class targetClass;
+ private List dependsOn;
+ private Boolean result = null;
+
+ private AssertionInfo(Assertion assertion, Class targetClass, List dependsOn) {
+ this.assertion = assertion;
+ this.targetClass = targetClass;
+ this.dependsOn = dependsOn;
+ }
+
+ }
+
+ private void setupWSDL20Assertions() {
+ fAssertions.put("Description-1001".intern(),
+ new AssertionInfo(new Description1001(), DescriptionElement.class, null));
+ fAssertions.put("Description-1002".intern(),
+ new AssertionInfo(new Description1002(), DescriptionElement.class, null));
+ fAssertions.put("Description-1003".intern(),
+ new AssertionInfo(new Description1003(), DescriptionElement.class, null));
+
+ //TODO rest of WSDL 2.0 assertions defined in the spec
+ }
+
+}
Propchange: webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java?rev=620832&r1=620831&r2=620832&view=diff
==============================================================================
--- webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java (original)
+++ webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java Tue Feb 12 07:54:41 2008
@@ -30,6 +30,7 @@
import org.apache.woden.WSDLException;
import org.apache.woden.XMLElement;
import org.apache.woden.wsdl20.WSDLComponent;
+import org.apache.woden.wsdl20.validation.Assertion;
import org.apache.woden.wsdl20.xml.WSDLElement;
import org.apache.woden.xml.UnknownAttr;
import org.apache.woden.xml.XMLAttr;
@@ -778,6 +779,14 @@
String[] array = new String[fResourceBundleNames.size()];
fResourceBundleNames.toArray(array);
return array;
+ }
+
+ public void registerAssertion(Assertion assertion, Class target, String dependencies) {
+ //register each extension assertion, the target class it applies to and the assertions it depends on
+ }
+
+ public void queryAssertions() {
+ //return details of all registered assertions - need a non-void array return type
}
}
Added: webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java?rev=620832&view=auto
==============================================================================
--- webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java (added)
+++ webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java Tue Feb 12 07:54:41 2008
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.wsdl20.validation;
+
+import org.apache.woden.ErrorReporter;
+
+/**
+ * Represents an assertion about the WSDL document or component model.
+ * This assertion may be defined by the WSDL 2.0 specification or by
+ * a WSDL extension specification.
+ *
+ * @author John Kaputin (jkaputin@apache.org)
+ *
+ */
+public interface Assertion {
+
+ /**
+ * Returns the identifier of the assertion.
+ *
+ * @return the String representing the ID of this assertion.
+ */
+ public String getAssertionID();
+
+ /**
+ * Validates the specified WSDL object against this assertion.
+ * <p>
+ * TODO boolean result for warnings v errors
+ *
+ * @param target the WSDL object that is the target of the assertion
+ * @param errorReporter for reporting any validation errors
+ * @return true if the WSDL satisfies the assertion, otherwise false.
+ */
+ public boolean validate(Object target, ErrorReporter errorReporter);
+
+}
Propchange: webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org