tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardEngineMBean.java StandardServiceMBean.java
Date Mon, 14 Jan 2002 20:10:00 GMT
amyroh      02/01/14 12:10:00

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        StandardEngineMBean.java StandardServiceMBean.java
  Log:
  Add "deleteObj" mbean operations.
  
  Revision  Changes    Path
  1.4       +27 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java
  
  Index: StandardEngineMBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardEngineMBean.java	14 Nov 2001 03:51:06 -0000	1.3
  +++ StandardEngineMBean.java	14 Jan 2002 20:10:00 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v
1.3 2001/11/14 03:51:06 amyroh Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/11/14 03:51:06 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v
1.4 2002/01/14 20:10:00 amyroh Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/01/14 20:10:00 $
    *
    * ====================================================================
    *
  @@ -94,7 +94,7 @@
    * <code>org.apache.catalina.core.StandardEngine</code> component.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/11/14 03:51:06 $
  + * @version $Revision: 1.4 $ $Date: 2002/01/14 20:10:00 $
    */
   
   public class StandardEngineMBean extends BaseModelMBean {
  @@ -153,6 +153,29 @@
           accessLogger.setContainer(engine);
           engine.addValve(accessLogger);
           MBeanUtils.createMBean(accessLogger);
  +
  +    }
  +
  +
  +    /**
  +     * Delete <code>AccessLogger<code>.
  +     *
  +     * @exception Exception if an MBean cannot be deleted or deregistered
  +     */
  +    public void deleteAccessLogger(String pattern)
  +        throws Exception {
  +
  +        StandardEngine engine = (StandardEngine) this.resource;
  +        Valve [] valves = engine.getValves();
  +        for (int i=0; i<valves.length; i++) {
  +            if (valves[i] instanceof AccessLogValve) {
  +                if ((((AccessLogValve)valves[i]).getPattern()).equals(pattern)) {
  +                    ((AccessLogValve)valves[i]).setContainer(null);
  +                    engine.removeValve(valves[i]);
  +                    MBeanUtils.destroyMBean(valves[i]);
  +                }
  +            }
  +        }
   
       }
   
  
  
  
  1.5       +27 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java
  
  Index: StandardServiceMBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardServiceMBean.java	14 Nov 2001 03:51:06 -0000	1.4
  +++ StandardServiceMBean.java	14 Jan 2002 20:10:00 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v
1.4 2001/11/14 03:51:06 amyroh Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/11/14 03:51:06 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v
1.5 2002/01/14 20:10:00 amyroh Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/01/14 20:10:00 $
    *
    * ====================================================================
    *
  @@ -78,7 +78,7 @@
    * <code>org.apache.catalina.core.StandardService</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.4 $ $Date: 2001/11/14 03:51:06 $
  + * @version $Revision: 1.5 $ $Date: 2002/01/14 20:10:00 $
    */
   
   public class StandardServiceMBean extends BaseModelMBean {
  @@ -145,4 +145,27 @@
       }
   
   
  +    /**
  +     * Delete <code>Connector<code>.
  +     *
  +     * @exception Exception if an MBean cannot be deleted or deregistered
  +     */
  +    public void deleteConnector(String address, int port)
  +        throws Exception {
  +
  +        Service service = (Service) this.resource;
  +        Connector [] conns = service.findConnectors();
  +        for (int i=0; i<conns.length; i++) {
  +            if (conns[i] instanceof HttpConnector) {
  +                HttpConnector httpcon = (HttpConnector) conns[i];
  +                if ((httpcon.getAddress().equals(address)) &&
  +                                                (httpcon.getPort()==port)) {
  +                    httpcon.setService(null);
  +                    service.removeConnector(conns[i]);
  +                    MBeanUtils.destroyMBean(conns[i]);
  +                }
  +            }
  +        }
  +
  +    }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message