KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > remote > soap > axis > ser > RoleResultSer


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.tools.remote.soap.axis.ser;
10
11 import java.io.IOException JavaDoc;
12 import javax.management.relation.RoleResult JavaDoc;
13 import javax.xml.namespace.QName JavaDoc;
14
15 import org.apache.axis.encoding.SerializationContext;
16 import org.apache.axis.wsdl.fromJava.Types;
17 import org.w3c.dom.Element JavaDoc;
18 import org.xml.sax.Attributes JavaDoc;
19
20 /**
21  * @version $Revision: 1.3 $
22  */

23 public class RoleResultSer extends AxisSerializer
24 {
25    static final String JavaDoc TYPE = "RoleResult";
26    static final String JavaDoc ROLE_LIST = "roleList";
27    static final String JavaDoc ROLE_UNRESOLVED_LIST = "roleUnresolvedList";
28    protected static final QName JavaDoc ROLE_LIST_QNAME = new QName JavaDoc("", ROLE_LIST);
29    protected static final QName JavaDoc ROLE_UNRESOLVED_LIST_QNAME = new QName JavaDoc("", ROLE_UNRESOLVED_LIST);
30
31    public void serialize(QName JavaDoc name, Attributes JavaDoc attributes, Object JavaDoc value,
32                          SerializationContext context)
33            throws IOException JavaDoc
34    {
35       RoleResult JavaDoc role = (RoleResult JavaDoc)value;
36       context.startElement(name, attributes);
37       context.serialize(ROLE_LIST_QNAME, null, role.getRoles());
38       context.serialize(ROLE_UNRESOLVED_LIST_QNAME, null, role.getRolesUnresolved());
39       context.endElement();
40    }
41
42    public Element JavaDoc writeSchema(Class JavaDoc aClass, Types types) throws Exception JavaDoc
43    {
44       Element JavaDoc complexType = types.createElement(SCHEMA_COMPLEX_TYPE);
45       complexType.setAttribute("name", TYPE);
46
47       Element JavaDoc roleListElement = types.createElement(SCHEMA_ELEMENT);
48       roleListElement.setAttribute("name", ROLE_LIST);
49       roleListElement.setAttribute("type", RoleListSer.TYPE);
50       complexType.appendChild(roleListElement);
51
52       Element JavaDoc roleUnresolvedListElement = types.createElement(SCHEMA_ELEMENT);
53       roleUnresolvedListElement.setAttribute("name", ROLE_LIST);
54       roleUnresolvedListElement.setAttribute("type", RoleUnresolvedListSer.TYPE);
55       complexType.appendChild(roleUnresolvedListElement);
56
57       return complexType;
58    }
59
60 }
61
Popular Tags