incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmidd...@apache.org
Subject svn commit: r504654 - in /incubator/yoko/trunk/bindings/src: main/java/org/apache/yoko/bindings/corba/ main/java/org/apache/yoko/bindings/corba/types/ test/java/org/apache/yoko/bindings/corba/
Date Wed, 07 Feb 2007 19:26:08 GMT
Author: dmiddlem
Date: Wed Feb  7 11:26:08 2007
New Revision: 504654

URL: http://svn.apache.org/viewvc?view=rev&rev=504654
Log:
Initial commit to support object references using WS-Addressing in the
runtime binding (YOKO-270).  Note that this is not the complete 
implementation, just the base for providing this functionality.

Added:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceRegistry.java
  (with props)
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
  (with props)
Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java?view=diff&rev=504654&r1=504653&r2=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
Wed Feb  7 11:26:08 2007
@@ -100,7 +100,16 @@
                 throw new CorbaBindingException("Unable to locate a valid CORBA address");
             }
             List args = message.getContent(List.class);
-            org.omg.CORBA.Object targetObject = CorbaUtils.importObjectReference(orb, address.getLocation());
+            EndpointReferenceType ref = (EndpointReferenceType)message.get(Message.ENDPOINT_ADDRESS);
+            org.omg.CORBA.Object targetObject;
+            // A non-null endpoint address from the message means that we want to invoke
on a particular
+            // object reference specified by the endpoint reference type.  If the reference
is null, then
+            // we want to invoke on the default location as specified in the WSDL.
+            if (ref != null) {
+                targetObject = CorbaObjectReferenceRegistry.getReferenceById(ref.getAddress().getValue());
 
+            } else {
+                targetObject = CorbaUtils.importObjectReference(orb, address.getLocation());
+            }
             message.put(CorbaConstants.ORB, orb);
             message.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, targetObject);
             message.setContent(OutputStream.class,
@@ -267,11 +276,11 @@
         Request request = null;
         ContextList ctxList = orb.create_context_list();
         Context ctx = orb.get_default_context();            
-        org.omg.CORBA.Object targetObj = 
+
+        org.omg.CORBA.Object targetObj =
             (org.omg.CORBA.Object)message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT);
-        if (targetObj != null) {                
-            request = targetObj._create_request(ctx, opName, 
-                                                nvlist, ret, exList, ctxList);
+        if (targetObj != null) {
+            request = targetObj._create_request(ctx, opName, nvlist, ret, exList, ctxList);
         }
         return request;
     }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java?view=diff&rev=504654&r1=504653&r2=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java
Wed Feb  7 11:26:08 2007
@@ -41,6 +41,7 @@
 import org.apache.yoko.bindings.corba.types.CorbaExceptionHandler;
 import org.apache.yoko.bindings.corba.types.CorbaFixedHandler;
 import org.apache.yoko.bindings.corba.types.CorbaObjectHandler;
+import org.apache.yoko.bindings.corba.types.CorbaObjectReferenceHandler;
 import org.apache.yoko.bindings.corba.types.CorbaPrimitiveHandler;
 import org.apache.yoko.bindings.corba.types.CorbaSequenceHandler;
 import org.apache.yoko.bindings.corba.types.CorbaStructHandler;
@@ -133,6 +134,9 @@
         case TCKind._tk_union:
             this.readUnion(obj);
             break;
+        case TCKind._tk_objref:
+            this.readObjectReference(obj);
+            break;            
         default:
         // TODO: Provide Implementation. Do we throw an exception.
         }
@@ -434,4 +438,10 @@
             }
         }
     }
+    
+    public void readObjectReference(CorbaObjectHandler obj) throws CorbaBindingException
{
+        CorbaObjectReferenceHandler objRefObj = (CorbaObjectReferenceHandler)obj;
+        org.omg.CORBA.Object objRef = stream.read_Object();
+        objRefObj.setReference(objRef);
+    }    
 }

