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.util.ArrayList;
12: import java.util.List;
13: import javax.management.relation.RelationTypeSupport;
14: import javax.management.relation.RoleInfo;
15:
16: import org.apache.axis.Constants;
17: import org.xml.sax.SAXException;
18:
19: /**
20: * @version $Revision: 1.3 $
21: */
22: public class RelationTypeSupportDeser extends AxisDeserializer {
23: String relationName;
24: List roleInfos = new ArrayList();
25:
26: public void onSetChildValue(Object value, Object hint)
27: throws SAXException {
28: if (RelationTypeSupportSer.NAME.equals(hint))
29: relationName = (String) value;
30: if (Constants.QNAME_LITERAL_ITEM.getLocalPart().equals(hint))
31: roleInfos.add(value);
32: }
33:
34: protected Object createObject() throws SAXException {
35: try {
36: RoleInfo[] infAry = new RoleInfo[roleInfos.size()];
37: roleInfos.toArray(infAry);
38: return new RelationTypeSupport(relationName, infAry);
39: } catch (Exception e) {
40: throw new SAXException(e);
41: }
42: }
43:
44: }
|