tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users MemoryGroup.java MemoryUser.java MemoryUserDatabase.java MemoryUserDatabaseFactory.java
Date Tue, 22 Jan 2002 23:22:24 GMT
craigmcc    02/01/22 15:22:24

  Modified:    catalina/src/share/org/apache/catalina Group.java User.java
                        UserDatabase.java
               catalina/src/share/org/apache/catalina/mbeans
                        MBeanUtils.java mbeans-descriptors.xml
               catalina/src/share/org/apache/catalina/users
                        MemoryGroup.java MemoryUser.java
                        MemoryUserDatabase.java
                        MemoryUserDatabaseFactory.java
  Added:       catalina/src/share/org/apache/catalina/mbeans
                        GroupMBean.java MemoryUserDatabaseMBean.java
                        UserMBean.java
  Log:
  Initial checkin of the MBean implementations to support live administration
  of the user database.
  
  Revision  Changes    Path
  1.2       +10 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java
  
  Index: Group.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Group.java	20 Jan 2002 03:00:56 -0000	1.1
  +++ Group.java	22 Jan 2002 23:22:23 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java,v 1.1 2002/01/20 03:00:56 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:56 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java,v 1.2 2002/01/22 23:22:23 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/22 23:22:23 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -73,7 +73,7 @@
    * inherits the security roles assigned to the group.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:56 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:23 $
    * @since 4.1
    */
   
  @@ -118,6 +118,12 @@
        * as Strings.
        */
       public Iterator getRoles();
  +
  +
  +    /**
  +     * Return the {@link UserDatabase} within which this Group is defined.
  +     */
  +    public UserDatabase getUserDatabase();
   
   
       /**
  
  
  
  1.2       +10 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java
  
  Index: User.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- User.java	20 Jan 2002 03:00:56 -0000	1.1
  +++ User.java	22 Jan 2002 23:22:23 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java,v 1.1 2002/01/20 03:00:56 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:56 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java,v 1.2 2002/01/22 23:22:23 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/22 23:22:23 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -74,7 +74,7 @@
    * of specific security roles.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:56 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:23 $
    * @since 4.1
    */
   
  @@ -127,6 +127,12 @@
        * as Strings.
        */
       public Iterator getRoles();
  +
  +
  +    /**
  +     * Return the {@link UserDatabase} within which this User is defined.
  +     */
  +    public UserDatabase getUserDatabase();
   
   
       /**
  
  
  
  1.2       +10 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/UserDatabase.java
  
  Index: UserDatabase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/UserDatabase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UserDatabase.java	20 Jan 2002 03:00:56 -0000	1.1
  +++ UserDatabase.java	22 Jan 2002 23:22:23 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/UserDatabase.java,v 1.1 2002/01/20 03:00:56 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:56 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/UserDatabase.java,v 1.2 2002/01/22 23:22:23 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/22 23:22:23 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -73,7 +73,7 @@
    * referenced by a {@link Realm} for authentication and access control.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:56 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:23 $
    * @since 4.1
    */
   
  @@ -87,6 +87,12 @@
        * Return the set of {@link Group}s defined in this user database.
        */
       public Iterator getGroups();
  +
  +
  +    /**
  +     * Return the unique global identifier of this user database.
  +     */
  +    public String getId();
   
   
       /**
  
  
  
  1.12      +232 -4    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java
  
  Index: MBeanUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MBeanUtils.java	22 Jan 2002 18:16:57 -0000	1.11
  +++ MBeanUtils.java	22 Jan 2002 23:22:23 -0000	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v 1.11 2002/01/22 18:16:57 remm Exp $
  - * $Revision: 1.11 $
  - * $Date: 2002/01/22 18:16:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v 1.12 2002/01/22 23:22:23 craigmcc Exp $
  + * $Revision: 1.12 $
  + * $Date: 2002/01/22 23:22:23 $
    *
    * ====================================================================
    *
  @@ -80,6 +80,7 @@
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Engine;
  +import org.apache.catalina.Group;
   import org.apache.catalina.Host;
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleListener;
  @@ -90,6 +91,8 @@
   import org.apache.catalina.Server;
   import org.apache.catalina.ServerFactory;
   import org.apache.catalina.Service;
  +import org.apache.catalina.User;
  +import org.apache.catalina.UserDatabase;
   import org.apache.catalina.Valve;
   import org.apache.catalina.connector.http.HttpConnector;
   import org.apache.catalina.connector.warp.WarpConnector;
  @@ -103,7 +106,7 @@
    *
    * @author Craig R. McClanahan
    * @author Amy Roh
  - * @version $Revision: 1.11 $ $Date: 2002/01/22 18:16:57 $
  + * @version $Revision: 1.12 $ $Date: 2002/01/22 23:22:23 $
    */
   
   public class MBeanUtils {
  @@ -122,6 +125,10 @@
             "Http10Connector" },
           { "org.apache.catalina.connector.http.HttpConnector",
             "Http11Connector" },
  +        { "org.apache.catalina.users.MemoryGroup",
  +          "Group" },
  +        { "org.apache.catalina.users.MemoryUser",
  +          "User" },
       };
   
   
  @@ -249,6 +256,33 @@
   
       /**
        * Create, register, and return an MBean for this
  +     * <code>Group</code> object.
  +     *
  +     * @param group The Group to be managed
  +     *
  +     * @exception Exception if an MBean cannot be created or registered
  +     */
  +    public static ModelMBean createMBean(Group group)
  +        throws Exception {
  +
  +        String mname = createManagedName(group);
  +        ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
  +        String domain = managed.getDomain();
  +        if (domain == null)
  +            domain = mserver.getDefaultDomain();
  +        ModelMBean mbean = managed.createMBean(group);
  +        ObjectName oname = createObjectName(domain, group);
  +        mserver.registerMBean(mbean, oname);
  +        return (mbean);
  +
  +    }
  +
  +
  +    /**
  +     * Create, register, and return an MBean for this
        * <code>Host</code> object.
        *
        * @param host The Host to be managed
  @@ -434,6 +468,60 @@
   
       /**
        * Create, register, and return an MBean for this
  +     * <code>User</code> object.
  +     *
  +     * @param user The User to be managed
  +     *
  +     * @exception Exception if an MBean cannot be created or registered
  +     */
  +    public static ModelMBean createMBean(User user)
  +        throws Exception {
  +
  +        String mname = createManagedName(user);
  +        ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
  +        String domain = managed.getDomain();
  +        if (domain == null)
  +            domain = mserver.getDefaultDomain();
  +        ModelMBean mbean = managed.createMBean(user);
  +        ObjectName oname = createObjectName(domain, user);
  +        mserver.registerMBean(mbean, oname);
  +        return (mbean);
  +
  +    }
  +
  +
  +    /**
  +     * Create, register, and return an MBean for this
  +     * <code>UserDatabase</code> object.
  +     *
  +     * @param userDatabase The UserDatabase to be managed
  +     *
  +     * @exception Exception if an MBean cannot be created or registered
  +     */
  +    public static ModelMBean createMBean(UserDatabase userDatabase)
  +        throws Exception {
  +
  +        String mname = createManagedName(userDatabase);
  +        ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
  +        String domain = managed.getDomain();
  +        if (domain == null)
  +            domain = mserver.getDefaultDomain();
  +        ModelMBean mbean = managed.createMBean(userDatabase);
  +        ObjectName oname = createObjectName(domain, userDatabase);
  +        mserver.registerMBean(mbean, oname);
  +        return (mbean);
  +
  +    }
  +
  +
  +    /**
  +     * Create, register, and return an MBean for this
        * <code>Valve</code> object.
        *
        * @param valve The Valve to be managed
  @@ -556,6 +644,28 @@
   
       /**
        * Create an <code>ObjectName</code> for this
  +     * <code>Group</code> object.
  +     *
  +     * @param domain Domain in which this name is to be created
  +     * @param group The Group to be named
  +     *
  +     * @exception MalformedObjectNameException if a name cannot be created
  +     */
  +    public static ObjectName createObjectName(String domain,
  +                                              Group group)
  +        throws MalformedObjectNameException {
  +
  +        ObjectName name = null;
  +        name = new ObjectName(domain + ":type=Group,groupname=" +
  +                              group.getGroupname() + ",database=" +
  +                              group.getUserDatabase().getId());
  +        return (name);
  +
  +    }
  +
  +
  +    /**
  +     * Create an <code>ObjectName</code> for this
        * <code>Host</code> object.
        *
        * @param domain Domain in which this name is to be created
  @@ -778,6 +888,49 @@
   
       /**
        * Create an <code>ObjectName</code> for this
  +     * <code>User</code> object.
  +     *
  +     * @param domain Domain in which this name is to be created
  +     * @param user The User to be named
  +     *
  +     * @exception MalformedObjectNameException if a name cannot be created
  +     */
  +    public static ObjectName createObjectName(String domain,
  +                                              User user)
  +        throws MalformedObjectNameException {
  +
  +        ObjectName name = null;
  +        name = new ObjectName(domain + ":type=User,username=" +
  +                              user.getUsername() + ",database=" +
  +                              user.getUserDatabase().getId());
  +        return (name);
  +
  +    }
  +
  +
  +    /**
  +     * Create an <code>ObjectName</code> for this
  +     * <code>UserDatabase</code> object.
  +     *
  +     * @param domain Domain in which this name is to be created
  +     * @param userDatabase The UserDatabase to be named
  +     *
  +     * @exception MalformedObjectNameException if a name cannot be created
  +     */
  +    public static ObjectName createObjectName(String domain,
  +                                              UserDatabase userDatabase)
  +        throws MalformedObjectNameException {
  +
  +        ObjectName name = null;
  +        name = new ObjectName(domain + ":type=UserDatabase,database=" +
  +                              userDatabase.getId());
  +        return (name);
  +
  +    }
  +
  +
  +    /**
  +     * Create an <code>ObjectName</code> for this
        * <code>Valve</code> object.
        *
        * @param domain Domain in which this name is to be created
  @@ -938,6 +1091,31 @@
   
       /**
        * Deregister the MBean for this
  +     * <code>Group</code> object.
  +     *
  +     * @param group The Group to be managed
  +     *
  +     * @exception Exception if an MBean cannot be deregistered
  +     */
  +    public static void destroyMBean(Group group)
  +        throws Exception {
  +
  +        String mname = createManagedName(group);
  +        ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return;
  +        }
  +        String domain = managed.getDomain();
  +        if (domain == null)
  +            domain = mserver.getDefaultDomain();
  +        ObjectName oname = createObjectName(domain, group);
  +        mserver.unregisterMBean(oname);
  +
  +    }
  +
  +
  +    /**
  +     * Deregister the MBean for this
        * <code>Host</code> object.
        *
        * @param host The Host to be managed
  @@ -1105,6 +1283,56 @@
           if (domain == null)
               domain = mserver.getDefaultDomain();
           ObjectName oname = createObjectName(domain, service);
  +        mserver.unregisterMBean(oname);
  +
  +    }
  +
  +
  +    /**
  +     * Deregister the MBean for this
  +     * <code>User</code> object.
  +     *
  +     * @param user The User to be managed
  +     *
  +     * @exception Exception if an MBean cannot be deregistered
  +     */
  +    public static void destroyMBean(User user)
  +        throws Exception {
  +
  +        String mname = createManagedName(user);
  +        ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return;
  +        }
  +        String domain = managed.getDomain();
  +        if (domain == null)
  +            domain = mserver.getDefaultDomain();
  +        ObjectName oname = createObjectName(domain, user);
  +        mserver.unregisterMBean(oname);
  +
  +    }
  +
  +
  +    /**
  +     * Deregister the MBean for this
  +     * <code>UserDatabase</code> object.
  +     *
  +     * @param userDatabase The UserDatabase to be managed
  +     *
  +     * @exception Exception if an MBean cannot be deregistered
  +     */
  +    public static void destroyMBean(UserDatabase userDatabase)
  +        throws Exception {
  +
  +        String mname = createManagedName(userDatabase);
  +        ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return;
  +        }
  +        String domain = managed.getDomain();
  +        if (domain == null)
  +            domain = mserver.getDefaultDomain();
  +        ObjectName oname = createObjectName(domain, userDatabase);
           mserver.unregisterMBean(oname);
   
       }
  
  
  
  1.18      +26 -8     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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mbeans-descriptors.xml	22 Jan 2002 21:20:48 -0000	1.17
  +++ mbeans-descriptors.xml	22 Jan 2002 23:22:24 -0000	1.18
  @@ -6,7 +6,7 @@
   <!--
        Descriptions of JMX MBeans for Catalina
   
  -     $Id: mbeans-descriptors.xml,v 1.17 2002/01/22 21:20:48 craigmcc Exp $
  +     $Id: mbeans-descriptors.xml,v 1.18 2002/01/22 23:22:24 craigmcc Exp $
    -->
   
   <mbeans-descriptors>
  @@ -108,7 +108,7 @@
     <mbean         name="Group"
               className="org.apache.catalina.mbeans.GroupMBean"
             description="Group from a user database"
  -               domain="Catalina"
  +               domain="Users"
                   group="Group"
                    type="org.apache.catalina.Group">
   
  @@ -598,7 +598,7 @@
     <mbean         name="MemoryUserDatabase"
               className="org.apache.catalina.mbeans.MemoryUserDatabaseMBean"
             description="In-memory user and group database"
  -               domain="Catalina"
  +               domain="Users"
                   group="UserDatabase"
                    type="org.apache.catalina.users.MemoryUserDatabase">
   
  @@ -671,6 +671,24 @@
                    type="java.lang.String"/>
       </operation>
   
  +    <operation   name="removeGroup"
  +          description="Remove existing group (and all user memberships)"
  +               impact="ACTION"
  +           returnType="void">
  +      <parameter name="groupname"
  +          description="Group name of the group to remove"
  +                 type="java.lang.String"/>
  +    </operation>
  +
  +    <operation   name="removeUser"
  +          description="Remove existing user (and all group memberships)"
  +               impact="ACTION"
  +           returnType="void">
  +      <parameter name="username"
  +          description="User name of the user to remove"
  +                 type="java.lang.String"/>
  +    </operation>
  +
     </mbean>
   
   
  @@ -1187,7 +1205,7 @@
     <mbean         name="User"
               className="org.apache.catalina.mbeans.UserMBean"
             description="User from a user database"
  -               domain="Catalina"
  +               domain="Users"
                   group="User"
                    type="org.apache.catalina.User">
   
  @@ -1216,8 +1234,8 @@
             description="Add a new group membership for this user"
                  impact="ACTION"
              returnType="void">
  -      <parameter name="group"
  -          description="MBean Name of the new group"
  +      <parameter name="groupname"
  +          description="Group name of the new group"
                    type="java.lang.String"/>
       </operation>
   
  @@ -1234,8 +1252,8 @@
             description="Remove an old group membership for this user"
                  impact="ACTION"
              returnType="void">
  -      <parameter name="group"
  -          description="MBean Name of the old group"
  +      <parameter name="groupname"
  +          description="Group name of the old group"
                    type="java.lang.String"/>
       </operation>
   
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/GroupMBean.java
  
  Index: GroupMBean.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/GroupMBean.java,v 1.1 2002/01/22 23:22:23 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/22 23:22:23 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.catalina.mbeans;
  
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import javax.management.MalformedObjectNameException;
  import javax.management.MBeanException;
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import javax.management.RuntimeOperationsException;
  import org.apache.catalina.Group;
  import org.apache.catalina.User;
  import org.apache.catalina.UserDatabase;
  import org.apache.commons.modeler.BaseModelMBean;
  import org.apache.commons.modeler.ManagedBean;
  import org.apache.commons.modeler.Registry;
  
  
  /**
   * <p>A <strong>ModelMBean</strong> implementation for the
   * <code>org.apache.catalina.Group</code> component.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/22 23:22:23 $
   */
  
  public class GroupMBean extends BaseModelMBean {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Construct a <code>ModelMBean</code> with default
       * <code>ModelMBeanInfo</code> information.
       *
       * @exception MBeanException if the initializer of an object
       *  throws an exception
       * @exception RuntimeOperationsException if an IllegalArgumentException
       *  occurs
       */
      public GroupMBean()
          throws MBeanException, RuntimeOperationsException {
  
          super();
  
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The configuration information registry for our managed beans.
       */
      protected Registry registry = MBeanUtils.createRegistry();
  
  
      /**
       * The <code>MBeanServer</code> in which we are registered.
       */
      protected MBeanServer mserver = MBeanUtils.createServer();
  
  
      /**
       * The <code>ManagedBean</code> information describing this MBean.
       */
      protected ManagedBean managed =
          registry.findManagedBean("Group");
  
  
      // ------------------------------------------------------------- Attributes
  
  
      /**
       * Return the set of authorized roles for this group.
       */
      public String[] getRoles() {
  
          Group group = (Group) this.resource;
          ArrayList results = new ArrayList();
          Iterator roles = group.getRoles();
          while (roles.hasNext()) {
              results.add(roles.next());
          }
          return ((String[]) results.toArray(new String[results.size()]));
  
      }
  
  
      /**
       * Return the MBean Names of all users that are members of this group.
       */
      public String[] getUsers() {
  
          Group group = (Group) this.resource;
          ArrayList results = new ArrayList();
          Iterator users = group.getUsers();
          while (users.hasNext()) {
              User user = null;
              try {
                  user = (User) users.next();
                  ObjectName oname =
                      MBeanUtils.createObjectName(managed.getDomain(), user);
                  results.add(oname.toString());
              } catch (MalformedObjectNameException e) {
                  throw new IllegalArgumentException
                      ("Cannot create object name for user " + user);
              }
          }
          return ((String[]) results.toArray(new String[results.size()]));
  
      }
  
  
      // ------------------------------------------------------------- Operations
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
  
  Index: MemoryUserDatabaseMBean.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java,v 1.1 2002/01/22 23:22:24 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/22 23:22:24 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.catalina.mbeans;
  
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import javax.management.MalformedObjectNameException;
  import javax.management.MBeanException;
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import javax.management.RuntimeOperationsException;
  import org.apache.catalina.Group;
  import org.apache.catalina.User;
  import org.apache.catalina.UserDatabase;
  import org.apache.commons.modeler.BaseModelMBean;
  import org.apache.commons.modeler.ManagedBean;
  import org.apache.commons.modeler.Registry;
  
  
  /**
   * <p>A <strong>ModelMBean</strong> implementation for the
   * <code>org.apache.catalina.users.MemoryUserDatabase</code> component.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/22 23:22:24 $
   */
  
  public class MemoryUserDatabaseMBean extends BaseModelMBean {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Construct a <code>ModelMBean</code> with default
       * <code>ModelMBeanInfo</code> information.
       *
       * @exception MBeanException if the initializer of an object
       *  throws an exception
       * @exception RuntimeOperationsException if an IllegalArgumentException
       *  occurs
       */
      public MemoryUserDatabaseMBean()
          throws MBeanException, RuntimeOperationsException {
  
          super();
  
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The configuration information registry for our managed beans.
       */
      protected Registry registry = MBeanUtils.createRegistry();
  
  
      /**
       * The <code>MBeanServer</code> in which we are registered.
       */
      protected MBeanServer mserver = MBeanUtils.createServer();
  
  
      /**
       * The <code>ManagedBean</code> information describing this MBean.
       */
      protected ManagedBean managed =
          registry.findManagedBean("MemoryUserDatabase");
  
  
      /**
       * The <code>ManagedBean</code> information describing Group MBeans.
       */
      protected ManagedBean managedGroup =
          registry.findManagedBean("Group");
  
  
      /**
       * The <code>ManagedBean</code> information describing User MBeans.
       */
      protected ManagedBean managedUser =
          registry.findManagedBean("User");
  
  
      // ------------------------------------------------------------- Attributes
  
  
      /**
       * Return the MBean Names of all groups defined in this database.
       */
      public String[] getGroups() {
  
          UserDatabase database = (UserDatabase) this.resource;
          ArrayList results = new ArrayList();
          Iterator groups = database.getGroups();
          while (groups.hasNext()) {
              Group group = (Group) groups.next();
              results.add(findGroup(group.getGroupname()));
          }
          return ((String[]) results.toArray(new String[results.size()]));
  
      }
  
  
      /**
       * Return the MBean Names of all users defined in this database.
       */
      public String[] getUsers() {
  
          UserDatabase database = (UserDatabase) this.resource;
          ArrayList results = new ArrayList();
          Iterator users = database.getUsers();
          while (users.hasNext()) {
              User user = (User) users.next();
              results.add(findUser(user.getUsername()));
          }
          return ((String[]) results.toArray(new String[results.size()]));
                                              
      }
  
  
      // ------------------------------------------------------------- Operations
  
  
      /**
       * Create a new Group and return the corresponding MBean Name.
       *
       * @param groupname Group name of the new group
       * @param description Description of the new group
       * @param roles Roles list for the new group
       */
      public String createGroup(String groupname, String description,
                                String roles[]) {
  
          UserDatabase database = (UserDatabase) this.resource;
          Group group = database.createGroup(groupname, description);
          if (roles != null) {
              for (int i = 0; i < roles.length; i++) {
                  group.addRole(roles[i]);
              }
          }
          try {
              MBeanUtils.createMBean(group);
          } catch (Exception e) {
              throw new IllegalArgumentException("Exception creating group " +
                                                 group + " MBean: " + e);
          }
          return (findGroup(groupname));
  
      }
  
  
      /**
       * Create a new User and return the corresponding MBean Name.
       *
       * @param username User name of the new user
       * @param password Password for the new user
       * @param fullName Full name for the new user
       * @param roles Roles list for the new user
       */
      public String createUser(String username, String password,
                               String fullName, String roles[]) {
  
          UserDatabase database = (UserDatabase) this.resource;
          User user = database.createUser(username, password, fullName);
          if (roles != null) {
              for (int i = 0; i < roles.length; i++) {
                  user.addRole(roles[i]);
              }
          }
          try {
              MBeanUtils.createMBean(user);
          } catch (Exception e) {
              throw new IllegalArgumentException("Exception creating user " +
                                                 user + " MBean: " + e);
          }
          return (findUser(username));
  
      }
  
  
      /**
       * Return the MBean Name for the specified group name (if any);
       * otherwise return <code>null</code>.
       *
       * @param groupname Group name to look up
       */
      public String findGroup(String groupname) {
  
          UserDatabase database = (UserDatabase) this.resource;
          Group group = database.findGroup(groupname);
          if (group == null) {
              return (null);
          }
          try {
              ObjectName oname =
                  MBeanUtils.createObjectName(managedGroup.getDomain(), group);
              return (oname.toString());
          } catch (MalformedObjectNameException e) {
              throw new IllegalArgumentException
                  ("Cannot create object name for group " + group);
          }
  
      }
  
  
      /**
       * Return the MBean Name for the specified user name (if any);
       * otherwise return <code>null</code>.
       *
       * @param username User name to look up
       */
      public String findUser(String username) {
  
          UserDatabase database = (UserDatabase) this.resource;
          User user = database.findUser(username);
          if (user == null) {
              return (null);
          }
          try {
              ObjectName oname =
                  MBeanUtils.createObjectName(managedUser.getDomain(), user);
              return (oname.toString());
          } catch (MalformedObjectNameException e) {
              throw new IllegalArgumentException
                  ("Cannot create object name for user " + user);
          }
  
      }
  
  
      /**
       * Remove an existing group and destroy the corresponding MBean.
       *
       * @param groupname Group name to remove
       */
      public void removeGroup(String groupname) {
  
          UserDatabase database = (UserDatabase) this.resource;
          Group group = database.findGroup(groupname);
          if (group == null) {
              return;
          }
          try {
              MBeanUtils.destroyMBean(group);
          } catch (Exception e) {
              throw new IllegalArgumentException("Exception destroying group " +
                                                 group + " MBean: " + e);
          }
  
      }
  
  
      /**
       * Remove an existing user and destroy the corresponding MBean.
       *
       * @param username User name to remove
       */
      public void removeUser(String username) {
  
          UserDatabase database = (UserDatabase) this.resource;
          User user = database.findUser(username);
          if (user == null) {
              return;
          }
          try {
              MBeanUtils.destroyMBean(user);
          } catch (Exception e) {
              throw new IllegalArgumentException("Exception destroying user " +
                                                 user + " MBean: " + e);
          }
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/UserMBean.java
  
  Index: UserMBean.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/UserMBean.java,v 1.1 2002/01/22 23:22:24 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/22 23:22:24 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.catalina.mbeans;
  
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import javax.management.MalformedObjectNameException;
  import javax.management.MBeanException;
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import javax.management.RuntimeOperationsException;
  import org.apache.catalina.Group;
  import org.apache.catalina.User;
  import org.apache.catalina.UserDatabase;
  import org.apache.commons.modeler.BaseModelMBean;
  import org.apache.commons.modeler.ManagedBean;
  import org.apache.commons.modeler.Registry;
  
  
  /**
   * <p>A <strong>ModelMBean</strong> implementation for the
   * <code>org.apache.catalina.User</code> component.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/22 23:22:24 $
   */
  
  public class UserMBean extends BaseModelMBean {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Construct a <code>ModelMBean</code> with default
       * <code>ModelMBeanInfo</code> information.
       *
       * @exception MBeanException if the initializer of an object
       *  throws an exception
       * @exception RuntimeOperationsException if an IllegalArgumentException
       *  occurs
       */
      public UserMBean()
          throws MBeanException, RuntimeOperationsException {
  
          super();
  
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The configuration information registry for our managed beans.
       */
      protected Registry registry = MBeanUtils.createRegistry();
  
  
      /**
       * The <code>MBeanServer</code> in which we are registered.
       */
      protected MBeanServer mserver = MBeanUtils.createServer();
  
  
      /**
       * The <code>ManagedBean</code> information describing this MBean.
       */
      protected ManagedBean managed =
          registry.findManagedBean("User");
  
  
      // ------------------------------------------------------------- Attributes
  
  
      /**
       * Return the MBean Names of all groups this user is a member of
       */
      public String[] getGroups() {
  
          User user = (User) this.resource;
          ArrayList results = new ArrayList();
          Iterator groups = user.getGroups();
          while (groups.hasNext()) {
              Group group = null;
              try {
                  group = (Group) groups.next();
                  ObjectName oname =
                      MBeanUtils.createObjectName(managed.getDomain(), group);
                  results.add(oname.toString());
              } catch (MalformedObjectNameException e) {
                  throw new IllegalArgumentException
                      ("Cannot create object name for group " + group);
              }
          }
          return ((String[]) results.toArray(new String[results.size()]));
  
      }
  
  
      /**
       * Return the set of authorized roles for this user.
       */
      public String[] getRoles() {
  
          User user = (User) this.resource;
          ArrayList results = new ArrayList();
          Iterator roles = user.getRoles();
          while (roles.hasNext()) {
              results.add(roles.next());
          }
          return ((String[]) results.toArray(new String[results.size()]));
  
      }
  
  
      // ------------------------------------------------------------- Operations
  
  
      /**
       * Add a new {@link Group} to those this user belongs to.
       *
       * @param groupname Group name of the new group
       */
      public void addGroup(String groupname) {
  
          User user = (User) this.resource;
          if (user == null) {
              return;
          }
          Group group = user.getUserDatabase().findGroup(groupname);
          if (group == null) {
              throw new IllegalArgumentException
                  ("Invalid group name '" + groupname + "'");
          }
          user.addGroup(group);
  
      }
  
  
      /**
       * Remove a {@link Group} from those this user belongs to.
       *
       * @param groupname Group name of the old group
       */
      public void removeGroup(String groupname) {
  
          User user = (User) this.resource;
          if (user == null) {
              return;
          }
          Group group = user.getUserDatabase().findGroup(groupname);
          if (group == null) {
              throw new IllegalArgumentException
                  ("Invalid group name '" + groupname + "'");
          }
          user.removeGroup(group);
  
      }
  
  
  
  }
  
  
  
  1.2       +14 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryGroup.java
  
  Index: MemoryGroup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryGroup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryGroup.java	20 Jan 2002 03:00:57 -0000	1.1
  +++ MemoryGroup.java	22 Jan 2002 23:22:24 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryGroup.java,v 1.1 2002/01/20 03:00:57 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryGroup.java,v 1.2 2002/01/22 23:22:24 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/22 23:22:24 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -76,7 +76,7 @@
    * {@link MemoryUserDatabase} implementation of {@link UserDatabase}.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:57 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:24 $
    * @since 4.1
    */
   
  @@ -115,6 +115,16 @@
   
   
       // --------------------------------------------------------- Public Methods
  +
  +
  +    /**
  +     * Return the {@link UserDatabase} within which this Group is defined.
  +     */
  +    public UserDatabase getUserDatabase() {
  +
  +        return (this.database);
  +
  +    }
   
   
       /**
  
  
  
  1.2       +14 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUser.java
  
  Index: MemoryUser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryUser.java	20 Jan 2002 03:00:57 -0000	1.1
  +++ MemoryUser.java	22 Jan 2002 23:22:24 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUser.java,v 1.1 2002/01/20 03:00:57 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUser.java,v 1.2 2002/01/22 23:22:24 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/22 23:22:24 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -76,7 +76,7 @@
    * {@link MemoryUserDatabase} implementation of {@link UserDatabase}.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:57 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:24 $
    * @since 4.1
    */
   
  @@ -133,6 +133,16 @@
           synchronized (groups) {
               return (groups.iterator());
           }
  +
  +    }
  +
  +
  +    /**
  +     * Return the {@link UserDatabase} within which this User is defined.
  +     */
  +    public UserDatabase getUserDatabase() {
  +
  +        return (this.database);
   
       }
   
  
  
  
  1.2       +46 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabase.java
  
  Index: MemoryUserDatabase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryUserDatabase.java	20 Jan 2002 03:00:57 -0000	1.1
  +++ MemoryUserDatabase.java	22 Jan 2002 23:22:24 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabase.java,v 1.1 2002/01/20 03:00:57 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabase.java,v 1.2 2002/01/22 23:22:24 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/22 23:22:24 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -87,13 +87,39 @@
    * a specified XML file for its persistent storage.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:57 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:24 $
    * @since 4.1
    */
   
   public class MemoryUserDatabase implements UserDatabase {
   
   
  +    // ----------------------------------------------------------- Constructors
  +
  +
  +    /**
  +     * Create a new instance with default values.
  +     */
  +    public MemoryUserDatabase() {
  +
  +        super();
  +
  +    }
  +
  +
  +    /**
  +     * Create a new instance with the specified values.
  +     *
  +     * @param id Unique global identifier of this user database
  +     */
  +    public MemoryUserDatabase(String id) {
  +
  +        super();
  +        this.id = id;
  +
  +    }
  +
  +
       // ----------------------------------------------------- Instance Variables
   
   
  @@ -113,6 +139,12 @@
   
   
       /**
  +     * The unique global identifier of this user database.
  +     */
  +    protected String id = null;
  +
  +
  +    /**
        * The relative (to <code>catalina.base</code>) or absolute pathname to
        * the XML file in which we will save our persistent information.
        */
  @@ -180,6 +212,16 @@
           synchronized (groups) {
               return (groups.values().iterator());
           }
  +
  +    }
  +
  +
  +    /**
  +     * Return the unique global identifier of this user database.
  +     */
  +    public String getId() {
  +
  +        return (this.id);
   
       }
   
  
  
  
  1.2       +5 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabaseFactory.java
  
  Index: MemoryUserDatabaseFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabaseFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryUserDatabaseFactory.java	20 Jan 2002 03:00:57 -0000	1.1
  +++ MemoryUserDatabaseFactory.java	22 Jan 2002 23:22:24 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabaseFactory.java,v 1.1 2002/01/20 03:00:57 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/MemoryUserDatabaseFactory.java,v 1.2 2002/01/22 23:22:24 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/22 23:22:24 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -94,7 +94,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:57 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:24 $
    * @since 4.1
    */
   
  @@ -135,7 +135,7 @@
   
           // Create and configure a MemoryUserDatabase instance based on the
           // RefAddr values associated with this Reference
  -        MemoryUserDatabase database = new MemoryUserDatabase();
  +        MemoryUserDatabase database = new MemoryUserDatabase(name.toString());
           RefAddr ra = null;
   
           ra = ref.get("encoding");
  
  
  

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