----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 6:36 AM
Subject: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans 
MBeanFactory.java mbeans-descriptors.xml


> amyroh      02/03/19 13:36:56
> 
>   Modified:    catalina/src/share/org/apache/catalina/mbeans
>                         MBeanFactory.java mbeans-descriptors.xml
>   Log:
>   Add createWebappLoader() and removeLoader().
>   
>   Revision  Changes    Path
>   1.16      +75 -16    
>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.15
>   retrieving revision 1.16
>   diff -u -r1.15 -r1.16
>   --- MBeanFactory.java 19 Mar 2002 21:14:54 -0000 1.15
>   +++ MBeanFactory.java 19 Mar 2002 21:36:56 -0000 1.16
>   @@ -1,7 +1,7 @@
>    /*
>   - * $Header: 
>/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
> 1.15 2002/03/19 21:14:54 amyroh Exp $
>   - * $Revision: 1.15 $
>   - * $Date: 2002/03/19 21:14:54 $
>   + * $Header: 
>/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
> 1.16 2002/03/19 21:36:56 amyroh Exp $
>   + * $Revision: 1.16 $
>   + * $Date: 2002/03/19 21:36:56 $
>     *
>     * ====================================================================
>     *
>   @@ -75,6 +75,7 @@
>    import org.apache.catalina.DefaultContext;
>    import org.apache.catalina.Engine;
>    import org.apache.catalina.Host;
>   +import org.apache.catalina.Loader;
>    import org.apache.catalina.Logger;
>    import org.apache.catalina.Manager;
>    import org.apache.catalina.Realm;
>   @@ -91,6 +92,7 @@
>    import org.apache.catalina.core.StandardHost;
>    import org.apache.catalina.core.StandardServer;
>    import org.apache.catalina.core.StandardService;
>   +import org.apache.catalina.loader.WebappLoader;
>    import org.apache.catalina.logger.FileLogger;
>    import org.apache.catalina.logger.SystemErrLogger;
>    import org.apache.catalina.logger.SystemOutLogger;
>   @@ -113,7 +115,7 @@
>     * <code>org.apache.catalina.core.StandardServer</code> component.</p>
>     *
>     * @author Amy Roh
>   - * @version $Revision: 1.15 $ $Date: 2002/03/19 21:14:54 $
>   + * @version $Revision: 1.16 $ $Date: 2002/03/19 21:36:56 $
>     */
>    
>    public class MBeanFactory extends BaseModelMBean {
>   @@ -199,7 +201,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                ((StandardContext)context).addValve(accessLogger);
>            } else if (tname.equals("Engine")) {
>                ((StandardEngine)engine).addValve(accessLogger);
>   @@ -277,7 +279,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                context.setLogger(fileLogger);
>            } else if (tname.equals("Engine")) {
>                engine.setLogger(fileLogger);
>   @@ -384,7 +386,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                context.setRealm(realm);
>            } else if (tname.equals("Engine")) {
>                engine.setRealm(realm);
>   @@ -425,7 +427,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                context.setRealm(realm);
>            } else if (tname.equals("Engine")) {
>                engine.setRealm(realm);
>   @@ -466,7 +468,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                context.setRealm(realm);
>            } else if (tname.equals("Engine")) {
>                engine.setRealm(realm);
>   @@ -507,7 +509,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                ((StandardContext)context).addValve(valve);
>            } else if (tname.equals("Engine")) {
>                ((StandardEngine)engine).addValve(valve);
>   @@ -548,7 +550,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                ((StandardContext)context).addValve(valve);
>            } else if (tname.equals("Engine")) {
>                ((StandardEngine)engine).addValve(valve);
>   @@ -589,7 +591,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                ((StandardContext)context).addValve(valve);
>            } else if (tname.equals("Engine")) {
>                ((StandardEngine)engine).addValve(valve);
>   @@ -630,7 +632,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                ((StandardContext)context).addValve(valve);
>            } else if (tname.equals("Engine")) {
>                ((StandardEngine)engine).addValve(valve);
>   @@ -772,7 +774,7 @@
>            Service service = server.findService(pname.getKeyProperty("service"));
>            Engine engine = (Engine) service.getContainer();
>            Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>   -        Context context = (Context) 
>host.findChild(pname.getKeyProperty("context"));
>   +        Context context = (Context) host.findChild(pname.getKeyProperty("path"));
>            context.setManager(manager);
>    
>            // Return the corresponding MBean name
>   @@ -836,7 +838,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                context.setLogger(logger);
>            } else if (tname.equals("Engine")) {
>                engine.setLogger(logger);
>   @@ -877,7 +879,7 @@
>            if (tname.equals("StandardContext")) {
>                Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>                Context context =
>   -                    (Context) host.findChild(pname.getKeyProperty("context"));
>   +                    (Context) host.findChild(pname.getKeyProperty("path"));
>                context.setLogger(logger);
>            } else if (tname.equals("Engine")) {
>                engine.setLogger(logger);
>   @@ -895,6 +897,37 @@
>    
>    
>        /**
>   +     * Create a new Web Application Loader.
>   +     *
>   +     * @param parent MBean Name of the associated parent component
>   +     *
>   +     * @exception Exception if an MBean cannot be created or registered
>   +     */
>   +    public String createWebappLoader(String parent)
>   +        throws Exception {
>   +
>   +        // Create a new WebappLoader instance
>   +        WebappLoader loader = new WebappLoader();
>   +
>   +        // Add the new instance to its parent component
>   +        ObjectName pname = new ObjectName(parent);
>   +        Server server = ServerFactory.getServer();
>   +        Service service = server.findService(pname.getKeyProperty("service"));
>   +        Engine engine = (Engine) service.getContainer();
>   +        Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
>   +        Context context = (Context) host.findChild(pname.getKeyProperty("path"));
>   +        context.setLoader(loader);
>   +
>   +        // Return the corresponding MBean name
>   +        ManagedBean managed = registry.findManagedBean("WebappLoader");
>   +        ObjectName oname =
>   +            MBeanUtils.createObjectName(managed.getDomain(), loader);
>   +        return (oname.toString());
>   +
>   +    }
>   +
>   +
>   +    /**
>         * Remove an existing Connector.
>         *
>         * @param name MBean Name of the comonent to remove
>   @@ -1057,6 +1090,32 @@
>                    }
>                }
>            }
>   +    }
>   +
>   +
>   +    /**
>   +     * Remove an existing Loader.
>   +     *
>   +     * @param name MBean Name of the comonent to remove
>   +     *
>   +     * @exception Exception if a component cannot be removed
>   +     */
>   +    public void removeLoader(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 contextName = oname.getKeyProperty("path");
>   +        Server server = ServerFactory.getServer();
>   +        Service service = server.findService(serviceName);
>   +        Engine engine = (Engine) service.getContainer();
>   +        Host host = (Host) engine.findChild(hostName);
>   +        Context context = (Context) host.findChild(contextName);
>   +
>   +        // Remove this component from its parent component
>   +        context.setLoader(null);
>   +
>        }
>    
>    
>   
>   
>   
>   1.42      +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.41
>   retrieving revision 1.42
>   diff -u -r1.41 -r1.42
>   --- mbeans-descriptors.xml 19 Mar 2002 21:14:54 -0000 1.41
>   +++ mbeans-descriptors.xml 19 Mar 2002 21:36:56 -0000 1.42
>   @@ -6,7 +6,7 @@
>    <!--
>         Descriptions of JMX MBeans for Catalina
>    
>   -     $Id: mbeans-descriptors.xml,v 1.41 2002/03/19 21:14:54 amyroh Exp $
>   +     $Id: mbeans-descriptors.xml,v 1.42 2002/03/19 21:36:56 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="removeLoader"
>   +          description="Remove an existing Loader"
>                   impact="ACTION"
>               returnType="void">
>          <parameter name="name"
>   
>   
>   
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Reply via email to