Author: jkaputin
Date: Tue Aug 19 05:48:45 2008
New Revision: 687040

URL: http://svn.apache.org/viewvc?rev=687040&view=rev
Log:
WODEN-209
Replaced the equals method in the Component API with the isEquivalentTo method 
for checking logical equivalence of two components.

Modified:
    webservices/woden/branches/woden209/.classpath
    
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
    
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java
    
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
    
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
    
webservices/woden/branches/woden209/src/org/apache/woden/wsdl20/WSDLComponent.java

Modified: webservices/woden/branches/woden209/.classpath
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden209/.classpath?rev=687040&r1=687039&r2=687040&view=diff
==============================================================================
--- webservices/woden/branches/woden209/.classpath (original)
+++ webservices/woden/branches/woden209/.classpath Tue Aug 19 05:48:45 2008
@@ -6,14 +6,14 @@
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry kind="var" path="JUNIT_HOME/junit.jar"/>
        <classpathentry kind="var" 
path="ECLIPSE_HOME/plugins/org.apache.ant_1.7.0.v200706080842/lib/ant.jar"/>
-       <classpathentry kind="lib" path="downloads/lib/axiom-api-1.2.3.jar"/>
-       <classpathentry kind="lib" path="downloads/lib/axiom-impl-1.2.3.jar"/>
+       <classpathentry kind="lib" 
path="C:/workspace/woden/woden209/downloads/lib/axiom-api-1.2.7.jar"/>
+       <classpathentry kind="lib" 
path="C:/workspace/woden/woden209/downloads/lib/axiom-impl-1.2.7.jar"/>
        <classpathentry kind="lib" 
path="downloads/lib/commons-logging-api-1.1.jar"/>
        <classpathentry kind="lib" path="downloads/lib/wsdl4j.jar"/>
        <classpathentry kind="lib" path="downloads/lib/wstx-asl-3.2.0.jar"/>
        <classpathentry kind="lib" path="downloads/lib/xercesImpl.jar"/>
        <classpathentry kind="lib" path="downloads/lib/xml-apis.jar"/>
-       <classpathentry kind="lib" path="downloads/lib/XmlSchema-1.3.1.jar"/>
+       <classpathentry kind="lib" 
path="C:/workspace/woden/woden209/downloads/lib/XmlSchema-1.4.2.jar"/>
        <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="lib" 
path="downloads/lib/geronimo-stax-api_1.0_spec-1.0.jar"/>
        <classpathentry kind="output" path="bin"/>

Modified: 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java?rev=687040&r1=687039&r2=687040&view=diff
==============================================================================
--- 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
 (original)
+++ 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/InterfaceImpl.java
 Tue Aug 19 05:48:45 2008
@@ -226,7 +226,55 @@
     }
     
     /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#isEquivalentTo(WSDLComponent)
