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 MBeanFactory.java mbeans-descriptors.xml
Date Thu, 21 Mar 2002 21:19:10 GMT
amyroh      02/03/21 13:19:10

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        MBeanFactory.java mbeans-descriptors.xml
  Log:
  Add createUserDatabaseRealm().
  
  Revision  Changes    Path
  1.17      +46 -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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MBeanFactory.java	19 Mar 2002 21:36:56 -0000	1.16
  +++ MBeanFactory.java	21 Mar 2002 21:19:10 -0000	1.17
  @@ -1,7 +1,7 @@
   /*
  - * $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 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
1.17 2002/03/21 21:19:10 amyroh Exp $
  + * $Revision: 1.17 $
  + * $Date: 2002/03/21 21:19:10 $
    *
    * ====================================================================
    *
  @@ -99,6 +99,7 @@
   import org.apache.catalina.realm.JDBCRealm;
   import org.apache.catalina.realm.JNDIRealm;
   import org.apache.catalina.realm.MemoryRealm;
  +import org.apache.catalina.realm.UserDatabaseRealm;
   import org.apache.catalina.session.StandardManager;
   import org.apache.catalina.valves.AccessLogValve;
   import org.apache.catalina.valves.RemoteAddrValve;
  @@ -115,7 +116,7 @@
    * <code>org.apache.catalina.core.StandardServer</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.16 $ $Date: 2002/03/19 21:36:56 $
  + * @version $Revision: 1.17 $ $Date: 2002/03/21 21:19:10 $
    */
   
   public class MBeanFactory extends BaseModelMBean {
  @@ -894,8 +895,49 @@
               MBeanUtils.createObjectName(managed.getDomain(), logger);
           return (oname.toString());
       }
  +    
  +    
  +    /**
  +     * Create a new  UserDatabaseRealm.
  +     *
  +     * @param parent MBean Name of the associated parent component
  +     *
  +     * @exception Exception if an MBean cannot be created or registered
  +     */
  +    public String createUserDatabaseRealm(String parent)
  +        throws Exception {
   
  +         // Create a new UserDatabaseRealm instance
  +        UserDatabaseRealm realm = new UserDatabaseRealm();
  +
  +        // Add the new instance to its parent component
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        Server server = ServerFactory.getServer();
  +        Service service = server.findService(pname.getKeyProperty("service"));
  +        Engine engine = (Engine) service.getContainer();
  +        if (tname.equals("StandardContext")) {
  +            Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  +            Context context =
  +                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            context.setRealm(realm);
  +        } else if (tname.equals("Engine")) {
  +            engine.setRealm(realm);
  +        } else if (tname.equals("Host")) {
  +            Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  +            host.setRealm(realm);
  +        }
  +
  +        // Return the corresponding MBean name
  +        ManagedBean managed = registry.findManagedBean("UserDatabseRealm");
  +        ObjectName oname =
  +            MBeanUtils.createObjectName(managed.getDomain(), realm);
  +        return (oname.toString());
  +
  +    }
   
  +    
       /**
        * Create a new Web Application Loader.
        *
  
  
  
  1.43      +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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- mbeans-descriptors.xml	19 Mar 2002 21:36:56 -0000	1.42
  +++ mbeans-descriptors.xml	21 Mar 2002 21:19:10 -0000	1.43
  @@ -6,7 +6,7 @@
   <!--
        Descriptions of JMX MBeans for Catalina
   
  -     $Id: mbeans-descriptors.xml,v 1.42 2002/03/19 21:36:56 amyroh Exp $
  +     $Id: mbeans-descriptors.xml,v 1.43 2002/03/21 21:19:10 amyroh Exp $
    -->
   
   <mbeans-descriptors>
  @@ -1233,6 +1233,15 @@
   
       <operation   name="createSystemOutLogger"
             description="Create a new System Output Logger"
  +               impact="ACTION"
  +           returnType="java.lang.String">
  +      <parameter name="parent"
  +          description="MBean Name of the associated parent component"
  +                 type="java.lang.String"/>
  +    </operation>
  +
  +    <operation   name="createUserDatabaseRealm"
  +          description="Create a new UserDatabase Realm"
                  impact="ACTION"
              returnType="java.lang.String">
         <parameter name="parent"
  
  
  

--
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