incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmidd...@apache.org
Subject svn commit: r541617 - in /incubator/yoko/branches/perf: ./ src/main/java/org/apache/yoko/bindings/corba/runtime/ src/main/java/org/apache/yoko/bindings/corba/types/ src/test/java/org/apache/yoko/bindings/corba/
Date Fri, 25 May 2007 11:12:29 GMT
Author: dmiddlem
Date: Fri May 25 04:12:27 2007
New Revision: 541617

URL: http://svn.apache.org/viewvc?view=rev&rev=541617
Log:
Commit for YOKO-366:
* Adding support for Object References/EPRs

Added:
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceEventProducer.java
  (with props)
Modified:
    incubator/yoko/branches/perf/pom.xml
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamReader.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractStartEndEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaTypeEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/ParameterEventProducer.java
    incubator/yoko/branches/perf/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceTest.java

Modified: incubator/yoko/branches/perf/pom.xml
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/pom.xml?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/pom.xml (original)
+++ incubator/yoko/branches/perf/pom.xml Fri May 25 04:12:27 2007
@@ -240,7 +240,7 @@
                                     <wsdl>${basedir}/target/generated/src/test/resources/wsdl/type_test/type_test_corba_inc.wsdl</wsdl>
                                     <corbabinding>true</corbabinding>
                                     <extraargs>
-                                        <extraarg>-o</extraarg>
+                                        <extraarg>-w</extraarg>
                                         <extraarg>type_test_corba.wsdl</extraarg>
                                         <extraarg>-b</extraarg>
                                         <extraarg>TypeTestCORBABinding</extraarg>

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamReader.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamReader.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamReader.java
Fri May 25 04:12:27 2007
@@ -18,12 +18,16 @@
  */
 package org.apache.yoko.bindings.corba.runtime;
 
+import java.util.List;
+
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
 
 import org.apache.yoko.bindings.corba.types.CorbaTypeEventProducer;
 
@@ -108,12 +112,23 @@
     }
 
     public int getAttributeCount() {
-        // TODO Auto-generated method stub
+        List<Attribute> attrs = eventProducer.getAttributes();
+        if (attrs != null) {
+            return attrs.size();
+        }
         return 0;
     }
 
     public String getAttributeLocalName(int arg0) {
-        // TODO Auto-generated method stub
+        List<Attribute> attrs = eventProducer.getAttributes();
+        if (attrs == null) {
+            return null;
+        }
+
+        Attribute a = attrs.get(arg0);
+        if (a != null) {
+            return a.getName().getLocalPart();
+        }
         return null;
     }
 
@@ -123,6 +138,15 @@
     }
 
     public String getAttributeNamespace(int arg0) {
+        List<Attribute> attrs = eventProducer.getAttributes();
+        if (attrs == null) {
+            return null;
+        }
+
+        Attribute a = attrs.get(arg0);
+        if (a != null) {
+            return a.getName().getNamespaceURI();
+        }
         // TODO Auto-generated method stub
         return null;
     }
@@ -138,7 +162,15 @@
     }
 
     public String getAttributeValue(int arg0) {
-        // TODO Auto-generated method stub
+        List<Attribute> attrs = eventProducer.getAttributes();
+        if (attrs == null) {
+            return null;
+        }
+
+        Attribute a = attrs.get(arg0);
+        if (a != null) {
+            return a.getValue();
+        }
         return null;
     }
 
@@ -200,12 +232,23 @@
     }
 
     public int getNamespaceCount() {
-        // TODO Auto-generated method stub
+        List<Namespace> namespaces = eventProducer.getNamespaces();
+        if (namespaces != null) {
+            return namespaces.size();
+        }
         return 0;
     }
 
     public String getNamespacePrefix(int arg0) {
-        // TODO Auto-generated method stub
+        List<Namespace> namespaces = eventProducer.getNamespaces();
+        if (namespaces == null) {
+            return null;
+        }
+
+        Namespace ns = namespaces.get(arg0);
+        if (ns != null) {
+            return ns.getPrefix();
+        }
         return null;
     }
 
