KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.Iterator JavaDoc;
13 import javax.management.relation.Role JavaDoc;
14 import javax.management.relation.RoleList JavaDoc;
15 import javax.xml.namespace.QName JavaDoc;
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 JavaDoc;
21 import org.xml.sax.Attributes JavaDoc;
22
23 /**
24  * @version $Revision: 1.3 $
25  */

26 public class RoleListSer extends AxisSerializer
27 {
28    static final String JavaDoc TYPE = "RoleList";
29
30    public void serialize(QName JavaDoc name, Attributes JavaDoc attributes, Object JavaDoc value, SerializationContext context) throws IOException JavaDoc
31    {
32       RoleList JavaDoc list = (RoleList JavaDoc)value;
33       context.startElement(name, attributes);
34       for (Iterator JavaDoc i = list.iterator(); i.hasNext();)
35       {
36          Role JavaDoc item = (Role JavaDoc)i.next();
37          context.serialize(Constants.QNAME_LITERAL_ITEM, null, item);
38       }
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       types.writeSchemaElement(Constants.SOAP_VECTOR, complexType);
47       Element JavaDoc sequence = types.createElement(SCHEMA_SEQUENCE);
48       complexType.appendChild(sequence);
49       Element JavaDoc element = types.createElement(SCHEMA_ELEMENT);
50       element.setAttribute("name", Constants.QNAME_LITERAL_ITEM.getLocalPart());
51       element.setAttribute("minOccurs", "0");
52       element.setAttribute("maxOccurs", "unbounded");
53       element.setAttribute("type", RoleSer.TYPE);
54       sequence.appendChild(element);
55       return complexType;
56    }
57
58 }
59
Popular Tags