1 17 18 package org.apache.catalina.mbeans; 19 20 21 import javax.management.Attribute ; 22 import javax.management.AttributeNotFoundException ; 23 import javax.management.InstanceNotFoundException ; 24 import javax.management.MBeanException ; 25 import javax.management.ReflectionException ; 26 import javax.management.RuntimeOperationsException ; 27 import javax.management.modelmbean.InvalidTargetObjectTypeException ; 28 29 import org.apache.catalina.deploy.ContextEnvironment; 30 import org.apache.catalina.deploy.NamingResources; 31 import org.apache.tomcat.util.modeler.BaseModelMBean; 32 33 34 41 42 public class ContextEnvironmentMBean extends BaseModelMBean { 43 44 45 47 48 57 public ContextEnvironmentMBean() 58 throws MBeanException , RuntimeOperationsException { 59 60 super(); 61 62 } 63 64 65 67 68 70 71 84 public void setAttribute(Attribute attribute) 85 throws AttributeNotFoundException , MBeanException , 86 ReflectionException { 87 88 super.setAttribute(attribute); 89 90 ContextEnvironment ce = null; 91 try { 92 ce = (ContextEnvironment) getManagedResource(); 93 } catch (InstanceNotFoundException e) { 94 throw new MBeanException (e); 95 } catch (InvalidTargetObjectTypeException e) { 96 throw new MBeanException (e); 97 } 98 99 NamingResources nr = ce.getNamingResources(); 102 nr.removeEnvironment(ce.getName()); 103 nr.addEnvironment(ce); 104 } 105 106 } 107 | Popular Tags |