package org.jboss.net.jmx.adaptor;
import org.jboss.axis.Constants;
import org.jboss.axis.encoding.SerializationContext;
import org.jboss.axis.encoding.Serializer;
import org.jboss.axis.wsdl.fromJava.Types;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import javax.management.MBeanAttributeInfo;
import javax.xml.namespace.QName;
import java.io.IOException;
public class MBeanAttributeInfoSer implements Serializer
{
public void serialize(QName name,
Attributes attributes,
Object value,
SerializationContext context)
throws IOException
{
if (!(value instanceof MBeanAttributeInfo))
throw new IOException("Can't serialize a "
+ value.getClass().getName()
+ " instance with a MBeanAttributeInfo Serializer.");
context.startElement(name, attributes);
MBeanAttributeInfo info = (MBeanAttributeInfo)value;
context.serialize(new QName("", "name"), null, info.getName());
context.serialize(new QName("", "type"), null, info.getType());
context.serialize(new QName("", "description"),
null,
info.getDescription());
context.serialize(new QName("", "isReadable"),
null,
new Boolean(info.isReadable()));
context.serialize(new QName("", "isWritable"),
null,
new Boolean(info.isWritable()));
context.serialize(new QName("", "isIs"), null, new Boolean(info.isIs()));
context.endElement();
return;
}
public Element writeSchema(Class aClass, Types types) throws Exception
{
return null;
}
public String getMechanismType()
{
return Constants.AXIS_SAX;
}
}