1 25 26 package org.objectweb.petals.jbi.management.service; 27 28 import javax.management.MalformedObjectNameException ; 29 import javax.management.ObjectName ; 30 31 39 public class MBeanNamesImpl implements javax.jbi.management.MBeanNames { 40 41 private static final String BINDING = "binding"; 42 43 private static final String CUSTOM = "custom"; 44 45 private static final String ENGINE = "engine"; 46 47 private static final String INSTALLER = "installer"; 48 49 private static final String SYSTEM = "system"; 50 51 private String domain; 52 53 59 public MBeanNamesImpl(String domain) { 60 this.domain = domain; 61 } 62 63 public ObjectName createBindingComponentMBeanName(String name) { 64 return createMBeanName(name, BINDING); 65 } 66 67 71 public ObjectName createCustomComponentMBeanName(String customName) { 72 return createMBeanName(customName, CUSTOM); 73 } 74 75 79 public ObjectName createEngineComponentMBeanName(String name) { 80 return createMBeanName(name, ENGINE); 81 } 82 83 public ObjectName createInstallerMBeanName(String name) { 84 return createMBeanName(name, INSTALLER); 85 } 86 87 protected ObjectName createMBeanName(String name, String type) { 88 ObjectName on = null; 89 String theType = type != null ? "type=" + type + "," : ""; 90 String theName = "name=" + name; 91 92 try { 93 on = new ObjectName (domain + ":" + theType + theName); 94 } catch (MalformedObjectNameException e) { 95 throw new RuntimeException (e); 96 } 98 return on; 99 } 100 101 public ObjectName createSystemComponentMBeanName(String name) { 102 return createMBeanName(name, SYSTEM); 103 } 104 105 108 public String getJmxDomainName() { 109 return domain; 110 } 111 } 112 | Popular Tags |