1 22 23 package org.snmp4j.agent.mo.jmx; 24 25 import org.snmp4j.smi.VariableBinding; 26 import org.snmp4j.smi.OID; 27 import org.snmp4j.smi.OctetString; 28 29 41 public class MBeanNotificationInfo { 42 43 private JMXNotificationIndexSupport indexSupport; 44 private MBeanNotificationObjectInfo[] objects; 45 private OctetString context = new OctetString(); 46 47 56 public MBeanNotificationInfo(MBeanNotificationObjectInfo[] objects, 57 JMXNotificationIndexSupport indexSupport) { 58 this.indexSupport = indexSupport; 59 this.objects = objects; 60 } 61 62 73 public MBeanNotificationInfo(MBeanNotificationObjectInfo[] objects, 74 JMXNotificationIndexSupport indexSupport, 75 OctetString context) { 76 this(objects, indexSupport); 77 this.context = context; 78 } 79 80 public VariableBinding[] getNotificationPayload(Object notificationObject) { 81 VariableBinding[] vbs = new VariableBinding[objects.length]; 82 if (indexSupport != null) { 83 synchronized (indexSupport) { 84 indexSupport.intialize(notificationObject); 85 for (int i=0; i<objects.length; i++) { 86 MBeanNotificationObjectInfo oinfo = objects[i]; 87 OID index = indexSupport.getIndex(i); 88 vbs[i] = oinfo.getVariableBinding(notificationObject, index); 89 } 90 } 91 } 92 else { 93 for (int i=0; i<objects.length; i++) { 94 MBeanNotificationObjectInfo oinfo = objects[i]; 95 vbs[i] = oinfo.getVariableBinding(notificationObject, null); 96 } 97 } 98 return vbs; 99 } 100 101 public OctetString getContext() { 102 return context; 103 } 104 105 } 106 | Popular Tags |