1 16 package org.mortbay.jetty.servlet.jmx; 17 18 import javax.management.MBeanException ; 19 import javax.management.MBeanServer ; 20 import javax.management.ObjectName ; 21 22 import org.apache.commons.logging.Log; 23 import org.mortbay.log.LogFactory; 24 import org.mortbay.jetty.servlet.WebApplicationContext.Configuration; 25 import org.mortbay.util.LogSupport; 26 import org.mortbay.util.jmx.ModelMBeanImpl; 27 28 29 39 public class ConfigurationMBean extends ModelMBeanImpl 40 { 41 private static final Log log = LogFactory.getLog(ConfigurationMBean.class); 42 protected Configuration _config = null; 43 44 public ConfigurationMBean() 45 throws MBeanException 46 {} 47 48 53 protected void defineManagedResource() 54 { 55 super.defineManagedResource(); 56 defineAttribute("name", READ_ONLY, ON_MBEAN); 57 _config=(Configuration)getManagedResource(); 58 } 59 60 66 public String getName () 67 { 68 if (null==_config) 69 return null; 70 71 return _config.getClass().getName(); 72 } 73 74 78 public synchronized ObjectName uniqueObjectName(MBeanServer server, String on) 79 { 80 ObjectName oName=null; 81 try{oName=new ObjectName (on+",config="+_config.getClass().getName());} 82 catch(Exception e){log.warn(LogSupport.EXCEPTION,e);} 83 84 return oName; 85 } 86 87 } 88 | Popular Tags |