@@ -215,7 +258,15 @@
     }
 
     public String getNamespaceURI(int arg0) {
-        // TODO Auto-generated method stub
+        List<Namespace> namespaces = eventProducer.getNamespaces();
+        if (namespaces == null) {
+            return null;
+        }
+
+        Namespace ns = namespaces.get(arg0);
+        if (ns != null) {
+            return ns.getNamespaceURI();
+        }
         return null;
     }
 

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
Fri May 25 04:12:27 2007
@@ -1,8 +1,11 @@
 package org.apache.yoko.bindings.corba.types;
 
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
 
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
@@ -47,5 +50,21 @@
             throw new RuntimeException("hasNext reported in error as there is no next event");
         }
         return event;
+    }
+
+    public List<Attribute> getAttributes() {
+        List<Attribute> attributes = null;
+        if (currentEventProducer != null) {
+            attributes = currentEventProducer.getAttributes();
+        }
+        return attributes;
+    }
+
+    public List<Namespace> getNamespaces() {
+        List<Namespace> namespaces = null;
+        if (currentEventProducer != null) {
+            namespaces = currentEventProducer.getNamespaces();
+        }
+        return namespaces;
     }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractStartEndEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractStartEndEventProducer.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractStartEndEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractStartEndEventProducer.java
Fri May 25 04:12:27 2007
@@ -19,9 +19,12 @@
 package org.apache.yoko.bindings.corba.types;
 
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
 
 import org.apache.cxf.service.model.ServiceInfo;
 
@@ -38,6 +41,7 @@
     protected CorbaTypeMap typeMap;
     protected QName name;
     protected Iterator<CorbaObjectHandler> iterator;
+    protected Iterator<CorbaTypeEventProducer> producers;
     protected ServiceInfo serviceInfo;
     protected ORB orb;
 
@@ -67,10 +71,13 @@
             state++;
         } else if (currentEventProducer != null && currentEventProducer.hasNext())
{
             event = currentEventProducer.next();
-        } else if (iterator.hasNext()) {
+        } else if (iterator != null && iterator.hasNext()) {
             CorbaObjectHandler obj = iterator.next();
             currentEventProducer = CorbaHandlerUtils.getTypeEventProducer(obj, typeMap, serviceInfo,
orb);
             event = currentEventProducer.next();
+        } else if (producers != null && producers.hasNext()) {
+            currentEventProducer = producers.next();
+            event = currentEventProducer.next();
         } else {
             // all done with content, move past state 0
             event = states[++state];
@@ -78,5 +85,21 @@
             currentEventProducer = null;
         }
         return event;
+    }
+
+    public List<Attribute> getAttributes() {
+        List<Attribute> attributes = null;
+        if (currentEventProducer != null) {
+            attributes = currentEventProducer.getAttributes();
+        }
+        return attributes;
+    }
+
+    public List<Namespace> getNamespaces() {
+        List<Namespace> namespaces = null;
+        if (currentEventProducer != null) {
+            namespaces = currentEventProducer.getNamespaces();
+        }
+        return namespaces;
     }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
Fri May 25 04:12:27 2007
@@ -18,8 +18,12 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
 
 import org.apache.cxf.service.model.ServiceInfo;
 
@@ -55,4 +59,11 @@
         return state < states.length;
     }
 
+    public List<Attribute> getAttributes() {
+        return null;
+    }
+
+    public List<Namespace> getNamespaces() {
+        return null;
+    }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
Fri May 25 04:12:27 2007
@@ -18,8 +18,12 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
 
 import org.apache.cxf.service.model.ServiceInfo;
 
@@ -55,4 +59,11 @@
         return state < states.length;
     }
 
+    public List<Attribute> getAttributes() {
+        return null;
+    }
+
+    public List<Namespace> getNamespaces() {
+        return null;
+    }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
Fri May 25 04:12:27 2007
@@ -575,7 +575,7 @@
                 break;
             case TCKind._tk_objref:
                 LOG.log(Level.INFO, "Reading object reference from XML reader");
