KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > net > jmx > adaptor > MBeanAttributeInfoSer


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 // $Id: MBeanAttributeInfoSer.java,v 1.4.8.1 2005/03/02 14:19:55 tdiesler Exp $
9

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 JavaDoc;
17 import org.xml.sax.Attributes JavaDoc;
18
19 import javax.management.MBeanAttributeInfo JavaDoc;
20 import javax.xml.namespace.QName JavaDoc;
21 import java.io.IOException JavaDoc;
22
23 /**
24  * An <code>MBeanAttributeInfoSer</code> is be used to serialize
25  * MBeanAttributeInfo using the <code>SOAP-ENC</code>
26  * encoding style.<p>
27  *
28  * @author <a HREF="mailto:a_taherkordi@users.sourceforge.net">Alireza Taherkordi</a>
29  * @version $Revision: 1.4.8.1 $
30  */

31 public class MBeanAttributeInfoSer implements Serializer
32 {
33
34    public void serialize(QName JavaDoc name,
35                          Attributes JavaDoc attributes,
36                          Object JavaDoc value,
37                          SerializationContext context)
38            throws IOException JavaDoc
39    {
40       if (!(value instanceof MBeanAttributeInfo JavaDoc))
41          throw new IOException JavaDoc("Can't serialize a "
42                  + value.getClass().getName()
43                  + " instance with a MBeanAttributeInfo Serializer.");
44       context.startElement(name, attributes);
45
46       MBeanAttributeInfo JavaDoc info = (MBeanAttributeInfo JavaDoc)value;
47       context.serialize(new QName JavaDoc("", "name"), null, info.getName());
48       context.serialize(new QName JavaDoc("", "type"), null, info.getType());
49       context.serialize(new QName JavaDoc("", "description"),
50               null,
51               info.getDescription());
52       context.serialize(new QName JavaDoc("", "isReadable"),
53               null,
54               new Boolean JavaDoc(info.isReadable()));
55       context.serialize(new QName JavaDoc("", "isWritable"),
56               null,
57               new Boolean JavaDoc(info.isWritable()));
58       context.serialize(new QName JavaDoc("", "isIs"), null, new Boolean JavaDoc(info.isIs()));
59
60       context.endElement();
61       return;
62
63    }
64
65    public Element JavaDoc writeSchema(Class JavaDoc aClass, Types types) throws Exception JavaDoc
66    {
67       return null;
68    }
69
70    public String JavaDoc getMechanismType()
71    {
72       return Constants.AXIS_SAX;
73    }
74
75 }
Popular Tags