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 06:57:40 UTC

svn commit: r293239 - in /incubator/woden/java/src/org/apache/woden/internal: util/ComponentModelBuilder.java wsdl20/TypesImpl.java

Author: jkaputin
Date: Sun Oct  2 21:57:34 2005
New Revision: 293239

URL: http://svn.apache.org/viewcvs?rev=293239&view=rev
Log:
Modified the internal Types representation of Schema and 
SchemaImport to Map of Lists, although will they
still be exposed on the API as typed arrays.

Modified:
    incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
    incubator/woden/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java

Modified: incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java?rev=293239&r1=293238&r2=293239&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java Sun Oct  2 21:57:34 2005
@@ -54,10 +54,6 @@
     //Collection of Schema objects
     private List fInScopeSchemas = new Vector();
     
-    //Collection of schema target namespace Strings
-    //TODO not sure if this is needed
-    private List fInScopeSchemaNamespaces = new Vector();
-    
     /*
      * Takes a DescriptionElement and converts its WSDL XML model
      * to a WSDL component model returned as a Description.
@@ -81,6 +77,7 @@
      */
     private void collectImportedWsdl()
     {
+        //TODO
     }
 
     /*
@@ -92,57 +89,47 @@
     {
         //TODO schemas inlined in wsdl:imported docs
         
-        //TODO ensure only schemas and schema namespaces in scope per
-        //W3C WSDL 2.0 spec are collected.
-        
-        //TODO not sure if the in scope namespaces collection is needed
+        //TODO ensure only schemas that are in scope per
+        //W3C WSDL 2.0 spec are used to extract elements and types.
         
         TypesElement types = fDescElement.getTypesElement();
         
-        Schema s = null;
-        SchemaImport si = null;
-        
         //collect all inlined schemas
-        Collection schemaArrays = types.getSchemas().values();
-        Iterator sIterator = schemaArrays.iterator();
-        while(sIterator.hasNext())
+ 
+        Collection schemaLists = types.getSchemas().values();
+        Iterator i1 = schemaLists.iterator();
+        while(i1.hasNext())
         {
-            Schema[] schemaArray = (Schema[])sIterator.next();
-            for(int i=0; i < schemaArray.length; i++)
-            {
-                s = schemaArray[i];
-                fInScopeSchemas.add(s);
-                fInScopeSchemaNamespaces.add(s.getTargetNamespace());
-            }
+            fInScopeSchemas.addAll((Collection)i1.next());
         }
         
         //collect all imported schemas
-        Collection schemaImportArrays = types.getSchemaImports().values();
-        Iterator siIterator = schemaImportArrays.iterator();
-        while(siIterator.hasNext())
+
+        Collection schemaImportLists = types.getSchemaImports().values();
+        Iterator i2 = schemaImportLists.iterator();
+        while(i2.hasNext())
         {
-            SchemaImport[] schemaImportArray = (SchemaImport[])siIterator.next();
-            for(int i=0; i < schemaImportArray.length; i++)
+            List schemaImportList = (List) i2.next();
+            Iterator i3 = schemaImportList.iterator();
+            while(i3.hasNext())
             {
-                si = schemaImportArray[i];
-                fInScopeSchemaNamespaces.add(si.getNamespace());
-                s = si.getSchema();
-                if(s != null) {
-                    fInScopeSchemas.add(s);
+                SchemaImport si = (SchemaImport)i3.next();
+                if(si.getSchema() != null)
+                {
+                    fInScopeSchemas.add(si.getSchema());
                 }
             }
         }
         
-        //We now have a 'flattened' collection of all inlined and imported 
-        //schemas (i.e. as XSModel objects) and a collection of the inlined
-        //and imported schema namespace Strings (i.e. the in-scope namespaces).
-        //These can now be used to extract the in-scope element declarations 
-        //and type definitions.
+        /* We now have a 'flattened' collection of all inlined and imported 
+         * schemas (i.e. as XSModel objects). These can now be used to extract 
+         * the element declarations and type definitions.
+         */
         
     }
 
     /*
-     * Extract from the collections of in-scope schemas and schema namespaces
+     * Extract from the collections of in-scope schemas
      * the element declarations and type definitions.
      */
     private void buildElementsAndTypes()
@@ -181,7 +168,7 @@
     }
         
     /*
-     * Extract from the collections of in-scope schemas and schema namespaces
+     * Extract from the collections of in-scope schemas
      * the type definitions.
      */
 

Modified: incubator/woden/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java?rev=293239&r1=293238&r2=293239&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java Sun Oct  2 21:57:34 2005
@@ -16,9 +16,10 @@
 package org.apache.woden.internal.wsdl20;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 
-import org.apache.woden.internal.ErrorReporter;
 import org.apache.woden.schema.Schema;
 import org.apache.woden.schema.SchemaImport;
 import org.apache.woden.wsdl20.xml.DocumentationElement;
@@ -40,23 +41,13 @@
  */
 public class TypesImpl implements TypesElement {
     
-    private DocumentationElement fDocumentation;
+    private List fDocumentationElements = new Vector();
     private String fTypeSystem;
     private Map fSchemaImports = new HashMap();
     private Map fSchemas = new HashMap();
     
     //TODO extension attributes and elements
 
-    public void setDocumentationElement(DocumentationElement docEl)
-    {
-        fDocumentation = docEl;
-    }
-    
-    public DocumentationElement getDocumentationElement()
-    {
-        return fDocumentation;
-    }
-
     public void setTypeSystem(String typeSystem)
     {
         fTypeSystem = typeSystem;
@@ -81,6 +72,20 @@
 
         if(namespace != null)
         {
+            List schemaImports = (List)fSchemaImports.get(namespace);
+            
+            if(schemaImports == null)
+            {
+                schemaImports = new Vector();
+                fSchemaImports.put(namespace, schemaImports);
+            }
+            
+            schemaImports.add(schemaImport);
+        }
+        
+        /*
+        if(namespace != null)
+        {
             SchemaImport[] oldArray, newArray;
             Object schemaImports = fSchemaImports.get(namespace);
             
@@ -103,6 +108,7 @@
             
             fSchemaImports.put(namespace, newArray);
         }
+        */
         //TODO report a warning if discarded due to missing namespace?
         
     }
@@ -141,7 +147,22 @@
     public void addSchema(Schema schema)
     {
         String targetNamespace = schema.getTargetNamespace();
+
+        if(targetNamespace != null)
+        {
+            List schemas = (List)fSchemas.get(targetNamespace);
+            
+            if(schemas == null)
+            {
+                schemas = new Vector();
+                fSchemas.put(targetNamespace, schemas);
+            }
+            
+            schemas.add(schema);
+        }
         
+
+        /*
         if(targetNamespace != null)
         {
             Schema[] oldArray, newArray;
@@ -166,6 +187,7 @@
             
             fSchemas.put(targetNamespace, newArray);
         }
+        */
         //TODO report a warning if discarded due to missing namespace?
         
     }
@@ -194,4 +216,20 @@
         fSchemas = schemas;
     }
 
+    /*
+     * @see org.apache.woden.wsdl20.xml.DocumentableElement#addDocumentationElement(DocumentationElement)
+     */
+    public void addDocumentationElement(DocumentationElement docEl) 
+    {
+        fDocumentationElements.add(docEl);
+    }
+
+    /*
+     * @see org.apache.woden.wsdl20.xml.DocumentableElement#getDocumentationElements()
+     */
+    public DocumentationElement[] getDocumentationElements() 
+    {
+        return (DocumentationElement[])fDocumentationElements.toArray();
+    }
+    
 }



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