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.MBeanAttributeInfo ; 21 import javax.management.MBeanConstructorInfo ; 22 import javax.management.MBeanInfo ; 23 import javax.management.MBeanNotificationInfo ; 24 import javax.management.MBeanOperationInfo ; 25 import javax.xml.namespace.QName ; 26 27 35 public class MBeanInfoDeser extends DeserializerImpl 36 { 37 38 private String className; 39 private String description; 40 private MBeanAttributeInfo [] attributes; 41 private MBeanConstructorInfo [] constructors; 42 private MBeanOperationInfo [] operations; 43 private MBeanNotificationInfo [] notifications; 44 45 public void onStartElement(String namespace, 46 String localName, 47 String prefix, 48 Attributes attributes, 49 DeserializationContext context) 50 throws SAXException 51 { 52 53 if (context.isNil(attributes)) 54 { 55 return; 56 } 57 58 60 } 61 62 public SOAPHandler onStartChild(String namespace, 63 String localName, 64 String prefix, 65 Attributes attributes, 66 DeserializationContext context) 67 throws SAXException 68 { 69 70 QName itemType = 72 context.getTypeFromAttributes(namespace, localName, attributes); 73 Deserializer dSer = null; 75 if (itemType != null) 76 { 77 dSer = context.getDeserializerForType(itemType); 78 } 79 if (dSer == null) 80 { 81 dSer = new DeserializerImpl(); 82 } 83 84 dSer.registerValueTarget(new DeserializerTarget(this, localName)); 87 88 addChildDeserializer(dSer); 89 90 return (SOAPHandler)dSer; 91 } 92 93 public void setChildValue(Object value, Object hint) throws SAXException 94 { 95 if (hint.equals("className")) 96 className = (String )value; 97 else if (hint.equals("description")) 98 description = (String )value; 99 else if (hint.equals("attributes")) 100 attributes = (MBeanAttributeInfo [])value; 101 else if (hint.equals("constructors")) 102 constructors = (MBeanConstructorInfo [])value; 103 else if (hint.equals("operations")) 104 operations = (MBeanOperationInfo [])value; 105 else if (hint.equals("notifications")) 106 notifications = (MBeanNotificationInfo [])value; 107 108 } 109 110 public void onEndElement(String s, 111 String s1, 112 DeserializationContext deserializationcontext) 113 { 114 try 115 { 116 super.value = 117 new MBeanInfo (className, 118 description, 119 attributes, 120 constructors, 121 operations, 122 notifications); 123 } 124 catch (Exception exception) 125 { 126 exception.printStackTrace(); 127 } 128 } 129 130 } 131 | Popular Tags |