amyroh 02/03/18 12:25:15 Modified: catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java mbeans-descriptors.xml Log: Add removeLogger() method to MBeanFactory. Revision Changes Path 1.14 +66 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java Index: MBeanFactory.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- MBeanFactory.java 15 Mar 2002 00:45:28 -0000 1.13 +++ MBeanFactory.java 18 Mar 2002 20:25:15 -0000 1.14 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v 1.13 2002/03/15 00:45:28 manveen Exp $ - * $Revision: 1.13 $ - * $Date: 2002/03/15 00:45:28 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v 1.14 2002/03/18 20:25:15 amyroh Exp $ + * $Revision: 1.14 $ + * $Date: 2002/03/18 20:25:15 $ * * ==================================================================== * @@ -75,6 +75,7 @@ import org.apache.catalina.DefaultContext; import org.apache.catalina.Engine; import org.apache.catalina.Host; +import org.apache.catalina.Logger; import org.apache.catalina.Server; import org.apache.catalina.ServerFactory; import org.apache.catalina.Service; @@ -110,7 +111,7 @@ * <code>org.apache.catalina.core.StandardServer</code> component.</p> * * @author Amy Roh - * @version $Revision: 1.13 $ $Date: 2002/03/15 00:45:28 $ + * @version $Revision: 1.14 $ $Date: 2002/03/18 20:25:15 $ */ public class MBeanFactory extends BaseModelMBean { @@ -988,6 +989,67 @@ // Remove this component from its parent component engine.removeChild(host); + } + + + /** + * Remove an existing Logger. + * + * @param name MBean Name of the comonent to remove + * + * @exception Exception if a component cannot be removed + */ + public void removeLogger(String name) throws Exception { + + // Acquire a reference to the component to be removed + ObjectName oname = new ObjectName(name); + String serviceName = oname.getKeyProperty("service"); + String hostName = oname.getKeyProperty("host"); + String path = oname.getKeyProperty("path"); + Server server = ServerFactory.getServer(); + Service service = server.findService(serviceName); + StandardEngine engine = (StandardEngine) service.getContainer(); + if (hostName == null) { // if logger's container is Engine + Logger logger = engine.getLogger(); + Container container = logger.getContainer(); + if (container instanceof StandardEngine) { + String sname = + ((StandardEngine)container).getService().getName(); + if (sname.equals(serviceName)) { + engine.setLogger(null); + } + } + } else if (path == null) { // if logger's container is Host + StandardHost host = (StandardHost) engine.findChild(hostName); + Logger logger = host.getLogger(); + Container container = logger.getContainer(); + if (container instanceof StandardHost) { + String hn = ((StandardHost)container).getName(); + StandardEngine se = + (StandardEngine) ((StandardHost)container).getParent(); + String sname = se.getService().getName(); + if (sname.equals(serviceName) && hn.equals(hostName)) { + host.setLogger(null); + } + } + } else { // logger's container is Context + StandardHost host = (StandardHost) engine.findChild(hostName); + StandardContext context = (StandardContext) host.findChild(path); + Logger logger = context.getLogger(); + Container container = logger.getContainer(); + if (container instanceof StandardContext) { + String pathName = ((StandardContext)container).getName(); + StandardHost sh = + (StandardHost)((StandardContext)container).getParent(); + String hn = sh.getName();; + StandardEngine se = (StandardEngine)sh.getParent(); + String sname = se.getService().getName(); + if ((sname.equals(serviceName) && hn.equals(hostName)) && + pathName.equals(path)) { + context.setLogger(null); + } + } + } } 1.40 +10 -1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/mbeans-descriptors.xml Index: mbeans-descriptors.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/mbeans-descriptors.xml,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- mbeans-descriptors.xml 9 Mar 2002 00:29:04 -0000 1.39 +++ mbeans-descriptors.xml 18 Mar 2002 20:25:15 -0000 1.40 @@ -6,7 +6,7 @@ <!-- Descriptions of JMX MBeans for Catalina - $Id: mbeans-descriptors.xml,v 1.39 2002/03/09 00:29:04 craigmcc Exp $ + $Id: mbeans-descriptors.xml,v 1.40 2002/03/18 20:25:15 amyroh Exp $ --> <mbeans-descriptors> @@ -1274,6 +1274,15 @@ <operation name="removeHost" description="Remove an existing Host" + impact="ACTION" + returnType="void"> + <parameter name="name" + description="MBean Name of the component to be removed" + type="java.lang.String"/> + </operation> + + <operation name="removeLogger" + description="Remove an existing Logger" impact="ACTION" returnType="void"> <parameter name="name"
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>