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 java.util.Iterator;
13: import javax.management.relation.RoleUnresolved;
14: import javax.management.relation.RoleUnresolvedList;
15: import javax.xml.namespace.QName;
16:
17: import org.apache.axis.Constants;
18: import org.apache.axis.encoding.SerializationContext;
19: import org.apache.axis.wsdl.fromJava.Types;
20: import org.w3c.dom.Element;
21: import org.xml.sax.Attributes;
22:
23: /**
24: * @version $Revision: 1.3 $
25: */
26: public class RoleUnresolvedListSer extends AxisSerializer {
27: static final String TYPE = "RoleUnresolvedList";
28:
29: public void serialize(QName name, Attributes attributes,
30: Object value, SerializationContext context)
31: throws IOException {
32: RoleUnresolvedList list = (RoleUnresolvedList) value;
33: context.startElement(name, attributes);
34: for (Iterator i = list.iterator(); i.hasNext();) {
35: RoleUnresolved item = (RoleUnresolved) i.next();
36: context.serialize(Constants.QNAME_LITERAL_ITEM, null, item);
37: }
38: context.endElement();
39: }
40:
41: public Element writeSchema(Class aClass, Types types)
42: throws Exception {
43: Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE);
44: complexType.setAttribute("name", TYPE);
45: types.writeSchemaElement(Constants.SOAP_VECTOR, complexType);
46: Element sequence = types.createElement(SCHEMA_SEQUENCE);
47: complexType.appendChild(sequence);
48: Element element = types.createElement(SCHEMA_ELEMENT);
49: element.setAttribute("name", Constants.QNAME_LITERAL_ITEM
50: .getLocalPart());
51: element.setAttribute("minOccurs", "0");
52: element.setAttribute("maxOccurs", "unbounded");
53: element.setAttribute("type", RoleUnresolvedSer.TYPE);
54: sequence.appendChild(element);
55: return complexType;
56: }
57:
58: }
|