axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r440231 - in /webservices/axis2/trunk/java/modules: adb-codegen/src/org/apache/axis2/schema/ java2wsdl/src/org/apache/ws/java2wsdl/ kernel/src/org/apache/axis2/deployment/util/ kernel/src/org/apache/axis2/description/
Date Tue, 05 Sep 2006 03:12:43 GMT
Author: dims
Date: Mon Sep  4 20:12:42 2006
New Revision: 440231

URL: http://svn.apache.org/viewvc?view=rev&rev=440231
Log:
Sync up with changes to WSCOMMONS-81

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=440231&r1=440230&r2=440231
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
Mon Sep  4 20:12:42 2006
@@ -223,10 +223,16 @@
 
             //set a mapper package if not avaialable
             if (writer.getExtensionMapperPackageName()==null){
+                String nsp = null;
                 //get the first schema from the list and take that namespace as the
                 //mapper namespace
-                writer.registerExtensionMapperPackageName(
-                        URLProcessor.makePackageName(((XmlSchema) schemalist.get(0)).getTargetNamespace()));
+                for (int i = 0; nsp == null && i < schemalist.size(); i++) {
+                    nsp = ((XmlSchema) schemalist.get(i)).getTargetNamespace();
+                }
+                if(nsp == null) {
+                    nsp = URLProcessor.DEFAULT_PACKAGE;
+                }
+                writer.registerExtensionMapperPackageName(URLProcessor.makePackageName(nsp));
             }
             // second round - call the schema compiler one by one
             for (int i = 0; i < schemalist.size(); i++) {

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java?view=diff&rev=440231&r1=440230&r2=440231
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
Mon Sep  4 20:12:42 2006
@@ -1,6 +1,7 @@
 package org.apache.ws.java2wsdl;
 
 import org.apache.ws.commons.schema.*;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.java2wsdl.bytecode.MethodTable;
 import org.apache.ws.java2wsdl.utils.TypeTable;
 import org.codehaus.jam.*;
@@ -278,12 +279,12 @@
                         elt1.setMinOccurs(1);
                     }
 
-                    if (!xmlSchema.getPrefixToNamespaceMap().values().
+                    if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().
                             contains(typeTable.getComplexSchemaType(propertyName).getNamespaceURI()))
{
                         XmlSchemaImport importElement = new XmlSchemaImport();
                         importElement.setNamespace(typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
                         xmlSchema.getItems().add(importElement);
-                        xmlSchema.getPrefixToNamespaceMap().
+                        ((NamespaceMap)xmlSchema.getNamespaceContext()).
                                 put(generatePrefix(), typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
                     }
                 }
@@ -380,10 +381,10 @@
             targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix);
             schemaMap.put(targetNamespace, xmlSchema);
 
-            Hashtable prefixmap = new Hashtable();
+            NamespaceMap prefixmap = new NamespaceMap();
             prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD);
             prefixmap.put(targetNamespacePrefix, targetNamespace);
-            xmlSchema.setPrefixToNamespaceMap(prefixmap);
+            xmlSchema.setNamespaceContext(prefixmap);
         }
         return xmlSchema;
     }
@@ -410,12 +411,12 @@
     }
 
     private void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
-        if (!xmlSchema.getPrefixToNamespaceMap().values().
+        if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().
                 contains(schemaTypeName.getNamespaceURI())) {
             XmlSchemaImport importElement = new XmlSchemaImport();
             importElement.setNamespace(schemaTypeName.getNamespaceURI());
             xmlSchema.getItems().add(importElement);
-            xmlSchema.getPrefixToNamespaceMap().
+            ((NamespaceMap)xmlSchema.getNamespaceContext()).
                     put(generatePrefix(), schemaTypeName.getNamespaceURI());
         }
     }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=440231&r1=440230&r2=440231
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Mon Sep  4 20:12:42 2006
@@ -20,6 +20,7 @@
 import org.apache.ws.java2wsdl.Java2WSDLConstants;
 import org.apache.ws.java2wsdl.SchemaGenerator;
 import org.apache.ws.java2wsdl.utils.TypeTable;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.codehaus.jam.JMethod;
 
 import javax.xml.namespace.QName;
@@ -245,7 +246,7 @@
 
         }
         // adding name spaces
-        Map map = new HashMap();
+        NamespaceMap map = new NamespaceMap();
         map.put(Java2WSDLConstants.AXIS2_NAMESPACE_PREFIX,
                 Java2WSDLConstants.AXIS2_XSD);
         map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=440231&r1=440230&r2=440231
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Mon Sep  4 20:12:42 2006
@@ -41,6 +41,8 @@
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaExternal;
 import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.utils.NamespacePrefixList;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.java2wsdl.Java2WSDLConstants;
 import org.apache.ws.java2wsdl.SchemaGenerator;
 import org.apache.ws.java2wsdl.utils.TypeTable;