-                //result = new CorbaObjectReferenceEventProducer(handler, serviceInfo, orb);
+                result = new CorbaObjectReferenceEventProducer(handler, serviceInfo, orb);
                 break;
             default:
                 throw new CorbaBindingException("Unsupported complex type "

Added: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceEventProducer.java?view=auto&rev=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceEventProducer.java
(added)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceEventProducer.java
Fri May 25 04:12:27 2007
@@ -0,0 +1,316 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba.types;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
+
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.wsdl11.WSDLServiceBuilder;
+import org.apache.yoko.bindings.corba.utils.CorbaObjectReferenceHelper;
+import org.apache.yoko.bindings.corba.utils.CorbaUtils;
+
+import org.omg.CORBA.ORB;
+
+public class CorbaObjectReferenceEventProducer extends AbstractStartEndEventProducer {
+
+    static final String WSDLI_NAMESPACE_URI = "http://www.w3.org/2006/01/wsdl-instance";
+    static final String XSI_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema-instance";
+    static final QName WSA_ADDRESS = new QName(CorbaObjectReferenceHelper.ADDRESSING_NAMESPACE_URI,
+                                               "Address");
+    List<Attribute> refAttrs;
+   
+    public CorbaObjectReferenceEventProducer(CorbaObjectHandler h, ServiceInfo service, ORB
orbRef) {
+        CorbaObjectReferenceHandler handler = (CorbaObjectReferenceHandler) h;
+        name = CorbaUtils.processQName(handler.getName(), service);
+        orb = orbRef;
+        serviceInfo = service;
+        refAttrs = null;
+
+        if (handler.getReference() == null) {
+            XMLEventFactory factory = XMLEventFactory.newInstance();
+
+            refAttrs = new ArrayList<Attribute>();
+            refAttrs.add(factory.createAttribute(new QName(XSI_NAMESPACE_URI, "nil", "xsi"),
"true"));
+
+            return;
+        }
+
+        List<CorbaTypeEventProducer> objRefProducers = new ArrayList<CorbaTypeEventProducer>();
+        
+        String address = orb.object_to_string(handler.getReference());
+        objRefProducers.add(new CorbaAddressEventProducer(address));
+
+        Definition wsdlDef = (Definition)serviceInfo.getProperty(WSDLServiceBuilder.WSDL_DEFINITION);
+        
+        // Get the TypeImpl of the object reference so that we can determine the binding
+        // needed for this object reference
+        org.apache.schemas.yoko.bindings.corba.Object objType =
+            (org.apache.schemas.yoko.bindings.corba.Object)handler.getType();
+        QName bindingName = objType.getBinding();
+        Binding wsdlBinding = null;
+        if (bindingName != null) {
+            wsdlBinding = getObjectReferenceBinding(wsdlDef, bindingName);
+        }
+
+        if (wsdlBinding != null) {
+            QName serviceName = CorbaObjectReferenceHelper.getServiceName(wsdlBinding, wsdlDef);
+            String endpointName = CorbaObjectReferenceHelper.getEndpointName(wsdlBinding,
wsdlDef);
+            QName interfaceName = wsdlBinding.getPortType().getQName();
+
+            // Create the meta data producer and add is child producers.            
+            CorbaMetaDataEventProducer metaProducer =    
+                new CorbaMetaDataEventProducer(CorbaObjectReferenceHelper.getWSDLLocation(wsdlDef),
+                                               new CorbaServiceNameEventProducer(serviceName,
endpointName),
+                                               new CorbaInterfaceNameEventProducer(interfaceName));
+
+            objRefProducers.add(metaProducer);
+        }
+
+        producers = objRefProducers.iterator();
+    }
+
+    public List<Attribute> getAttributes() {
+        if (currentEventProducer != null) {
+            return currentEventProducer.getAttributes();
+        }
+        return refAttrs;
+    }
+    
+    protected Binding getObjectReferenceBinding(Definition wsdlDef, QName bindingName) {
+        Binding wsdlBinding = null;
+        if (bindingName != null) {
+            wsdlBinding = wsdlDef.getBinding(bindingName);
+        }
+
+        // If the binding name does not have a namespace associated with it, then we'll need
to 
+        // get the list of all bindings and compare their local parts against our name.
+        if (wsdlBinding == null && bindingName.getNamespaceURI().equals("")
+            && !bindingName.getLocalPart().equals("")) {
+            Map bindings = wsdlDef.getBindings();
+            Collection bindingsCollection = bindings.values();
+            for (Iterator i = bindingsCollection.iterator(); i.hasNext();) {
+                Binding b = (Binding)i.next();
+                if (b.getQName().getLocalPart().equals(bindingName.getLocalPart())) {
+                    wsdlBinding = b;
+                    break;
+                }
+            }
+        }
+
+        return wsdlBinding;
+    }
+
+    // An event producer to handle the production of the Address XML data.
+    class CorbaAddressEventProducer implements CorbaTypeEventProducer {
+        int state;
+
+        int[] states = {XMLStreamReader.START_ELEMENT, 
+                        XMLStreamReader.CHARACTERS, 
+                        XMLStreamReader.END_ELEMENT};
+        final String address;
+
+        public CorbaAddressEventProducer(String value) {
+            address = value;
+        }
+
+        public String getLocalName() {
+            return WSA_ADDRESS.getLocalPart();
+        }
+
+        public String getText() {
+            return address;
+        }
+
+        public int next() {
+            return states[state++];
+        }
+
+        public QName getName() {
+            return WSA_ADDRESS;
+        }
+
+        public boolean hasNext() {
+            return state < states.length;
+        }
+
+        public List<Attribute> getAttributes() {
+            return null;
+        }
+
+        public List<Namespace> getNamespaces() {
+            return null;
+        }
+    }
+
+    // An event producer to handle the production of the Metadata XML data.  This producer
will rely
+    // on two additional producers to handle the production of sub-events.
+    class CorbaMetaDataEventProducer extends AbstractStartEndEventProducer {
+
+        CorbaServiceNameEventProducer svcProducer;
+        CorbaInterfaceNameEventProducer intfProducer;
+        List<Attribute> metaAttrs;
+
+        public CorbaMetaDataEventProducer(String location,
+                                          CorbaServiceNameEventProducer svc,
+                                          CorbaInterfaceNameEventProducer intf) {
+            name = new QName(CorbaObjectReferenceHelper.ADDRESSING_NAMESPACE_URI, "Metadata");
+
+            List<CorbaTypeEventProducer> metaDataProducers = new ArrayList<CorbaTypeEventProducer>();
+            metaDataProducers.add(svc);
+            metaDataProducers.add(intf);
+
+            producers = metaDataProducers.iterator();
+
+            XMLEventFactory factory = XMLEventFactory.newInstance();
+
+            metaAttrs = new ArrayList<Attribute>();
+            metaAttrs.add(factory.createAttribute(
+                        new QName(WSDLI_NAMESPACE_URI, "wsdlLocation", "objrefns1"), location));
+
+        }
+
+        public List<Attribute> getAttributes() {
+            if (currentEventProducer != null) {
+                return currentEventProducer.getAttributes();
+            } else {
+                return metaAttrs;
+            }
+        }
+   
+    }
+
+    // An event producer to handle the production of the ServiceName XML data.
+    class CorbaServiceNameEventProducer implements CorbaTypeEventProducer {
+        int state;
+        int[] states = {XMLStreamReader.START_ELEMENT,
+                        XMLStreamReader.CHARACTERS,
+                        XMLStreamReader.END_ELEMENT};
+        QName serviceName;
+        QName name;
+
+        List<Attribute> attributes;
+        List<Namespace> namespaces;
+
+        public CorbaServiceNameEventProducer(QName svc, String ep) {
+            serviceName = svc;
+
+            name = new QName(CorbaObjectReferenceHelper.ADDRESSING_NAMESPACE_URI + "/wsdl",
+                             "ServiceName");
+            
+            XMLEventFactory factory = XMLEventFactory.newInstance();
+
+            attributes = new ArrayList<Attribute>();
+            attributes.add(factory.createAttribute("EndpointName", ep));
+
+            namespaces = new ArrayList<Namespace>();
+            namespaces.add(factory.createNamespace("objrefns2", svc.getNamespaceURI()));
+        }
+
+        public String getLocalName() {
+            return name.getLocalPart();
+        }
+
+        public String getText() {
+            return namespaces.get(0).getPrefix() + ":" + serviceName.getLocalPart();
+        }
+
+        public int next() {
+            return states[state++];
+        }
+
+        public boolean hasNext() {
+            return state < states.length;
+        }
+
+        public QName getName() {
+            return name;
+        }
+
+        public List<Attribute> getAttributes() {
+            return attributes;
+        }
+
+        public List<Namespace> getNamespaces() {
+            return namespaces;
+        }
+    }
+
+    // An event producer to handle the production of the InterfaceName XML data.
+    class CorbaInterfaceNameEventProducer implements CorbaTypeEventProducer {
+        int state;
+        int[] states = {XMLStreamReader.START_ELEMENT,
+                        XMLStreamReader.CHARACTERS,
+                        XMLStreamReader.END_ELEMENT};
+        QName interfaceName;
+        QName name;
+        List<Namespace> namespaces;
+
+        public CorbaInterfaceNameEventProducer(QName intf) {
+            interfaceName = intf;
+
+            name = new QName(CorbaObjectReferenceHelper.ADDRESSING_NAMESPACE_URI + "/wsdl",
+                             "InterfaceName");
+            
+            XMLEventFactory factory = XMLEventFactory.newInstance();
+            namespaces = new ArrayList<Namespace>();
+            namespaces.add(factory.createNamespace("objrefns2", intf.getNamespaceURI()));
+        }
+
+        public String getLocalName() {
+            return name.getLocalPart();
+        }
+
+        public String getText() {
+            return namespaces.get(0).getPrefix() + ":" + interfaceName.getLocalPart();
+        }
+
+        public int next() {
+            return states[state++];
+        }
+
+        public boolean hasNext() {
+            return state < states.length;
+        }
+
+        public QName getName() {
+            return name;
+        }
+
+        public List<Attribute> getAttributes() {
+            return null;
+        }
+
+        public List<Namespace> getNamespaces() {
+            return namespaces;
+        }
+    }
+}

Propchange: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceEventProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceEventProducer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
Fri May 25 04:12:27 2007
@@ -18,8 +18,12 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
 
 import org.apache.cxf.service.model.ServiceInfo;
 
@@ -53,5 +57,13 @@
 
     public boolean hasNext() {
         return state < states.length;
+    }
+
+    public List<Attribute> getAttributes() {
+        return null;
+    }
+
+    public List<Namespace> getNamespaces() {
+        return null;
     }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaTypeEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaTypeEventProducer.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaTypeEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaTypeEventProducer.java
Fri May 25 04:12:27 2007
@@ -18,8 +18,13 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
+
 public interface CorbaTypeEventProducer {
     
     boolean hasNext();
@@ -43,5 +48,14 @@
      * text of current content
      */
     String getText();
-    
+
+    /*
+     * return any attributes for the current type
+     */
+    List<Attribute> getAttributes();
+
+    /*
+     * return any namespace for the current type
+     */
+    List<Namespace> getNamespaces();    
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/ParameterEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/ParameterEventProducer.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/ParameterEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/ParameterEventProducer.java
Fri May 25 04:12:27 2007
@@ -19,8 +19,11 @@
 package org.apache.yoko.bindings.corba.types;
 
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Namespace;
 
 import org.apache.cxf.service.model.ServiceInfo;
 
@@ -78,4 +81,11 @@
         return event;
     }
 
+    public List<Attribute> getAttributes() {
+        return null;
+    }
+
+    public List<Namespace> getNamespaces() {
+        return null;
+    }
 }

