tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardServerMBean.java
Date Thu, 02 May 2002 19:32:28 GMT
amyroh      02/05/02 12:32:28

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        StandardServerMBean.java
  Log:
  Fix Resource and ResourceParam config save.
  
  Revision  Changes    Path
  1.15      +98 -106   jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StandardServerMBean.java	2 May 2002 17:45:43 -0000	1.14
  +++ StandardServerMBean.java	2 May 2002 19:32:28 -0000	1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
1.14 2002/05/02 17:45:43 craigmcc Exp $
  - * $Revision: 1.14 $
  - * $Date: 2002/05/02 17:45:43 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
1.15 2002/05/02 19:32:28 amyroh Exp $
  + * $Revision: 1.15 $
  + * $Date: 2002/05/02 19:32:28 $
    *
    * ====================================================================
    *
  @@ -113,7 +113,7 @@
    * <code>org.apache.catalina.core.StandardServer</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.14 $ $Date: 2002/05/02 17:45:43 $
  + * @version $Revision: 1.15 $ $Date: 2002/05/02 19:32:28 $
    */
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -595,61 +595,59 @@
           
           // Store nested <Resources> element
           ContextResource[] resources = context.findResources();
  -         for (int i = 0; i < resources.length; i++) {
  +        for (int i = 0; i < resources.length; i++) {
               for (int j = 0; j < indent + 2; j++) {
                   writer.print(' ');
               }
               writer.print("<Resource");
               storeAttributes(writer, false, resources[i]);
               writer.println("/>");
  -        }           
           
  -        // Store nested <ResourceParams> elements
  -        NamingResources namingResources = context.getNamingResources();
  -        ResourceParams[] params = namingResources.findResourceParams();            
  -        for (int i = 0; i < indent + 2; i++) {
  -            writer.print(' ');
  -        }
  -        if (params.length > 0) {
  -            writer.print("<ResourceParams ");
  -        }
  -        for (int i = 0; i < params.length; i++) {
  -            storeAttributes(writer, false, params[i]);
  -        }
  -        writer.println(">");
  - 
  -        for (int i = 0; i < params.length; i++) {
  -            Hashtable resourceParams = params[i].getParameters();
  -            Enumeration nameEnum = resourceParams.keys();
  -            Enumeration valueEnum = resourceParams.elements();
  -            while ((nameEnum.hasMoreElements()) && (valueEnum.hasMoreElements()))
{      
  -                for (int j = 0; j < indent + 4; j++) {
  -                    writer.print(' ');
  -                }                
  -                writer.println("<parameter>");
  -                for (int j = 0; j < indent + 6; j++) {
  -                    writer.print(' ');
  -                }               
  -                writer.print("<name>");
  -                writer.print(nameEnum.nextElement());
  -                writer.println("</name>"); 
  -                for (int j = 0; j < indent + 6; j++) {
  -                    writer.print(' ');
  -                }               
  -                writer.print("<value>"); 
  -                writer.print(valueEnum.nextElement());
  -                writer.println("</value>");         
  -                for (int j = 0; j < indent + 4; j++) {
  -                    writer.print(' ');
  -                }               
  -                writer.println("</parameter>");      
  +            // Store nested <ResourceParams> elements
  +            NamingResources namingResources = context.getNamingResources();
  +            ResourceParams[] params = namingResources.findResourceParams();  
  +            for (int j = 0; j < params.length; j++ ) {
  +                if (resources[i].getName().equals(params[j].getName())) {
  +                    for (int k = 0; k < indent + 2; k++) {
  +                        writer.print(' ');
  +                    }
  +                    writer.print("<ResourceParams ");
  +                    storeAttributes(writer, false, params[j]);
  +                    writer.println(">");
  +                    Hashtable resourceParams = params[j].getParameters();
  +                    Enumeration nameEnum = resourceParams.keys();
  +                    Enumeration valueEnum = resourceParams.elements();
  +                    while ((nameEnum.hasMoreElements()) && 
  +                                    (valueEnum.hasMoreElements())) {      
  +                        for (int k = 0; k < indent + 4; k++) {
  +                            writer.print(' ');
  +                        }                
  +                        writer.println("<parameter>");
  +                        for (int k = 0; k < indent + 6; k++) {
  +                            writer.print(' ');
  +                        }               
  +                        writer.print("<name>");
  +                        writer.print(nameEnum.nextElement());
  +                        writer.println("</name>"); 
  +                        for (int k = 0; k < indent + 6; k++) {
  +                            writer.print(' ');
  +                        }               
  +                        writer.print("<value>"); 
  +                        writer.print(valueEnum.nextElement());
  +                        writer.println("</value>");         
  +                        for (int k = 0; k < indent + 4; k++) {
  +                            writer.print(' ');
  +                        }               
  +                        writer.println("</parameter>");      
  +                    }
  +                    for (int k = 0; k < indent + 2; k++) {
  +                        writer.print(' ');
  +                    }          
  +                    writer.println("</ResourceParams>");
  +                }
               }
           }
           
  -        for (int i = 0; i < indent + 2; i++) {
  -            writer.print(' ');
  -        }          
  -        writer.println("</ResourceParams>");      
           
           // Store nested <ResourceLink> elements
           ContextResourceLink[] resourceLinks = context.findResourceLinks();
  @@ -840,69 +838,63 @@
               storeAttributes(writer, false, envs[i]);
           }
           writer.println("/>");
  -
  -        for (int i = 0; i < indent + 2; i++) {
  -            writer.print(' ');
  -        }                
  +                
           // Store nested <Resource> elements
           ContextResource[] resources = globalNamingResources.findResources();
  -        if (resources.length > 0) {
  -            writer.print("<Resource");
  -        }
           for (int i = 0; i < resources.length; i++) {
  +            for (int j = 0; j < indent + 2; j++) {
  +                writer.print(' ');
  +            }
  +            writer.print("<Resource");
               storeAttributes(writer, false, resources[i]);
  -        }
  -        writer.println(">");
  -        for (int i = 0; i < indent + 2; i++) {
  -            writer.print(' ');
  -        }          
  -        writer.println("</Resource>");
  -        
  -        for (int i = 0; i < indent + 2; i++) {
  -            writer.print(' ');
  -        }          
  -        // Store nested <ResourceParams> elements
  -        ResourceParams[] params = globalNamingResources.findResourceParams();
  -        if (params.length > 0) {
  -            writer.print("<ResourceParams ");
  -        }
  -        for (int i = 0; i < params.length; i++) {
  -            storeAttributes(writer, false, params[i]);
  -        }
  -        writer.println(">");
  - 
  -        for (int i = 0; i < params.length; i++) {
  -            Hashtable resourceParams = params[i].getParameters();
  -            Enumeration nameEnum = resourceParams.keys();
  -            Enumeration valueEnum = resourceParams.elements();
  -            while ((nameEnum.hasMoreElements()) && (valueEnum.hasMoreElements()))
{      
  -                for (int j = 0; j < indent + 4; j++) {
  -                    writer.print(' ');
  -                }                
  -                writer.println("<parameter>");
  -                for (int j = 0; j < indent + 6; j++) {
  -                    writer.print(' ');
  -                }               
  -                writer.print("<name>");
  -                writer.print(nameEnum.nextElement());
  -                writer.println("</name>"); 
  -                for (int j = 0; j < indent + 6; j++) {
  -                    writer.print(' ');
  -                }               
  -                writer.print("<value>"); 
  -                writer.print(valueEnum.nextElement());
  -                writer.println("</value>");         
  -                for (int j = 0; j < indent + 4; j++) {
  -                    writer.print(' ');
  -                }               
  -                writer.println("</parameter>");      
  +            writer.println(">");
  +            for (int j = 0; j < indent + 2; j++) {
  +                writer.print(' ');
  +            }          
  +            writer.println("</Resource>");
  +            
  +            // Store nested <ResourceParams> elements
  +            ResourceParams[] params = globalNamingResources.findResourceParams();
  +            for (int j = 0; j < params.length; j++) {
  +                if (resources[i].getName().equals(params[j].getName())) {        
  +                    for (int k = 0; k < indent + 2; k++) {
  +                        writer.print(' ');
  +                    }
  +                    writer.print("<ResourceParams");
  +                    storeAttributes(writer, false, params[j]);
  +                    writer.println(">");
  +                    Hashtable resourceParams = params[j].getParameters();
  +                    Enumeration nameEnum = resourceParams.keys();
  +                    Enumeration valueEnum = resourceParams.elements();
  +                    while ((nameEnum.hasMoreElements()) && (valueEnum.hasMoreElements()))
{      
  +                        for (int k = 0; k < indent + 4; k++) {
  +                            writer.print(' ');
  +                        }                
  +                        writer.println("<parameter>");
  +                        for (int k = 0; k < indent + 6; k++) {
  +                            writer.print(' ');
  +                        }               
  +                        writer.print("<name>");
  +                        writer.print(nameEnum.nextElement());
  +                        writer.println("</name>"); 
  +                        for (int k = 0; k < indent + 6; k++) {
  +                            writer.print(' ');
  +                        }               
  +                        writer.print("<value>"); 
  +                        writer.print(valueEnum.nextElement());
  +                        writer.println("</value>");         
  +                        for (int k = 0; k < indent + 4; k++) {
  +                            writer.print(' ');
  +                        }               
  +                        writer.println("</parameter>");      
  +                    }
  +                    for (int k = 0; k < indent + 2; k++) {
  +                        writer.print(' ');
  +                    }          
  +                    writer.println("</ResourceParams>");
  +                }
               }
           }
  -        
  -        for (int i = 0; i < indent + 2; i++) {
  -            writer.print(' ');
  -        }          
  -        writer.println("</ResourceParams>");
           
           // Store the ending of this element
           for (int i = 0; i < indent; i++) {
  
  
  

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