You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2005/10/03 13:11:40 UTC

svn commit: r293308 - in /incubator/woden/java/src/org/apache/woden: internal/DOMWSDLReader.java internal/wsdl20/PropertyImpl.java wsdl20/xml/PropertyElement.java

Author: jkaputin
Date: Mon Oct  3 04:11:30 2005
New Revision: 293308

URL: http://svn.apache.org/viewcvs?rev=293308&view=rev
Log:
Added parsing of <property> and added invocations of
parseFeature and parseProperty.

Modified:
    incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.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=293308&r1=293307&r2=293308&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java Mon Oct  3 04:11:30 2005
@@ -244,7 +244,7 @@
         
         feature.setRequired("true".equals(req) ? true : false);
         
-        //TODO t.b.c. what if attr value is not true or false?
+        //TODO t.b.c. what if attr value is not 'true' or 'false'? (eg, missing, mispelt or case change)
         
         //TODO extension attributes
         
@@ -326,9 +326,17 @@
             {
                 intface.addInterfaceOperationElement(parseInterfaceOperation(tempEl, desc));
             }
+            else if (QNameUtils.matches(Constants.Q_ELEM_FEATURE, tempEl))
+            {
+                intface.addFeatureElement(parseFeature(tempEl, desc));
+            }
+            else if (QNameUtils.matches(Constants.Q_ELEM_PROPERTY, tempEl))
+            {
+                intface.addPropertyElement(parseProperty(tempEl, desc));
+            }
             else
             {
-                //TODO feature, property, extensions
+                //TODO extensions
             }
             
             tempEl = DOMUtils.getNextSiblingElement(tempEl);
@@ -405,6 +413,8 @@
     {
         InterfaceOperationElement oper = desc.createInterfaceOperationElement();
         
+        //TODO complete the parsing of interface operation
+        
         return oper;
     }
 
@@ -413,6 +423,49 @@
     {
         PropertyElement property = desc.createPropertyElement();
         
+        String ref = 
+            DOMUtils.getAttribute(propEl, Constants.ATTR_REF);
+        
+        property.setRef(ref);
+        
+        //TODO extension attributes
+        
+        /* Parse the child elements of the <property> element. 
+         * As per WSDL 2.0 spec, they must be in the following order if present:
+         * <documentation>
+         * <value> or <constraint>
+         * extension elements.
+         * 
+         * TODO validate that the elements are in correct order
+         * TODO validate that 'value' and 'constraint' are mutually exclusive
+         */ 
+
+        Element tempEl = DOMUtils.getFirstChildElement(propEl);
+
+        while (tempEl != null)
+        {
+            if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+            {
+                property.addDocumentationElement(parseDocumentation(tempEl, desc));
+            }
+            else if(QNameUtils.matches(Constants.Q_ELEM_VALUE, tempEl))
+            {
+                //TODO decide how to represent 'value'. Store as Object for now.
+                property.setValue(tempEl);
+            }
+            else if(QNameUtils.matches(Constants.Q_ELEM_CONSTRAINT, tempEl))
+            {
+                //TODO get the qname or token '#value' from the <constraint>
+                //String text = tempEl.getTextContent();
+            }
+            else
+            {
+                //TODO extensions
+            }
+            
+            tempEl = DOMUtils.getNextSiblingElement(tempEl);
+        }
+        
         return property;
     }
 
@@ -519,7 +572,7 @@
     }
 
     /*
-     * Parse the &lt.xs:import&gt. element and retrieve the imported
+     * Parse the &lt;xs:import&gt; element and retrieve the imported
      * schema document if schemaLocation specified. Failure to retrieve 
      * the schema will only matter if any WSDL components contain elements or
      * constraints that refer to the schema, and typically this will be 

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=293308&r1=293307&r2=293308&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 Mon Oct  3 04:11:30 2005
@@ -18,6 +18,8 @@
 import java.util.List;
 import java.util.Vector;
 
+import javax.xml.namespace.QName;
+
 import org.apache.woden.wsdl20.Component;
 import org.apache.woden.wsdl20.Property;
 import org.apache.woden.wsdl20.TypeDefinition;
@@ -34,6 +36,10 @@
     
     private String fRef = null;
     private List fDocumentationElements = new Vector();
+    private Object fValue = null; //TODO decide how to handle value contents
+    private QName fConstraint = null;
+
+    private boolean fHasValue = false; //true if constraint='#value'
 
     /*
      * @see org.apache.woden.wsdl20.xml.PropertyElement#setRef(String)
@@ -52,19 +58,65 @@
         return fRef;
     }
 
-
-    /* (non-Javadoc)
-     * @see org.apache.woden.wsdl20.Property#getValueConstraint()
+    /*
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#setValue(Object)
      */
-    public TypeDefinition getValueConstraint() {
-        // TODO Auto-generated method stub
-        return null;
+    public void setValue(Object value) 
+    {
+        fValue = value;
     }
-
-    /* (non-Javadoc)
+    
+    /*
      * @see org.apache.woden.wsdl20.Property#getValue()
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#getValue()
      */
-    public Object getValue() {
+    public Object getValue() 
+    {
+        return fValue;
+    }
+    
+    /*
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#setConstraint(QName)
+     */
+    public void setConstraint(QName constraint) 
+    {
+        fConstraint = constraint;
+    }
+    
+    /*
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#getConstraint()
+     */
+    public QName getConstraint() 
+    {
+        return fConstraint;
+    }
+    
+    /*
+     * Set to true if <constraint> contains the token "#value", which 
+     * indicates that this property specifies a value instead of a constraint.
+     * 
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#setHasValue(boolean)
+     */
+    public void setHasValue(boolean b) 
+    {
+        fHasValue = b;
+    }
+    
+    /*
+     * Returns true if <constraint> contains the token "#value", which 
+     * indicates that this property specifies a value instead of a constraint.
+     * 
+     * @see org.apache.woden.wsdl20.xml.PropertyElement#setHasValue(boolean)
+     */
+    public boolean hasValue() 
+    {
+        return fHasValue;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.Property#getValueConstraint()
+     */
+    public TypeDefinition getValueConstraint() {
         // TODO Auto-generated method stub
         return null;
     }

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=293308&r1=293307&r2=293308&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 Mon Oct  3 04:11:30 2005
@@ -15,8 +15,10 @@
  */
 package org.apache.woden.wsdl20.xml;
 
+import javax.xml.namespace.QName;
+
 /**
- * Represents the &lt.property&gt. element.
+ * Represents the &lt;property&gt; element.
  *  
  * @author jkaputin@apache.org
  */
@@ -24,5 +26,23 @@
 {
     public void setRef(String uri);
     public String getRef();
+    
+    public void setValue(Object o);
+    public Object getValue();
+    
+    public void setConstraint(QName qname);
+    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.
+     */
+    public void setHasValue(boolean b);
+    
+    /**
+     * Returns true if &lt;constraint&gt; contains the token "#value", which 
+     * indicates that this property specifies a value instead of a constraint.
+     */ 
+    public boolean hasValue();
     
 }



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