ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sag...@apache.org
Subject svn commit: r809831 [9/10] - in /webservices/woden/trunk/java/woden-commons: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/woden/ src/main/java/org/apache/woden/internal/ src/main/java/org/apache...
Date Tue, 01 Sep 2009 05:49:07 GMT
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/HTTPAuthenticationSchemeAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,94 @@
+/**
+ * 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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme;
+import org.apache.woden.xml.HTTPAuthenticationSchemeAttr;
+
+/**
+ * This class implements the whttp:authenticationScheme attribute.
+ * 
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ * 
+ */
+public class HTTPAuthenticationSchemeAttrImpl extends XMLAttrImpl implements
+		HTTPAuthenticationSchemeAttr {
+
+    public HTTPAuthenticationSchemeAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element,
+	 *      java.lang.String)
+	 */
+	protected Object convert(XMLElement ownerEl, String attrValue)
+			throws WSDLException {
+
+		// TODO: define correct error numbers
+
+		HTTPAuthenticationScheme scheme = null;
+
+		if (attrValue == null) {
+			setValid(false);
+			getErrorReporter().reportError(new ErrorLocatorImpl(), // TODO
+					// line&col
+					// nos.
+					"WSDL508", new Object[] { attrValue },
+					ErrorReporter.SEVERITY_ERROR);
+		} else if (attrValue.equals(HTTPAuthenticationScheme.BASIC.toString())) {
+
+			setValid(true);
+			scheme = HTTPAuthenticationScheme.BASIC;
+		} else if (attrValue.equals(HTTPAuthenticationScheme.DIGEST.toString())) {
+
+			setValid(true);
+			scheme = HTTPAuthenticationScheme.DIGEST;
+		} else {
+
+			setValid(false);
+			getErrorReporter().reportError(new ErrorLocatorImpl(), // TODO
+					// line&col
+					// nos.
+					"WSDL508", new Object[] { attrValue },
+					ErrorReporter.SEVERITY_ERROR);
+		}
+
+		return scheme;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.woden.xml.HTTPAuthenticationSchemeAttr#getScheme()
+	 */
+	public HTTPAuthenticationScheme getScheme() {
+
+		return (HTTPAuthenticationScheme) getContent();
+	}
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/IntOrTokenAnyAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,123 @@
+/**
+ * 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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.xml.IntOrTokenAttr;
+
+/**
+ * This class represents XML attribute information items of type
+ * 'Union of xs:int, xs:token #any', for example the 
+ * whttp:code extension attribute of binding <fault>.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class IntOrTokenAnyAttrImpl extends XMLAttrImpl implements IntOrTokenAttr 
+{
+
+    public IntOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    /* ************************************************************
+     *  QNameOrTokenAttr interface declared methods 
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.IntOrTokenAttr#isInt()
+     */
+    public boolean isInt() 
+    {
+        return getContent() instanceof Integer;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.IntOrTokenAttr#isToken()
+     */
+    public boolean isToken() 
+    {
+        return !isInt() && isValid();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.IntOrTokenAttr#getInt()
+     */
+    public Integer getInt() 
+    {
+        if(isInt()) {
+            return (Integer)getContent();
+        } else {
+            return null;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.IntOrTokenAttr#getToken()
+     */
+    public String getToken() 
+    {
+        if(!isInt() && isValid()) {
+            return (String)getContent();
+        } else {
+            return null;
+        }
+    }
+
+    /* ************************************************************
+     *  Implementation of abstract method inherited from XmlAttrImpl 
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element, java.lang.String)
+     * 
+     * Convert a string of type "Union of xs:int, xs:token #any" to a 
+     * java.lang.Integer or a String.
+     * A null argument will return a null value.
+     * Any conversion error will be reported and a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+        //First, check if the attribute contains the xs:token '#any'.
+        if("#any".equals(attrValue)) return attrValue;
+        
+        //Second, assume the attribute contains a xs:int value.
+        Integer intVal = null;
+        try 
+        {
+            intVal = new Integer(attrValue);
+        } 
+        catch (NumberFormatException e) 
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL512",
+                    new Object[] {attrValue}, 
+                    ErrorReporter.SEVERITY_ERROR, 
+                    e);
+        }
+        return intVal;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,88 @@
+/**
+ * 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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.xml.QNameAttr;
+
+/**
+ * This class represents XML attribute information items of type xs:QName.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class QNameAttrImpl extends XMLAttrImpl implements QNameAttr 
+{
+    public QNameAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    /* ************************************************************
+     *  QNameAttr interface declared methods 
+     * ************************************************************/
+    
+    public QName getQName() {
+        return (QName)getContent();
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods 
+     * ************************************************************/
+
+    /*
+     * Convert a string of type xs:QName to a java.xml.namespace.QName.
+     * A a null argument will return a null value.
+     * Any conversion error will be reported and a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+        Exception ex = null;
+        QName qn = null;
+        
+        if(attrValue != null)
+        {
+            try
+            {
+                qn = ownerEl.getQName(attrValue);
+            } 
+            catch (WSDLException e) 
+            {
+                ex = e;
+            }
+        }
+        
+        if(qn == null)
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL507",              //TODO chg to WSDL505 and test
+                    new Object[] {attrValue}, 
+                    ErrorReporter.SEVERITY_ERROR, 
+                    ex);
+        }
+        
+        return qn;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,111 @@
+/**
+ * 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.xml;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.internal.util.StringUtils;
+import org.apache.woden.xml.QNameListAttr;
+
+
+/**
+ * This class represents XML attribute information items of type xs:list of QNames.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class QNameListAttrImpl extends XMLAttrImpl implements QNameListAttr 
+{
+    private static final String emptyString = "".intern();
+    public QNameListAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    /* ************************************************************
+     *  QNameAttr interface declared methods 
+     * ************************************************************/
+    
+    public QName[] getQNames() {
+        return (QName[])getContent();
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods 
+     * ************************************************************/
+
+    /*
+     * Convert a string of type 'xs:list of QNames' to a java.xml.namespace.QName[].
+     * A a null argument will return a null value.
+     * If a QName string in the list causes a conversion error, it will be reported 
+     * and that QName will not appear in the array. Valid QName strings will still
+     * be converted, but the object will be marked invalid. If no QName strings can
+     * be converted, a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+        if(attrValue == null || emptyString.equals(attrValue))
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL509", 
+                    new Object[] {attrValue}, 
+                    ErrorReporter.SEVERITY_ERROR);
+            return null;
+        }
+        
+        List qnStrings = StringUtils.parseNMTokens(attrValue);
+        Iterator i = qnStrings.iterator();
+        String qnString;
+        QName qname;
+        List qnames = new Vector();
+        
+        while(i.hasNext())
+        {
+            qnString = (String)i.next();
+            try
+            {
+                qname = ownerEl.getQName(qnString);
+            } 
+            catch (WSDLException e) 
+            {
+                setValid(false);
+                getErrorReporter().reportError(
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL510", 
+                        new Object[] {qnString, attrValue}, 
+                        ErrorReporter.SEVERITY_ERROR, 
+                        e);
+                continue;
+            }
+            qnames.add(qname);
+        }
+        QName[] qnArray = new QName[qnames.size()];
+        qnames.toArray(qnArray);
+        return qnArray;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameListOrTokenAnyAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,153 @@
+/**
+ * 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.xml;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.internal.util.StringUtils;
+import org.apache.woden.xml.QNameListOrTokenAttr;
+
+/**
+ * This class represents XML attribute information items of type
+ * <code>Union of list of QName or xs:token #any</code>.
+ * For example, the wsoap:subcodes extension attribute of binding fault.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class QNameListOrTokenAnyAttrImpl extends XMLAttrImpl 
+                                         implements QNameListOrTokenAttr 
+{
+    private static final String emptyString = "".intern();
+    public QNameListOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    /* ************************************************************
+     *  QNameListOrTokenAttr interface declared methods 
+     * ************************************************************/
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameListOrTokenAttr#isQNameList()
+     */
+    public boolean isQNameList() 
+    {
+        return getContent() instanceof QName[];
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameListOrTokenAttr#isToken()
+     */
+    public boolean isToken() 
+    {
+        return !isQNameList() && isValid();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameListOrTokenAttr#getQNames()
+     */
+    public QName[] getQNames() 
+    {
+        if(isQNameList()) {
+            return (QName[])getContent();
+        } else {
+            return null;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameListOrTokenAttr#getToken()
+     */
+    public String getToken() 
+    {
+        if(!isQNameList() && isValid()) {
+            return (String)getContent();
+        } else {
+            return null;
+        }
+    }
+
+    /* ************************************************************
+     *  Non-API implementation methods 
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element, java.lang.String)
+     *
+     * Convert a string of type "Union of list of xs:QName or xs:token #any" to a 
+     * java.xml.namespace.QName array or a String.
+     * A null argument will return a null value.
+     * Any conversion error will be reported and a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+        //First, check if the attribute contains the xs:token '#any'.
+        if("#any".equals(attrValue)) return attrValue;
+        
+        //Second, assume the attribute contains a list of xs:QName.
+        if(attrValue == null || emptyString.equals(attrValue))
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL509", 
+                    new Object[] {attrValue}, 
+                    ErrorReporter.SEVERITY_ERROR);
+            return null;
+        }
+        
+        List qnStrings = StringUtils.parseNMTokens(attrValue);
+        Iterator i = qnStrings.iterator();
+        String qnString;
+        QName qname;
+        List qnames = new Vector();
+        
+        while(i.hasNext())
+        {
+            qnString = (String)i.next();
+            try
+            {
+                qname = ownerEl.getQName(qnString);
+            } 
+            catch (WSDLException e) 
+            {
+                setValid(false);
+                getErrorReporter().reportError(
+                        new ErrorLocatorImpl(),  //TODO line&col nos.
+                        "WSDL510", 
+                        new Object[] {qnString, attrValue}, 
+                        ErrorReporter.SEVERITY_ERROR, 
+                        e);
+                continue;
+            }
+            qnames.add(qname);
+        }
+        QName[] qnArray = new QName[qnames.size()];
+        qnames.toArray(qnArray);
+        return qnArray;    
+    }
+    
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/QNameOrTokenAnyAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,134 @@
+/**
+ * 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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.xml.QNameOrTokenAttr;
+
+/**
+ * This class represents XML attribute information items of type
+ * <code>Union of QName or xs:token #any</code>.
+ * For example, the wsoap:code extension attribute of binding fault.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class QNameOrTokenAnyAttrImpl extends XMLAttrImpl 
+                                     implements QNameOrTokenAttr 
+{
+    public QNameOrTokenAnyAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    /* ************************************************************
+     *  QNameOrTokenAttr interface declared methods 
+     * ************************************************************/
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameOrTokenAttr#isQName()
+     */
+    public boolean isQName() 
+    {
+        return getContent() instanceof QName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameOrTokenAttr#isToken()
+     */
+    public boolean isToken() 
+    {
+        if(!isQName() && isValid()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameOrTokenAttr#getQName()
+     */
+    public QName getQName() 
+    {
+        if(isQName()) {
+            return (QName)getContent();
+        } else {
+            return null;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.QNameOrTokenAttr#getToken()
+     */
+    public String getToken() 
+    {
+        if(!isQName() && isValid()) {
+            return (String)getContent();
+        } else {
+            return null;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.internal.xml.XMLAttrImpl#convert(org.w3c.dom.Element, java.lang.String)
+     *
+     * Convert a string of type "Union of xs:QName or xs:token #any" to a 
+     * java.xml.namespace.QName or a String.
+     * A null argument will return a null value.
+     * Any conversion error will be reported and a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+        //First, check if the attribute contains the xs:token '#any'.
+        if("#any".equals(attrValue)) return attrValue;
+        
+        //Second, assume the attribute contains a xs:QName value.
+        Exception ex = null;
+        QName qn = null;
+        
+        if(attrValue != null)
+        {
+            try
+            {
+                qn = ownerEl.getQName(attrValue);
+            } 
+            catch (WSDLException e) 
+            {
+                ex = e;
+            }
+        }
+        
+        if(qn == null)
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL507",
+                    new Object[] {attrValue}, 
+                    ErrorReporter.SEVERITY_ERROR, 
+                    ex);
+        }
+        
+        return qn;
+    }
+    
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/StringAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/StringAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/StringAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/StringAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,73 @@
+/**
+ * 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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.xml.StringAttr;
+
+
+/**
+ * This class represents XML attribute information items of type xs:string.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class StringAttrImpl extends XMLAttrImpl implements StringAttr 
+{
+    public StringAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    /* ************************************************************
+     *  StringAttr interface declared methods 
+     * ************************************************************/
+    
+    public String getString() {
+        return (String)getContent();
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods 
+     * ************************************************************/
+
+    /*
+     * Convert a string of type xs:string to a java.lang.String.
+     * A null argument will return a null value.
+     * Any conversion error will be reported and a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+
+        if(attrValue == null)
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL508",
+                    new Object[] {attrValue},
+                    ErrorReporter.SEVERITY_ERROR);
+        }
+        return attrValue;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/TokenAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/TokenAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/TokenAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/TokenAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,76 @@
+/**
+ * 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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.xml.TokenAttr;
+
+/**
+ * This class represents XML attribute information items of type xs:token.
+ * 
+ * TODO when the class org.apache.woden.types.Token has been created, convert the
+ * xs:token to a Token instead of a String and modify the getToken method to return
+ * a Token instead of a String.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class TokenAttrImpl extends XMLAttrImpl implements TokenAttr 
+{
+    public TokenAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    /* ************************************************************
+     *  TokenAttr interface declared methods 
+     * ************************************************************/
+    
+    public String getToken() {
+        return (String)getContent();
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods 
+     * ************************************************************/
+
+    /*
+     * Convert a string of type xs:token to a java.lang.String (for now, but see 'todo' above).
+     * A null argument will return a null value.
+     * Any conversion error will be reported and a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+
+        if(attrValue == null)
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL508",
+                    new Object[] {attrValue},
+                    ErrorReporter.SEVERITY_ERROR);
+        }
+        return attrValue;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/URIAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/URIAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/URIAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/URIAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,92 @@
+/**
+ * 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.xml;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.xml.URIAttr;
+
+/**
+ * This class represents XML attribute information items of type xs:anyURI.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class URIAttrImpl extends XMLAttrImpl implements URIAttr 
+{
+    public URIAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        super(ownerEl, attrType, attrValue, errRpt);
+    }
+    
+    
+    /* ************************************************************
+     *  URIAttr interface declared methods 
+     * ************************************************************/
+    
+    public URI getURI() {
+        return (URI)getContent();
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods 
+     * ************************************************************/
+
+    /*
+     * Convert a string of type xs:anyURI to a java.net.URI.
+     * An empty string argument will return an empty string URI.
+     * A null argument will return a null value.
+     * Any conversion error will be reported and a null value will be returned.
+     */
+    protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException
+    {
+        Exception ex = null;
+        URI uri = null;
+        
+        if(attrValue != null)
+        {
+            try 
+            {
+                uri = new URI(attrValue);
+            } 
+            catch (URISyntaxException e) 
+            {
+                ex = e;
+            }
+        }
+        
+        if(uri == null)
+        {
+            setValid(false);
+            getErrorReporter().reportError(
+                    new ErrorLocatorImpl(),  //TODO line&col nos.
+                    "WSDL506", 
+                    new Object[] {attrValue}, 
+                    ErrorReporter.SEVERITY_ERROR, 
+                    ex);
+        }
+        return uri;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/XMLAttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/XMLAttrImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/XMLAttrImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xml/XMLAttrImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,96 @@
+/**
+ * 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.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.ErrorReporterImpl;
+import org.apache.woden.internal.WSDLContext;
+import org.apache.woden.xml.XMLAttr;
+
+/**
+ * This is an abstract superclass for all classes representing different
+ * types of XML attribute information items.
+ * 
+ * @author jkaputin@apache.org
+ */
+public abstract class XMLAttrImpl implements XMLAttr
+{
+    private QName fAttrType = null;
+    private Object fContent = null;
+    private String fExternalForm = null;
+    private boolean fValid = true;
+    private ErrorReporter fErrorReporter = null;
+    
+    protected XMLAttrImpl(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        fErrorReporter = errRpt;
+        fAttrType = attrType;
+        fExternalForm = attrValue;
+        fContent = convert(ownerEl, attrValue);
+        if(fContent == null) {
+            fValid = false;
+        }
+    }
+    
+    /* ************************************************************
+     *  XMLAttr interface declared methods 
+     * ************************************************************/
+
+    public QName getAttributeType() {
+        return fAttrType;
+    }
+    
+    public Object getContent() {
+        return fContent;
+    }
+    
+    public String toExternalForm() {
+        return fExternalForm;
+    }
+    
+    public boolean isValid() {
+        return fValid;
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods 
+     * ************************************************************/
+
+    abstract protected Object convert(XMLElement ownerEl, String attrValue) throws WSDLException;
+    
+    protected ErrorReporter getErrorReporter()
+    {
+        return fErrorReporter;
+    }
+    
+    /*
+     * Validity is initialized to true, but set to false if the attribute's
+     * value is null or if it cannot be converted to an object of the 
+     * appropriate type). This method may be used to change the validity later
+     * (e.g. if Validation determines an error).
+     * 
+     * TODO confirm this method is needed, otherwise remove it.
+     */
+    protected void setValid(boolean validity) {
+        fValid = validity;
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xpointer/XMLElementEvaluator.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xpointer/XMLElementEvaluator.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xpointer/XMLElementEvaluator.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/xpointer/XMLElementEvaluator.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,217 @@
+/**
+ * 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.xpointer;
+
+import java.util.Collections;
+import java.util.EmptyStackException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Stack;
+import java.util.Arrays;
+
+import org.apache.woden.XMLElement;
+import org.apache.woden.types.NCName;
+import org.apache.woden.xpointer.PointerPart;
+import org.apache.woden.xpointer.ElementPointerPart;
+import org.apache.woden.xpointer.XPointer;
+
+/**
+ * This class Evaluates an XPointer on a XMLElement, using the XPointer model in Woden.
+ * It currently supports shorthand pointer and element() scheme based pointer part.
+ * 
+ * @author Dan Harvey <danharvey42@gmail.com>
+ *
+ */
+public abstract class XMLElementEvaluator {
+    private final XPointer xpointer;
+    private final XMLElement root;
+
+    /**
+     * Constructs a new XMLElement abstract class for a XPointer and XMLElement.
+     *  
+     * @param xpointer an XPointer which to evaluate.
+     * @param root an XMLElement which to evaluate the XPointer against.
+     */
+    public XMLElementEvaluator(XPointer xpointer, XMLElement root) {
+        this.xpointer = xpointer;
+        this.root = root;
+    }
+    
+    /**
+     * Evaluates the XPointer on the root XMLElement and returns the resulting XMLElement or null.
+     * 
+     * @return an XMLElement from the resultant evaluation of the root XMLElement or null if evaluation fails.
+     * 
+     */
+    public XMLElement evaluate() {
+        if(xpointer.hasPointerParts()) { //Scheme based pointer.
+            //Take each pointer part at a time and evaluate it against the root element. The first result found will be returned.
+            XMLElement result = null;
+            for(Iterator it = Arrays.asList(xpointer.getPointerParts()).iterator(); it.hasNext(); ) {
+                PointerPart pointerPart = (PointerPart)it.next();
+                //TODO Add extra pointer parts here once we support them.
+                if (pointerPart instanceof ElementPointerPart) {
+                    result = evaluateElementPointerPart((ElementPointerPart)pointerPart);
+                }
+                if (result != null) return result;
+            }
+        } else if(xpointer.hasShorthandPointer()) { //Shorthand pointer
+            //Iterator for XMLElement from root in document order. See http://www.w3.org/TR/xpath#dt-document-order
+            return evaluateShorthandPointer(xpointer.getShorthandPointer());
+            
+        }
+        return null;
+    }
+    
+    /**
+     * Evaluates an element() XPointer scheme based pointer part to the specification at
+     * <a href="http://www.w3.org/TR/xptr-element/">http://www.w3.org/TR/xptr-element/</a>
+     * 
+     * @param elementPointerPart an ElementPointerPart to evaluate.
+     * @return an XMLElement pointed to by this Element pointer part, or null if none exists.
+     */
+    private XMLElement evaluateElementPointerPart(ElementPointerPart elementPointerPart) {
+        if (elementPointerPart.hasChildSequence() && elementPointerPart.hasNCName()) { //Both NCName and childSequence.
+            //Find NCName.
+            XMLElement element = evaluateShorthandPointer(elementPointerPart.getNCName());
+            if (element == null) return null;
+            //Walk through children.
+            return evaluateChildSequence(element, elementPointerPart.getChildSequence());
+        } else if(elementPointerPart.hasNCName()) { //Only NCName
+            return evaluateShorthandPointer(elementPointerPart.getNCName());
+        } else { //Only a childSequence
+            //XML must only have 1 root element so we can't evaluate it if its > 1
+            Integer[] childSequence = elementPointerPart.getChildSequence();
+            if (childSequence[0].intValue() > 1) return null;
+            Integer[] nChildSequence = new Integer[childSequence.length-1];
+            for (int i=1; i<childSequence.length; i++) {
+                nChildSequence[i-1] = childSequence[i];
+            }
+            return evaluateChildSequence(root, nChildSequence);
+        }
+    }
+    
+    /**
+     * Evaluates an shorthand pointer in an XPointer based on the specification at
+     * <a href="http://www.w3.org/TR/xptr-framework/#shorthand">http://www.w3.org/TR/xptr-framework/#shorthand</a>
+     * 
+     * @param ncname an NCName to evaluate.
+     * @return an XMLElement pointed to by this shorthand name, or null if none exists.
+     */
+    private XMLElement evaluateShorthandPointer(NCName ncname) {
+        //Iterator for XMLElement from root in document order. See http://www.w3.org/TR/xpath#dt-document-order
+        String shorthand = ncname.toString();
+        for(Iterator it = new DocumentOrderIterator(root); it.hasNext(); ){
+            XMLElement element = (XMLElement)it.next();
+            if (testElementShorthand(element, shorthand)) return element;
+        }
+        return null;
+    }
+    
+    /**
+     * Evaluates a child sequence array of Integers to an XMLElement following XML Document Order.
+     * This is a helper method used by other evaluation methods in this class.
+     * 
+     * @param element an XMLElement to start from.
+     * @param childSequence an Integer[] to evaluate from the start XMLElement.
+     * @return an XMLElement pointed to by this childSequence, or null if none exists.
+     */
+    private XMLElement evaluateChildSequence(XMLElement element, Integer[] childSequence) {
+        for(int i=0; i<childSequence.length; i++) {
+            //does the iTh child exist?
+            XMLElement[] children = element.getChildElements();
+            children = filterNoneElementNodes(children);
+            if (childSequence[i].intValue() > children.length) { //childSequence int out of bounds of child array so does not exist.
+                return null;
+            } else {
+                element = element.getChildElements()[childSequence[i].intValue()-1];
+            }
+        }
+        return element;
+    }
+    
+    //Utility classes
+    
+    /**
+     * Filters an XMLElement[] for nodes which are not xml tag elements.
+     * 
+     * @param nodes an XMLElement[] of the nodes to filter.
+     * @return an XMLElement[] of the remaining nodes.
+     */
+    private static XMLElement[] filterNoneElementNodes(XMLElement[] nodes) {
+        List nodeList = Arrays.asList(nodes);
+        for(Iterator it = nodeList.iterator(); it.hasNext(); ) {            
+            XMLElement node = (XMLElement)it.next();
+            if(node.getLocalName().indexOf('#') > -1) {
+                it.remove();
+            }
+        }
+        XMLElement[] nNodes = new XMLElement[nodeList.size()];
+        nodeList.toArray(nNodes);
+        return nNodes;
+    }
+    
+    //Abstract Methods
+    /**
+     * Tests the element for an id according to the specification at
+     * <a href="http://www.w3.org/TR/xptr-framework/#term-sdi">http://www.w3.org/TR/xptr-framework/#term-sdi</a> and returns a boolean answer.
+     * 
+     * @param element An XMLElement to test for an id.
+     * @param id A String of the id to test for.
+     * @return boolean value of whether the id matches or not.
+     */
+    public abstract boolean testElementShorthand(XMLElement element, String id);
+    
+    //Internal classes
+    /**
+     * DocumentOrderIterator is a implementation of Iterator which iterates in Document Order from a root XMLElement object.
+     * 
+     */
+    private class DocumentOrderIterator implements Iterator {
+        private final Stack stack;
+        
+        public DocumentOrderIterator(XMLElement root) {
+            stack = new Stack();
+            stack.add(root);
+        }
+        
+        public boolean hasNext() {
+            return !stack.isEmpty();
+        }
+        
+        public Object next() {
+            //Get next element.
+            XMLElement element;
+            try {
+                element = (XMLElement)stack.pop(); 
+            } catch (EmptyStackException e) {
+                throw new NoSuchElementException();
+            }
+            //Add children to top of stack in reverse order.
+            List children = Arrays.asList(element.getChildElements());
+            Collections.reverse(children);
+            stack.addAll(children);
+            
+            return element;
+        }
+        
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/resources/org/apache/woden/internal/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/resources/org/apache/woden/internal/Messages.properties?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/resources/org/apache/woden/internal/Messages.properties (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/resources/org/apache/woden/internal/Messages.properties Tue Sep  1 05:49:02 2009
@@ -0,0 +1,306 @@
+############################################################
+#  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.
+#############################################################
+
+############################################################
+#
+# Filename: Messages.properties
+#
+# This file contains the text for all messages produced by Woden.
+# Each message is keyed by a message number. The file is used as
+# a ResourceBundle by Woden.
+#
+# The messages are separated into two groups - those that relate
+# to System type problems (e.g. Woden or parser configuration)
+# and those that relate specifically to processing WSDL documents
+# (i.e. related to the rules defined in the WSDL spec).  The
+# latter group of messages will eventually correspond to asserts
+# being added to the W3C WSDL spec and the message numbers will 
+# be replaced with corresponding assert references.
+#
+############################################################
+
+# TODO post-milestone2, resort and renumber the System Config and Parsing errors (JK)
+
+# ------------ System Config errors ---------------------
+
+WSDL001=###Not used yet###
+WSDL002={0} Parser configuration error.
+WSDL005=The feature name must not be null when attempting to get or set a named feature.
+WSDL006=The feature name "{0}" is not recognized.
+WSDL007=The property name must not be null when attempting to get or set a named property.
+WSDL008=The property name "{0}" is not recognized.
+WSDL009=Could not instantiate the "{0}" class.
+WSDL010=The extension attribute "{0}" in the context of "{1}" does not have a Java class registered, so it will map to "{2}" by default.
+WSDL011=The Java class "{0}" does not implement the "Attr" interface.
+WSDL012=No Java type was registered for the extension element "{0}" in the context of "{1}".
+WSDL013=The Java class "{0}" does not implement the "ExtensionElement" interface.
+WSDL014=Cannot specify a null Extension Registry.
+WSDL015=The extension namespace "{0}" in the context of "{1}" does not have a Java class registered.
+WSDL016=The Java class "{0}" does not implement the "ComponentExtensionContext" interface.
+WSDL017=WSDL source represented by the type "{0}" cannot be read by the WSDLReader implementation class "{1}".
+WSDL018=WSDL cannot be represented by the type "{0}" in the WSDLSource implementation class "{1}".
+WSDL019=A WSDL element cannot be represented by the type "{0}" in the XMLElement implementation class "{1}".
+WSDL020=Woden extension registrar class "{0}" not found.
+WSDL021=Class "{0}" does not implement the Woden ExtensionRegistrar interface.
+WSDL022=Unable to instantiate the Woden extension registrar class "{0}".
+WSDL023=The extension namespace cannot be null.
+WSDL024=The extension property name cannot be null.
+WSDL025=The parent WSDLComponent cannot be null.
+WSDL026=The "{0}" parameter cannot be null.
+
+# ------------ Parsing errors -------------------
+
+WSDL500={0} Parsing error in document located at {1}.
+WSDL501=Expected a "{0}" element, but found a "{1}" element instead.
+WSDL502=Could not create a URL from context URI "{0}" and location URI "{1}".
+WSDL503=Could not locate the WSDL document at URL "{0}".
+WSDL504=Could not locate the schema document at URL "{0}"
+WSDL505=Could not create a QName from the string "{0}" in element "{1}".
+WSDL506=Could not create a URI from the string "{0}".
+WSDL507=Could not create a QName from the string "{0}".
+WSDL508=Could not create a String from a null value.
+WSDL509=Could not create a list of QNames from the string "{0}".
+WSDL510=Could not create a QName from the string "{0}" within the string of QNames "{1}".
+WSDL511=Boolean defaulted to 'false' due to invalid boolean string "{0}".
+WSDL512=Could not create an Integer from the string "{0}".
+WSDL513=Could not determine the namespace for prefixed value "{0}" in element "{1}".
+
+WSDL520=Extension element "{0}" in the context of "{1}" must not be in the WSDL 2.0 namespace.
+WSDL521=Could not parse an inline schema in the WSDL at URL "{0}".
+WSDL522=Could not parse a schema imported from URL "{0}".
+WSDL523=The QName of an extension attribute must not be null.
+WSDL524=URI resolution failed on URI "{0}".
+WSDL523=Cannot add a new TypesElement as one already exists in the DescriptionElement.
+
+WSDL530=The XPointer "{0}" from the context URI "{1}" is invalid.
+WSDL531=The XPointer "{0}" from the context URI "{1}" failed to resolve any xml element.
+
+# ------------ TODO determine if these errors are needed -------------------
+
+# TODO - replace WSDL5xx error codes with reference numbers from the asserts
+#        to be defined in the WSDL spec (i.e. err msg nos. that point to the
+#        specific part of the WSDL spec that the error relates to).
+# The error codes listed below match the assertion ids in the WSDL 2.0 specification.
+# The error code itself is a key for the error message.
+# The error code ref is a reference to the location in the specification that
+# describes the assertion.
+# The error code assertion is the text of the assertion from the specification.
+
+
+# ---------------- 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]).
+
+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.
+
+Interface-1012 = The styleDefault attribute contains the IRI ''{0}'', which is not absolute. All IRIs specified for styleDefault must be absolute.
+Interface-1012.assertion = The type of the styleDefault attribute information item is list of xs:anyURI. Its value, if present, MUST contain absolute IRIs (see [IETF RFC 3987]).
+
+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-1041 = 
+MessageLabel-1041.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-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-1056 = 
+MessageLabel-1056.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-1030 = 
+MessageLabel-1030.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-1042 = 
+MessageLabel-1042.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-1053 = 
+MessageLabel-1053.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-1057 = 
+MessageLabel-1057.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-1031 = 
+MessageLabel-1031.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-1043 = 
+MessageLabel-1043.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.
+
+MessageLabel-1054 = 
+MessageLabel-1054.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-1058 = 
+MessageLabel-1058.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.
+
+Schema-1066 = The schema component ''{0}'' in the namespace ''{1}'' cannot be referenced unless this namespace is imported by an xs:import element or is the target namespace of an inlined xs:schema element.
+Schema-1066.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, http://www.w3.org/2001/XMLSchema, which contains built-in types as defined in XML Schema Part 2: Datatypes Second Edition [XML Schema: Datatypes].
+
+Schema-1069 = The XML schema imported from ''{0}'' must specify a target namespace.
+Schema-1069.assertion = The referenced schema MUST contain a targetNamespace attribute information item on its xs:schema element information item.
+
+#schema-0017b is a replacement for WSDL502
+#WSDL502=The namespace "{0}" specified on a schema import element does not match the target namespace "{1}" of the schema at the schemaLocation "{2}".
+
+Schema-1073 = The element ''{0}'' has already been defined in another inline XML Schema with the target namespace ''{1}''.
+Schema-1073.assertion = A WSDL 2.0 document MUST NOT define the same element or type in more than one inlined schema.
+
+Schema-1073b = The type ''{0}'' has already been defined in another inline XML Schema with the target namespace ''{1}''.
+Schema-1073b.assertion = A WSDL 2.0 document MUST NOT define the same element or type in more than one inlined schema.
+
+Schema-1075 = The alternative schema language makes use of the XML Schema namespace.
+Schema-1075.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-1079 = 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-1079.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-1070 = The imported XML Schema is not defined with the namespace ''{0}'' that is specified on the import element.
+Schema-1070.assertion = The value of the targetNamespace attribute information item of the xs:schema element information item of an imported schema MUST equal the value of the namespace of the import element information item in the importing WSDL 2.0 document.
+
+Schema-1076 = The namespace ''{0}'' specified is not an absolute IRI.
+Schema-1076.assertion = The namespace used for an alternate schema language MUST be an absolute IRI.
+
+Types-1074 = The alternate schema language does not include a declaration of an element information item to appear as a child of the types element.
+Types-1074.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).
+
+
+# ---------------- WSDL Component Level Assertions -------------------
+
+# If a Binding component specifies any operation-specific binding details (by including Binding Operation components) or any fault binding details (by including Binding Fault components) then it MUST specify an interface the Binding  component applies to, so as to indicate which interface the operations come from.
+Binding-1044 = An interface has not been specified for a binding that specifies operation or fault details. An interface must be specified when operation or fault details are specified.
+
+# A Binding component that defines bindings for an Interface component MUST define bindings for all the operations of that Interface component.
+Binding-1045 = The binding ''{0}'' does not define bindings for the interface operation ''{1}''. When a binding specifies an interface it must specify bindings for all of the interface's operations.
+
+# This xs:anyURI MUST be an absolute IRI as defined by [IETF RFC 3987].
+Binding-1048 = The type ''{0}'' specified for this binding is not an absolute IRI. The type must be absolute.
+
+# For each Binding component in the {bindings} property of a Description component, the {name} property MUST be unique.
+Binding-1049 = A binding with the name ''{0}'' has already been defined for the description component. All bindings defined in the description component must have unique names.
+
+# For each Binding Fault component in the {binding faults} property of a Binding component, the {interface fault} property MUST be unique.
+BindingFault-1050 = The interface fault specified for this binding fault has already been specified on another binding fault. Each binding fault within a binding must specify a unique interface fault.
+
+# For each Binding Fault Reference component in the {binding fault references} property of a Binding Operation component, the {interface fault reference} property MUST be unique.
+BindingFaultReference-1055 = A binding fault reference has already been specified for the interface fault reference ''{0}''. Each binding fault reference within a binding operation component must specify a unique interface fault reference.
+
+# There MUST be an Interface Fault Reference component in the {interface fault references} of the Interface Operation being bound with {message label} equal to the effective message label and with {interface fault} equal to an Interface Fault component with {name} equal to the actual value of the ref attribute information item.
+BindingFaultReference-1059 = The binding fault reference must reference an defined interface fault reference.
+
+# For each Binding Message Reference component in the {binding message references} property of a Binding Operation component, the {interface message reference} property MUST be unique.
+BindingMessageReference-1052 = A binding message reference has already been specified for the interface message reference ''{0}''. Each binding message reference within a binding operation component must specify a unique interface message reference.
+
+# For each Binding Operation component in the {binding operations} property of a Binding component, the {interface operation} property MUST be unique.
+BindingOperation-1051 = A binding operation has already been specified for the interface operation ''{0}''. Each binding operation within a binding component must specify a unique interface operation.
+
+Description-0024 = 
+Description-0024.ref = 2.1.2
+Description-0024.assertion = Each WSDL 2.0 or type system component MUST be uniquely identified by its qualified name.
+
+# This xs:anyURI MUST be an absolute IRI as defined by [IETF RFC 3987].
+Endpoint-1061 = The address ''{0}'' specified for this endpoint is not an absolute IRI. The address must be absolute.
+
+# For each Endpoint component in the {endpoints} property of a Service component, the {binding} property MUST either be a Binding component with an unspecified {interface} property or a Binding component with an {interface} property equal to the {interface} property of the Service component.
+Endpoint-1062 = The binding ''{0}'' specified for this endpoint specifies the interface ''{1}'' and not the interface ''{2}'' specified by the service. The binding specified for this endpoint must either not specify an interface or specify the same interface as the service.
+
+Interface-1009 = The interface ''{0}'' appears in the list of interfaces it extends.
+Interface-1009.ref = 2.2.1
+Interface-1009.assertion = To avoid circular definitions, an interface MUST NOT appear as an element of the set of interfaces it extends, either directly or indirectly.
+
+Interface-1010 = An interface with the name ''{0}'' has already been defined for the description component. All interfaces defined in the description component must have unique names.
+Interface-1010.ref = 2.2.1
+Interface-1010.assertion = For each Interface component in the {interfaces} property of a Description component, the {name} property MUST be unique.
+
+InterfaceFault-1015 = 
+InterfaceFault-1015.ref = 2.3.1
+InterfaceFault-1015.assertion = In cases where, due to an interface extending one or more other interfaces, two or more Interface Fault components have the same value for their {name} property, then the component models of those Interface Fault components MUST be equivalent (see 2.17 Equivalence of Components).
+
+InterfaceFaultReference-1037 = 
+InterfaceFaultReference-1037.ref = 2.6.1
+InterfaceFaultReference-1037.assertion = The value of this property MUST match the name of a placeholder message defined by the message exchange pattern.
+
+InterfaceFaultReference-1038 = 
+InterfaceFaultReference-1038.ref = 2.6.1
+InterfaceFaultReference-1038.assertion = The direction MUST be consistent with the direction implied by the fault propagation ruleset used in the message exchange pattern of the operation.
+
+InterfaceFaultReference-1039 = An interface fault reference with for the fault ''{0}'' and message label ''{1}'' has already been defined for this interface operation. Each fault reference in an interface operation must have a unique combination of fault and message label.
+InterfaceFaultReference-1039.ref = 2.6.1
+InterfaceFaultReference-1039.assertion = For each Interface Fault Reference component in the {interface fault references} property of an Interface Operation component, the combination of its {interface fault} and {message label} properties MUST be unique.
+
+InterfaceMessageReference-1026 = 
+InterfaceMessageReference-1026.ref = 2.5.1
+InterfaceMessageReference-1026.assertion = The direction MUST be the same as the direction of the message identified by the {message label} property in the {message exchange pattern} of the Interface Operation component this is contained within.
+
+InterfaceMessageReference-1028 = The message content model is #any or #none and the element declaration is not empty. The element declaration must be empty when the message content model is #any or #none.
+InterfaceMessageReference-1028.ref = 2.5.1
+InterfaceMessageReference-1028.assertion = When the {message content model} property has the value #any or #none the {element declaration} property MUST be empty.
+
+InterfaceMessageReference-1029 = An interface message reference with the message label ''{0}'' has already been defined. An interface message reference must have a unique message label within the interface operation that contains it.
+InterfaceMessageReference-1029.ref = 2.5.1
+InterfaceMessageReference-1029.assertion = For each Interface Message Reference component in the {interface message references} property of an Interface Operation component, its {message label} property MUST be unique.
+
+InterfaceOperation-20970 = 
+InterfaceOperation-20970 = 2.4.1
+InterfaceOperation-20970.assertion = In cases where, due to an interface extending one or more other interfaces, two or more Interface Operation components have the same value for their {name} property, then the component models of those Interface Operation components MUST be equivalent (see 2.17 Equivalence of Components).
+
+InterfaceOperation-20973 = 
+InterfaceOperation-20973.ref = 2.4.1.2
+InterfaceOperation-20973.assertion = An Interface Operation component MUST satisfy the specification defined by each operation style identified by its {style} property.
+
+MEP-1022 = The message exchange pattern ''{0}'' is not absolute. A message exchange pattern must be identified by an absolute IRI.
+MEP-1022.ref = 2.4.1.1
+MEP-1022.assertion = A message exchange pattern is uniquely identified by an absolute IRI which is used as the value of the {message exchange pattern} property the Interface Operation component, and it specifies the fault propagation ruleset that its faults obey.
+
+MessageLabel-1024 = 
+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-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.
+
+Types-1008 = 
+Types-1008.ref = 2.1.2.1
+Types-1008.assertion = It is an error if there are multiple type definitions for each QName.
+
+# ------------SECTION 3: WSDL-related warnings -------------------
+# These warnings were pulled from the WSDL 2.0 spec and are possible warnings
+# for the validator to report.
+
+Description-S0001 = 
+Description-S0001.ref = 2.1.2
+Description-S0001.assertion = The value of the targetNamespace attribute information item SHOULD be a dereferenceable IRI (see [IETF RFC 3987])
+
+InterfaceFault-S0002 = 
+InterfaceFault-S0002.ref = 2.3.1
+InterfaceFault-S0002.assertion = For the above reason, it is considered good practice to ensure, where necessary, that the local name of the {name} property of Interface Fault components within a namespace are unique, thus allowing such derivation to occur without inadvertent error.
+
+InterfaceOperation-S0003 = 
+InterfaceOperation-S0003.ref = 2.4.1
+InterfaceOperation-S0003.assertion = For the above reason, it is considered good practice to ensure, where necessary, that the {name} property of Interface Operation components within a namespace are unique, thus allowing such derivation to occur without inadvertent error.
+
+------------------- End of Messages ----------------------------
\ No newline at end of file

Added: webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/internal/ReaderFeaturesTest.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/internal/ReaderFeaturesTest.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/internal/ReaderFeaturesTest.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/internal/ReaderFeaturesTest.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,87 @@
+/**
+ * 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;
+
+import org.apache.woden.WSDLReader;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for the ReaderFeatures class.
+ * 
+ * TODO: Add tests for all features.
+ */
+public class ReaderFeaturesTest extends TestCase {
+
+	private ReaderFeatures defaultFeatures = new ReaderFeatures();
+	private ReaderFeatures features = new ReaderFeatures();
+	
+	/**
+	 * Test that the validation feature is off by default.
+	 */
+	public void testValidationDefault()
+	{
+		assertFalse("The validation feature is not off by default.", defaultFeatures.getValue(WSDLReader.FEATURE_VALIDATION));
+	}
+	
+	/**
+	 * Test that the getValue method throws an exception for invalid
+	 * features.
+	 */
+	public void testGetValueForInvalidFeature()
+	{
+		try
+		{
+			features.getValue("http://invalidfeatureid");
+			fail("An IllegalStateException was not thrown when getValue is called for an invalid feature ID.");
+		}
+		catch(IllegalArgumentException e)
+		{
+			// The successful case will reach here. Nothing to do at this point.
+		}
+	}
+	
+	/**
+	 * Test that the setValue method throws an exception for invalid
+	 * features.
+	 */
+	public void testSetValueForInvalidFeature()
+	{
+		try
+		{
+			features.setValue("http://invalidfeatureid", true);
+			fail("An IllegalStateException was not thrown when setValue is called for an invalid feature ID.");
+		}
+		catch(IllegalArgumentException e)
+		{
+			// The successful case will reach here. Nothing to do at this point.
+		}
+	}
+	
+	/**
+	 * Test that setting values to on or off works correctly.
+	 */
+	public void testSetValue()
+	{
+		features.setValue(WSDLReader.FEATURE_VALIDATION, true);
+		assertTrue("The validation feature is not set to true.", features.getValue(WSDLReader.FEATURE_VALIDATION));
+		
+		features.setValue(WSDLReader.FEATURE_VALIDATION, false);
+		assertFalse("The validation feature is not set to false.", features.getValue(WSDLReader.FEATURE_VALIDATION));
+	}
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/tests/TestErrorHandler.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/tests/TestErrorHandler.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/tests/TestErrorHandler.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/test/java/org/apache/woden/tests/TestErrorHandler.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,149 @@
+/**
+ * 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.tests;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import org.apache.woden.ErrorHandler;
+import org.apache.woden.ErrorInfo;
+
+/**
+ * An error handler that will allow the test cases to get access to the
+ * errors and warnings reported by the validators.
+ */
+public class TestErrorHandler implements ErrorHandler 
+{
+  public Hashtable warnings = new Hashtable();
+  public int numWarnings = 0;
+  public Hashtable errors = new Hashtable();
+  public int numErrors = 0;
+  public Hashtable fatalErrors = new Hashtable();
+  public int numFatalErrors = 0;
+
+  /**
+   * Reset the handler. Remove all messages stored in the handler.
+   */
+  public void reset()
+  {
+	warnings.clear();
+	numWarnings = 0;
+	errors.clear();
+	numErrors = 0;
+	fatalErrors.clear();
+	numFatalErrors = 0;
+  }
+  
+  /**
+   * Determine whether an error or fatal error message has been reported.
+   * 
+   * @return True if an error or fatal error message has been reported, false otherwise.
+   */
+  public boolean errorMessageHasBeenReported()
+  {
+    if(numErrors + numFatalErrors == 0)
+      return false;
+    return true;
+  }
+  
+  /**
+   * Determine whether any message has been reported (warning, error or fatal error).
+   * 
+   * @return True if a message has been reported, false otherwise.
+   */
+  public boolean messageHasBeenReported()
+  {
+	if(numWarnings + numErrors + numFatalErrors == 0)
+	  return false;
+	return true;
+  }
+  
+  /**
+   * Get a summary of the message keys. This is used in
+   * reporting the keys of messages that were reported.
+   * 
+   * @return A summary string of the message keys.
+   */
+  public String getSummaryOfMessageKeys()
+  {
+	StringBuffer summary = new StringBuffer();
+	
+	if(numFatalErrors > 0)
+	{
+	  summary.append("Fatal Errors: ");
+	  Enumeration keys = fatalErrors.keys();
+	  while(keys.hasMoreElements())
+	  {
+		summary.append(keys.nextElement()).append(" ");
+	  }
+	  summary.append("\n");
+	}
+	
+	if(numErrors > 0)
+	{
+	  summary.append("Errors: ");
+	  Enumeration keys = errors.keys();
+	  while(keys.hasMoreElements())
+	  {
+		summary.append(keys.nextElement()).append(" ");
+	  }
+	  summary.append("\n");
+	}
+	
+	if(numWarnings > 0)
+	{
+	  summary.append("Warnings: ");
+	  Enumeration keys = warnings.keys();
+	  while(keys.hasMoreElements())
+	  {
+		summary.append(keys.nextElement()).append(" ");
+	  }
+	}
+	
+	return summary.toString();
+  }
+  
+  /* (non-Javadoc)
+   * @see org.apache.woden.ErrorHandler#warning(org.apache.woden.ErrorInfo)
+   */
+  public void warning(ErrorInfo errorInfo)
+  {
+    warnings.put(errorInfo.getKey(), errorInfo);
+    numWarnings++;
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.woden.ErrorHandler#error(org.apache.woden.ErrorInfo)
+   */
+  public void error(ErrorInfo errorInfo) 
+  {
+    errors.put(errorInfo.getKey(), errorInfo);
+    numErrors++;
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.woden.ErrorHandler#fatalError(org.apache.woden.ErrorInfo)
+   */
+  public void fatalError(ErrorInfo errorInfo) 
+  {
+    fatalErrors.put(errorInfo.getKey(), errorInfo);
+    numFatalErrors++;
+  }
+  
+  
+
+}



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


Mime
View raw message