KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.management.Notification JavaDoc;
12
13 import org.xml.sax.SAXException JavaDoc;
14
15 /**
16  * @version $Revision: 1.4 $
17  */

18 public class NotificationDeser extends AxisDeserializer
19 {
20    private String JavaDoc type;
21    private Object JavaDoc source;
22    private long sequenceNumber;
23    private long timeStamp;
24    private String JavaDoc message;
25    private Object JavaDoc userData;
26
27    public void onSetChildValue(Object JavaDoc value, Object JavaDoc hint) throws SAXException JavaDoc
28    {
29       if (NotificationSer.CLASS_NAME.equals(hint))
30          type = (String JavaDoc)value;
31       else if (NotificationSer.SOURCE.equals(hint))
32          source = value;
33       else if (NotificationSer.SEQUENCE_NUMBER.equals(hint))
34          sequenceNumber = ((Long JavaDoc)value).longValue();
35       else if (NotificationSer.TIMESTAMP.equals(hint))
36          timeStamp = ((Long JavaDoc)value).longValue();
37       else if (NotificationSer.MESSAGE.equals(hint))
38          message = (String JavaDoc)value;
39       else if (NotificationSer.USER_DATA.equals(hint)) userData = value;
40    }
41
42    protected Object JavaDoc createObject() throws SAXException JavaDoc
43    {
44       Notification JavaDoc notification = new Notification JavaDoc(getType(), getSource(), getSequenceNumber(), getTimeStamp(), getMessage());
45       notification.setUserData(getUserData());
46       return notification;
47    }
48
49    protected String JavaDoc getType()
50    {
51       return type;
52    }
53
54    protected Object JavaDoc getSource()
55    {
56       return source;
57    }
58
59    protected long getSequenceNumber()
60    {
61       return sequenceNumber;
62    }
63
64    protected long getTimeStamp()
65    {
66       return timeStamp;
67    }
68
69    protected String JavaDoc getMessage()
70    {
71       return message;
72    }
73
74    protected Object JavaDoc getUserData()
75    {
76       return userData;
77    }
78 }
79
Popular Tags