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.ObjectName;
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 ObjectNameSer extends AxisSerializer {
25: static final String TYPE = "ObjectName";
26: static final String NAME = "canonicalName";
27: private static final QName NAME_QNAME = new QName("", NAME);
28:
29: public void serialize(QName name, Attributes attributes,
30: Object value, SerializationContext context)
31: throws IOException {
32: ObjectName objectName = (ObjectName) value;
33: context.startElement(name, attributes);
34: context.serialize(NAME_QNAME, null, objectName
35: .getCanonicalName());
36: context.endElement();
37: }
38:
39: public Element writeSchema(Class javaType, Types types)
40: throws Exception {
41: Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE);
42: complexType.setAttribute("name", TYPE);
43: Element allElement = types.createElement(SCHEMA_ALL);
44: complexType.appendChild(allElement);
45: Element element = types.createElement(SCHEMA_ELEMENT);
46: element.setAttribute("name", NAME);
47: element.setAttribute("type", XMLType.XSD_STRING.getLocalPart());
48: allElement.appendChild(element);
49: return complexType;
50: }
51: }
|