Modified: incubator/yoko/branches/perf/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceTest.java?view=diff&rev=541617&r1=541616&r2=541617
==============================================================================
--- incubator/yoko/branches/perf/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceTest.java
(original)
+++ incubator/yoko/branches/perf/src/test/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceTest.java
Fri May 25 04:12:27 2007
@@ -161,14 +161,7 @@
 
         int startVal = testObj.testObjectValue();
 
-        // We keep on having to set the request context with the endpoints address.  This
-        // was not the case before and should be looked at further
-        Map<String, Object> requestContext = ((BindingProvider)testObj).getRequestContext();
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ref.getAddress().getValue());
         testObj.testObjectValueUpdate(updateVal);
-
-        requestContext = ((BindingProvider)testObj).getRequestContext();
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ref.getAddress().getValue());
         int endVal = testObj.testObjectValue();
 
         assertTrue(endVal == updateVal);
@@ -177,23 +170,20 @@
     public void testDefaultObjectReturn() throws Exception {
         System.out.println("Testing default object reference as a return value...");
         EndpointReferenceType ref = client.testDefaultObjectReturn();
-        TestObject testObj = createObjectFromEndpointReferenceType(ref);
 
-        int updateVal = 246;
+        assertNotNull(ref.getAddress().getValue());
 
-        int startVal = testObj.testObjectValue();
+        QName interfaceName = EndpointReferenceUtils.getInterfaceName(ref);
+        assertNull(interfaceName);
 
-        // We keep on having to set the request context with the endpoints address.  This
-        // was not the case before and should be looked at further
-        Map<String, Object> requestContext = ((BindingProvider)testObj).getRequestContext();
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ref.getAddress().getValue());
-        testObj.testObjectValueUpdate(updateVal);
+        String wsdlLocation = EndpointReferenceUtils.getWSDLLocation(ref);
+        assertNull(wsdlLocation);
 
