1 8 9 package mx4j.tools.remote.soap.axis.ser; 10 11 import java.lang.reflect.Constructor ; 12 import java.security.AccessController ; 13 import java.security.PrivilegedActionException ; 14 import java.security.PrivilegedExceptionAction ; 15 import javax.management.ObjectName ; 16 import javax.management.monitor.MonitorNotification ; 17 18 import org.xml.sax.SAXException ; 19 20 23 public class MonitorNotificationDeser extends NotificationDeser 24 { 25 private ObjectName monitoredName; 26 private String monitoredAttribute; 27 private Object gaugeValue; 28 private Object triggerValue; 29 30 public void onSetChildValue(Object value, Object hint) throws SAXException 31 { 32 super.onSetChildValue(value, hint); 33 if (MonitorNotificationSer.DERIVED_GAUGE.equals(hint)) 34 gaugeValue = value; 35 else if (MonitorNotificationSer.OBSERVED_ATTRIBUTE.equals(hint)) 36 monitoredAttribute = (String )value; 37 else if (MonitorNotificationSer.OBSERVED_OBJECT.equals(hint)) 38 monitoredName = (ObjectName )value; 39 else if (MonitorNotificationSer.TRIGGER.equals(hint)) triggerValue = value; 40 } 41 42 protected Object createObject() throws SAXException 43 { 44 try 47 { 48 return AccessController.doPrivileged(new PrivilegedExceptionAction () 49 { 50 public Object run() throws Exception 51 { 52 Constructor ctor = MonitorNotification .class.getDeclaredConstructor(new Class []{String .class, Object .class, long.class, long.class, String .class, ObjectName .class, String .class, Object .class, Object .class}); 53 ctor.setAccessible(true); 55 return ctor.newInstance(new Object []{getType(), getSource(), new Long (getSequenceNumber()), new Long (getTimeStamp()), getMessage(), monitoredName, monitoredAttribute, gaugeValue, triggerValue}); 56 } 57 }); 58 } 59 catch (PrivilegedActionException x) 60 { 61 throw new SAXException (x.getException()); 62 } 63 } 64 } 65 | Popular Tags |