1 16 17 18 package org.apache.commons.modeler; 19 20 21 import java.io.Serializable ; 22 23 import javax.management.Descriptor ; 24 import javax.management.modelmbean.ModelMBeanNotificationInfo ; 25 26 27 34 35 public class NotificationInfo extends FeatureInfo implements Serializable { 36 static final long serialVersionUID = -6319885418912650856L; 37 38 40 41 45 transient ModelMBeanNotificationInfo info = null; 46 protected String notifTypes[] = new String [0]; 47 48 50 51 56 public void setDescription(String description) { 57 super.setDescription(description); 58 this.info = null; 59 } 60 61 62 67 public void setName(String name) { 68 super.setName(name); 69 this.info = null; 70 } 71 72 73 76 public String [] getNotifTypes() { 77 return (this.notifTypes); 78 } 79 80 81 83 84 89 public void addNotifType(String notifType) { 90 91 synchronized (notifTypes) { 92 String results[] = new String [notifTypes.length + 1]; 93 System.arraycopy(notifTypes, 0, results, 0, notifTypes.length); 94 results[notifTypes.length] = notifType; 95 notifTypes = results; 96 this.info = null; 97 } 98 99 } 100 101 102 106 public ModelMBeanNotificationInfo createNotificationInfo() { 107 108 if (info != null) 110 return (info); 111 112 info = new ModelMBeanNotificationInfo 114 (getNotifTypes(), getName(), getDescription()); 115 Descriptor descriptor = info.getDescriptor(); 116 addFields(descriptor); 117 info.setDescriptor(descriptor); 118 return (info); 119 120 } 121 122 123 126 public String toString() { 127 128 StringBuffer sb = new StringBuffer ("NotificationInfo["); 129 sb.append("name="); 130 sb.append(name); 131 sb.append(", description="); 132 sb.append(description); 133 sb.append(", notifTypes="); 134 sb.append(notifTypes.length); 135 sb.append("]"); 136 return (sb.toString()); 137 138 } 139 140 141 } 142 | Popular Tags |