1 25 26 package org.objectweb.jonas.webapp.jonasadmin.mbean; 27 28 import javax.management.ObjectName ; 29 30 import org.objectweb.jonas.webapp.jonasadmin.common.NameItem; 31 32 35 public class MbeanItem implements NameItem { 36 37 39 public static final int FAMILY_UNKNOWN = 0; 40 public static final int FAMILY_OWNER = 1; 41 public static final int FAMILY_J2EE = 2; 42 43 public static final int SIZE_FAMILIES = 3; 44 public static final String [] ALL_FAMILY_TEXT = { 45 "unknown", "owner", "j2ee"}; 46 47 49 private int family = FAMILY_UNKNOWN; 50 private String familyText = null; 51 private String objectName = null; 52 private String domain = null; 53 private String name = null; 54 55 57 public MbeanItem() { 58 initialize(); 59 } 60 61 public MbeanItem(ObjectName p_ObjectName) { 62 initialize(); 63 setObjectName(p_ObjectName.toString()); 64 setDomain(p_ObjectName.getDomain()); 65 } 66 67 69 protected void initialize() { 70 setFamily(FAMILY_UNKNOWN); 71 } 72 73 75 81 public static MbeanItem build(ObjectName p_ObjectName) { 82 MbeanItem oItem = null; 83 if (p_ObjectName.getKeyProperty("j2eeType") != null) { 84 oItem = new J2eeMbeanItem(p_ObjectName); 85 } 86 else if (p_ObjectName.getKeyProperty("type") != null) { 87 oItem = new OwnerMbeanItem(p_ObjectName); 88 } 89 else { 90 oItem = new MbeanItem(p_ObjectName); 91 } 92 return oItem; 93 } 94 95 97 public int getFamily() { 98 return family; 99 } 100 101 public void setFamily(int family) { 102 this.family = family; 103 } 104 105 public int sizeFamilies() { 106 return SIZE_FAMILIES; 107 } 108 109 public String getTextFamily() { 110 return ALL_FAMILY_TEXT[family]; 111 } 112 113 public String getObjectName() { 114 return objectName; 115 } 116 117 public void setObjectName(String objectName) { 118 this.objectName = objectName; 119 } 120 121 public String getDomain() { 122 return domain; 123 } 124 125 public void setDomain(String domain) { 126 this.domain = domain; 127 } 128 129 public String getName() { 130 return name; 131 } 132 133 public void setName(String name) { 134 this.name = name; 135 } 136 } | Popular Tags |