KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.ArrayList JavaDoc;
12 import java.util.List JavaDoc;
13 import javax.management.relation.RelationTypeSupport JavaDoc;
14 import javax.management.relation.RoleInfo JavaDoc;
15
16 import org.apache.axis.Constants;
17 import org.xml.sax.SAXException JavaDoc;
18
19 /**
20  * @version $Revision: 1.3 $
21  */

22 public class RelationTypeSupportDeser extends AxisDeserializer
23 {
24    String JavaDoc relationName;
25    List JavaDoc roleInfos = new ArrayList JavaDoc();
26
27    public void onSetChildValue(Object JavaDoc value, Object JavaDoc hint) throws SAXException JavaDoc
28    {
29       if (RelationTypeSupportSer.NAME.equals(hint)) relationName = (String JavaDoc)value;
30       if (Constants.QNAME_LITERAL_ITEM.getLocalPart().equals(hint)) roleInfos.add(value);
31    }
32
33    protected Object JavaDoc createObject() throws SAXException JavaDoc
34    {
35       try
36       {
37          RoleInfo JavaDoc[] infAry = new RoleInfo JavaDoc[roleInfos.size()];
38          roleInfos.toArray(infAry);
39          return new RelationTypeSupport JavaDoc(relationName, infAry);
40       }
41       catch (Exception JavaDoc e)
42       {
43          throw new SAXException JavaDoc(e);
44       }
45    }
46
47 }
48
Popular Tags