01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package mx4j.tools.remote.soap.axis.ser;
10:
11: import java.io.IOException;
12: import javax.management.MBeanConstructorInfo;
13: import javax.xml.namespace.QName;
14:
15: import org.apache.axis.encoding.SerializationContext;
16: import org.apache.axis.encoding.XMLType;
17: import org.apache.axis.wsdl.fromJava.Types;
18: import org.w3c.dom.Element;
19: import org.xml.sax.Attributes;
20:
21: /**
22: * @version $Revision: 1.5 $
23: */
24: public class MBeanConstructorInfoSer extends AxisSerializer {
25: static final String TYPE = "MBeanConstructorInfo";
26: static final String NAME = "name";
27: static final String DESCRIPTION = "description";
28: static final String SIGNATURE = "signature";
29: private static final QName NAME_QNAME = new QName("", NAME);
30: private static final QName DESCRIPTION_QNAME = new QName("",
31: DESCRIPTION);
32: private static final QName SIGNATURE_QNAME = new QName("",
33: SIGNATURE);
34:
35: public void serialize(QName name, Attributes attributes,
36: Object value, SerializationContext context)
37: throws IOException {
38: MBeanConstructorInfo info = (MBeanConstructorInfo) value;
39: context.startElement(name, attributes);
40: context.serialize(NAME_QNAME, null, info.getName());
41: context.serialize(DESCRIPTION_QNAME, null, info
42: .getDescription());
43: context.serialize(SIGNATURE_QNAME, null, info.getSignature());
44: context.endElement();
45: }
46:
47: public Element writeSchema(Class javaType, Types types)
48: throws Exception {
49: Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE);
50: complexType.setAttribute("name", TYPE);
51: Element allElement = types.createElement(SCHEMA_ALL);
52: complexType.appendChild(allElement);
53:
54: Element nameElement = types.createElement(SCHEMA_ELEMENT);
55: nameElement.setAttribute("name", NAME);
56: nameElement.setAttribute("type", XMLType.XSD_STRING
57: .getLocalPart());
58: allElement.appendChild(nameElement);
59:
60: Element descrElement = types.createElement(SCHEMA_ELEMENT);
61: descrElement.setAttribute("name", DESCRIPTION);
62: descrElement.setAttribute("type", XMLType.XSD_STRING
63: .getLocalPart());
64: allElement.appendChild(descrElement);
65:
66: Element signatureElement = types.createElement(SCHEMA_ELEMENT);
67: signatureElement.setAttribute("name", SIGNATURE);
68: signatureElement.setAttribute("type", XMLType.SOAP_ARRAY
69: .getLocalPart());
70: allElement.appendChild(signatureElement);
71:
72: return complexType;
73: }
74: }
|