Author: jkaputin
Date: Sun Jan 28 17:32:00 2007
New Revision: 500917

URL: http://svn.apache.org/viewvc?view=rev&rev=500917
Log:
WODEN-87 Added methods to Interface API to flatten
interface inheritance by returning all faults or
operations, including directly delcared and extended
interface components. Also, did some code reorganizing
and renaming of method args.

Modified:
    
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingFaultImpl.java
    
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
    
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java
    
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
    incubator/woden/trunk/java/src/org/apache/woden/wsdl20/Interface.java
    
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingFaultImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingFaultImpl.java?view=diff&rev=500917&r1=500916&r2=500917
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingFaultImpl.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingFaultImpl.java
 Sun Jan 28 17:32:00 2007
@@ -51,7 +51,7 @@
         Binding binding = (Binding)getParent();
         Interface interfac = binding.getInterface();
         if(interfac != null) {
-            fault = ((InterfaceImpl)interfac).getInScopeInterfaceFault(fRef);
+            fault = interfac.getFromAllInterfaceFaults(fRef);
         }
         return fault;
     }

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java?view=diff&rev=500917&r1=500916&r2=500917
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/BindingOperationImpl.java
 Sun Jan 28 17:32:00 2007
@@ -60,7 +60,7 @@
         Binding binding = (Binding)getParent();
         Interface interfac = binding.getInterface();
         if(interfac != null) {
-            oper = 
((InterfaceImpl)interfac).getInScopeInterfaceOperation(fRef);
+            oper = interfac.getFromAllInterfaceOperations(fRef);
         }
         return oper;
     }
@@ -117,8 +117,10 @@
         BindingElement binding = (BindingElement)getParentElement();
         InterfaceElement interfac = binding.getInterfaceElement();
         if(interfac != null) {
-            InterfaceOperation operComp = 
((InterfaceImpl)interfac).getInScopeInterfaceOperation(fRef);
-            oper = operComp.toElement();
+            InterfaceOperation operComp = 
((Interface)interfac).getFromAllInterfaceOperations(fRef);
+            if(operComp != null) {
+                oper = operComp.toElement();
+            }
         }
         return oper;
 

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java?view=diff&rev=500917&r1=500916&r2=500917
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java
 Sun Jan 28 17:32:00 2007
@@ -55,7 +55,7 @@
     {
         InterfaceOperation oper = (InterfaceOperation)getParent();
         Interface interfac = (Interface)oper.getParent();
-        InterfaceFault intFault = 
((InterfaceImpl)interfac).getInScopeInterfaceFault(fRef);
+        InterfaceFault intFault = interfac.getFromAllInterfaceFaults(fRef);
         return intFault;
     }
 

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java?view=diff&rev=500917&r1=500916&r2=500917
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
 Sun Jan 28 17:32:00 2007
@@ -125,12 +125,45 @@
     /* 
      * @see 
org.apache.woden.wsdl20.Interface#getInterfaceFault(javax.xml.namespace.QName)
      */
-    public InterfaceFault getInterfaceFault(QName qname) 
+    public InterfaceFault getInterfaceFault(QName faultName) 
     {
-        return (InterfaceFault)getInterfaceFaultElement(qname);
+        return (InterfaceFault)getInterfaceFaultElement(faultName);
     }
     
     /* 
+     * @see org.apache.woden.wsdl20.Interface#getAllInterfaceFaults()
+     */
+    public InterfaceFault[] getAllInterfaceFaults() 
+    {
+        List allInterfaceFaults = new Vector();
+        allInterfaceFaults.addAll(fInterfaceFaultElements);
+        allInterfaceFaults.addAll(getDerivedInterfaceFaults());
+        InterfaceFault[] array = new InterfaceFault[allInterfaceFaults.size()];
+        allInterfaceFaults.toArray(array);
+        return array;
+    }
+
+    /* 
+     * @see 
org.apache.woden.wsdl20.Interface#getFromAllInterfaceFaults(javax.xml.namespace.QName)
+     */
+    public InterfaceFault getFromAllInterfaceFaults(QName faultName) 
+    {
+        InterfaceFault theFault = null;
+        if(faultName != null) {
+            InterfaceFault[] faults = getAllInterfaceFaults();
+            for(int i=0; i<faults.length; i++) {
+                InterfaceFault fault = faults[i];
+                if(faultName.equals(fault.getName())) {
+                    theFault = fault;
+                    break;
+                }
+            }
+        }
+        return theFault;
+    }
+
+    /* 
+    /* 
      * @see org.apache.woden.wsdl20.Interface#getInterfaceOperations()
      */
     public InterfaceOperation[] getInterfaceOperations() 