-        requestContext = ((BindingProvider)testObj).getRequestContext();
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ref.getAddress().getValue());
-        int endVal = testObj.testObjectValue();
+        QName serviceName = EndpointReferenceUtils.getServiceName(ref);
+        assertNull(serviceName);
 
-        assertTrue(endVal == updateVal);
+        String portName = EndpointReferenceUtils.getPortName(ref);
+        assertNull(portName);
     }
 
     public void testNilObjectParam() {
@@ -201,7 +191,7 @@
         boolean result = client.testNilObjectParam(null);
         assertTrue(result);
     }
-
+    
     public void testNilObjectReturn() {
         System.out.println("Testing nil object reference as a return value...");
         EndpointReferenceType result = client.testNilObjectReturn();
@@ -307,6 +297,7 @@
             try {
                 testObj = createObjectFromEndpointReferenceType(param);
             } catch (Exception ex) {
+                ex.printStackTrace();
                 return false;
             }
 
@@ -318,14 +309,7 @@
                 int updateVal = 123;
                 int startVal = testObj.testObjectValue();
 
-                // We keep on having to set the request context with the endpoints address.
 This
-                // was not the case before and should be looked at further
-                Map<String, Object> requestContext = ((BindingProvider)testObj).getRequestContext();
-                requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, param.getAddress().getValue());
                 testObj.testObjectValueUpdate(updateVal);
