1 7 8 10 package org.jboss.net.jmx.adaptor; 11 12 import org.jboss.axis.Constants; 13 import org.jboss.axis.encoding.SerializationContext; 14 import org.jboss.axis.encoding.Serializer; 15 import org.jboss.axis.wsdl.fromJava.Types; 16 import org.w3c.dom.Element ; 17 import org.xml.sax.Attributes ; 18 19 import javax.management.ObjectInstance ; 20 import javax.xml.namespace.QName ; 21 import java.io.IOException ; 22 23 31 public class ObjectInstanceSer implements Serializer 32 { 33 34 public void serialize(QName name, 35 Attributes attributes, 36 Object value, 37 SerializationContext context) 38 throws IOException 39 { 40 if (!(value instanceof ObjectInstance )) 41 throw new IOException ("Can't serialize a " 42 + value.getClass().getName() 43 + " instance with a ObjectInstance Serializer."); 44 context.startElement(name, attributes); 45 46 context.serialize(new QName ("", "objectName"), 47 null, 48 ((ObjectInstance )value).getObjectName()); 49 context.serialize(new QName ("", "className"), 50 null, 51 ((ObjectInstance )value).getClassName()); 52 53 context.endElement(); 54 return; 55 56 } 57 58 public Element writeSchema(Class aClass, Types types) throws Exception 59 { 60 return null; 61 } 62 63 public String getMechanismType() 64 { 65 return Constants.AXIS_SAX; 66 } 67 68 } | Popular Tags |