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.ContextResourceLink; 30 import org.apache.catalina.deploy.NamingResources; 31 import org.apache.tomcat.util.modeler.BaseModelMBean; 32 33 34 41 42 public class ContextResourceLinkMBean extends BaseModelMBean { 43 44 45 47 48 57 public ContextResourceLinkMBean() 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 ContextResourceLink crl = null; 91 try { 92 crl = (ContextResourceLink) getManagedResource(); 93 } catch (InstanceNotFoundException e) { 94 throw new MBeanException (e); 95 } catch (InvalidTargetObjectTypeException e) { 96 throw new MBeanException (e); 97 } 98 99 NamingResources nr = crl.getNamingResources(); 102 nr.removeResourceLink(crl.getName()); 103 nr.addResourceLink(crl); 104 } 105 106 } 107 | Popular Tags |