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.ObjectName;
14: import javax.management.relation.RoleUnresolved;
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.encoding.XMLType;
20: import org.apache.axis.wsdl.fromJava.Types;
21: import org.w3c.dom.Element;
22: import org.xml.sax.Attributes;
23:
24: /**
25: * @version $Revision: 1.3 $
26: */
27: public class RoleUnresolvedSer extends RoleSer {
28: static final String TYPE = "RoleUnresolved";
29: static final String PROBLEM_TYPE = "problemType";
30: private static final QName PROBLEM_TYPE_QNAME = new QName("",
31: PROBLEM_TYPE);
32:
33: public void serialize(QName name, Attributes attributes,
34: Object value, SerializationContext context)
35: throws IOException {
36: RoleUnresolved role = (RoleUnresolved) value;
37: context.startElement(name, attributes);
38: context.serialize(ROLE_NAME_QNAME, null, role.getRoleName());
39: for (Iterator i = role.getRoleValue().iterator(); i.hasNext();) {
40: ObjectName on = (ObjectName) i.next();
41: context.serialize(Constants.QNAME_LITERAL_ITEM, null, on);
42: }
43: context.serialize(PROBLEM_TYPE_QNAME, null, new Integer(role
44: .getProblemType()));
45: context.endElement();
46: }
47:
48: public Element writeSchema(Class aClass, Types types)
49: throws Exception {
50: Element complexType = super .writeSchema(aClass, types);
51: Element problemType = types.createElement(SCHEMA_ELEMENT);
52: problemType.setAttribute("name", PROBLEM_TYPE);
53: problemType
54: .setAttribute("type", XMLType.XSD_INT.getLocalPart());
55: complexType.appendChild(problemType);
56: return complexType;
57: }
58:
59: }
|