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.io.IOException;
12: import javax.management.Notification;
13: import javax.management.timer.TimerNotification;
14: import javax.xml.namespace.QName;
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;
20:
21: /**
22: * @version $Revision: 1.3 $
23: */
24: public class TimerNotificationSer extends NotificationSer {
25: static final String NOTIFICATION_ID = "notificationID";
26: private static final QName NOTIFICATION_ID_QNAME = new QName("",
27: NOTIFICATION_ID);
28:
29: protected void onSerialize(SerializationContext context,
30: Notification notification) throws IOException {
31: super .onSerialize(context, notification);
32: TimerNotification serverNotification = (TimerNotification) notification;
33: context.serialize(NOTIFICATION_ID_QNAME, null,
34: serverNotification.getNotificationID());
35: }
36:
37: public Element writeSchema(Class aClass, Types types)
38: throws Exception {
39: Element elem = super .writeSchema(aClass, types);
40:
41: Element notID = types.createElement(SCHEMA_ELEMENT);
42: notID.setAttribute("name", NOTIFICATION_ID);
43: notID.setAttribute("type", XMLType.XSD_INT.getLocalPart());
44: elem.appendChild(notID);
45:
46: return elem;
47: }
48:
49: }
|