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.relation.RoleResult;
13: import javax.xml.namespace.QName;
14:
15: import org.apache.axis.encoding.SerializationContext;
16: import org.apache.axis.wsdl.fromJava.Types;
17: import org.w3c.dom.Element;
18: import org.xml.sax.Attributes;
19:
20: /**
21: * @version $Revision: 1.3 $
22: */
23: public class RoleResultSer extends AxisSerializer {
24: static final String TYPE = "RoleResult";
25: static final String ROLE_LIST = "roleList";
26: static final String ROLE_UNRESOLVED_LIST = "roleUnresolvedList";
27: protected static final QName ROLE_LIST_QNAME = new QName("",
28: ROLE_LIST);
29: protected static final QName ROLE_UNRESOLVED_LIST_QNAME = new QName(
30: "", ROLE_UNRESOLVED_LIST);
31:
32: public void serialize(QName name, Attributes attributes,
33: Object value, SerializationContext context)
34: throws IOException {
35: RoleResult role = (RoleResult) value;
36: context.startElement(name, attributes);
37: context.serialize(ROLE_LIST_QNAME, null, role.getRoles());
38: context.serialize(ROLE_UNRESOLVED_LIST_QNAME, null, role
39: .getRolesUnresolved());
40: context.endElement();
41: }
42:
43: public Element writeSchema(Class aClass, Types types)
44: throws Exception {
45: Element complexType = types.createElement(SCHEMA_COMPLEX_TYPE);
46: complexType.setAttribute("name", TYPE);
47:
48: Element roleListElement = types.createElement(SCHEMA_ELEMENT);
49: roleListElement.setAttribute("name", ROLE_LIST);
50: roleListElement.setAttribute("type", RoleListSer.TYPE);
51: complexType.appendChild(roleListElement);
52:
53: Element roleUnresolvedListElement = types
54: .createElement(SCHEMA_ELEMENT);
55: roleUnresolvedListElement.setAttribute("name", ROLE_LIST);
56: roleUnresolvedListElement.setAttribute("type",
57: RoleUnresolvedListSer.TYPE);
58: complexType.appendChild(roleUnresolvedListElement);
59:
60: return complexType;
61: }
62:
63: }
|