1 7 8 10 package org.jboss.net.jmx.adaptor; 11 12 import org.jboss.axis.encoding.DeserializationContext; 13 import org.jboss.axis.encoding.Deserializer; 14 import org.jboss.axis.encoding.DeserializerImpl; 15 import org.jboss.axis.encoding.DeserializerTarget; 16 import org.jboss.axis.message.SOAPHandler; 17 import org.xml.sax.Attributes ; 18 import org.xml.sax.SAXException ; 19 20 import javax.management.ObjectInstance ; 21 import javax.management.ObjectName ; 22 import javax.xml.namespace.QName ; 23 24 32 public class ObjectInstanceDeser extends DeserializerImpl 33 { 34 35 ObjectName objectName; 36 String className; 37 38 public void onStartElement(String namespace, 39 String localName, 40 String prefix, 41 Attributes attributes, 42 DeserializationContext context) 43 throws SAXException 44 { 45 46 if (context.isNil(attributes)) 47 { 48 return; 49 } 50 51 53 } 54 55 public SOAPHandler onStartChild(String namespace, 56 String localName, 57 String prefix, 58 Attributes attributes, 59 DeserializationContext context) 60 throws SAXException 61 { 62 63 QName itemType = 65 context.getTypeFromAttributes(namespace, localName, attributes); 66 Deserializer dSer = null; 68 if (itemType != null) 69 { 70 dSer = context.getDeserializerForType(itemType); 71 } 72 if (dSer == null) 73 { 74 dSer = new DeserializerImpl(); 75 } 76 77 dSer.registerValueTarget(new DeserializerTarget(this, localName)); 80 81 addChildDeserializer(dSer); 82 83 return (SOAPHandler)dSer; 84 } 85 86 public void setChildValue(Object value, Object hint) throws SAXException 87 { 88 if (hint.equals("className")) 89 className = (String )value; 90 else if (hint.equals("objectName")) 91 objectName = (ObjectName )value; 92 93 } 94 95 public void onEndElement(String s, 96 String s1, 97 DeserializationContext deserializationcontext) 98 { 99 try 100 { 101 super.value = new ObjectInstance (objectName, className); 102 } 103 catch (Exception exception) 104 { 105 exception.printStackTrace(); 106 } 107 } 108 109 } 110 | Popular Tags |