Author: jkaputin
Date: Thu Feb 14 15:18:34 2008
New Revision: 627907

URL: http://svn.apache.org/viewvc?rev=627907&view=rev
Log:
Changes to validation API and impl.

Added:
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/AssertionContextImpl.java
   (with props)
    
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionContext.java
   (with props)
Modified:
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLFactory.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLReader.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/Messages.properties
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/WSDLContext.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1010.java
    
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java
    
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/extensions/ExtensionRegistry.java
    
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java
    
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionInfo.java

Modified: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLFactory.java?rev=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLFactory.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLFactory.java
 Thu Feb 14 15:18:34 2008
@@ -39,7 +39,7 @@
         ErrorReporter errRpt = new ErrorReporterImpl();
         ExtensionRegistry extReg = new PopulatedExtensionRegistry(errRpt);
         ((ErrorReporterImpl)errRpt).setExtensionRegistry(extReg);
-        fWsdlContext = new WSDLContext(this, errRpt, extReg);
+        fWsdlContext = new WSDLContext(this, errRpt, extReg, null);
     }
     
     abstract public WSDLReader newWSDLReader() throws WSDLException;

Modified: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLReader.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLReader.java?rev=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLReader.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/BaseWSDLReader.java
 Thu Feb 14 15:18:34 2008
@@ -84,15 +84,13 @@
        private final String 
DEFAULT_RESOLVER_PROPERTY="org.apache.woden.resolver.default";
     
     private String fFactoryImplName = null; //TODO deprecate/remove?
-    private URIResolver fResolver = null;
     
     protected WSDLContext fWsdlContext;
     final protected ReaderFeatures features;
 
     protected BaseWSDLReader(WSDLContext wsdlContext) throws WSDLException {
-        fWsdlContext = wsdlContext;
         //TODO decide what to do with fact impl name...re- only known use case 
is to change newDescription factory method
-        fFactoryImplName = fWsdlContext.wsdlFactory.getClass().getName();
+        fFactoryImplName = wsdlContext.wsdlFactory.getClass().getName();
         features = new ReaderFeatures();
 
         /* Establish the default URIResolver.
@@ -109,18 +107,19 @@
          */
        
         String defaultURIResolver = 
PropertyUtils.findProperty(DEFAULT_RESOLVER_PROPERTY);
+        URIResolver resolver;
         if (defaultURIResolver == null)
         {
                // property not set (an allowable condition)
                // use the "default default" URI resolver
-               fResolver = new SimpleURIResolver();
+               resolver = new SimpleURIResolver();
         }
         else
         {
                try 
                {
                        Class resolverClass = Class.forName(defaultURIResolver);
-                       fResolver = (URIResolver) resolverClass.newInstance();
+                       resolver = (URIResolver) resolverClass.newInstance();
                } 
                catch (Exception e)
                {
@@ -137,6 +136,12 @@
                        e);
            }
         }
+        
+        fWsdlContext = new WSDLContext(
+                wsdlContext.wsdlFactory,
+                wsdlContext.errorReporter,
+                wsdlContext.extensionRegistry,
+                resolver);
     }
     
     /* ************************************************************
@@ -197,7 +202,8 @@
         fWsdlContext = new WSDLContext(
                 fWsdlContext.wsdlFactory,
                 fWsdlContext.errorReporter,
-                extReg);
+                extReg,
+                fWsdlContext.uriResolver);
     }
     
     public ExtensionRegistry getExtensionRegistry() {
@@ -1638,11 +1644,24 @@
             throws WSDLException;
 
     /**
-     * Provides the capability of setting a supplied URI Resolver.
+     * Provides the capability of setting a custom URI Resolver.
      * 
+     * @param resolver the custom URIResolver
+     * @throws NullPointerException if the 'resolver' parameter is null.
      */
     public void setURIResolver(URIResolver resolver) {
-        fResolver = resolver;
+       
+        if(resolver == null) {
+            String msg = fWsdlContext.errorReporter.getFormattedMessage(
+                    "WSDL026", new Object[] {"resolver"});
+            throw new NullPointerException(msg);
+        }
+        
+        fWsdlContext = new WSDLContext(
+                fWsdlContext.wsdlFactory,
+                fWsdlContext.errorReporter,
+                fWsdlContext.extensionRegistry,
+                resolver);
     }
 
     /*
@@ -1697,7 +1716,7 @@
      * Find the current URI Resolver
      */
     public URIResolver getURIResolver() {
-        return fResolver;
+        return fWsdlContext.uriResolver;
     }
     
     

