1 25 26 package org.objectweb.easybeans.jsr77; 27 28 import java.util.Hashtable ; 29 import java.util.Iterator ; 30 31 import javax.management.MalformedObjectNameException ; 32 import javax.management.ObjectName ; 33 34 import org.objectweb.easybeans.api.jmx.EZBManagementIdentifier; 35 import org.objectweb.easybeans.log.JLog; 36 import org.objectweb.easybeans.log.JLogFactory; 37 38 44 public abstract class JSR77ManagementIdentifier<T> implements EZBManagementIdentifier<T> { 45 46 49 private static JLog logger = JLogFactory.getLog(JSR77ManagementIdentifier.class); 50 51 54 protected JSR77ManagementIdentifier() { } 55 56 61 protected static String getInheritedPropertiesAsString(final ObjectName name) { 62 Hashtable table = (Hashtable ) name.getKeyPropertyList().clone(); 63 table.remove("j2eeType"); 65 table.remove("type"); 66 table.remove("subtype"); 67 table.remove("name"); 68 StringBuffer sb = new StringBuffer (); 69 for (Iterator i = table.keySet().iterator(); i.hasNext();) { 70 String key = (String ) i.next(); 71 sb.append(key + "=" + table.get(key) + ","); 72 } 73 if (sb.length() > 1) { 74 sb.setLength(sb.length() - 1); 76 } 77 return sb.toString(); 78 } 79 80 84 protected static String getParentNameProperty(final String parentObjectName) { 85 ObjectName on = null; 86 try { 87 on = ObjectName.getInstance(parentObjectName); 88 } catch (MalformedObjectNameException e) { 89 return ""; 91 } catch (NullPointerException e) { 92 return ""; 94 } 95 96 String type = on.getKeyProperty("j2eeType"); 97 String name = on.getKeyProperty("name"); 98 99 return type + "=" + name; 100 } 101 102 105 public String getDomain() { 106 return ""; 108 } 109 110 113 public String getTypeName() { 114 return "j2eeType"; 115 } 116 117 120 public String getTypeProperty() { 121 return getTypeName() + "=" + getTypeValue(); 123 } 124 125 128 public static final JLog getLogger() { 129 return logger; 130 } 131 132 } 133 | Popular Tags |