@@ -155,7 +157,7 @@
     /////////////////////////////////////////
     // WSDL related stuff ////////////////////
     ////////////////////////////////////////
-    private Map nameSpacesMap;
+    private NamespaceMap nameSpacesMap;
 
     private String soapNsUri;
     private String endpoint;
@@ -509,14 +511,7 @@
 
     private XmlSchema addNameSpaces(int i) {
         XmlSchema schema = (XmlSchema) schemaList.get(i);
-        Iterator keys = nameSpacesMap.keySet().iterator();
-        Hashtable prefixTable = schema.getPrefixToNamespaceMap();
-        while (keys.hasNext()) {
-            String key = (String) keys.next();
-            if (prefixTable.get(key) == null) {
-                prefixTable.put(key, nameSpacesMap.get(key));
-            }
-        }
+        schema.setNamespaceContext(nameSpacesMap);
         return schema;
     }
 
@@ -911,7 +906,9 @@
     public void addSchema(XmlSchema schema) {
         if (schema != null) {
             schemaList.add(schema);
-            addSchemaNameSpace(schema.getTargetNamespace());
+            if(schema.getTargetNamespace() != null) {
+                addSchemaNameSpace(schema.getTargetNamespace());
+            }
         }
 
     }
@@ -1304,7 +1301,7 @@
         return nameSpacesMap;
     }
 
-    public void setNameSpacesMap(Map nameSpacesMap) {
+    public void setNameSpacesMap(NamespaceMap nameSpacesMap) {
         this.nameSpacesMap = nameSpacesMap;
     }
 
@@ -1320,7 +1317,7 @@
             }
         }
         if (nameSpacesMap == null) {
-            nameSpacesMap = new HashMap();
+            nameSpacesMap = new NamespaceMap();
         }
         if (!found) {
             nameSpacesMap.put("ns" + nsCount, targetNameSpace);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=440231&r1=440230&r2=440231
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Mon Sep  4 20:12:42 2006
@@ -17,6 +17,7 @@
 import org.apache.ws.policy.PolicyReference;
 import org.apache.ws.policy.util.DOMPolicyReader;
 import org.apache.ws.policy.util.PolicyFactory;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -185,7 +186,7 @@
             axisService.setTargetNamespace(wsdl4jDefinition
                     .getTargetNamespace());
 
-            axisService.setNameSpacesMap(wsdl4jDefinition.getNamespaces());
+            axisService.setNameSpacesMap(new NamespaceMap(wsdl4jDefinition.getNamespaces()));
 
             Binding binding = findBinding(wsdl4jDefinition);
 
@@ -1267,7 +1268,11 @@
                 String s = nameSpaceDeclarationArray[i];
                 schemaElement.setAttributeNS(XML_NAMESPACE_URI,
                         NAMESPACE_DECLARATION_PREFIX + namespacePrefixMap.get(s).toString(),
s);
-
+            }
+            
+            if(schemaElement.getAttributeNS(XML_NAMESPACE_URI, xsdPrefix).length()==0){
+                schemaElement.setAttributeNS(XML_NAMESPACE_URI,
+                        NAMESPACE_DECLARATION_PREFIX + xsdPrefix, XMLSCHEMA_NAMESPACE_URI);
             }
 
             //add the targetNamespace

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=440231&r1=440230&r2=440231
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
Mon Sep  4 20:12:42 2006
@@ -28,6 +28,7 @@
 import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
 import org.apache.woden.wsdl20.xml.TypesElement;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.policy.Policy;
 import org.apache.ws.policy.PolicyReference;
 import org.apache.ws.policy.util.DOMPolicyReader;
@@ -78,7 +79,7 @@
 
     private Map namespacemap;
     
-    private HashMap stringBasedNamespaceMap;
+    private NamespaceMap stringBasedNamespaceMap;
     
     private boolean setupComplete = false;
 
@@ -248,7 +249,7 @@
             }
             // Create the namespacemap
 
-            stringBasedNamespaceMap = new HashMap();
+            stringBasedNamespaceMap = new NamespaceMap();
             Iterator iterator = namespacemap.keySet().iterator();
             while (iterator.hasNext()) {
                 String key = (String) iterator.next();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java?view=diff&rev=440231&r1=440230&r2=440231
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
Mon Sep  4 20:12:42 2006
@@ -122,13 +122,6 @@
 
     protected XmlSchema getXMLSchema(Element element, String baseUri) {
         XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
-        Map nsMap = axisService.getNameSpacesMap();
-        Iterator keys = nsMap.keySet().iterator();
-        String key;
-        while (keys.hasNext()) {
-            key = (String) keys.next();
-            schemaCollection.mapNamespace(key, (String) nsMap.get(key));
-        }
 
         if (baseUri != null) schemaCollection.setBaseUri(baseUri);
 



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


Mime
View raw message