amyroh      02/04/29 16:06:27

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        MBeanFactory.java mbeans-descriptors.xml
  Log:
  Modify Connector MBeans descriptors and operations.
  Now MBeans for HttpConnector, HttpsConnector, and AjpConnector implement
  CoyoteConnector and set different properties according to the connector type.
  Use reflection to avoid circular dependency.
  
  Revision  Changes    Path
  1.26      +96 -87    
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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- MBeanFactory.java 15 Apr 2002 20:57:06 -0000      1.25
  +++ MBeanFactory.java 29 Apr 2002 23:06:26 -0000      1.26
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
 1.25 2002/04/15 20:57:06 amyroh Exp $
  - * $Revision: 1.25 $
  - * $Date: 2002/04/15 20:57:06 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
 1.26 2002/04/29 23:06:26 amyroh Exp $
  + * $Revision: 1.26 $
  + * $Date: 2002/04/29 23:06:26 $
    *
    * ====================================================================
    *
  @@ -117,7 +117,7 @@
    * <code>org.apache.catalina.core.StandardServer</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.25 $ $Date: 2002/04/15 20:57:06 $
  + * @version $Revision: 1.26 $ $Date: 2002/04/29 23:06:26 $
    */
   
   public class MBeanFactory extends BaseModelMBean {
  @@ -220,7 +220,7 @@
       }
   
       /**
  -     * Create a new Ajp13Connector
  +     * Create a new AjpConnector
        *
        * @param parent MBean Name of the associated parent component
        * @param address The IP address on which to bind
  @@ -228,70 +228,14 @@
        *
        * @exception Exception if an MBean cannot be created or registered
        */
  -    public String createAjp13Connector(String parent, String address, int port)
  +    public String createAjpConnector(String parent, String address, int port)
           throws Exception {
   
           Object retobj = null;
   
           try {
   
  -            // Create a new AjpConnector instance
  -            // use reflection to avoid j-t-c compile-time circular dependencies
  -            Class cls = Class.forName("org.apache.ajp.tomcat4.Ajp13Connector");
  -            Constructor ct = cls.getConstructor(null);
  -            retobj = ct.newInstance(null);
  -            Class partypes1 [] = new Class[1];
  -            // Set address
  -            String str = new String();
  -            partypes1[0] = str.getClass();
  -            Method meth1 = cls.getMethod("setAddress", partypes1);
  -            Object arglist1[] = new Object[1];
  -            arglist1[0] = address;
  -            meth1.invoke(retobj, arglist1);
  -            // Set port number
  -            Class partypes2 [] = new Class[1];
  -            partypes2[0] = Integer.TYPE;
  -            Method meth2 = cls.getMethod("setPort", partypes2);
  -            Object arglist2[] = new Object[1];
  -            arglist2[0] = new Integer(port);
  -            meth2.invoke(retobj, arglist2);
  -
  -        } catch (Exception e) {
  -            throw new MBeanException(e);
  -        }
  -
  -        // Add the new instance to its parent component
  -        ObjectName pname = new ObjectName(parent);
  -        Server server = ServerFactory.getServer();
  -        Service service = server.findService(pname.getKeyProperty("name"));
  -        service.addConnector((Connector)retobj);
  -
  -        // Return the corresponding MBean name
  -        ManagedBean managed = registry.findManagedBean("Ajp13Connector");
  -        ObjectName oname =
  -            MBeanUtils.createObjectName(managed.getDomain(), (Connector)retobj);
  -        return (oname.toString());
  -
  -    }
  -
  -
  -    /**
  -     * Create a new CoyoteConnector
  -     *
  -     * @param parent MBean Name of the associated parent component
  -     * @param address The IP address on which to bind
  -     * @param port TCP port number to listen on
  -     *
  -     * @exception Exception if an MBean cannot be created or registered
  -     */
  -    public String createCoyoteConnector(String parent, String address, int port)
  -        throws Exception {
  -
  -        Object retobj = null;
  -
  -        try {
  -
  -            // Create a new CoyoteConnector instance
  +            // Create a new CoyoteConnector instance for AJP
               // use reflection to avoid j-t-c compile-time circular dependencies
               Class cls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
               Constructor ct = cls.getConstructor(null);
  @@ -311,6 +255,13 @@
               Object arglist2[] = new Object[1];
               arglist2[0] = new Integer(port);
               meth2.invoke(retobj, arglist2);
  +            // set protocolHandlerClassName for AJP
  +            Class partypes3 [] = new Class[1];
  +            partypes3[0] = str.getClass();
  +            Method meth3 = cls.getMethod("setProtocolHandlerClassName", partypes3);
  +            Object arglist3[] = new Object[1];
  +            arglist3[0] = new String("org.apache.jk.server.JkCoyoteHandler");
  +            meth3.invoke(retobj, arglist2);
   
           } catch (Exception e) {
               throw new MBeanException(e);
  @@ -323,7 +274,7 @@
           service.addConnector((Connector)retobj);
   
           // Return the corresponding MBean name
  -        ManagedBean managed = registry.findManagedBean("CoyoteConnector");
  +        ManagedBean managed = registry.findManagedBean("AjpConnector");
           ObjectName oname =
               MBeanUtils.createObjectName(managed.getDomain(), (Connector)retobj);
           return (oname.toString());
  @@ -405,10 +356,10 @@
           return (oname.toString());
   
       }
  -
  -
  +    
  +    
       /**
  -     * Create a new HTTP/1.0 Connector.
  +     * Create a new HTTPConnector
        *
        * @param parent MBean Name of the associated parent component
        * @param address The IP address on which to bind
  @@ -416,32 +367,54 @@
        *
        * @exception Exception if an MBean cannot be created or registered
        */
  -    public String createHttp10Connector(String parent, String address, int port)
  +    public String createHTTPConnector(String parent, String address, int port)
           throws Exception {
   
  -        // Create a new HttpConnector instance
  -        org.apache.catalina.connector.http10.HttpConnector connector =
  -            new org.apache.catalina.connector.http10.HttpConnector();
  -        connector.setAddress(address);
  -        connector.setPort(port);
  +        Object retobj = null;
  +
  +        try {
  +
  +            // Create a new CoyoteConnector instance
  +            // use reflection to avoid j-t-c compile-time circular dependencies
  +            Class cls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
  +            Constructor ct = cls.getConstructor(null);
  +            retobj = ct.newInstance(null);
  +            Class partypes1 [] = new Class[1];
  +            // Set address
  +            String str = new String();
  +            partypes1[0] = str.getClass();
  +            Method meth1 = cls.getMethod("setAddress", partypes1);
  +            Object arglist1[] = new Object[1];
  +            arglist1[0] = address;
  +            meth1.invoke(retobj, arglist1);
  +            // Set port number
  +            Class partypes2 [] = new Class[1];
  +            partypes2[0] = Integer.TYPE;
  +            Method meth2 = cls.getMethod("setPort", partypes2);
  +            Object arglist2[] = new Object[1];
  +            arglist2[0] = new Integer(port);
  +            meth2.invoke(retobj, arglist2);
  +        } catch (Exception e) {
  +            throw new MBeanException(e);
  +        }
   
           // Add the new instance to its parent component
           ObjectName pname = new ObjectName(parent);
           Server server = ServerFactory.getServer();
           Service service = server.findService(pname.getKeyProperty("name"));
  -        service.addConnector(connector);
  +        service.addConnector((Connector)retobj);
   
           // Return the corresponding MBean name
  -        ManagedBean managed = registry.findManagedBean("Http10Connector");
  +        ManagedBean managed = registry.findManagedBean("HttpConnector");
           ObjectName oname =
  -            MBeanUtils.createObjectName(managed.getDomain(), connector);
  +            MBeanUtils.createObjectName(managed.getDomain(), (Connector)retobj);
           return (oname.toString());
   
       }
   
  -
  +    
       /**
  -     * Create a new HTTP/1.1 Connector.
  +     * Create a new HTTPSConnector
        *
        * @param parent MBean Name of the associated parent component
        * @param address The IP address on which to bind
  @@ -449,25 +422,61 @@
        *
        * @exception Exception if an MBean cannot be created or registered
        */
  -    public String createHttp11Connector(String parent, String address, int port)
  +    public String createHTTPSConnector(String parent, String address, int port)
           throws Exception {
   
  -        // Create a new HttpConnector instance
  -        org.apache.catalina.connector.http.HttpConnector connector =
  -            new org.apache.catalina.connector.http.HttpConnector();
  -        connector.setAddress(address);
  -        connector.setPort(port);
  +        Object retobj = null;
  +
  +        try {
  +
  +            // Create a new CoyoteConnector instance
  +            // use reflection to avoid j-t-c compile-time circular dependencies
  +            Class cls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
  +            Constructor ct = cls.getConstructor(null);
  +            retobj = ct.newInstance(null);
  +            Class partypes1 [] = new Class[1];
  +            // Set address
  +            String str = new String();
  +            partypes1[0] = str.getClass();
  +            Method meth1 = cls.getMethod("setAddress", partypes1);
  +            Object arglist1[] = new Object[1];
  +            arglist1[0] = address;
  +            meth1.invoke(retobj, arglist1);
  +            // Set port number
  +            Class partypes2 [] = new Class[1];
  +            partypes2[0] = Integer.TYPE;
  +            Method meth2 = cls.getMethod("setPort", partypes2);
  +            Object arglist2[] = new Object[1];
  +            arglist2[0] = new Integer(port);
  +            meth2.invoke(retobj, arglist2);
  +            // Set scheme
  +            Class partypes3 [] = new Class[1];
  +            partypes3[0] = str.getClass();
  +            Method meth3 = cls.getMethod("setScheme", partypes3);
  +            Object arglist3[] = new Object[1];
  +            arglist3[0] = new String("https");
  +            meth3.invoke(retobj, arglist3);
  +            // Set secure
  +            Class partypes4 [] = new Class[1];
  +            partypes4[0] = Boolean.TYPE;
  +            Method meth4 = cls.getMethod("setSecure", partypes4);
  +            Object arglist4[] = new Object[1];
  +            arglist4[0] = new Boolean(true);
  +            meth4.invoke(retobj, arglist4);
  +        } catch (Exception e) {
  +            throw new MBeanException(e);
  +        }
   
           // Add the new instance to its parent component
           ObjectName pname = new ObjectName(parent);
           Server server = ServerFactory.getServer();
           Service service = server.findService(pname.getKeyProperty("name"));
  -        service.addConnector(connector);
  +        service.addConnector((Connector)retobj);
   
           // Return the corresponding MBean name
  -        ManagedBean managed = registry.findManagedBean("Http11Connector");
  +        ManagedBean managed = registry.findManagedBean("HttpsConnector");
           ObjectName oname =
  -            MBeanUtils.createObjectName(managed.getDomain(), connector);
  +            MBeanUtils.createObjectName(managed.getDomain(), (Connector)retobj);
           return (oname.toString());
   
       }
  
  
  
  1.49      +26 -126   
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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- mbeans-descriptors.xml    27 Apr 2002 05:09:03 -0000      1.48
  +++ mbeans-descriptors.xml    29 Apr 2002 23:06:26 -0000      1.49
  @@ -6,7 +6,7 @@
   <!--
        Descriptions of JMX MBeans for Catalina
   
  -     $Id: mbeans-descriptors.xml,v 1.48 2002/04/27 05:09:03 craigmcc Exp $
  +     $Id: mbeans-descriptors.xml,v 1.49 2002/04/29 23:06:26 amyroh Exp $
    -->
   
   <mbeans-descriptors>
  @@ -52,12 +52,12 @@
     </mbean>
   
   
  -  <mbean         name="Ajp13Connector"
  +  <mbean         name="AjpConnector"
               className="org.apache.catalina.mbeans.ClassNameMBean"
  -          description="Implementation of an Ajp13 connector"
  +          description="Implementation of an Ajp connector"
                  domain="Catalina"
                   group="Connector"
  -                 type="org.apache.ajp.tomcat4.Ajp13Connector">
  +                 type="org.apache.coyote.tomcat4.CoyoteConnector">
   
       <attribute   name="acceptCount"
             description="The accept count for this Connector"
  @@ -204,88 +204,6 @@
     </mbean>
   
   
  -  <mbean         name="CoyoteConnector"
  -            className="org.apache.catalina.mbeans.ClassNameMBean"
  -          description="Implementation of an Ajp13 connector"
  -               domain="Catalina"
  -                group="Connector"
  -                 type="org.apache.coyote.tomcat4.CoyoteConnector">
  -
  -    <attribute   name="acceptCount"
  -          description="The accept count for this Connector"
  -                 type="int"/>
  -
  -    <attribute   name="address"
  -          description="The IP address on which to bind"
  -                 type="java.lang.String"/>
  -
  -    <attribute   name="bufferSize"
  -          description="The input buffer size we should create on input streams"
  -                 type="int"/>
  -
  -    <attribute   name="className"
  -          description="Fully qualified class name of the managed object"
  -                 type="java.lang.String"
  -            writeable="false"/>
  -
  -    <attribute   name="connectionTimeout"
  -          description="Timeout value on the incoming connection"
  -                 type="int"/>
  -
  -    <attribute   name="curProcessors"
  -          description="Current number of active processors"
  -                 type="int"
  -            writeable="false"/>
  -
  -    <attribute   name="debug"
  -          description="The debugging detail level for this component"
  -                 type="int"/>
  -
  -    <attribute   name="enableLookups"
  -          description="The 'enable DNS lookups' flag for this Connector"
  -                 type="boolean"/>
  -
  -    <attribute   name="maxProcessors"
  -          description="The maximum number of processors allowed"
  -                 type="int"/>
  -
  -    <attribute   name="minProcessors"
  -          description="The minimum number of processors to start at
  -                        initialization time"
  -                 type="int"/>
  -
  -    <attribute   name="port"
  -          description="The port number on which we listen for ajp13 requests"
  -                 type="int"/>
  -
  -    <attribute   name="proxyName"
  -          description="The server name to which we should pretend requests to
  -                        this Connector were directed"
  -                 type="java.lang.String"/>
  -
  -    <attribute   name="proxyPort"
  -          description="The server port to which we should pretend requests to
  -                        this Connector were directed"
  -                 type="int"/>
  -
  -    <attribute   name="redirectPort"
  -          description="The redirect port for non-SSL to SSL redirects"
  -                 type="int"/>
  -
  -    <attribute   name="scheme"
  -          description="Protocol name for this Connector (http, https)"
  -                 type="java.lang.String"/>
  -
  -    <attribute   name="secure"
  -          description="Is this a secure (SSL) Connector?"
  -                 type="boolean"/>
  -
  -    <attribute   name="tcpNoDelay"
  -          description="Should we set the TCP no-delay option on connections?"
  -                 type="boolean"/>
  -
  -  </mbean>
  -
   
     <mbean         name="DefaultContext"
                 className="org.apache.catalina.mbeans.ClassNameMBean"
  @@ -570,12 +488,12 @@
     </mbean>
   
   
  -  <mbean         name="Http10Connector"
  +  <mbean         name="HttpConnector"
               className="org.apache.catalina.mbeans.ClassNameMBean"
  -          description="HTTP/1.0 Connector for Tomcat Standalone"
  +          description="Implementation of a Http Coyote connector for Tomcat 4.x"
                  domain="Catalina"
                   group="Connector"
  -                 type="org.apache.catalina.connector.http10.HttpConnector">
  +                 type="org.apache.coyote.tomcat4.CoyoteConnector">
   
       <attribute   name="acceptCount"
             description="The accept count for this Connector"
  @@ -616,7 +534,7 @@
                    type="int"/>
   
       <attribute   name="port"
  -          description="TCP port number to listen on"
  +          description="The port number on which we listen for ajp13 requests"
                    type="int"/>
   
       <attribute   name="proxyName"
  @@ -637,19 +555,15 @@
             description="Protocol name for this Connector (http, https)"
                    type="java.lang.String"/>
   
  -    <attribute   name="secure"
  -          description="Is this a secure (SSL) Connector?"
  -                 type="boolean"/>
  -
     </mbean>
   
   
  -  <mbean         name="Http11Connector"
  -            className="org.apache.catalina.mbeans.ClassNameMBean"
  -          description="HTTP/1.1 Connector for Tomcat Standalone"
  +  <mbean         name="HttpsConnector"
  +            className="org.apache.catalina.mbeans.HttpsConnectorMBean"
  +          description="Implementation of a Https Coyote connector for Tomcat 4.x"
                  domain="Catalina"
                   group="Connector"
  -                 type="org.apache.catalina.connector.http.HttpConnector">
  +                 type="org.apache.coyote.tomcat4.CoyoteConnector">
   
       <attribute   name="acceptCount"
             description="The accept count for this Connector"
  @@ -659,11 +573,6 @@
             description="The IP address on which to bind"
                    type="java.lang.String"/>
   
  -    <attribute   name="allowChunking"
  -          description="Flag which indicates if HTTP/1.1 chunking transfer
  -                        encoding can be used"
  -                 type="boolean"/>
  -
       <attribute   name="bufferSize"
             description="The input buffer size we should create on input streams"
                    type="int"/>
  @@ -673,6 +582,10 @@
                    type="java.lang.String"
               writeable="false"/>
   
  +    <attribute   name="clientAuth"
  +          description="Should we require client authentication?"
  +                 type="boolean"/>
  +
       <attribute   name="connectionTimeout"
             description="Timeout value on the incoming connection"
                    type="int"/>
  @@ -685,6 +598,14 @@
             description="The 'enable DNS lookups' flag for this Connector"
                    type="boolean"/>
   
  +    <attribute   name="keystoreFile"
  +          description="Pathname to the key store file to be used"
  +                 type="java.lang.String"/>
  +
  +    <attribute   name="keystorePass"
  +          description="Password for accessing the key store file"
  +                 type="java.lang.String"/>
  +
       <attribute   name="maxProcessors"
             description="The maximum number of processors allowed"
                    type="int"/>
  @@ -695,7 +616,7 @@
                    type="int"/>
   
       <attribute   name="port"
  -          description="TCP port number to listen on"
  +          description="The port number on which we listen for ajp13 requests"
                    type="int"/>
   
       <attribute   name="proxyName"
  @@ -716,12 +637,8 @@
             description="Protocol name for this Connector (http, https)"
                    type="java.lang.String"/>
   
  -    <attribute   name="secure"
  -          description="Is this a secure (SSL) Connector?"
  -                 type="boolean"/>
  -
     </mbean>
  -
  + 
   
     <mbean         name="JAASRealm"
               className="org.apache.catalina.mbeans.ClassNameMBean"
  @@ -974,10 +891,6 @@
             description="The IP address on which to bind"
                    type="java.lang.String"/>
   
  -    <attribute   name="allowChunking"
  -          description="Is HTTP/1.1 chunking allowed?"
  -                 type="boolean"/>
  -
       <attribute   name="bufferSize"
             description="The input buffer size we should create on input streams"
                    type="int"/>
  @@ -991,11 +904,6 @@
             description="Timeout value on the incoming connection"
                    type="int"/>
   
  -    <attribute   name="curProcessors"
  -          description="Current number of active processors"
  -                 type="int"
  -            writeable="false"/>
  -
       <attribute   name="debug"
             description="The debugging detail level for this component"
                    type="int"/>
  @@ -1038,14 +946,6 @@
       <attribute   name="scheme"
             description="Protocol name for this Connector (http, https)"
                    type="java.lang.String"/>
  -
  -    <attribute   name="secure"
  -          description="Is this a secure (SSL) Connector?"
  -                 type="boolean"/>
  -
  -    <attribute   name="tcpNoDelay"
  -          description="Should we set the TCP no-delay option on connections?"
  -                 type="boolean"/>
   
     </mbean>
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to