1 4 5 9 10 25 26 package org.openlaszlo.remote.soap.encoding; 27 28 import org.apache.axis.encoding.DeserializationContext; 29 import org.apache.axis.encoding.ser.ArrayDeserializer; 30 import org.apache.axis.message.SOAPHandler; 31 import org.openlaszlo.iv.flash.util.FlashBuffer; 32 import org.openlaszlo.iv.flash.api.action.Actions; 33 import org.openlaszlo.iv.flash.api.action.Program; 34 import java.util.ArrayList ; 35 import org.apache.log4j.Logger; 36 import org.xml.sax.Attributes ; 37 import org.xml.sax.SAXException ; 38 39 public class SWFArrayDeserializer extends ArrayDeserializer 40 { 41 public static Logger mLogger = 42 Logger.getLogger(SWFArrayDeserializer.class); 43 44 String mItemTag = null; 47 48 static int BUFSIZE = 8192; 49 50 51 62 public SOAPHandler onStartChild(String namespace, 63 String localName, 64 String prefix, 65 Attributes attributes, 66 DeserializationContext context) 67 throws SAXException { 68 69 if (mItemTag == null) mItemTag = localName; 70 71 return super.onStartChild(namespace, localName, prefix, attributes, context); 72 73 } 74 75 76 82 public void valueComplete() throws SAXException 83 { 84 if (componentsReady()) { 85 try { 86 ArrayList list = (ArrayList )value; 87 FlashBuffer fbuf = new FlashBuffer(BUFSIZE); 88 int i=list.size(); 89 while (--i >= 0) { 90 fbuf.writeFOB( ( (Program)list.get(i) ).body()); 91 } 92 Program program = new Program(fbuf); 93 program.push(list.size()); 94 fbuf.writeByte(Actions.InitArray); 95 96 if (mItemTag != null) { 97 program.body().writeByte(Actions.PushDuplicate); 98 program.push("__LZtag"); program.push(mItemTag); 100 program.body().writeByte(Actions.SetMember); 101 } 102 103 value = program; 104 } catch (RuntimeException e) { 105 } 107 } 108 super.valueComplete(); 109 } 110 } 111 | Popular Tags |