1 8 9 package mx4j.tools.remote.soap.axis.ser; 10 11 import java.io.IOException ; 12 import javax.management.MBeanNotificationInfo ; 13 import javax.xml.namespace.QName ; 14 15 import org.apache.axis.encoding.SerializationContext; 16 import org.apache.axis.encoding.XMLType; 17 import org.apache.axis.wsdl.fromJava.Types; 18 import org.w3c.dom.Element ; 19 import org.xml.sax.Attributes ; 20 21 24 public class MBeanNotificationInfoSer extends AxisSerializer 25 { 26 static final String TYPE = "MBeanNotificationInfo"; 27 static final String NAME = "name"; 28 static final String DESCRIPTION = "description"; 29 static final String NOTIFICATION_TYPES = "notificationTypes"; 30 private static final QName NAME_QNAME = new QName ("", NAME); 31 private static final QName DESCRIPTION_QNAME = new QName ("", DESCRIPTION); 32 private static final QName NOTIFICATION_TYPES_QNAME = new QName ("", NOTIFICATION_TYPES); 33 34 public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException 35 { 36 MBeanNotificationInfo info = (MBeanNotificationInfo )value; 37 context.startElement(name, attributes); 38 context.serialize(NAME_QNAME, null, info.getName()); 39 context.serialize(DESCRIPTION_QNAME, null, info.getDescription()); 40 context.serialize(NOTIFICATION_TYPES_QNAME, null, info.getNotifTypes()); 41 context.endElement(); 42 } 43 44 public Element writeSchema(Class javaType, Types types) throws Exception 45 { 46 Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE); 47 complexType.setAttribute("name", TYPE); 48 Element allElement = types.createElement(SCHEMA_ALL); 49 complexType.appendChild(allElement); 50 51 Element nameElement = types.createElement(SCHEMA_ELEMENT); 52 nameElement.setAttribute("name", NAME); 53 nameElement.setAttribute("type", XMLType.XSD_STRING.getLocalPart()); 54 allElement.appendChild(nameElement); 55 56 Element descrElement = types.createElement(SCHEMA_ELEMENT); 57 descrElement.setAttribute("name", DESCRIPTION); 58 descrElement.setAttribute("type", XMLType.XSD_STRING.getLocalPart()); 59 allElement.appendChild(descrElement); 60 61 Element typesElement = types.createElement(SCHEMA_ELEMENT); 62 typesElement.setAttribute("name", NOTIFICATION_TYPES); 63 typesElement.setAttribute("type", XMLType.SOAP_ARRAY.getLocalPart()); 64 allElement.appendChild(typesElement); 65 66 return complexType; 67 } 68 } 69 | Popular Tags |