Added: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceRegistry.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceRegistry.java?view=auto&rev=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceRegistry.java
(added)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceRegistry.java
Wed Feb  7 11:26:08 2007
@@ -0,0 +1,53 @@
+/**
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+// We need to keep a list of all object references that we have used in the binding.
+// This helps us in two ways:
+//   1. When we receive a CORBA object reference in Yoko, we can make sure that 
+//      when Yoko makes any invocation on that reference, the binding selects the 
+//      correct target to send the request to.
+//   2. When we want to send a Yoko reference to a CORBA target, we make sure that 
+//      we provide the correct DSI servant to the request so that the CORBA target
+//      can correctly call the corresponding Yoko object.
+public class CorbaObjectReferenceRegistry {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(CorbaObjectReferenceRegistry.class);
+
+    private static Map<String, org.omg.CORBA.Object> objectReferences =
+        new HashMap<String, org.omg.CORBA.Object>();
+
+    public static void addReference(String id, org.omg.CORBA.Object reference) {
+        LOG.log(Level.INFO, "Registering object with id " + id);
+        objectReferences.put(id, reference);
+    }
+
+    public static org.omg.CORBA.Object getReferenceById(String id) {
+        LOG.log(Level.INFO, "Retrieving object with id " + id);
+        return objectReferences.get(id);
+    }
+}

Propchange: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReferenceRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java?view=diff&rev=504654&r1=504653&r2=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java
Wed Feb  7 11:26:08 2007
@@ -32,6 +32,7 @@
 import org.apache.yoko.bindings.corba.types.CorbaExceptionHandler;
 import org.apache.yoko.bindings.corba.types.CorbaFixedHandler;
 import org.apache.yoko.bindings.corba.types.CorbaObjectHandler;
+import org.apache.yoko.bindings.corba.types.CorbaObjectReferenceHandler;
 import org.apache.yoko.bindings.corba.types.CorbaPrimitiveHandler;
 import org.apache.yoko.bindings.corba.types.CorbaSequenceHandler;
 import org.apache.yoko.bindings.corba.types.CorbaStructHandler;
@@ -121,6 +122,9 @@
         case TCKind._tk_union:
             this.writeUnion(obj);
             break;
+        case TCKind._tk_objref:
+            this.writeObjectReference(obj);
+            break;            
         default:
         // TODO: Provide Implementation. Do we throw an exception.
         }
@@ -262,4 +266,9 @@
             this.write(seqElements.get(i));
         }
     }
+    
+    public void writeObjectReference(CorbaObjectHandler obj) throws CorbaBindingException
{
+        CorbaObjectReferenceHandler objHandler = (CorbaObjectReferenceHandler)obj;
+        stream.write_Object(objHandler.getReference());
+    }   
 }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java?view=diff&rev=504654&r1=504653&r2=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java
Wed Feb  7 11:26:08 2007
@@ -26,6 +26,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventFactory;
 import javax.xml.stream.XMLEventReader;
@@ -40,6 +41,7 @@
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
 import org.apache.schemas.yoko.bindings.corba.Anonarray;
 import org.apache.schemas.yoko.bindings.corba.Anonsequence;
@@ -71,6 +73,7 @@
 import org.apache.yoko.bindings.corba.types.CorbaFixedHandler;
 import org.apache.yoko.bindings.corba.types.CorbaHandlerUtils;
 import org.apache.yoko.bindings.corba.types.CorbaObjectHandler;
+import org.apache.yoko.bindings.corba.types.CorbaObjectReferenceHandler;
 import org.apache.yoko.bindings.corba.types.CorbaPrimitiveHandler;
 import org.apache.yoko.bindings.corba.types.CorbaSequenceHandler;
 import org.apache.yoko.bindings.corba.types.CorbaStructHandler;
@@ -82,7 +85,6 @@
 import org.omg.CORBA.TCKind;
 import org.omg.CORBA.TypeCode;
 
-
 /**
  * Holder for reading and writing stax methods.
  */
@@ -94,7 +96,12 @@
     private static final String XSI_PREFIX = "xsi";
     private static final String XMLSCHEMA_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema";
     private static final String XMLSCHEMA_PREFIX = "xs";
-    
+
+    // TODO: XXX Check names...
+    private static final String WSDLI_NAMESPACE_URI = "http://www.w3.org/2006/01/wsdl-instance";
+    private static final String ADDRESSING_NAMESPACE_URI = "http://www.w3.org/2005/08/addressing";
+    private static final String ADDRESSING_WSDL_NAMESPACE_URI = "http://www.w3.org/2005/08/addressing/wsdl";
+  
     private ORB orb;
     private List<CorbaTypeMap> typeMaps;       
     private ServiceInfo serviceInfo;
@@ -200,6 +207,10 @@
                 LOG.log(Level.INFO, "Reading union type from XML reader");
                 obj = readUnionFromStax(reader, idlType, tc, schemaType);
                 break;
