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/webapps/admin/WEB-INF/classes/org/apache/webapp/admin AttributeTag.java ListGroupsAction.java ListGroupsForm.java ListUsersAction.java ListUsersForm.java UsersTreeBuilder.java ApplicationResources_en.properties RowTag.java SetUpTreeAction.java
Date Wed, 23 Jan 2002 23:06:54 GMT
craigmcc    02/01/23 15:06:54

  Modified:    webapps/admin/WEB-INF controls.tld struts-config.xml web.xml
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        ApplicationResources_en.properties RowTag.java
                        SetUpTreeAction.java
  Added:       webapps/admin listGroups.jsp listUsers.jsp
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        AttributeTag.java ListGroupsAction.java
                        ListGroupsForm.java ListUsersAction.java
                        ListUsersForm.java UsersTreeBuilder.java
  Log:
  Initial integration of user database administration.  So far, only the
  "list" screens for groups and users are present -- next step is to add
  the ability to add, remove, and edit them.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-4.0/webapps/admin/listGroups.jsp
  
  Index: listGroups.jsp
  ===================================================================
  <!-- Standard Struts Entries -->
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
  <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
  <%@ taglib uri="/WEB-INF/controls.tld" prefix="controls" %>
  
  <html:html locale="true">
  
  <%@ include file="header.jsp" %>
  
  <!-- Body -->
  <body bgcolor="white">
  
  <!--Form -->
  
  <html:errors/>
  
  <html:form action="/listUsers">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr bgcolor="7171A5">
        <td width="81%"> 
          <div class="page-title-text" align="left">
            <bean:message key="listGroups.title"/>
          </div>
        </td>
        <td width="19%"> 
          <div align="right">
              <controls:actions>
                <controls:action selected="true">
                  ----<bean:message key="actions.available.actions"/>----
                </controls:action>
                <controls:action>
                  ---------------------------------
                </controls:action>
                <controls:action url="">
                  <bean:message key="actions.group.create"/>
                </controls:action>
                <controls:action url="">
                  <bean:message key="actions.group.delete"/>
                </controls:action>
                <!-- add the urls later once those screens get implemented -->
              </controls:actions>
          </div>
        </td>
      </tr>
    </table>
  </html:form>
  
  <%--    <%@ include file="buttons.jsp" %>    --%>
    <br>
  
    <%-- Groups List --%>
  
    <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
      <tr> 
        <td> 
          <table class="front-table" border="1"
           cellspacing="0" cellpadding="0" width="100%">
            <tr class="header-row">
              <td><div align="left" class="table-header-text">
                <bean:message key="listGroups.groupname"/>
              </div></td>
              <td><div align="left" class="table-header-text">
                <bean:message key="listGroups.description"/>
              </div></td>
            </tr>
            <logic:iterate name="groups" id="group">
              <tr class="line-row">
                <td><div align="left" class="table-normal-text">&nbsp;
                  <controls:attribute name="group" attribute="groupname"/>
                </div></td>
                <td><div align="left" class="table-normal-text">&nbsp;
                  <controls:attribute name="group" attribute="description"/>
                </div></td>
              </tr>
            </logic:iterate>
          </table>
        </td>
      </tr>
    </table>
  
  <%--   <%@ include file="buttons.jsp" %>  --%>
  
    <br>
  
  <p>&nbsp;</p>
  </body>
  </html:html>
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/listUsers.jsp
  
  Index: listUsers.jsp
  ===================================================================
  <!-- Standard Struts Entries -->
  <%@ page language="java" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
  <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
  <%@ taglib uri="/WEB-INF/controls.tld" prefix="controls" %>
  
  <html:html locale="true">
  
  <%@ include file="header.jsp" %>
  
  <!-- Body -->
  <body bgcolor="white">
  
  <!--Form -->
  
  <html:errors/>
  
  <html:form action="/listUsers">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr bgcolor="7171A5">
        <td width="81%"> 
          <div class="page-title-text" align="left">
            <bean:message key="listUsers.title"/>
          </div>
        </td>
        <td width="19%"> 
          <div align="right">
              <controls:actions>
                <controls:action selected="true">
                  ----<bean:message key="actions.available.actions"/>----
                </controls:action>
                <controls:action>
                  ---------------------------------
                </controls:action>
                <controls:action url="">
                  <bean:message key="actions.user.create"/>
                </controls:action>
                <controls:action url="">
                  <bean:message key="actions.user.delete"/>
                </controls:action>
                <!-- add the urls later once those screens get implemented -->
              </controls:actions>
          </div>
        </td>
      </tr>
    </table>
  </html:form>
  
  <%--    <%@ include file="buttons.jsp" %>    --%>
    <br>
  
    <%-- Users List --%>
  
    <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
      <tr> 
        <td> 
          <table class="front-table" border="1"
           cellspacing="0" cellpadding="0" width="100%">
            <tr class="header-row">
              <td><div align="left" class="table-header-text">
                <bean:message key="listUsers.username"/>
              </div></td>
              <td><div align="left" class="table-header-text">
                <bean:message key="listUsers.fullName"/>
              </div></td>
            </tr>
            <logic:iterate name="users" id="user">
              <tr class="line-row">
                <td><div align="left" class="table-normal-text">&nbsp;
                  <controls:attribute name="user" attribute="username"/>
                </div></td>
                <td><div align="left" class="table-normal-text">&nbsp;
                  <controls:attribute name="user" attribute="fullName"/>
                </div></td>
              </tr>
            </logic:iterate>
          </table>
        </td>
      </tr>
    </table>
  
  <%--   <%@ include file="buttons.jsp" %>  --%>
  
    <br>
  
  <p>&nbsp;</p>
  </body>
  </html:html>
  
  
  
  1.4       +62 -0     jakarta-tomcat-4.0/webapps/admin/WEB-INF/controls.tld
  
  Index: controls.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/controls.tld,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- controls.tld	3 Jan 2002 23:21:53 -0000	1.3
  +++ controls.tld	23 Jan 2002 23:06:53 -0000	1.4
  @@ -322,4 +322,66 @@
   
     </tag>
   
  +  <!-- ========== JMX Attribute Display Tag =============================== -->
  +
  +  <tag>
  +
  +    <name>attribute</name>
  +    <tag-class>org.apache.webapp.admin.AttributeTag</tag-class>
  +    <body-content>empty</body-content>
  +    <description>
  +      Look up an attribute on a JMX MBean, specified by an object name
  +      specified by the "name" (and optional "property" and "scope")
  +      attributes, and render it to the current JSP writer.  The object name
  +      identified by these attributes can be either a java.lang.String version
  +      of the name, or a javax.management.ObjectName instance.
  +    </description>
  +
  +    <attribute>
  +      <name>attribute</name>
  +      <required>true</required>
  +      <rtexprvalue>true</rtexprvalue>
  +      <description>
  +        Name of the attribute of the JMX MBean whose value is to be
  +        retrieved and written to the current JSP writer.
  +      </description>
  +    </attribute>
  +
  +    <attribute>
  +      <name>name</name>
  +      <required>true</required>
  +      <rtexprvalue>true</rtexprvalue>
  +      <description>
  +        Name of a bean, optionally in some scope identified by the "scope"
  +        attribute.  If the "property" attribute is not specified, this bean
  +        must by a String or an ObjectName.  Otherwise, this bean must have
  +        a property getter for the property named by "property", which will
  +        return the String or ObjectName.
  +      </description>
  +    </attribute>
  +
  +    <attribute>
  +      <name>property</name>
  +      <required>false</required>
  +      <rtexprvalue>true</rtexprvalue>
  +      <description>
  +        Name of a bean property, on the bean identified by the "name"
  +        (and optional "scope") attributes, that is either a String or an
  +        ObjectName of the JMX MBean whose attribute is to be retrieved.
  +      </description>
  +    </attribute>
  +
  +    <attribute>
  +      <name>scope</name>
  +      <required>false</required>
  +      <rtexprvalue>true</rtexprvalue>
  +      <description>
  +        Name of the scope ("page", "request", "session", or "application")
  +        in which the bean identified by the "name" attribute is to be found.
  +        If not specified, all scopes will be searched in ascending order.
  +      </description>
  +    </attribute>
  +
  +  </tag>
  +
   </taglib>
  
  
  
  1.17      +26 -0     jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml
  
  Index: struts-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- struts-config.xml	23 Jan 2002 02:18:49 -0000	1.16
  +++ struts-config.xml	23 Jan 2002 23:06:53 -0000	1.17
  @@ -39,6 +39,14 @@
       <form-bean      name="setLocaleForm"
                       type="org.apache.webapp.admin.SetLocaleForm"/>
   
  +    <!-- List Groups form bean -->
  +    <form-bean      name="listGroupsForm"
  +                    type="org.apache.webapp.admin.ListGroupsForm"/>
  +
  +    <!-- List Users form bean -->
  +    <form-bean      name="listUsersForm"
  +                    type="org.apache.webapp.admin.ListUsersForm"/>
  +
     </form-beans>
   
   
  @@ -90,6 +98,14 @@
                       path="/blank.jsp"
                   redirect="false"/>
   
  +    <forward        name="Groups List"
  +                    path="/listGroups.jsp"
  +                redirect="false"/>
  +
  +    <forward        name="Users List"
  +                    path="/listUsers.jsp"
  +                redirect="false"/>
  +
     </global-forwards>
   
   
  @@ -222,6 +238,16 @@
       <!-- Tree control test action -->
       <action    path="/treeControlTest"
                  type="org.apache.webapp.admin.TreeControlTestAction"/>
  +
  +    <!-- Set up groups list action -->
  +    <action    path="/listGroups"
  +               name="listGroupsForm"
  +               type="org.apache.webapp.admin.ListGroupsAction"/>
  +
  +    <!-- Set up users list axction -->
  +    <action    path="/listUsers"
  +               name="listUsersForm"
  +               type="org.apache.webapp.admin.ListUsersAction"/>
   
     </action-mappings>
     
  
  
  
  1.8       +4 -1      jakarta-tomcat-4.0/webapps/admin/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/web.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- web.xml	16 Dec 2001 19:38:02 -0000	1.7
  +++ web.xml	23 Jan 2002 23:06:53 -0000	1.8
  @@ -49,7 +49,10 @@
       </init-param>
       <init-param>
         <param-name>treebuilders</param-name>
  -      <param-value>org.apache.webapp.admin.TomcatTreeBuilder</param-value>
  +      <param-value>
  +        org.apache.webapp.admin.TomcatTreeBuilder,
  +        org.apache.webapp.admin.UsersTreeBuilder
  +    </param-value>
       </init-param>
       <load-on-startup>2</load-on-startup>
     </servlet>
  
  
  
  1.14      +14 -0     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties
  
  Index: ApplicationResources_en.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ApplicationResources_en.properties	18 Jan 2002 05:53:26 -0000	1.13
  +++ ApplicationResources_en.properties	23 Jan 2002 23:06:54 -0000	1.14
  @@ -45,6 +45,7 @@
   error.redirectPortText.format=<li>Redirect Port Number not a valid integer!</li>
   error.redirectPortText.range=<li>Redirect Port Number seems out of range. Valid range is 1-65535. </li>
   error.minProcessorsText.required=<li>Minimum Processors cannot be empty</li>
  +b
   error.minProcessorsText.format=<li>Minimum Processors not a valid integer!</li>
   error.minProcessorsText.range=<li>Minimum Processors seems out of range. Valid range is 1-512. </li>
   error.maxProcessorsText.required=<li>Maximum Processors cannot be empty</li>
  @@ -69,12 +70,16 @@
   actions.accesslogger.delete=Delete Access Logger
   actions.connector.create=Create New Connector
   actions.connector.delete=Delete Connectors
  +actions.group.create=Create New Group
  +actions.group.delete=Delete Existing Group
   actions.host.create=Create New Host
   actions.host.delete=Delete Hosts
   actions.logger.create=Create New Logger
   actions.logger.delete=Delete Loggers
   actions.requestfilter.create=Create New Request Filter
   actions.requestfilter.delete=Delete Request Filters
  +actions.user.create=Create New User
  +actions.user.delete=Delete Existing User
   actions.userrealm.create=Create New User Realm
   actions.userrealm.delete=Delete User Realms
   actions.valve.create=Create New Valve
  @@ -131,3 +136,12 @@
   error.mgrMaxSessions.required=<li>Maximum sessions cannot be empty</li>
   error.mgrMaxSessions.format=<li>Maximum sessions not a valid integer!</li>
   error.mgrMaxSessions.range=<li>Maximum sessions seems out of range. Valid range is -1 to 100. </li>
  +usersTreeBuilder.groupsNode=Group Administration
  +usersTreeBuilder.subtreeNode=User and Group Administration
  +usersTreeBuilder.usersNode=User Administration
  +listGroups.title=Groups List
  +listGroups.groupname=Group Name
  +listGroups.description=Description
  +listUsers.title=Users List
  +listUsers.username=Username
  +listUsers.fullName=Full Name
  
  
  
  1.2       +9 -5      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/RowTag.java
  
  Index: RowTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/RowTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RowTag.java	3 Jan 2002 23:21:53 -0000	1.1
  +++ RowTag.java	23 Jan 2002 23:06:54 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/RowTag.java,v 1.1 2002/01/03 23:21:53 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/03 23:21:53 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/RowTag.java,v 1.2 2002/01/23 23:06:54 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/23 23:06:54 $
    *
    * ====================================================================
    *
  @@ -90,7 +90,7 @@
    * </ul>
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.1 $ $Date: 2002/01/03 23:21:53 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/23 23:06:54 $
    */
   
   public class RowTag extends BodyTagSupport {
  @@ -191,8 +191,12 @@
           
           // Find our parent TableTag instance
           Tag parent = getParent();
  -        if ((parent == null) || !(parent instanceof TableTag))
  +        while ((parent != null) && !(parent instanceof TableTag)) {
  +            parent = parent.getParent();
  +        }
  +        if (parent == null) {
               throw new JspException("Must be nested in a TableTag instance");
  +        }
           TableTag table = (TableTag) parent;
           
           // Register the information for the row represented by
  
  
  
  1.5       +6 -6      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpTreeAction.java
  
  Index: SetUpTreeAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpTreeAction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SetUpTreeAction.java	23 Jan 2002 02:18:49 -0000	1.4
  +++ SetUpTreeAction.java	23 Jan 2002 23:06:54 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpTreeAction.java,v 1.4 2002/01/23 02:18:49 patrickl Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/01/23 02:18:49 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpTreeAction.java,v 1.5 2002/01/23 23:06:54 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/01/23 23:06:54 $
    *
    * ====================================================================
    *
  @@ -86,7 +86,7 @@
    *
    * @author Jazmin Jonson
    * @author Manveen Kaur
  - * @version $Revision: 1.4 $ $Date: 2002/01/23 02:18:49 $
  + * @version $Revision: 1.5 $ $Date: 2002/01/23 23:06:54 $
    */
   
   public class SetUpTreeAction extends Action {
  @@ -150,11 +150,11 @@
               int i = 0;
               StringTokenizer st = new StringTokenizer(treeBuildersStr, ", ");
               while (st.hasMoreTokens()) {
  -                treeBuilders.add(st.nextToken());
  +                treeBuilders.add(st.nextToken().trim());
               }
   
               if(treeBuilders.size() == 0)
  -                treeBuilders.add(treeBuildersStr);
  +                treeBuilders.add(treeBuildersStr.trim());
   
               for(i = 0; i < treeBuilders.size(); i++) {
   
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/AttributeTag.java
  
  Index: AttributeTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/AttributeTag.java,v 1.1 2002/01/23 23:06:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/23 23:06:54 $
   *
   * ====================================================================
   *
   * 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/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  import java.io.IOException;
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspWriter;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagSupport;
  import org.apache.struts.util.PropertyUtils;
  
  
  /**
   * Custom tag that retrieves a JMX MBean attribute value, and writes it
   * out to the current output stream.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/23 23:06:54 $
   */
  
  public class AttributeTag extends TagSupport {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * The attribute name on the JMX MBean to be retrieved.
       */
      protected String attribute = null;
  
      public String getAttribute() {
          return (this.attribute);
      }
  
      public void setAttribute(String attribute) {
          this.attribute = attribute;
      }
  
  
      /**
       * The bean name to be retrieved.
       */
      protected String name = null;
  
      public String getName() {
          return (this.name);
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
  
      /**
       * The property name to be retrieved.
       */
      protected String property = null;
  
      public String getProperty() {
          return (this.property);
      }
  
      public void setProperty(String property) {
          this.property = property;
      }
  
  
      /**
       * The scope in which the bean should be searched.
       */
      protected String scope = null;
  
      public String getScope() {
          return (this.scope);
      }
  
      public void setScope(String scope) {
          this.scope = scope;
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Render the JMX MBean attribute identified by this tag
       *
       * @exception JspException if a processing exception occurs
       */
      public int doEndTag() throws JspException {
  
          // Retrieve the object name identified by our attributes
          Object bean = null;
          if (scope == null) {
              bean = pageContext.findAttribute(name);
          } else if ("page".equalsIgnoreCase(scope)) {
              bean = pageContext.getAttribute(name, PageContext.PAGE_SCOPE);
          } else if ("request".equalsIgnoreCase(scope)) {
              bean = pageContext.getAttribute(name, PageContext.REQUEST_SCOPE);
          } else if ("session".equalsIgnoreCase(scope)) {
              bean = pageContext.getAttribute(name, PageContext.SESSION_SCOPE);
          } else if ("application".equalsIgnoreCase(scope)) {
              bean = pageContext.getAttribute(name,
                                              PageContext.APPLICATION_SCOPE);
          } else {
              throw new JspException("Invalid scope value '" + scope + "'");
          }
          if (bean == null) {
              throw new JspException("No bean '" + name + "' found");
          }
          if (property != null) {
              try {
                  bean = PropertyUtils.getProperty(bean, property);
              } catch (Throwable t) {
                  throw new JspException
                      ("Exception retrieving property '" + property + "': " + t);
              }
              if (bean == null) {
                  throw new JspException("No property '" + property + "' found");
              }
          }
  
          // Convert to an object name as necessary
          ObjectName oname = null;
          try {
              if (bean instanceof ObjectName) {
                  oname = (ObjectName) bean;
              } else if (bean instanceof String) {
                  oname = new ObjectName((String) bean);
              } else {
                  oname = new ObjectName(bean.toString());
              }
          } catch (Throwable t) {
              throw new JspException("Exception creating object name for '" +
                                     bean + "': " + t);
          }
  
          // Acquire a reference to our MBeanServer
          MBeanServer mserver =
              (MBeanServer) pageContext.getAttribute
              ("org.apache.catalina.MBeanServer", PageContext.APPLICATION_SCOPE);
          if (mserver == null)
              throw new JspException("MBeanServer is not available");
  
          // Retrieve the specified attribute from the specified MBean
          Object value = null;
          try {
              value = mserver.getAttribute(oname, attribute);
          } catch (Throwable t) {
              throw new JspException("Exception retrieving attribute '" +
                                     attribute + "'");
          }
  
          // Render this value to our current output writer
          if (value != null) {
              JspWriter out = pageContext.getOut();
              try {
                  out.print(value);
              } catch (IOException e) {
                  throw new JspException("IOException: " + e);
              }
          }
  
          // Evaluate the remainder of this page
          return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release all current state.
       */
      public void release() {
  
          attribute = null;
          name = null;
          property = null;
          scope = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListGroupsAction.java
  
  Index: ListGroupsAction.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListGroupsAction.java,v 1.1 2002/01/23 23:06:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/23 23:06:54 $
   *
   * ====================================================================
   *
   * 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/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.Set;
  import java.util.TreeSet;
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import javax.management.modelmbean.ModelMBean;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  
  
  /**
   * Retrieve the Set of MBean namess for all currently defined groups,
   * and expose them as a request attribute named "groups".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/23 23:06:54 $
   */
  
  public class ListGroupsAction extends Action {
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Process the specified HTTP request, and create the corresponding HTTP
       * response (or forward to another web component that will create it).
       * Return an <code>ActionForward</code> instance describing where and how
       * control should be forwarded, or <code>null</code> if the response has
       * already been completed.
       *
       * @param mapping The ActionMapping used to select this instance
       * @param actionForm The optional ActionForm bean for this request (if any)
       * @param request The HTTP request we are processing
       * @param response The HTTP response we are creating
       *
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet exception occurs
       */
      public ActionForward perform(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
          throws IOException, ServletException {
  
  
          // Acquire a reference to the MBeanServer containing our MBeans
          MBeanServer mserver = null;
          try {
              mserver = ((ApplicationServlet) getServlet()).getServer();
          } catch (Throwable t) {
              throw new ServletException
                  ("Cannot acquire MBeanServer reference", t);
          }
  
          // Acquire the set of group MBean names to be listed
          // FIXME - limit to global user database?
          String pattern = "Users:type=Group,*";
          Set results = null;
          try {
              results = mserver.queryNames(new ObjectName(pattern), null);
          } catch (Throwable t) {
              throw new ServletException("queryNames(" + pattern + ")", t);
          }
          TreeSet groups = new TreeSet();
          Iterator names = results.iterator();
          while (names.hasNext()) {
              ObjectName name = (ObjectName) names.next();
              groups.add(name.toString());
          }
  
          // Forward the Set as a request attribute
          request.setAttribute("groups", groups);
          return (mapping.findForward("Groups List"));
  
      }
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListGroupsForm.java
  
  Index: ListGroupsForm.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListGroupsForm.java,v 1.1 2002/01/23 23:06:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/23 23:06:54 $
   *
   * ====================================================================
   *
   * 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/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  import org.apache.struts.action.ActionForm;
  
  
  /**
   * Dummy form bean for the "List Groups" page.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/23 23:06:54 $
   */
  
  public class ListGroupsForm extends ActionForm {
  
      // No extensions needed
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListUsersAction.java
  
  Index: ListUsersAction.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListUsersAction.java,v 1.1 2002/01/23 23:06:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/23 23:06:54 $
   *
   * ====================================================================
   *
   * 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/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.Set;
  import java.util.TreeSet;
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import javax.management.modelmbean.ModelMBean;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  
  
  /**
   * Retrieve the Set of MBean namess for all currently defined users,
   * and expose them as a request attribute named "users".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/23 23:06:54 $
   */
  
  public class ListUsersAction extends Action {
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Process the specified HTTP request, and create the corresponding HTTP
       * response (or forward to another web component that will create it).
       * Return an <code>ActionForward</code> instance describing where and how
       * control should be forwarded, or <code>null</code> if the response has
       * already been completed.
       *
       * @param mapping The ActionMapping used to select this instance
       * @param actionForm The optional ActionForm bean for this request (if any)
       * @param request The HTTP request we are processing
       * @param response The HTTP response we are creating
       *
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet exception occurs
       */
      public ActionForward perform(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
          throws IOException, ServletException {
  
  
          // Acquire a reference to the MBeanServer containing our MBeans
          MBeanServer mserver = null;
          try {
              mserver = ((ApplicationServlet) getServlet()).getServer();
          } catch (Throwable t) {
              throw new ServletException
                  ("Cannot acquire MBeanServer reference", t);
          }
  
          // Acquire the set of user MBean names to be listed
          // FIXME - limit to global user database?
          String pattern = "Users:type=User,*";
          Set results = null;
          try {
              results = mserver.queryNames(new ObjectName(pattern), null);
          } catch (Throwable t) {
              throw new ServletException("queryNames(" + pattern + ")", t);
          }
          TreeSet users = new TreeSet();
          Iterator names = results.iterator();
          while (names.hasNext()) {
              ObjectName name = (ObjectName) names.next();
              users.add(name.toString());
          }
  
          // Forward the Set as a request attribute
          request.setAttribute("users", users);
          return (mapping.findForward("Users List"));
  
      }
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListUsersForm.java
  
  Index: ListUsersForm.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ListUsersForm.java,v 1.1 2002/01/23 23:06:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/23 23:06:54 $
   *
   * ====================================================================
   *
   * 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/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  import org.apache.struts.action.ActionForm;
  
  
  /**
   * Dummy form bean for the "List Users" page.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/23 23:06:54 $
   */
  
  public class ListUsersForm extends ActionForm {
  
      // No extensions needed
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/UsersTreeBuilder.java
  
  Index: UsersTreeBuilder.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/UsersTreeBuilder.java,v 1.1 2002/01/23 23:06:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/23 23:06:54 $
   *
   * ====================================================================
   *
   * 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/>.
   *
   */
  
  package org.apache.webapp.admin;
  
  
  import javax.servlet.http.HttpServletRequest;
  import org.apache.struts.action.Action;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Implementation of <code>TreeBuilder</code> that adds the nodes required
   * for administering the user database.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/23 23:06:54 $
   */
  
  public class UsersTreeBuilder implements TreeBuilder {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // ---------------------------------------------------- TreeBuilder Methods
  
  
      /**
       * Add the required nodes to the specified <code>treeControl</code>
       * instance.
       *
       * @param treeControl The <code>TreeControl</code> to which we should
       *  add our nodes
       * @param servlet The controller servlet for the admin application
       * @param request The servlet request we are processing
       */
      public void buildTree(TreeControl treeControl,
                            ApplicationServlet servlet,
                            HttpServletRequest request) {
  
          MessageResources resources = (MessageResources)
              servlet.getServletContext().getAttribute(Action.MESSAGES_KEY);
          addSubtree(treeControl.getRoot(), resources);
  
      }
  
  
      // ------------------------------------------------------ Protected Methods
  
  
      /**
       * Add the subtree of nodes required for user administration.
       *
       * @param root The root node of our tree control
       * @param resources The MessageResources for our localized messages
       *  messages
       */
      protected void addSubtree(TreeControlNode root,
                                MessageResources resources) {
  
          TreeControlNode subtree = new TreeControlNode
              ("Global User and Group Administration",
               "folder_16_pad.gif",
               resources.getMessage("usersTreeBuilder.subtreeNode"),
               null,
               "content",
               true);
          TreeControlNode groups = new TreeControlNode
              ("Global Administer Groups",
               "folder_16_pad.gif",
               resources.getMessage("usersTreeBuilder.groupsNode"),
               "listGroups.do",
               "content",
               false);
          TreeControlNode users = new TreeControlNode
              ("Global Administer Users",
               "folder_16_pad.gif",
               resources.getMessage("usersTreeBuilder.usersNode"),
               "listUsers.do",
               "content",
               false);
  
          root.addChild(subtree);
          subtree.addChild(groups);
          subtree.addChild(users);
  
      }
  
  
  }
  
  
  

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