Modified: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/Messages.properties
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/Messages.properties?rev=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/Messages.properties
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/Messages.properties
 Thu Feb 14 15:18:34 2008
@@ -103,6 +103,9 @@
 
 # ---------------- WSDL Document Level Assertions -------------------
 
+Description-1001 = The targetNamespace ''{0}'' is not dereferencable.
+Description-1001.assertion = The value of the targetNamespace attribute 
information item SHOULD be dereferencable.
+
 Description-1006 = The target namespace ''{0}'' is not an absolute IRI. The 
target namespace must be an absolute IRI.
 Description-1006.assertion = The type of the targetNamespace attribute 
information item is xs:anyURI. Its value MUST be an absolute IRI (see [IETF RFC 
3987]).
 

Modified: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/WSDLContext.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/WSDLContext.java?rev=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/WSDLContext.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/WSDLContext.java
 Thu Feb 14 15:18:34 2008
@@ -19,13 +19,24 @@
 
 import org.apache.woden.ErrorReporter;
 import org.apache.woden.WSDLFactory;
+import org.apache.woden.resolver.URIResolver;
 import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
 
 /**
- * A container of objects shared across Woden within the context of a 
WSDLFactory.
- * 
- * TODO may need to be API, if so interface is WSDLContext, class name is 
WSDLContextImpl, add getters and make variables private
- * TODO check for use cases that break the WSDLFactory context concept (ie 
WSDLReader.setFactoryImplName).
+ * A container of objects shared internally across the Woden implementation.
+ * Intially, within the context of a WSDLFactory, the properties of this 
object are
+ * passed by the WSDLFactory implementation to the constructor, with a null 
value
+ * for the <code>uriResolver</code> property (as this is set by the 
WSDLReader, not the
+ * factory).
+ * <p>
+ * Within the finer grained context of a WSDLReader, the 
<code>uriResolver</code> property
+ * will reference the resolver used by the reader and if the reader's 
extension registry 
+ * reference changes, the <code>extensionRegistry</code> property will reflect 
that new reference.
+ * <p>
+ * TODO if this needs to be made public on the API, either keep it as an 
immutable data object as-is,
+ * or create an API interface called WSDLContext with getters instead of 
public variables and create
+ * an implementation class called WSDLContextImpl.<br>
+ * TODO check for use cases that break the WSDLFactory context concept (ie 
WSDLReader.setFactoryImplName).<br>
  * TODO decide if anything else should be kept here (e.g. woden feats & props, 
Description factory)
  *  
  * @author John Kaputin ([EMAIL PROTECTED])
@@ -34,13 +45,16 @@
     final public WSDLFactory wsdlFactory;
     final public ErrorReporter errorReporter;
     final public ExtensionRegistry extensionRegistry;
+    final public URIResolver uriResolver;
     
     //package private ctor
     WSDLContext(WSDLFactory wsdlFactory,
             ErrorReporter errorReporter,
-            ExtensionRegistry extensionRegistry) {
+            ExtensionRegistry extensionRegistry,
+            URIResolver uriResolver) {
         this.wsdlFactory = wsdlFactory;
         this.errorReporter = errorReporter;
         this.extensionRegistry = extensionRegistry;
+        this.uriResolver = uriResolver;
     }
 }

Modified: 
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=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1001.java
 Thu Feb 14 15:18:34 2008
@@ -1,16 +1,47 @@
 package org.apache.woden.internal.wsdl20.assertions;
 
+import java.net.URI;
+import java.net.URL;
+
 import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.internal.ErrorLocatorImpl;
 import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.AssertionContext;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
 
 public class Description1001 implements Assertion {
 
-    public String getAssertionId() {
+    public String getId() {
         return "Description-1001".intern();
     }
 
-    public void validate(Object target, ErrorReporter errorReporter) {
-        // TODO Auto-generated method stub
+    public void validate(Object target, AssertionContext assertionCtx) throws 
WSDLException {
+        DescriptionElement descElem = (DescriptionElement) target;
+        URI tns = descElem.getTargetNamespace();
+        
+        try {
+            URI resolvedUri = assertionCtx.getUriResolver().resolveURI(tns);
+            URI uri = resolvedUri != null ? resolvedUri : tns;
+            URL url = uri.toURL();
+            Object o = url.getContent();
+            if(o == null) {
+                assertionCtx.getErrorReporter().reportError(
+                        new ErrorLocatorImpl(), getId(), new Object[] {tns}, 
ErrorReporter.SEVERITY_WARNING);
+            }
+        } catch (Exception e) {
+            // WSDLException
+            // IOException
+            // MalformedURLException
+            if(e instanceof WSDLException) {
+                throw (WSDLException)e;
+            }
+            else {
+                throw new WSDLException(WSDLException.OTHER_ERROR,
+                                        "Fatal error.",
+                                        e);
+            }
+        }
     }
 
 }

Modified: 
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=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1002.java
 Thu Feb 14 15:18:34 2008
@@ -1,15 +1,16 @@
 package org.apache.woden.internal.wsdl20.assertions;
 
-import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
 import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.AssertionContext;
 
 public class Description1002 implements Assertion {
 
-    public String getAssertionId() {
+    public String getId() {
         return "Description-1002".intern();
     }
 
-    public void validate(Object target, ErrorReporter errorReporter) {
+    public void validate(Object target, AssertionContext assertionCtx) throws 
WSDLException {
         // TODO Auto-generated method stub
     }
 

Modified: 
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=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Description1003.java
 Thu Feb 14 15:18:34 2008
@@ -1,15 +1,16 @@
 package org.apache.woden.internal.wsdl20.assertions;
 
-import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
 import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.AssertionContext;
 
 public class Description1003 implements Assertion {
 
-    public String getAssertionId() {
+    public String getId() {
         return "Description-1003".intern();
     }
 
-    public void validate(Object target, ErrorReporter errorReporter) {
+    public void validate(Object target, AssertionContext assertionCtx) throws 
WSDLException {
         // TODO Auto-generated method stub
     }
 

Modified: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java?rev=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
 Thu Feb 14 15:18:34 2008
@@ -21,6 +21,7 @@
 import org.apache.woden.internal.ErrorLocatorImpl;
 import org.apache.woden.wsdl20.Interface;
 import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.AssertionContext;
 
 /**
  * This class represents assertion Interface-1009 from the WSDL 2.0 
specification.
@@ -36,19 +37,19 @@
        /* (non-Javadoc)
         * @see org.apache.woden.wsdl20.validation.Assertion#getAssertionID()
         */
