ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkapu...@apache.org
Subject svn commit: r307331 - in /incubator/woden/java/src/org/apache/woden: internal/DOMWSDLReader.java internal/wsdl20/Constants.java internal/wsdl20/PropertyImpl.java wsdl20/xml/PropertyElement.java
Date Sat, 08 Oct 2005 23:04:45 GMT
Author: jkaputin
Date: Sat Oct  8 16:04:35 2005
New Revision: 307331

URL: http://svn.apache.org/viewcvs?rev=307331&view=rev
Log:
Finished off parse <property> to complete the parsing
of interface fault.

Modified:
    incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
    incubator/woden/java/src/org/apache/woden/internal/wsdl20/Constants.java
    incubator/woden/java/src/org/apache/woden/internal/wsdl20/PropertyImpl.java
    incubator/woden/java/src/org/apache/woden/wsdl20/xml/PropertyElement.java

Modified: incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java?rev=307331&r1=307330&r2=307331&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java Sat Oct  8 16:04:35
2005
@@ -54,6 +54,9 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
 import org.w3c.dom.bootstrap.DOMImplementationRegistry;
 import org.w3c.dom.ls.DOMImplementationLS;
 import org.w3c.dom.ls.LSInput;
@@ -362,9 +365,17 @@
         String element = 
             DOMUtils.getAttribute(faultEl, Constants.ATTR_ELEMENT);
         
-        // TODO report bad qname here or leave it for the validator?
-        QName qname = DOMUtils.getQName(element, faultEl, desc);
-        fault.setElement(qname);
+        
+        try {
+            QName qname = DOMUtils.getQName(element, faultEl, desc);
+            fault.setElement(qname);
+        } catch (WSDLException e) {
+            //Bad qname, so ignore element attribute and let validator handle it later.
+            
+            //TODO Confirm that validator can handle this later. One problem might be
+            //that the context is gone, so the validator cannot tell if the element attr
+            //was missing or if the qname string had an unbound prefix.
+        }
         
         //TODO extension attributes
         
