KickJava   Java API By Example, From Geeks To Geeks.

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


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.io.IOException JavaDoc;
12 import javax.management.Notification JavaDoc;
13 import javax.management.timer.TimerNotification JavaDoc;
14 import javax.xml.namespace.QName JavaDoc;
15
16 import org.apache.axis.encoding.SerializationContext;
17 import org.apache.axis.encoding.XMLType;
18 import org.apache.axis.wsdl.fromJava.Types;
19 import org.w3c.dom.Element JavaDoc;
20
21 /**
22  * @version $Revision: 1.3 $
23  */

24 public class TimerNotificationSer extends NotificationSer
25 {
26    static final String JavaDoc NOTIFICATION_ID = "notificationID";
27    private static final QName JavaDoc NOTIFICATION_ID_QNAME = new QName JavaDoc("", NOTIFICATION_ID);
28
29    protected void onSerialize(SerializationContext context, Notification JavaDoc notification) throws IOException JavaDoc
30    {
31       super.onSerialize(context, notification);
32       TimerNotification JavaDoc serverNotification = (TimerNotification JavaDoc)notification;
33       context.serialize(NOTIFICATION_ID_QNAME, null, serverNotification.getNotificationID());
34    }
35
36    public Element JavaDoc writeSchema(Class JavaDoc aClass, Types types) throws Exception JavaDoc
37    {
38       Element JavaDoc elem = super.writeSchema(aClass, types);
39
40       Element JavaDoc notID = types.createElement(SCHEMA_ELEMENT);
41       notID.setAttribute("name", NOTIFICATION_ID);
42       notID.setAttribute("type", XMLType.XSD_INT.getLocalPart());
43       elem.appendChild(notID);
44
45       return elem;
46    }
47
48 }
49
Popular Tags