1 8 9 package mx4j.tools.remote.soap.axis.ser; 10 11 import java.io.IOException ; 12 import javax.management.remote.TargetedNotification ; 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 TargetedNotificationSer extends AxisSerializer 25 { 26 static final String NOTIFICATION = "notification"; 27 static final String LISTENER_ID = "listenerID"; 28 private static final QName NOTIFICATION_QNAME = new QName ("", NOTIFICATION); 29 private static final QName LISTENER_ID_QNAME = new QName ("", LISTENER_ID); 30 static final String TYPE = "TargetedNotification"; 31 32 public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException 33 { 34 TargetedNotification targetedNotification = (TargetedNotification )value; 35 context.startElement(name, attributes); 36 context.serialize(NOTIFICATION_QNAME, null, targetedNotification.getNotification()); 37 context.serialize(LISTENER_ID_QNAME, null, targetedNotification.getListenerID()); 38 context.endElement(); 39 } 40 41 public Element writeSchema(Class aClass, Types types) throws Exception 42 { 43 Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE); 44 complexType.setAttribute("name", TYPE); 45 Element allElement = types.createElement(SCHEMA_ALL); 46 complexType.appendChild(allElement); 47 48 Element typeElement = types.createElement(SCHEMA_ELEMENT); 49 typeElement.setAttribute("name", NOTIFICATION); 50 typeElement.setAttribute("type", NotificationSer.TYPE); 51 allElement.appendChild(typeElement); 52 53 Element sourceElement = types.createElement(SCHEMA_ELEMENT); 54 sourceElement.setAttribute("name", LISTENER_ID); 55 sourceElement.setAttribute("type", XMLType.XSD_INT.getLocalPart()); 56 allElement.appendChild(sourceElement); 57 58 return complexType; 59 } 60 } 61 | Popular Tags |