@@ -416,7 +427,7 @@
     }
 
     private PropertyElement parseProperty(Element propEl, 
-                                          DescriptionElement desc) 
+                                          DescriptionElement desc)
     {
         PropertyElement property = desc.createPropertyElement();
         
@@ -447,13 +458,41 @@
             }
             else if(QNameUtils.matches(Constants.Q_ELEM_VALUE, tempEl))
             {
-                //TODO decide how to represent 'value'. Store as Object for now.
-                property.setValue(tempEl);
-            }
+                //the property value consists of the child info items of <value>
+                NodeList nodeList = tempEl.getChildNodes();
+                property.setValue(nodeList);
+           }
             else if(QNameUtils.matches(Constants.Q_ELEM_CONSTRAINT, tempEl))
             {
-                //TODO get the qname or token '#value' from the <constraint>
-                //String text = tempEl.getTextContent();
+                //TODO t.b.c. assume <constraint> has just '#value' or a qname 
+                //and don't check for extraneous text or child elements?
+                
+                Node node = tempEl.getFirstChild();
+                if(node != null && node instanceof Text)
+                {
+                    Text textNode = (Text)node;
+                    String textValue = textNode.getTextContent().trim();
+                    if(textValue.length() > 0)
+                    {
+                        if(textValue.equals(Constants.TOKEN_VALUE))
+                        {
+                            property.setHasValueToken(true);
+                        }
+                        else 
+                        {
+                            try {
+                                QName qname = DOMUtils.getQName(textValue, tempEl, desc);
+                                property.setConstraint(qname);
+                            } catch (WSDLException e) {
+                                //Bad qname, so ignore constraint text and let validator
handle it later.
+                                
+                                //TODO Confirm that validator can handle this later. One
problem might be
+                                //that the context is gone, so the validator cannot tell
if the constraint
+                                //qname was missing or if the qname string had an unbound
prefix.
+                            }
+                        }
+                    }
+                }
             }
             else
             {

Modified: incubator/woden/java/src/org/apache/woden/internal/wsdl20/Constants.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/Constants.java?rev=307331&r1=307330&r2=307331&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/Constants.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/Constants.java Sat Oct  8 16:04:35
2005
@@ -115,6 +115,9 @@
     public static final String ATTR_BINDING = "binding";
     public static final String ATTR_LOCATION = "address";
 
+    // NMTokens
+    public static final String TOKEN_VALUE = "#value";
+    
     //Type systems and content model APIs
     //TODO consider where in the API to query or set the type system used.
     public static final String TYPE_XSD_2001 =

Modified: incubator/woden/java/src/org/apache/woden/internal/wsdl20/PropertyImpl.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/PropertyImpl.java?rev=307331&r1=307330&r2=307331&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/PropertyImpl.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/PropertyImpl.java Sat Oct  8
16:04:35 2005
@@ -39,7 +39,7 @@
     private Object fValue = null; //TODO decide how to handle value contents
     private QName fConstraint = null;
 
-    private boolean fHasValue = false; //true if constraint='#value'
+    private boolean fHasValueToken = false; //true if constraint='#value'
 
     /*
      * @see org.apache.woden.wsdl20.xml.PropertyElement#setRef(String)
@@ -92,25 +92,27 @@
     }
     
     /*
-     * Set to true if <constraint> contains the token "#value", which 
-     * indicates that this property specifies a value instead of a constraint.
+     * Set to true if <constraint> contains the NMToken "#value",  
+     * which would indicate that this property specifies a <value> instead of a 
+     * <constraint> QName.
      * 
-     * @see org.apache.woden.wsdl20.xml.PropertyElement#setHasValue(boolean)
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#setHasValueToken(boolean)
      */
-    public void setHasValue(boolean b) 
+    public void setHasValueToken(boolean b) 
     {
-        fHasValue = b;
+        fHasValueToken = b;
     }
     
     /*
-     * Returns true if <constraint> contains the token "#value", which 
-     * indicates that this property specifies a value instead of a constraint.
+     * Should return true if the <constraint> contains the NMToken "#value",
+     * which would indicate that this property specifies a <value> instead of a 
+     * <constraint> QName.
      * 
-     * @see org.apache.woden.wsdl20.xml.PropertyElement#setHasValue(boolean)
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#hasValueToken()
      */
-    public boolean hasValue() 
+    public boolean hasValueToken() 
     {
-        return fHasValue;
+        return fHasValueToken;
     }
     
     /* 

Modified: incubator/woden/java/src/org/apache/woden/wsdl20/xml/PropertyElement.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/wsdl20/xml/PropertyElement.java?rev=307331&r1=307330&r2=307331&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/wsdl20/xml/PropertyElement.java (original)
+++ incubator/woden/java/src/org/apache/woden/wsdl20/xml/PropertyElement.java Sat Oct  8 16:04:35
2005
@@ -34,15 +34,17 @@
     public QName getConstraint();
     
     /**
-     * Set to true if &lt;constraint&gt; contains the token "#value", which 
-     * indicates that this property specifies a value instead of a constraint.
+     * Set to true if &lt;constraint&gt; contains the NMToken "#value",  
+     * which would indicate that this property specifies a &lt;value&gt; 
+     * instead of a &lt;constraint&gt; QName.
      */
-    public void setHasValue(boolean b);
+    public void setHasValueToken(boolean b);
     
     /**
-     * Returns true if &lt;constraint&gt; contains the token "#value", which 
-     * indicates that this property specifies a value instead of a constraint.
+     * Returns true if &lt;constraint&gt; contains the NMToken "#value", 
+     * which would indicate that this property specifies a &lt;value&gt; 
+     * instead of a &lt;constraint&gt; QName.
      */ 
-    public boolean hasValue();
+    public boolean hasValueToken();
     
 }



---------------------------------------------------------------------
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