-
-                requestContext = ((BindingProvider)testObj).getRequestContext();
-                requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, param.getAddress().getValue());
                 int endVal = testObj.testObjectValue();
 
                 return (endVal == updateVal);
@@ -336,34 +320,24 @@
 
         public boolean testDefaultObjectParam(EndpointReferenceType param) {
             TestObject testObj = null;
-            try {
-                testObj = createObjectFromEndpointReferenceType(param);
-            } catch (Exception ex) {
-                return false;
-            }
 
-            if (testObj == null) {
+            if (param.getAddress().getValue() == null) {
                 return false;
             }
 
-            try {
-                int updateVal = 456;
-                int startVal = testObj.testObjectValue();
-
-                // We keep on having to set the request context with the endpoints address.
 This
-                // was not the case before and should be looked at further
-                Map<String, Object> requestContext = ((BindingProvider)testObj).getRequestContext();
-                requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, param.getAddress().getValue());
-                testObj.testObjectValueUpdate(updateVal);
+            QName interfaceName = EndpointReferenceUtils.getInterfaceName(param);
+            String wsdlLocation = EndpointReferenceUtils.getWSDLLocation(param);
+            QName serviceName = EndpointReferenceUtils.getServiceName(param);
+            String portName = EndpointReferenceUtils.getPortName(param);
 
-                requestContext = ((BindingProvider)testObj).getRequestContext();
-                requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, param.getAddress().getValue());
-                int endVal = testObj.testObjectValue();
-
-                return (endVal == updateVal);
-            } catch(Exception ex) {
+            if (interfaceName != null ||
+                wsdlLocation != null ||
+                serviceName != null ||
+                portName != null) {
                 return false;
             }
+
+            return true;
         }
 
         public EndpointReferenceType testCustomObjectReturn() {



Mime
View raw message