1 8 9 package mx4j.tools.remote.soap.axis.ser; 10 11 import java.io.IOException ; 12 import java.util.Iterator ; 13 import java.util.Vector ; 14 import javax.management.NotificationFilterSupport ; 15 import javax.xml.namespace.QName ; 16 17 import org.apache.axis.Constants; 18 import org.apache.axis.encoding.SerializationContext; 19 import org.apache.axis.wsdl.fromJava.Types; 20 import org.w3c.dom.Element ; 21 import org.xml.sax.Attributes ; 22 23 26 public class NotificationFilterSupportSer extends AxisSerializer 27 { 28 static final String TYPE = "NotificationFilterSupport"; 29 static final String NOTIFICATION_TYPE = "notificationType"; 30 private static final QName NOTIFICATION_TYPE_QNAME = new QName ("", NOTIFICATION_TYPE); 31 32 public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException 33 { 34 NotificationFilterSupport filter = (NotificationFilterSupport )value; 35 context.startElement(name, attributes); 36 onSerialize(context, filter); 37 context.endElement(); 38 } 39 40 protected void onSerialize(SerializationContext context, NotificationFilterSupport filter) throws IOException 41 { 42 Vector types = filter.getEnabledTypes(); 43 for (Iterator i = types.iterator(); i.hasNext();) 44 { 45 String type = (String )i.next(); 46 context.serialize(NOTIFICATION_TYPE_QNAME, null, type); 47 } 48 } 49 50 public Element writeSchema(Class javaType, Types types) throws Exception 51 { 52 Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE); 53 complexType.setAttribute("name", TYPE); 54 types.writeSchemaElement(Constants.SOAP_VECTOR, complexType); 55 Element allElement = types.createElement(SCHEMA_ALL); 56 complexType.appendChild(allElement); 57 Element element = types.createElement(SCHEMA_ELEMENT); 58 element.setAttribute("name", NOTIFICATION_TYPE); 59 element.setAttribute("minOccurs", "0"); 60 element.setAttribute("maxOccurs", "unbounded"); 61 element.setAttribute("type", Constants.XSD_STRING.getLocalPart()); 62 allElement.appendChild(element); 63 return complexType; 64 } 65 } 66 | Popular Tags |