cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r686314 - /cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
Date Fri, 15 Aug 2008 18:44:22 GMT
Author: dkulp
Date: Fri Aug 15 11:44:21 2008
New Revision: 686314

URL: http://svn.apache.org/viewvc?rev=686314&view=rev
Log:
[CXF-1751] Patch to handle ws-addressing refrences from Matteo applied.

Modified:
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java?rev=686314&r1=686313&r2=686314&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
Fri Aug 15 11:44:21 2008
@@ -462,10 +462,24 @@
                     scopedName = new Scope(currentScope, node);
                 }
                 if (scopedNames.getScope(scopedName) != null) {
-                    XmlSchema wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE,
schemas);
-                    XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
-                    wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
-                    result = wsaType;
+                    XmlSchema wsaSchema = null;
+                    // check whether a schema with the required namespace has already been
created
+                    XmlSchema[] existingSchemas = schemas.getXmlSchemas();
+                    for (XmlSchema xs : existingSchemas) {
+                        if (xs.getTargetNamespace().equals(ReferenceConstants.WSADDRESSING_NAMESPACE))
{
+                            // if it has been created, reuse it
+                            wsaSchema = xs;
+                            result = wsaSchema.getTypeByName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
+                            break;
+                        }
+                    }
+                    // if not, create a new one and create the WS-Addressing EndpointReferenceType
+                    if (wsaSchema == null) {
+                        wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE,
schemas);
+                        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
+                        wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
+                        result = wsaType;
+                    }
                 }                
                 currentScope = currentScope.getParent();
             }
@@ -478,10 +492,24 @@
                 scopedName = scope;
             }
             if (scopedNames.getScope(scopedName) != null) {
-                XmlSchema wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE,
schemas);
-                XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
-                wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
-                result = wsaType;
+                XmlSchema wsaSchema = null;
+                // check whether a schema with the required namespace has already been created
+                XmlSchema[] existingSchemas = schemas.getXmlSchemas();
+                for (XmlSchema xs : existingSchemas) {
+                    if (xs.getTargetNamespace().equals(ReferenceConstants.WSADDRESSING_NAMESPACE))
{
+                        // if it has been created, reuse it
+                        wsaSchema = xs;
+                        result = wsaSchema.getTypeByName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
+                        break;
+                    }
+                }
+                // if not, create a new one and create the WS-Addressing EndpointReferenceType
+                if (wsaSchema == null) {
+                    wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE,
schemas);
+                    XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
+                    wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
+                    result = wsaType;
+                }
             }
         }
         



Mime
View raw message