1 22 package org.jboss.jmx.adaptor.model; 23 24 import javax.management.MBeanInfo ; 25 import javax.management.ObjectName ; 26 27 32 public class MBeanData implements Comparable 33 { 34 private ObjectName objectName; 35 private MBeanInfo metaData; 36 37 public MBeanData() 38 { 39 } 40 41 42 public MBeanData(ObjectName objectName, MBeanInfo metaData) 43 { 44 this.objectName = objectName; 45 this.metaData = metaData; 46 } 47 48 51 public ObjectName getObjectName() 52 { 53 return objectName; 54 } 55 56 59 public void setObjectName(ObjectName objectName) 60 { 61 this.objectName = objectName; 62 } 63 64 67 public MBeanInfo getMetaData() 68 { 69 return metaData; 70 } 71 72 75 public void setMetaData(MBeanInfo metaData) 76 { 77 this.metaData = metaData; 78 } 79 80 83 public String getName() 84 { 85 return objectName.toString(); 86 } 87 90 public String getNameProperties() 91 { 92 return objectName.getCanonicalKeyPropertyListString(); 93 } 94 97 public String getClassName() 98 { 99 return metaData.getClassName(); 100 } 101 102 109 public int compareTo(Object o) 110 { 111 MBeanData md = (MBeanData) o; 112 String d1 = objectName.getDomain(); 113 String d2 = md.objectName.getDomain(); 114 int compare = d1.compareTo(d2); 115 if( compare == 0 ) 116 { 117 String p1 = objectName.getCanonicalKeyPropertyListString(); 118 String p2 = md.objectName.getCanonicalKeyPropertyListString(); 119 compare = p1.compareTo(p2); 120 } 121 return compare; 122 } 123 124 public boolean equals(Object o) 125 { 126 if (o == null || (o instanceof MBeanData) == false) 127 return false; 128 if (this == o) 129 return true; 130 return (this.compareTo(o) == 0); 131 } 132 } 133 | Popular Tags |