-       public String getAssertionId() {
+       public String getId() {
                return ID;
        }
 
        /* (non-Javadoc)
         * @see 
org.apache.woden.wsdl20.validation.Assertion#validate(java.lang.Object, 
org.apache.woden.ErrorReporter)
         */
-       public void validate(Object target, ErrorReporter errorReporter) {
+       public void validate(Object target, AssertionContext assertionCtx) 
throws WSDLException {
                Interface interfac = (Interface)target;
                Interface[] extendedInterfaces = 
interfac.getExtendedInterfaces();
                if(containsInterface(interfac, extendedInterfaces)) {
                        try {
-                               errorReporter.reportError(new 
ErrorLocatorImpl(), ID , new Object[]{interfac.getName()}, 
ErrorReporter.SEVERITY_ERROR);
+                               assertionCtx.getErrorReporter().reportError(new 
ErrorLocatorImpl(), ID , new Object[]{interfac.getName()}, 
ErrorReporter.SEVERITY_ERROR);
                        }catch(WSDLException e) {
                                //TODO: Log problem reporting error.
                        }

Modified: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1010.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1010.java?rev=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1010.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/assertions/Interface1010.java
 Thu Feb 14 15:18:34 2008
@@ -27,6 +27,7 @@
 import org.apache.woden.wsdl20.Description;
 import org.apache.woden.wsdl20.Interface;
 import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.AssertionContext;
 
 /**
  * This class represents assertion Interface-1010 from the WSDL 2.0 
specification.
@@ -42,14 +43,14 @@
        /* (non-Javadoc)
         * @see org.apache.woden.wsdl20.validation.Assertion#getAssertionID()
         */
-       public String getAssertionId() {
+       public String getId() {
                return ID;
        }
 
        /* (non-Javadoc)
         * @see 
org.apache.woden.wsdl20.validation.Assertion#validate(java.lang.Object, 
org.apache.woden.ErrorReporter)
         */
-       public void validate(Object target, ErrorReporter errorReporter) {
+       public void validate(Object target, AssertionContext assertionCtx) 
throws WSDLException {
                Description desc = (Description)target;
                Interface[] interfaces = desc.getInterfaces();
                
@@ -61,7 +62,7 @@
                                continue;
                        if(names.contains(name)) {
                                try {
-                                       errorReporter.reportError(new 
ErrorLocatorImpl(), ID, new Object[]{name}, ErrorReporter.SEVERITY_ERROR);
+                                       
assertionCtx.getErrorReporter().reportError(new ErrorLocatorImpl(), ID, new 
Object[]{name}, ErrorReporter.SEVERITY_ERROR);
                                }catch(WSDLException e) {
                                        //TODO: Log problem reporting error.
                                }

Added: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/AssertionContextImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/AssertionContextImpl.java?rev=627907&view=auto
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/AssertionContextImpl.java
 (added)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/AssertionContextImpl.java
 Thu Feb 14 15:18:34 2008
@@ -0,0 +1,51 @@
+/**
+ * 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 org.apache.woden.ErrorReporter;
+import org.apache.woden.resolver.URIResolver;
+import org.apache.woden.wsdl20.validation.AssertionContext;
+
+/**
+ * @author John Kaputin ([EMAIL PROTECTED])
+ */
+public class AssertionContextImpl implements AssertionContext {
+    
+    private ErrorReporter errReporter;
+    private URIResolver uriResolver;
+    
+    //package private ctor
+    AssertionContextImpl(ErrorReporter errReporter, URIResolver uriResolver) {
+        this.errReporter = errReporter;
+        this.uriResolver = uriResolver;
+    }
+
+    /* (non-Javadoc)
+     * @see 
org.apache.woden.wsdl20.validation.AssertionContext#getErrorReporter()
+     */
+    public ErrorReporter getErrorReporter() {
+        return this.errReporter;
+    }
+
+    /* (non-Javadoc)
+     * @see 
org.apache.woden.wsdl20.validation.AssertionContext#getUriResolver()
+     */
+    public URIResolver getUriResolver() {
+        return this.uriResolver;
+    }
+
+}

Propchange: 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/AssertionContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
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=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/internal/wsdl20/validation/WSDLValidator.java
 Thu Feb 14 15:18:34 2008
@@ -21,7 +21,7 @@
 import java.util.Map;
 import java.util.Vector;
 
-import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
 import org.apache.woden.internal.WSDLContext;
 import org.apache.woden.internal.wsdl20.assertions.Description1001;
 import org.apache.woden.internal.wsdl20.assertions.Description1002;
@@ -29,8 +29,8 @@
 import org.apache.woden.internal.wsdl20.assertions.Interface1010;
 import org.apache.woden.wsdl20.Description;
 import org.apache.woden.wsdl20.Interface;
-import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
 import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.AssertionContext;
 import org.apache.woden.wsdl20.validation.AssertionInfo;
 import org.apache.woden.wsdl20.xml.DescriptionElement;
 
@@ -46,18 +46,18 @@
  */
 public class WSDLValidator {
     
-    private ExtensionRegistry extReg;
-    private ErrorReporter errReporter;
+    private WSDLContext fWsdlCtx;
+    private AssertionContext fAssertionCtx;
     
     //not needed? ... private Map fAssertions;    //map of assertion id string 
-> AssertionInfo
     
     private Map fWSDLAsserts;   //map of target Class -> list of WSDL 2.0 
Assertions
     private Map fExtAsserts;    //map of target Class -> list of extension 
Assertions
     
-    public void validate(Description description, WSDLContext wsdlContext) {
+    public void validate(Description description, WSDLContext wsdlContext) 
throws WSDLException {
         int len = 0;
-        this.extReg = wsdlContext.extensionRegistry;
-        this.errReporter = wsdlContext.errorReporter;
+        this.fWsdlCtx = wsdlContext;
+        this.fAssertionCtx = new AssertionContextImpl(fWsdlCtx.errorReporter, 
fWsdlCtx.uriResolver);
                
         //setup the WSDL 2.0 assertions
         //TODO do this once per wsdl reader object, not per document
@@ -96,7 +96,7 @@
      * Note: with the outstanding API review issue about merging the two WSDL 
models, might be
      * able to change the Object paramater to a Woden-specific type.
      */
-    private void checkAssertions(Object target) {
+    private void checkAssertions(Object target) throws WSDLException {
         
         Class targetClass = target.getClass();
         Assertion a = null;
@@ -105,14 +105,14 @@
         List wsdlAsserts = (List)fWSDLAsserts.get(targetClass);
         for(Iterator i=wsdlAsserts.iterator(); i.hasNext(); ) {
             a = (Assertion) i.next();
-            a.validate(target, this.errReporter);
+            a.validate(target, fAssertionCtx);
         }
         
         //Check extension assertions (get them from ExtensionRegistry)
         List extAsserts = (List)fExtAsserts.get(targetClass);
         for(Iterator i=extAsserts.iterator(); i.hasNext(); ) {
             a = (Assertion) i.next();
-            a.validate(target, this.errReporter);
+            a.validate(target, fAssertionCtx);
         }
         
     }
@@ -155,7 +155,7 @@
     
     private void setupExtensionAssertions() {
         
-        AssertionInfo[] infos = this.extReg.queryAssertions();
+        AssertionInfo[] infos = 
this.fWsdlCtx.extensionRegistry.queryAssertions();
         
         List asserts;
         int len = infos.length;

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=627907&r1=627906&r2=627907&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
 Thu Feb 14 15:18:34 2008
@@ -803,12 +803,12 @@
         if(assertion == null) {
             String msg = this.errorReporter.getFormattedMessage("WSDL026", new 
Object[] {"assertion"});
             throw new NullPointerException(msg);
-        } else if(targetClass==null) {
+        } else if(targetClass == null) {
             String msg = this.errorReporter.getFormattedMessage("WSDL026", new 
Object[] {"targetClass"});
             throw new NullPointerException(msg);
         }
         
-        this.assertionReg.put(assertion.getAssertionId(), new 
AssertionInfo(assertion, targetClass));
+        this.assertionReg.put(assertion.getId(), new AssertionInfo(assertion, 
targetClass));
     }
     
     public AssertionInfo queryAssertion(String assertionId) {

Modified: 
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=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/Assertion.java
 Thu Feb 14 15:18:34 2008
@@ -16,7 +16,8 @@
  */
 package org.apache.woden.wsdl20.validation;
 
-import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+
 
 /**
  * Represents an assertion about the WSDL document or component model.
@@ -29,18 +30,25 @@
 public interface Assertion {
     
     /**
-     * Returns the identifier of the assertion.
+     * Return the assertion identifier. 
+     * For example, "Description-1001".
+     * The WSDL 2.0 specification defines assertion ids for the WSDL infoset 
and
+     * component model and for the extensions defined in Part 2: Adjuncts
+     * (wsdlx, wrpc, wsoap, whttp).
+     * Providers of other extensions must define unique identifiers for their 
+     * assertions.
      * 
      * @return the String representing the ID of this assertion.
      */
-    public String getAssertionId();
+    public String getId();
     
     /**
      * Validates the specified WSDL object against this assertion.
      * 
      * @param target the WSDL object that is the target of the assertion
-     * @param errorReporter for reporting any validation errors
+     * @param assertionCtx AssertionContext containing helper objects useful 
to 
+     * Assertion implementors
      */
-    public void validate(Object target, ErrorReporter errorReporter);
+    public void validate(Object target, AssertionContext assertionCtx) throws 
WSDLException;
 
 }

Added: 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionContext.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionContext.java?rev=627907&view=auto
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionContext.java
 (added)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionContext.java
 Thu Feb 14 15:18:34 2008
@@ -0,0 +1,34 @@
+/**
+ * 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;
+import org.apache.woden.resolver.URIResolver;
+
+/**
+ * Represents a container of 'helper' objects which can be used
+ * by Assertion implementors
+ * 
+ * @author John Kaputin ([EMAIL PROTECTED])
+ *
+ */
+public interface AssertionContext {
+
+    public ErrorReporter getErrorReporter();
+    
+    public URIResolver getUriResolver();
+}

Propchange: 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionInfo.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionInfo.java?rev=627907&r1=627906&r2=627907&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionInfo.java
 (original)
+++ 
webservices/woden/branches/woden62/src/org/apache/woden/wsdl20/validation/AssertionInfo.java
 Thu Feb 14 15:18:34 2008
@@ -19,8 +19,6 @@
 
 
 /**
- * TODO decide if this needs to be API-public (eg ExtReg query methods)
- * <p>
  * Represents an immutable object containing the information about an 
assertion 
  * which is needed to perform WSDL validation. 
  * This information consists of the Assertion object and the target Class



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to