+     */
+    public boolean isEquivalentTo(WSDLComponent comp)
+    {
+        //compare object refs
+        if(this == comp) return true;
+        
+        if(!(comp instanceof Interface)) {
+            return false;
+        }
+        
+        Interface other = (Interface)comp;
+        
+        //compare {name}
+        QName myName = getName();
+        if(myName != null && !myName.equals(other.getName())) return false;
+        
+        /* To compare {extended interfaces} we cannot just retrieve and 
compare the two sets 
+         * of extended Interface components because we'd enter a recursive 
loop. To get the
+         * extended interfaces (i.e. to resolve the qnames in the 'extends' 
attribute)
+         * we need to get the set of interfaces available to the Description, 
which in turn 
+         * invokes this equivalence checking method.
+         * Instead, compare just the qnames in the 'extends' attributes, but 
we first 
+         * eliminate any duplicate qnames to ensure we make a logical test for 
+         * equivalence (i.e. use Set comparison).
+         */
+        Set thisExtendsSet = new HashSet(fExtends);
+        QName[] otherExtends = 
((InterfaceElement)other).getExtendedInterfaceNames();
+        Set otherExtendsSet = new HashSet(); 
+        for(int i=0; i<otherExtends.length; i++)
+        {
+            otherExtendsSet.add(otherExtends[i]);
+        }
+        if(thisExtendsSet.size() != otherExtendsSet.size()) return false;
+        if(!(thisExtendsSet.containsAll(otherExtendsSet) && 
otherExtendsSet.containsAll(thisExtendsSet)))
+        {
+            return false;
+        }
+        
+        //TODO compare {interface faults}
+        //TODO compare {interface operations}
+            
+        return true;    
+    }
+    
+    /* (non-Javadoc)
      * @see org.apache.woden.wsdl20.WSDLComponent#equals(WSDLComponent)
+     * 
+     * TODO Remove. Deprecated, replaced by isEquivalentTo.
      */
     public boolean equals(WSDLComponent comp)
     {

Modified: 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java?rev=687040&r1=687039&r2=687040&view=diff
==============================================================================
--- 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java
 (original)
+++ 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java
 Tue Aug 19 05:48:45 2008
@@ -50,8 +50,21 @@
      * ************************************************************/
     
     /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#isEquivalentTo(WSDLComponent)
+     * 
+     * TODO implement this method in all concrete component classes and make 
this
+     * implementation abstract or throw UnsupportedExc.
+     */
+    public boolean isEquivalentTo(WSDLComponent comp)
+    {
+        return super.equals(comp);
+    }
+    
+    /* (non-Javadoc)
      * @see org.apache.woden.wsdl20.WSDLComponent#equals(WSDLComponent)
      * 
+     * TODO - deprecated. Remove. Replaced by isEquivalentTo.
+     * 
      * TODO implement this method in all concrete component classes and make 
this
      * implementation abstract or throw UnsupportedExc.
      */
@@ -155,7 +168,7 @@
         for(Iterator i=components.iterator(); i.hasNext(); )
         {
             WSDLComponent tempComp = (WSDLComponent)i.next();
-            if(tempComp.equals(comp)) {
+            if(tempComp.isEquivalentTo(comp)) {
                 return true;
             }
         }

Modified: 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java?rev=687040&r1=687039&r2=687040&view=diff
==============================================================================
--- 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
 (original)
+++ 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
 Tue Aug 19 05:48:45 2008
@@ -68,7 +68,7 @@
                
                int numExtInterfaces = extendedInterfaces.length;
                for(int i = 0; i < numExtInterfaces && !foundInterface; i++) {
-                 if(interfac.equals(extendedInterfaces[i]))
+                 if(interfac.isEquivalentTo(extendedInterfaces[i]))
                    foundInterface = true;
                  else if(containsInterface(interfac, 
extendedInterfaces[i].getExtendedInterfaces()))
                        foundInterface = true;

Modified: 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java?rev=687040&r1=687039&r2=687040&view=diff
==============================================================================
--- 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
 (original)
+++ 
webservices/woden/branches/woden209/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
 Tue Aug 19 05:48:45 2008
@@ -336,7 +336,7 @@
        int numExtInterfaces = extendedInterfaces.length;
        for(int i = 0; i < numExtInterfaces; i++)
        {
-         if(interfac.equals(extendedInterfaces[i]))
+         if(interfac.isEquivalentTo(extendedInterfaces[i]))
            return extendedInterfaces[i];
          else if(containsInterface(interfac, 
extendedInterfaces[i].getExtendedInterfaces()) != null)
                return extendedInterfaces[i];
@@ -879,7 +879,7 @@
          
          // If an interface hasn't been specified on the service this 
assertion doesn't apply.
          // If the binding interface is null this assertion passes.
-         if(serviceInterface != null && bindingInterface != null && 
!serviceInterface.equals(bindingInterface))
+         if(serviceInterface != null && bindingInterface != null && 
!serviceInterface.isEquivalentTo(bindingInterface))
          {
                errorReporter.reportError(new ErrorLocatorImpl(), 
"Endpoint-1062", new Object[]{binding, bindingInterface, serviceInterface}, 
ErrorReporter.SEVERITY_ERROR);
                return false;  

Modified: 
webservices/woden/branches/woden209/src/org/apache/woden/wsdl20/WSDLComponent.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden209/src/org/apache/woden/wsdl20/WSDLComponent.java?rev=687040&r1=687039&r2=687040&view=diff
==============================================================================
--- 
webservices/woden/branches/woden209/src/org/apache/woden/wsdl20/WSDLComponent.java
 (original)
+++ 
webservices/woden/branches/woden209/src/org/apache/woden/wsdl20/WSDLComponent.java
 Tue Aug 19 05:48:45 2008
@@ -41,6 +41,18 @@
      * @param comp the WSDL component that this component will be compared to
      * @return true if the components are logically equivalent
      */
+    public boolean isEquivalentTo(WSDLComponent comp);
+    
+    /**
+     * Tests whether this component is logically equivalent the specified 
component.
+     * Equivalence is determined per spec WSDL 2.0 Part 1 Section 2.17 
Equivalence
+     * of Components.
+     * 
+     * @param comp the WSDL component that this component will be compared to
+     * @return true if the components are logically equivalent
+     * @deprecated
+     * @see isEquivalentTo(WSDLComponent)
+     */
     public boolean equals(WSDLComponent comp);
     
     /**



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

Reply via email to