incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r487281 - /incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java
Date Thu, 14 Dec 2006 18:01:10 GMT
Author: enolan
Date: Thu Dec 14 10:01:09 2006
New Revision: 487281

URL: http://svn.apache.org/viewvc?view=rev&rev=487281
Log:
yoko-244 - need to fix marshalling.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java?view=diff&rev=487281&r1=487280&r2=487281
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java
Thu Dec 14 10:01:09 2006
@@ -170,23 +170,26 @@
                 for (int i = 0; i < params.size(); i++) {
                     Object partValue;
                     ParamType param = params.get(i);
-                    if (param.getMode() != ModeType.IN) {
-                        partValue = ((Holder)args.get(i)).value;
-                    } else {
-                        partValue = args.get(i);
-                    }
-
-                    MessagePartInfo part = getMessagePartInfo(msgInfo, param.getName());
+                    boolean skipRead = false;
                     QName elName = new QName("", param.getName());
-                    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-                    XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
-                    writer.write(partValue, part, evtWriter);
-
-                    ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
-                    XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
                     QName idlType = param.getIdltype();
                     CorbaObjectHandler obj = null;
-                    boolean skipRead = false;
+                    XMLEventReader evtReader = null;
+                    if (param.getMode() == ModeType.IN || param.getMode() == ModeType.INOUT)
{
+                        if (param.getMode() == ModeType.INOUT) {
+                            partValue = ((Holder)args.get(i)).value;
+                        } else {
+                            partValue = args.get(i);
+                        }
+
+                        //MessagePartInfo part = getMessagePartInfo(msgInfo, param.getName());
                       
+                        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+                        XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
+                        //writer.write(partValue, part, evtWriter);
+                        writer.write(partValue, evtWriter);
+                        ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
+                        evtReader = inputFactory.createXMLEventReader(inStream);        
                                       
+                    }
                     if (!ContextUtils.isRequestor(message)) {
                         if (param.getMode().equals(ModeType.IN)) {
                             skipRead = true;
@@ -197,7 +200,7 @@
                     if (skipRead) {
                         obj = CorbaHandlerUtils.initializeObjectHandler(orb, elName, idlType,
typeMaps);
                     } else {
-                        obj = corbaStaxObject.readObjectFromStax(evtReader, idlType, false);
+                        obj = corbaStaxObject.readObjectFromStax(evtReader, idlType, false);
                      
                     }
                     CorbaStreamable streamable = new CorbaStreamable(obj, elName);
                     ModeType paramMode = param.getMode();
@@ -234,13 +237,15 @@
 
     protected MessagePartInfo getMessagePartInfo(MessageInfo msgInfo, String name) {
         List<MessagePartInfo> parts = msgInfo.getMessageParts();
-        for (int i = 0; i < parts.size(); i++) {
-            MessagePartInfo part = parts.get(i);
+        MessagePartInfo part = parts.get(0);
+        return part;
+        /*for (int i = 0; i < parts.size(); i++) {
+            MessagePartInfo part = parts.get(0);            
             if (part.getName().getLocalPart().equals(name)) {
                 return part;
             }
-        }
-        return null;
+        }*/
+        //return null;
     }
     
     protected DataWriter<XMLEventWriter> getDataWriter(CorbaMessage message) {
@@ -266,4 +271,38 @@
         return dataWriter;
     }
 
+    /*private String getNamespace(InterfaceInfo info, OperationType opType, ParamType param)
{
+        String namespace = null;
+        Iterator iter = info.getOperations().iterator();
+        while (iter.hasNext()) {                
+            OperationInfo op = (OperationInfo)iter.next();
+            if (opType.getName().equals(op.getName().getLocalPart())) {   
+                MessageInfo mInfo = op.getInput();                
+                if (mInfo != null) {
+                    List <MessagePartInfo> lInfo = mInfo.getMessageParts();
+                    for (MessagePartInfo pInfo : lInfo) {
+                        if (pInfo.getName().getLocalPart().equals(param.getName())) {
+                            QName el = pInfo.getElementQName();
+                            namespace = el.getNamespaceURI();
+                            break;
+                        }
+                    }
+                }                
+                
+                if (namespace == null) {
+                    mInfo = op.getOutput();
+                    if (mInfo != null) {
+                        List<MessagePartInfo> lInfo = mInfo.getMessageParts();
+                        for (MessagePartInfo pInfo : lInfo) {
+                            if (pInfo.getName().getLocalPart().equals(param.getName())) {
+                                QName el = pInfo.getElementQName();
+                                namespace = el.getNamespaceURI();
+                            }
+                        }
+                    }
+                }
+            }               
+        }
+        return namespace;
+    }*/
 }



Mime
View raw message