+            case TCKind._tk_objref:
+                LOG.log(Level.INFO, "Reading object reference from XML reader");
+                obj = readObjectReferenceFromStax(reader, idlType, tc, schemaType);
+                break;
             default:
                 throw new CorbaBindingException("Unsupported complex type");
             }
@@ -277,6 +288,10 @@
                         LOG.log(Level.INFO, "Wrting anonymous string to XML writer");
                         writePrimitiveToStax(obj, objName, schemaType, writer, factory);
                         break;
+                    case TCKind._tk_objref:
+                        LOG.log(Level.INFO, "Writing object reference to XML writer");
+                        writeObjectReferenceToStax(obj, objName, schemaType, writer, factory);
+                        break;
                     default:
                         throw new CorbaBindingException("Unsupported complex type");
                     }                    
@@ -1238,6 +1253,134 @@
         writer.add(endEl); 
     }
 
+    protected CorbaObjectHandler readObjectReferenceFromStax(XMLEventReader reader,
+                                                             QName idlType,
+                                                             TypeCode tc,
+                                                             XmlSchemaObject schemaType)
{
+        CorbaObjectReferenceHandler obj = null;
+        try {
+            Object objType = (Object)CorbaUtils.getCorbaType(idlType, typeMaps);
+            StartElement objStartEl = reader.nextEvent().asStartElement();
+
+            obj = new CorbaObjectReferenceHandler(objStartEl.getName(), idlType, tc, objType);
+            while (true) {
+                // Try to get the next event as a start element.  We should have a start
element
+                // directly after the objects start if the object reference is valie.  If
it
+                // isn't, the generated exception should be caught below.
+                StartElement startEl = reader.nextEvent().asStartElement();
+
+                if (startEl.getName().getLocalPart().equals("Metadata")) {
+                    while (true) {
+                        StartElement metaEl = reader.nextEvent().asStartElement();
+                        if (metaEl.getName().getLocalPart().equals("InterfaceName")) {
+                            Characters intfChars = reader.nextEvent().asCharacters();
+                            // TODO: How do we want to handle this information
+                        } else if (metaEl.getName().getLocalPart().equals("ServiceName"))
{
+                            Characters svcChars = reader.nextEvent().asCharacters();
+                            // TODO: How do we want to handle this information
+                        }
+                        reader.nextEvent().asEndElement();
+                        if (reader.peek().isEndElement()) {
+                            break;
+                        }
+                    }
+                } else if (startEl.getName().getLocalPart().equals("Address")) {
+                    Characters addrChars = reader.nextEvent().asCharacters();
+                    org.omg.CORBA.Object ref =
+                        CorbaObjectReferenceRegistry.getReferenceById(addrChars.getData());
+                    obj.setReference(ref);
+                }
+
+                reader.nextEvent().asEndElement();
+                if (reader.peek().isEndElement()) {
+                    // Two end elements in a row at this point should mean we've hit the
end
+                    // of the stax description for the object reference
+                    break;
+                }
+            }
+            reader.nextEvent().asEndElement();
+
+            // TODO: Verify that the reference has been set for the object
+
+        } catch (java.lang.Exception ex) {
+            LOG.log(Level.SEVERE, "Received exception while reading object of type " + idlType);
+            throw new CorbaBindingException("Error while reading object reference corba type",
ex);
+        }
+
+        return obj;
+    }
+   
+    protected void writeObjectReferenceToStax(CorbaObjectHandler obj,
+                                              QName objName,
+                                              XmlSchemaObject schemaType,
+                                              XMLEventWriter writer,
+                                              XMLEventFactory factory)
+        throws XMLStreamException {
+        if (objName == null) {
+            objName = obj.getName();
+        }
+
+        CorbaObjectReferenceHandler objRefHandler = (CorbaObjectReferenceHandler)obj;
+        org.omg.CORBA.Object corbaObj = objRefHandler.getReference();
+
+        // Register the servant if not already done.
+        String objAddress = orb.object_to_string(corbaObj);
+        org.omg.CORBA.Object servant = CorbaObjectReferenceRegistry.getReferenceById(objAddress);
+        if (servant == null) {
+            CorbaObjectReferenceRegistry.addReference(objAddress, corbaObj);
+        }
+
+        // TODO: This is not a guaranteed way to get all of the meta info if we use a
+        // wsdl generated by a non-Yoko idltowsdl tool.  For now, we are using this to
+        // test the concepts for object references.  In the future, we need a more
+        // correct way of obtaining the metadata values.
+        String interfaceName = 
+            ((org.apache.schemas.yoko.bindings.corba.Object)objRefHandler.getType()).getName();
+        String referenceName = interfaceName + "Ref";
+        String serviceName = interfaceName + "CORBAService";
+        String endpointName = interfaceName + "CORBAPort";
+        String referenceNamespace = serviceInfo.getTargetNamespace();
+        String refNSPrefix = "objrefns";
+
+        StartElement refStart = factory.createStartElement(new QName(referenceName), null,
null);
+        writer.add(refStart);
+
+        // Add the Address information
+        QName addrQName = new QName(ADDRESSING_NAMESPACE_URI, "Address");
+        writer.add(factory.createStartElement(addrQName, null, null));
+        writer.add(factory.createCharacters(objAddress));
+        writer.add(factory.createEndElement(addrQName, null));
+
+        // Add the Metadata information
+        QName metaQName = new QName(ADDRESSING_NAMESPACE_URI, "Metadata");
+        List<Attribute> metaAttrs = new ArrayList<Attribute>();
+        metaAttrs.add(factory.createAttribute(new QName(WSDLI_NAMESPACE_URI, "wsdlLocation"),

+                      getWSDLLocationFromService()));
+        // TODO: This is a hack to get around namespaces not working correctly for Stax.
 Find
+        // out why this is happening.
+        QName serviceNS = new QName(referenceNamespace, refNSPrefix, refNSPrefix);
+        metaAttrs.add(factory.createAttribute(serviceNS, ""));
+        writer.add(factory.createStartElement(metaQName, metaAttrs.iterator(), null));
+
+        // Add ServiceName information to Metadata
+        QName serviceQName = new QName(ADDRESSING_WSDL_NAMESPACE_URI, "ServiceName");
+        List<Attribute> serviceAttrs = new ArrayList<Attribute>();
+        serviceAttrs.add(factory.createAttribute(new QName("EndpointName"), endpointName));
+        writer.add(factory.createStartElement(serviceQName, serviceAttrs.iterator(), null));
+        writer.add(factory.createCharacters(refNSPrefix + ":" + serviceName));
+        writer.add(factory.createEndElement(serviceQName, null));
+
+        // Add InterfaceName information to Metadata
+        QName interfaceQName = new QName(ADDRESSING_WSDL_NAMESPACE_URI, "InterfaceName");
+        writer.add(factory.createStartElement(interfaceQName, null, null));
+        writer.add(factory.createCharacters(refNSPrefix + ":" + interfaceName));
+        writer.add(factory.createEndElement(interfaceQName, null));
+
+        writer.add(factory.createEndElement(metaQName, null));
+
+        writer.add(factory.createEndElement(new QName(referenceName), null));
+    }
+    
     private boolean isNestedSequence(TypeCode tc) {
         boolean result = false;
         if (tc.kind().value() == TCKind._tk_sequence) {
@@ -1303,5 +1446,10 @@
             }
         }
         return result;
