incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmidd...@apache.org
Subject svn commit: r534892 - in /incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba: runtime/CorbaStaxObject.java utils/CorbaObjectReferenceHelper.java
Date Thu, 03 May 2007 14:36:59 GMT
Author: dmiddlem
Date: Thu May  3 07:36:56 2007
New Revision: 534892

URL: http://svn.apache.org/viewvc?view=rev&rev=534892
Log:
* Fix for YOKO-364.
* A few miscellaneous optimizations for Object Reference support.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaObjectReferenceHelper.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java?view=diff&rev=534892&r1=534891&r2=534892
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java
Thu May  3 07:36:56 2007
@@ -29,6 +29,8 @@
 
 import javax.wsdl.Binding;
 import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventFactory;
 import javax.xml.stream.XMLEventReader;
@@ -46,6 +48,7 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
+import org.apache.schemas.yoko.bindings.corba.AddressType;
 import org.apache.schemas.yoko.bindings.corba.Alias;
 import org.apache.schemas.yoko.bindings.corba.Anonarray;
 import org.apache.schemas.yoko.bindings.corba.Anonsequence;
@@ -1427,9 +1430,13 @@
                 }
                 reader.nextEvent().asEndElement();
 
-                org.omg.CORBA.Object ref = orb.string_to_object(address);
+                if (address == null) {
+                    address = readAddressInfoFromWSDL(serviceName, interfaceName);
+                }
+                
+                org.omg.CORBA.Object ref = CorbaUtils.importObjectReference(orb, address);
                 ref = CorbaObjectReferenceHelper.addYokoProfileToReference(ref, address,
endpointName,
-                        interfaceName, serviceName);
+                                                                           interfaceName,
serviceName);
                 obj.setReference(ref);
             }
         } catch (java.lang.Exception ex) {
@@ -1607,6 +1614,37 @@
         }
 
         return wsdlBinding;
+    }
+
+    private String readAddressInfoFromWSDL(QName serviceName, QName interfaceName) {
+        String address = null;
+        
+        Definition wsdlDef = (Definition)serviceInfo.getProperty(WSDLServiceBuilder.WSDL_DEFINITION);
+        Service service = wsdlDef.getService(serviceName);
+        Collection portsList = service.getPorts().values();
+        Port port = null;
+
+        for (Iterator iter = portsList.iterator(); iter.hasNext();) {
+            Port p = (Port)iter.next();
+            Binding binding = p.getBinding();
+            if (binding.getPortType().getQName().equals(interfaceName)) {
+                port = p;
+                break;
+            }
+        }
+        
+        if (port != null) {
+            List extElements = port.getExtensibilityElements();
+            for (Iterator iter = extElements.iterator(); iter.hasNext();) {
+                Object obj = iter.next();
+                if (obj instanceof AddressType) {
+                    AddressType addr = (AddressType)obj;
+                    address = addr.getLocation();
+                }
+            }
+        }
+        
+        return address;
     }
     
     private boolean isNestedSequence(TypeCode tc) {

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaObjectReferenceHelper.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaObjectReferenceHelper.java?view=diff&rev=534892&r1=534891&r2=534892
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaObjectReferenceHelper.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaObjectReferenceHelper.java
Thu May  3 07:36:56 2007
@@ -240,7 +240,17 @@
                     int id = profileStream.read_ulong();
                     switch(id) {
                     case YOKO_ENDPOINT_ADDRESS_ID:
-                        address.append(profileStream.read_string());
+                        String addr = profileStream.read_string();
+                        //address.append(profileStream.read_string());
+                        
+                        // We have to remember that if the address was specified as a file,
the
+                        // file most likely will not be available on the remote side.  We'll

+                        // convert these over to an address based on our object reference.
+                        if (addr.startsWith("relfile:") || addr.startsWith("file:")) {
+                            address.append(orb.object_to_string(obj));
+                        } else {
+                            address.append(addr);
+                        }
                         break;
                     case YOKO_ENDPOINT_NAME_ID:
                         endpointName.append(profileStream.read_string());
@@ -272,4 +282,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}



Mime
View raw message