You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/07/25 04:59:31 UTC

svn commit: r559294 - in /incubator/tuscany/java/sca/modules: contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/ interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ interface-wsdl/src/main/java...

Author: jsdelfino
Date: Tue Jul 24 19:59:30 2007
New Revision: 559294

URL: http://svn.apache.org/viewvc?view=rev&rev=559294
Log:
Fixed resolution of imports with no location uri. Test the model unresolved flag instead of checking for null, which was not correct as resolvers never return nulls anyway.

Added:
    incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Base.java   (with props)
Modified:
    incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java
    incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java?view=diff&rev=559294&r1=559293&r2=559294
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java Tue Jul 24 19:59:30 2007
@@ -55,32 +55,35 @@
         //TODO optimize and cache results of the resolution later
         
         // Go over all available contributions
-        Object resolved = null;
         for (Contribution contribution : contributions) {
             
             // Go over all exports in the contribution
             for (Export export : contribution.getExports()) {
                 if (export instanceof NamespaceExport) {
                     NamespaceExport namespaceExport = (NamespaceExport)export;
+                    
+                    // If the export matches our namespace, try to the resolve the model object
                     if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
-                        Object r = namespaceExport.getModelResolver().resolveModel(modelClass, unresolved);
-                        if (r != null) {
-                            //FIXME we should test the unresolved flag instead
-                            resolved = r;
-                            break;
+                        Object resolved = namespaceExport.getModelResolver().resolveModel(modelClass, unresolved);
+                        
+                        // Return the resolved model object
+                        if (resolved instanceof org.apache.tuscany.sca.interfacedef.Base) {
+                            if (!((org.apache.tuscany.sca.interfacedef.Base)resolved).isUnresolved()) {
+                                return modelClass.cast(resolved);
+                            }
+                        }
+                        else if (resolved instanceof org.apache.tuscany.sca.assembly.Base) {
+                            if (!((org.apache.tuscany.sca.assembly.Base)resolved).isUnresolved()) {
+                                return modelClass.cast(resolved);
+                            }
                         }
                     }
                 }
             }
-            if (resolved != null)
-                break;
-        }
-        
-        if (resolved != null) {
-            return modelClass.cast(resolved);
-        } else {
-            return unresolved;
         }
+
+        // Model object was not resolved
+        return unresolved;
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java?view=diff&rev=559294&r1=559293&r2=559294
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java Tue Jul 24 19:59:30 2007
@@ -48,7 +48,7 @@
                     resolved = namespaceImport.getModelResolver().resolveModel(WSDLDefinition.class, unresolved);
                     
                     // If resolved... then we are done
-                    if(resolved.isUnresolved() == false) {
+                    if (resolved.isUnresolved() == false) {
                         break;
                     }
                 }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java?view=diff&rev=559294&r1=559293&r2=559294
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java Tue Jul 24 19:59:30 2007
@@ -21,6 +21,7 @@
 
 import javax.wsdl.Definition;
 
+import org.apache.tuscany.sca.interfacedef.Base;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 /**
@@ -29,7 +30,7 @@
  *
  * @version $Rev$ $Date$
  */
-public interface WSDLDefinition {
+public interface WSDLDefinition extends Base {
     
     /**
      * Returns the WSDL definition model
@@ -60,19 +61,5 @@
      * @param namespace the namespace of this WSDL definition
      */
     void setNamespace(String namespace);
-
-    /**
-     * Returns true if the model element is unresolved.
-     * 
-     * @return true if the model element is unresolved.
-     */
-    boolean isUnresolved();
-
-    /**
-     * Sets whether the model element is unresolved.
-     * 
-     * @param unresolved whether the model element is unresolved
-     */
-    void setUnresolved(boolean unresolved);
 
 }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java?view=diff&rev=559294&r1=559293&r2=559294
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java Tue Jul 24 19:59:30 2007
@@ -19,6 +19,7 @@
 
 package org.apache.tuscany.sca.interfacedef.wsdl;
 
+import org.apache.tuscany.sca.interfacedef.Base;
 import org.apache.ws.commons.schema.XmlSchema;
 
 /**
@@ -26,7 +27,7 @@
  *
  * @version $Rev$ $Date$
  */
-public interface XSDefinition {
+public interface XSDefinition extends Base {
     
     /**
      * Returns the XmlSchema definition model
@@ -51,19 +52,5 @@
      * @param namespace the namespace of this XmlSchema definition
      */
     void setNamespace(String namespace);
-
-    /**
-     * Returns true if the model element is unresolved.
-     * 
-     * @return true if the model element is unresolved.
-     */
-    boolean isUnresolved();
-
-    /**
-     * Sets whether the model element is unresolved.
-     * 
-     * @param unresolved whether the model element is unresolved
-     */
-    void setUnresolved(boolean unresolved);
 
 }

Added: incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Base.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Base.java?view=auto&rev=559294
==============================================================================
--- incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Base.java (added)
+++ incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Base.java Tue Jul 24 19:59:30 2007
@@ -0,0 +1,23 @@
+package org.apache.tuscany.sca.interfacedef;
+/**
+ * Base interface for all interface model objects.
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface Base {
+
+    /**
+     * Returns true if the model element is unresolved.
+     * 
+     * @return true if the model element is unresolved.
+     */
+    boolean isUnresolved();
+
+    /**
+     * Sets whether the model element is unresolved.
+     * 
+     * @param unresolved whether the model element is unresolved
+     */
+    void setUnresolved(boolean unresolved);
+
+}

Propchange: incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Base.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Base.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java?view=diff&rev=559294&r1=559293&r2=559294
==============================================================================
--- incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java (original)
+++ incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java Tue Jul 24 19:59:30 2007
@@ -25,7 +25,7 @@
  * support concrete interface type systems, such as Java interfaces, WSDL 1.1
  * portTypes and WSDL 2.0 interfaces.
  */
-public interface Interface extends Cloneable {
+public interface Interface extends Base, Cloneable {
 
     /**
      * Returns true if the interface is a remotable interface..
@@ -62,20 +62,6 @@
      */
     List<Operation> getOperations();
 
-    /**
-     * Returns true if the model element is unresolved.
-     * 
-     * @return true if the model element is unresolved.
-     */
-    boolean isUnresolved();
-
-    /**
-     * Sets whether the model element is unresolved.
-     * 
-     * @param unresolved whether the model element is unresolved
-     */
-    void setUnresolved(boolean unresolved);
-    
     // TODO: [rfeng] We might need to have a better way
     /**
      * Set the databinding for the interface
@@ -84,7 +70,7 @@
     void setDefaultDataBinding(String dataBinding);
 
     /**
-     * Returns true if the Interaface is dynamic.
+     * Returns true if the Interface is dynamic.
      * 
      * @return true if the Interface is dynamic.
      */



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