1 8 9 package mx4j.tools.remote.soap.axis.ser; 10 11 import java.io.IOException ; 12 import javax.management.Notification ; 13 import javax.management.monitor.MonitorNotification ; 14 import javax.xml.namespace.QName ; 15 16 import org.apache.axis.encoding.SerializationContext; 17 import org.apache.axis.encoding.XMLType; 18 import org.apache.axis.wsdl.fromJava.Types; 19 import org.w3c.dom.Element ; 20 21 24 public class MonitorNotificationSer extends NotificationSer 25 { 26 static final String TYPE = "MonitorNotification"; 27 static final String DERIVED_GAUGE = "derivedGauge"; 28 static final String OBSERVED_ATTRIBUTE = "observedAttribute"; 29 static final String OBSERVED_OBJECT = "observedObject"; 30 static final String TRIGGER = "trigger"; 31 private static final QName DERIVED_GAUGE_QNAME = new QName ("", DERIVED_GAUGE); 32 private static final QName OBSERVED_ATTRIBUTE_QNAME = new QName ("", OBSERVED_ATTRIBUTE); 33 private static final QName OBSERVED_OBJECT_QNAME = new QName ("", OBSERVED_OBJECT); 34 private static final QName TRIGGER_QNAME = new QName ("", TRIGGER); 35 36 protected void onSerialize(SerializationContext context, Notification notification) throws IOException 37 { 38 super.onSerialize(context, notification); 39 MonitorNotification monNot = (MonitorNotification )notification; 40 context.serialize(DERIVED_GAUGE_QNAME, null, monNot.getDerivedGauge()); 41 context.serialize(OBSERVED_ATTRIBUTE_QNAME, null, monNot.getObservedAttribute()); 42 context.serialize(OBSERVED_OBJECT_QNAME, null, monNot.getObservedObject()); 43 context.serialize(TRIGGER_QNAME, null, monNot.getTrigger()); 44 } 45 46 public Element writeSchema(Class aClass, Types types) throws Exception 47 { 48 Element complexType = super.writeSchema(aClass, types); 49 50 Element derivedGaugeElement = types.createElement(SCHEMA_ELEMENT); 51 derivedGaugeElement.setAttribute("name", DERIVED_GAUGE); 52 derivedGaugeElement.setAttribute("type", XMLType.XSD_ANYTYPE.getLocalPart()); 53 complexType.appendChild(derivedGaugeElement); 54 55 Element observedAttElement = types.createElement(SCHEMA_ELEMENT); 56 observedAttElement.setAttribute("name", OBSERVED_ATTRIBUTE); 57 observedAttElement.setAttribute("type", XMLType.XSD_STRING.getLocalPart()); 58 complexType.appendChild(observedAttElement); 59 60 Element observedObjectElement = types.createElement(SCHEMA_ELEMENT); 61 observedObjectElement.setAttribute("name", OBSERVED_OBJECT); 62 observedObjectElement.setAttribute("type", ObjectNameSer.TYPE); 63 complexType.appendChild(observedObjectElement); 64 65 Element triggerElement = types.createElement(SCHEMA_ELEMENT); 66 triggerElement.setAttribute("name", TRIGGER); 67 triggerElement.setAttribute("type", XMLType.XSD_ANYTYPE.getLocalPart()); 68 complexType.appendChild(triggerElement); 69 70 return complexType; 71 } 72 } 73 | Popular Tags |