KickJava   Java API By Example, From Geeks To Geeks.

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


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.ObjectName JavaDoc;
14 import javax.management.relation.RoleUnresolved 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.encoding.XMLType;
20 import org.apache.axis.wsdl.fromJava.Types;
21 import org.w3c.dom.Element JavaDoc;
22 import org.xml.sax.Attributes JavaDoc;
23
24 /**
25  * @version $Revision: 1.3 $
26  */

27 public class RoleUnresolvedSer extends RoleSer
28 {
29    static final String JavaDoc TYPE = "RoleUnresolved";
30    static final String JavaDoc PROBLEM_TYPE = "problemType";
31    private static final QName JavaDoc PROBLEM_TYPE_QNAME = new QName JavaDoc("", PROBLEM_TYPE);
32
33    public void serialize(QName JavaDoc name, Attributes JavaDoc attributes, Object JavaDoc value,
34                          SerializationContext context)
35            throws IOException JavaDoc
36    {
37       RoleUnresolved JavaDoc role = (RoleUnresolved JavaDoc)value;
38       context.startElement(name, attributes);
39       context.serialize(ROLE_NAME_QNAME, null, role.getRoleName());
40       for (Iterator JavaDoc i = role.getRoleValue().iterator(); i.hasNext();)
41       {
42          ObjectName JavaDoc on = (ObjectName JavaDoc)i.next();
43          context.serialize(Constants.QNAME_LITERAL_ITEM, null, on);
44       }
45       context.serialize(PROBLEM_TYPE_QNAME, null, new Integer JavaDoc(role.getProblemType()));
46       context.endElement();
47    }
48
49    public Element JavaDoc writeSchema(Class JavaDoc aClass, Types types) throws Exception JavaDoc
50    {
51       Element JavaDoc complexType = super.writeSchema(aClass, types);
52       Element JavaDoc problemType = types.createElement(SCHEMA_ELEMENT);
53       problemType.setAttribute("name", PROBLEM_TYPE);
54       problemType.setAttribute("type", XMLType.XSD_INT.getLocalPart());
55       complexType.appendChild(problemType);
56       return complexType;
57    }
58
59 }
60
Popular Tags