+    }
+    
+    private String getWSDLLocationFromService() {
+        Definition wsdlDef = (Definition)serviceInfo.getProperty(WSDLServiceBuilder.WSDL_DEFINITION);
+        return wsdlDef.getDocumentBaseURI();
     }
 }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java?view=diff&rev=504654&r1=504653&r2=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
Wed Feb  7 11:26:08 2007
@@ -34,7 +34,7 @@
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 
-import org.apache.schemas.yoko.bindings.corba.Alias;
+//import org.apache.schemas.yoko.bindings.corba.Alias;
 import org.apache.schemas.yoko.bindings.corba.Anonarray;
 import org.apache.schemas.yoko.bindings.corba.Anonfixed;
 import org.apache.schemas.yoko.bindings.corba.Anonsequence;
@@ -42,7 +42,7 @@
 import org.apache.schemas.yoko.bindings.corba.Anonwstring;
 import org.apache.schemas.yoko.bindings.corba.Array;
 import org.apache.schemas.yoko.bindings.corba.CaseType;
-import org.apache.schemas.yoko.bindings.corba.Const;
+//import org.apache.schemas.yoko.bindings.corba.Const;
 import org.apache.schemas.yoko.bindings.corba.CorbaType;
 import org.apache.schemas.yoko.bindings.corba.Enum;
 import org.apache.schemas.yoko.bindings.corba.Enumerator;
@@ -135,12 +135,13 @@
         
         // Split all of these up into separate get*** methods.  One big method will not satisfy
checkstyle
         // rules