@@ -143,12 +176,44 @@
     /* 
      * @see 
org.apache.woden.wsdl20.Interface#getInterfaceOperation(javax.xml.namespace.QName)
      */
-    public InterfaceOperation getInterfaceOperation(QName qname) 
+    public InterfaceOperation getInterfaceOperation(QName operName) 
     {
-        return (InterfaceOperation)getInterfaceOperationElement(qname);
+        return (InterfaceOperation)getInterfaceOperationElement(operName);
     }
     
     /* 
+     * @see org.apache.woden.wsdl20.Interface#getAllInterfaceOperations()
+     */
+    public InterfaceOperation[] getAllInterfaceOperations() 
+    {
+        List allInterfaceOperations = new Vector();
+        allInterfaceOperations.addAll(fInterfaceOperationElements);
+        allInterfaceOperations.addAll(getDerivedInterfaceOperations());
+        InterfaceOperation[] array = new 
InterfaceOperation[allInterfaceOperations.size()];
+        allInterfaceOperations.toArray(array);
+        return array;
+    }
+
+    /* 
+     * @see 
org.apache.woden.wsdl20.Interface#getFromAllInterfaceOperations(javax.xml.namespace.QName)
+     */
+    public InterfaceOperation getFromAllInterfaceOperations(QName operName) 
+    {
+        InterfaceOperation theOper = null;
+        if(operName != null) {
+            InterfaceOperation[] opers = getAllInterfaceOperations();
+            for(int i=0; i<opers.length; i++) {
+                InterfaceOperation oper = opers[i];
+                if(operName.equals(oper.getName())) {
+                    theOper = oper;
+                    break;
+                }
+            }
+        }
+        return theOper;
+    }
+
+    /* 
      * @see org.apache.woden.wsdl20.Interface#toElement()
      */
     public InterfaceElement toElement() {
@@ -208,9 +273,6 @@
     /* 
      * @see org.apache.woden.wsdl20.xml.InterfaceElement#setName(NCName)
      */
-    // TODO: need to store NCName and not QName because it is valid for somone
-    // to create an InterfaceImpl and set the name without first having added
-    // the interfaceimpl to the DescriptionElement.
     public void setName(NCName name) {
         fName = name;
     }
@@ -238,20 +300,20 @@
     /* 
      * @see 
org.apache.woden.wsdl20.xml.InterfaceElement#addExtendedInterfaceName(javax.xml.namespace.QName)
      */
-    public void addExtendedInterfaceName(QName qname)
+    public void addExtendedInterfaceName(QName interfaceName)
     {
-        if(qname != null) {
-            fExtends.add(qname);
+        if(interfaceName != null) {
+            fExtends.add(interfaceName);
         }
     }
     
     /* 
      * @see 
org.apache.woden.wsdl20.xml.InterfaceElement#removeExtendedInterfaceName(javax.xml.namespace.QName)
      */
-    public void removeExtendedInterfaceName(QName qname)
+    public void removeExtendedInterfaceName(QName interfaceName)
     {
-        if(qname != null) {
-            fExtends.remove(qname);
+        if(interfaceName != null) {
+            fExtends.remove(interfaceName);
         }
     }
     
@@ -268,12 +330,12 @@
     /* 
      * @see 
org.apache.woden.wsdl20.xml.InterfaceElement#getExtendedInterfaceElement(javax.xml.namespace.QName)
      */
-    public InterfaceElement getExtendedInterfaceElement(QName qname)
+    public InterfaceElement getExtendedInterfaceElement(QName interfaceName)
     {
         //Cast the containing description element to a description component 
to re-use its
         //logic for navigating a composite wsdl to retrieve the in-scope 
top-level components.
         Description desc = (Description)fParentElem;
-        InterfaceElement intface = (InterfaceElement)desc.getInterface(qname); 
+        InterfaceElement intface = 
(InterfaceElement)desc.getInterface(interfaceName); 
         return intface;
     }
     
@@ -309,17 +371,17 @@
     /* 
      * @see 
org.apache.woden.wsdl20.xml.InterfaceElement#getInterfaceFaultElement(javax.xml.namespace.QName)
      */
-    public InterfaceFaultElement getInterfaceFaultElement(QName qname)
+    public InterfaceFaultElement getInterfaceFaultElement(QName faultName)
     {
         InterfaceFaultElement fault = null;
         
-        if(qname != null)
+        if(faultName != null)
         {
             InterfaceFaultElement tempFault = null;
             for(Iterator i=fInterfaceFaultElements.iterator(); i.hasNext(); )
             {
                 tempFault = (InterfaceFaultElement)i.next();
-                if(qname.equals(tempFault.getName()))
+                if(faultName.equals(tempFault.getName()))
                 {
                     fault = tempFault;
                     break;
@@ -354,17 +416,17 @@
     /* 
      * @see 
org.apache.woden.wsdl20.xml.InterfaceElement#getInterfaceOperationElement(javax.xml.namespace.QName)
      */
-    public InterfaceOperationElement getInterfaceOperationElement(QName qname)
+    public InterfaceOperationElement getInterfaceOperationElement(QName 
operName)
     {
         InterfaceOperationElement oper = null;
         
-        if(qname != null)
+        if(operName != null)
         {
             InterfaceOperationElement tempOper = null;
             for(Iterator i=fInterfaceOperationElements.iterator(); 
i.hasNext(); )
             {
                 tempOper = (InterfaceOperationElement)i.next();
-                if(qname.equals(tempOper.getName()))
+                if(operName.equals(tempOper.getName()))
                 {
                     oper = tempOper;
                     break;
@@ -410,8 +472,10 @@
      * 
      * TODO consider whether this is needed on the API (currently just used by 
validator)
      * TODO also consider whether getInScopeInterfaceOperations() is needed. 
+     * 
+     * TODO remove this method, made redundant by new API method 
getFromAllInterfaceOperations(QN)
      */
-    public InterfaceOperation getInScopeInterfaceOperation(QName qname) 
+    private InterfaceOperation getInScopeInterfaceOperation(QName qname) 
     {
         InterfaceOperation oper = null;
         
@@ -468,8 +532,10 @@
      * 
      * TODO consider whether this is needed on the API (currently just used by 
validator) 
      * TODO also consider whether getInScopeInterfaceFaults() is needed. 
+     * 
+     * TODO remove this method, made redundant by new API method 
getFromAllInterfaceFaults(QN)
      */
-    public InterfaceFault getInScopeInterfaceFault(QName qname) 
+    private InterfaceFault getInScopeInterfaceFault(QName qname) 
     {
         InterfaceFault fault = null;
         

Modified: incubator/woden/trunk/java/src/org/apache/woden/wsdl20/Interface.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/Interface.java?view=diff&rev=500917&r1=500916&r2=500917
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/wsdl20/Interface.java 
(original)
+++ incubator/woden/trunk/java/src/org/apache/woden/wsdl20/Interface.java Sun 
Jan 28 17:32:00 2007
@@ -38,42 +38,84 @@
     public Interface[] getExtendedInterfaces();
     
     /**
-     * Returns the InterfaceFault with the specified QName from the {interface 
faults}
-     * property of the Interface component. This property contains directly 
declared faults
-     * but not any derived from extended interfaces.
+     * Returns the set of InterfaceFault components representing the 
{interface faults} 
+     * property of this Interface. That is, the InterfaceFaults declared by 
this Interface 
+     * but not those declared by any Interfaces it extends, directly or 
indirectly.
+     * 
+     * @return array of InterfaceFault components
+     */
+    public InterfaceFault[] getInterfaceFaults();
+    
+    /**
+     * Returns the InterfaceFault with the specified name from the {interface 
faults}
+     * property of this Interface. That is, a named InterfaceFault declared by 
this Interface 
+     * only, which excludes any inherited directly or indirectly from extended 
Interfaces.
+     * If the name parameter is null, this method will return null.
      * 
-     * @param qname the qualified name of the required InterfaceFault
+     * @param faultName the qualified name of the InterfaceFault
      * @return the InterfaceFault object
      */
-    public InterfaceFault getInterfaceFault(QName qname);
+    public InterfaceFault getInterfaceFault(QName faultName);
     
     /**
-     * Returns the set of InterfaceFault components representing the 
{interface faults} 
-     * property of the Interface component, which includes the directly 
declared interface faults
-     * but not any derived from extended interfaces.
+     * Returns the set of all InterfaceFault components available to this 
Interface,
+     * which includes those declared by this Interface and those declared by 
any Interfaces 
+     * it extends, directly or indirectly. 
      * 
      * @return array of InterfaceFault components
      */
-    public InterfaceFault[] getInterfaceFaults();
+    public InterfaceFault[] getAllInterfaceFaults();
     
     /**
-     * Returns the InterfaceOperation with the specified QName from the 
{interface operations}
-     * property of the Interface component. This property contains directly 
declared operations
-     * but not any derived from extended interfaces.
+     * Returns the InterfaceFault with the specified name from the set of all 
InterfaceFaults
+     * available to this Interface, which includes those declared by this 
Interface and those
+     * declared by any Interfaces it extends, directly or indirectly.
+     * If the name parameter is null, this method will return null.
      * 
-     * @param qname the qualified name of the required InterfaceOperation
-     * @return the InterfaceOperation object
+     * @param faultName the qualified name of the InterfaceFault
+     * @return the InterfaceFault object
      */
-    public InterfaceOperation getInterfaceOperation(QName qname);
+    public InterfaceFault getFromAllInterfaceFaults(QName faultName);
     
     /**
      * Returns the set of InterfaceOperation components representing the 
{interface operations} 
-     * property of the Interface component, which includes the directly 
declared interface operations
-     * but not any derived from extended interfaces.
+     * property of this Interface. That is, the InterfaceOperations declared 
by this Interface 
+     * but not those declared by any Interfaces it extends, directly or 
indirectly.
      * 
      * @return array of InterfaceOperation components
      */
     public InterfaceOperation[] getInterfaceOperations();
+    
+    /**
+     * Returns the InterfaceOperation with the specified name from the 
{interface operations}
+     * property of this Interface. That is, a named InterfaceOperation 
declared by this Interface 
+     * only, which excludes any inherited directly or indirectly from extended 
Interfaces.
+     * If the name parameter is null, this method will return null.
+     * 
+     * @param operName the qualified name of the required InterfaceOperation
+     * @return the InterfaceOperation object
+     */
+    public InterfaceOperation getInterfaceOperation(QName operName);
+    
+    /**
+     * Returns the set of all InterfaceOperation components referenceable by 
this Interface,
+     * include those declared by this Interface and those declared by the 
Interfaces 
+     * it extends, directly or indirectly.
+     * 
+     * @return array of InterfaceOperation components
+     */
+    public InterfaceOperation[] getAllInterfaceOperations();
+    
+    /**
+     * Returns the InterfaceOperation with the specified name from the set of 
all InterfaceOperations
+     * available to this Interface, which includes those declared by this 
Interface and those
+     * declared by any Interfaces it extends, directly or indirectly. 
+     * If the name parameter is null, this method will return null.
+     * 
+     * @param operName the qualified name of the InterfaceOperation
+     * @return the InterfaceOperation object
+     */
+    public InterfaceOperation getFromAllInterfaceOperations(QName operName);
     
     public InterfaceElement toElement();
     

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java?view=diff&rev=500917&r1=500916&r2=500917
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/wsdl20/xml/InterfaceElement.java
 Sun Jan 28 17:32:00 2007
@@ -39,11 +39,11 @@
     public void setName(NCName name);
     public QName getName();
     
-    public void addExtendedInterfaceName(QName qname);
-    public void removeExtendedInterfaceName(QName qname);
+    public void addExtendedInterfaceName(QName interfaceName);
+    public void removeExtendedInterfaceName(QName interfaceName);
     public QName[] getExtendedInterfaceNames();
     
-    public InterfaceElement getExtendedInterfaceElement(QName qname);
+    public InterfaceElement getExtendedInterfaceElement(QName interfaceName);
     public InterfaceElement[] getExtendedInterfaceElements();
     
     public void addStyleDefaultURI(URI uri);
@@ -56,7 +56,7 @@
      */
     
     public InterfaceFaultElement addInterfaceFaultElement();
-    //TODO public void removeInterfaceFaultElement(QName qname);
+    //TODO public void removeInterfaceFaultElement(QName faultName);
     
     /**
      * Returns the InterfaceFaultElement representing the &lt;fault&gt; 
element 
@@ -64,10 +64,10 @@
      * &lt;interface&gt; element. 
      * This set does not include faults derived from extended interfaces.
      * 
-     * @param qname the qualified name of the required InterfaceFault
+     * @param faultName the qualified name of the required InterfaceFault
      * @return the InterfaceFault object
      */
-    public InterfaceFaultElement getInterfaceFaultElement(QName qname);
+    public InterfaceFaultElement getInterfaceFaultElement(QName faultName);
     
     /**
      * Returns the set of InterfaceFaultElements representing the 
&lt;fault&gt; elements 
@@ -79,7 +79,7 @@
     public InterfaceFaultElement[] getInterfaceFaultElements();
     
     public InterfaceOperationElement addInterfaceOperationElement();
-    //TODO public void removeInterfaceOperationElement(QName qname);
+    //TODO public void removeInterfaceOperationElement(QName operName);
     
     /**
      * Returns the InterfaceOperationElement representing the 
&lt;operation&gt; element 
@@ -87,10 +87,10 @@
      * &lt;interface&gt; element. 
      * This set does not include operations derived from extended interfaces.
      * 
-     * @param qname the qualified name of the required InterfaceOperation
+     * @param operName the qualified name of the required InterfaceOperation
      * @return the InterfaceOperation object
      */
-    public InterfaceOperationElement getInterfaceOperationElement(QName qname);
+    public InterfaceOperationElement getInterfaceOperationElement(QName 
operName);
     
     /**
      * Returns the set of InterfaceOperationElements representing the 
&lt;operation&gt; elements 



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

Reply via email to