1 22 package org.jboss.console.plugins.helpers.jmx; 23 24 import javax.management.MBeanInfo ; 25 import javax.management.ObjectName ; 26 27 32 public class MBeanData 33 implements Comparable 34 { 35 private ObjectName objectName; 36 private MBeanInfo metaData; 37 38 39 public MBeanData(ObjectName objectName, MBeanInfo metaData) 40 { 41 this.objectName = objectName; 42 this.metaData = metaData; 43 } 44 45 48 public ObjectName getObjectName() 49 { 50 return objectName; 51 } 52 53 56 public void setObjectName(ObjectName objectName) 57 { 58 this.objectName = objectName; 59 } 60 61 64 public MBeanInfo getMetaData() 65 { 66 return metaData; 67 } 68 69 72 public void setMetaData(MBeanInfo metaData) 73 { 74 this.metaData = metaData; 75 } 76 77 80 public String getName() 81 { 82 return objectName.toString(); 83 } 84 87 public String getNameProperties() 88 { 89 return objectName.getCanonicalKeyPropertyListString(); 90 } 91 94 public String getClassName() 95 { 96 return metaData.getClassName(); 97 } 98 99 106 public int compareTo(Object o) 107 { 108 MBeanData md = (MBeanData) o; 109 String d1 = objectName.getDomain(); 110 String d2 = md.objectName.getDomain(); 111 int compare = d1.compareTo(d2); 112 if( compare == 0 ) 113 { 114 String p1 = objectName.getCanonicalKeyPropertyListString(); 115 String p2 = md.objectName.getCanonicalKeyPropertyListString(); 116 compare = p1.compareTo(p2); 117 } 118 return compare; 119 } 120 121 public boolean equals(Object o) 122 { 123 if (o == null || (o instanceof MBeanData) == false) 124 return false; 125 if (this == o) 126 return true; 127 return (this.compareTo(o) == 0); 128 } 129 } 130 | Popular Tags |