1 8 9 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 27 public class RoleUnresolvedSer extends RoleSer 28 { 29 static final String TYPE = "RoleUnresolved"; 30 static final String PROBLEM_TYPE = "problemType"; 31 private static final QName PROBLEM_TYPE_QNAME = new QName ("", PROBLEM_TYPE); 32 33 public void serialize(QName name, Attributes attributes, Object value, 34 SerializationContext context) 35 throws IOException 36 { 37 RoleUnresolved role = (RoleUnresolved )value; 38 context.startElement(name, attributes); 39 context.serialize(ROLE_NAME_QNAME, null, role.getRoleName()); 40 for (Iterator i = role.getRoleValue().iterator(); i.hasNext();) 41 { 42 ObjectName on = (ObjectName )i.next(); 43 context.serialize(Constants.QNAME_LITERAL_ITEM, null, on); 44 } 45 context.serialize(PROBLEM_TYPE_QNAME, null, new Integer (role.getProblemType())); 46 context.endElement(); 47 } 48 49 public Element writeSchema(Class aClass, Types types) throws Exception 50 { 51 Element complexType = super.writeSchema(aClass, types); 52 Element 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 |