-        if (obj instanceof Alias) {
-            Alias aliasType = (Alias)obj;
-            tc = orb.create_alias_tc(aliasType.getRepositoryID(), 
-                                     aliasType.getName(), 
-                                     getTypeCode(orb, aliasType.getBasetype(), typeMaps));
-        } else if (obj instanceof Anonarray) {
+        //if (obj instanceof Alias) {
+        //    Alias aliasType = (Alias)obj;
+        //    tc = orb.create_alias_tc(aliasType.getRepositoryID(), 
+        //                             aliasType.getName(), 
+        //                             getTypeCode(orb, aliasType.getBasetype(), typeMaps));
+        //} else if (obj instanceof Anonarray) {
+        if (obj instanceof Anonarray) {
             Anonarray anonArrayType = (Anonarray)obj;
             tc = orb.create_array_tc((int) anonArrayType.getBound(), 
                                      getTypeCode(orb, anonArrayType.getElemtype(), typeMaps));
@@ -161,9 +162,9 @@
             Array arrayType = (Array)obj;
             tc = orb.create_array_tc((int) arrayType.getBound(), 
                                      getTypeCode(orb, arrayType.getElemtype(), typeMaps));
-        } else if (obj instanceof Const) {
-            Const constType = (Const)obj;
-            tc = getTypeCode(orb, constType.getIdltype(), typeMaps);
+        //} else if (obj instanceof Const) {
+        //    Const constType = (Const)obj;
+        //    tc = getTypeCode(orb, constType.getIdltype(), typeMaps);
         } else if (obj instanceof Enum) {
             Enum enumType = (Enum)obj;
             String name = enumType.getName();
@@ -190,6 +191,10 @@
         } else if (obj instanceof Fixed) {
             Fixed fixedType = (Fixed) obj;
             tc = orb.create_fixed_tc((short) fixedType.getDigits(), (short) fixedType.getScale());
+        } else if (obj instanceof org.apache.schemas.yoko.bindings.corba.Object) {
+            org.apache.schemas.yoko.bindings.corba.Object objType =
+                (org.apache.schemas.yoko.bindings.corba.Object)obj;
+            tc = orb.create_interface_tc(objType.getRepositoryID(), objType.getName()); 
          
         } else if (obj instanceof Sequence) {
             Sequence seqType = (Sequence)obj;
             tc = orb.create_sequence_tc((int) seqType.getBound(), 

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java?view=diff&rev=504654&r1=504653&r2=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
Wed Feb  7 11:26:08 2007
@@ -98,6 +98,9 @@
                 // These need to be here to catch the anonymous string types.
                 handler = new CorbaPrimitiveHandler(name, idlType, tc, type);
                 break;
+            case TCKind._tk_objref:
+                handler = new CorbaObjectReferenceHandler(name, idlType, tc, type);
+                break;                
             default:
                 handler = new CorbaObjectHandler(name, idlType, tc, type);              
 
             }

Added: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java?view=auto&rev=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
(added)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
Wed Feb  7 11:26:08 2007
@@ -0,0 +1,42 @@
+/**
+ * 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 javax.xml.namespace.QName;
+
+import org.omg.CORBA.TypeCode;
+
+public class CorbaObjectReferenceHandler extends CorbaObjectHandler {
+
+    private org.omg.CORBA.Object value;
+
+    public CorbaObjectReferenceHandler(QName objName, QName objIdlType, TypeCode objTC, Object
objType) {
+        super(objName, objIdlType, objTC, objType);
+        value = null;
+    }
+
+    public org.omg.CORBA.Object getReference() {
+        return value;
+    }
+
+    public void setReference(org.omg.CORBA.Object ref) {
+        value = ref;
+    }
+}
\ No newline at end of file

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

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

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java?view=diff&rev=504654&r1=504653&r2=504654
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java
Wed Feb  7 11:26:08 2007
@@ -210,7 +210,7 @@
     
     public void testBuildRequest() throws Exception {
         CorbaConduit conduit = setupCorbaConduit(false);            
-        CorbaMessage message = control.createMock(CorbaMessage.class);        
+        CorbaMessage message = control.createMock(CorbaMessage.class);
         Exchange exchange = control.createMock(Exchange.class);
         EasyMock.expect(message.getExchange());
         EasyMock.expectLastCall().andReturn(exchange);        
@@ -341,6 +341,7 @@
         
         org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class); 
         EasyMock.expect(message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)).andReturn(obj);
+        
         //msg.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, obj);        
         Request r = control.createMock(Request.class);        
         NVList nvList = (NVList)orb.create_list(0);



Mime
View raw message