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/startup NamingRuleSet.java
Date Thu, 02 May 2002 22:14:46 GMT
craigmcc    02/05/02 15:14:45

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardEngine.java StandardHost.java
               catalina/src/share/org/apache/catalina/mbeans
                        StandardServerMBean.java
               catalina/src/share/org/apache/catalina/startup
                        NamingRuleSet.java
  Log:
  Refactor storing of resource related information (under <GlobalJNDIResources>
  and <Context> elements) into a shared common method.
  
  Remaining issues for 100% reproducible configuration:
  
  * StandardDefaultContext needs to be refactored to use a NamingResources
    instance underneath (like StandardContext does) in order to save
    resource definitions nested inside <DefaultContext>.
  
  * Need to create o.a.c.deploy.ContextResourceEnvRef and the associated
    handling of <ResourceEnvRef> elements so that such things can be
    registered and saved in naming resources.
  
  * Currently, resources that are defined only in web.xml (such as
    <env-entry> settings) are saved to server.xml as well, instead of
    only the things that originally came from server.xml.  Generally,
    this is benign (because updating values in web.xml will override
    the stored values), but we should really only be saving the stuff
    that was originally configured here.
  
  Once these items are addressed, changes made via the admin webapp (or other
  dynamic changes, such as applications deployed via the manager webapp) will
  be persisted across Tomcat restarts.
  
  Revision  Changes    Path
  1.15      +12 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java
  
  Index: StandardEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StandardEngine.java	6 Mar 2002 06:49:11 -0000	1.14
  +++ StandardEngine.java	2 May 2002 22:14:45 -0000	1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
1.14 2002/03/06 06:49:11 craigmcc Exp $
  - * $Revision: 1.14 $
  - * $Date: 2002/03/06 06:49:11 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
1.15 2002/05/02 22:14:45 craigmcc Exp $
  + * $Revision: 1.15 $
  + * $Date: 2002/05/02 22:14:45 $
    *
    * ====================================================================
    *
  @@ -86,7 +86,7 @@
    * fully qualified host name of that virtual host.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.14 $ $Date: 2002/03/06 06:49:11 $
  + * @version $Revision: 1.15 $ $Date: 2002/05/02 22:14:45 $
    */
   
   public class StandardEngine
  @@ -217,6 +217,14 @@
           support.firePropertyChange("defaultContext",
                                      oldDefaultContext, this.defaultContext);
   
  +    }
  +
  +
  +    /**
  +     * Retrieve the DefaultContext for new web applications.
  +     */
  +    public DefaultContext getDefaultContext() {
  +        return (this.defaultContext);
       }
   
   
  
  
  
  1.27      +12 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java
  
  Index: StandardHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- StandardHost.java	20 Mar 2002 12:29:55 -0000	1.26
  +++ StandardHost.java	2 May 2002 22:14:45 -0000	1.27
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
1.26 2002/03/20 12:29:55 glenn Exp $
  - * $Revision: 1.26 $
  - * $Date: 2002/03/20 12:29:55 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
1.27 2002/05/02 22:14:45 craigmcc Exp $
  + * $Revision: 1.27 $
  + * $Date: 2002/05/02 22:14:45 $
    *
    * ====================================================================
    *
  @@ -95,7 +95,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.26 $ $Date: 2002/03/20 12:29:55 $
  + * @version $Revision: 1.27 $ $Date: 2002/05/02 22:14:45 $
    */
   
   public class StandardHost
  @@ -309,6 +309,14 @@
           support.firePropertyChange("defaultContext",
                                      oldDefaultContext, this.defaultContext);
   
  +    }
  +
  +
  +    /**
  +     * Retrieve the DefaultContext for new web applications.
  +     */
  +    public DefaultContext getDefaultContext() {
  +        return (this.defaultContext);
       }
   
   
  
  
  
  1.17      +319 -183  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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- StandardServerMBean.java	2 May 2002 20:08:31 -0000	1.16
  +++ StandardServerMBean.java	2 May 2002 22:14:45 -0000	1.17
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
1.16 2002/05/02 20:08:31 craigmcc Exp $
  - * $Revision: 1.16 $
  - * $Date: 2002/05/02 20:08:31 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
1.17 2002/05/02 22:14:45 craigmcc Exp $
  + * $Revision: 1.17 $
  + * $Date: 2002/05/02 22:14:45 $
    *
    * ====================================================================
    *
  @@ -84,6 +84,7 @@
   import org.apache.catalina.Connector;
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
  +import org.apache.catalina.DefaultContext;
   import org.apache.catalina.Engine;
   import org.apache.catalina.Host;
   import org.apache.catalina.Lifecycle;
  @@ -98,8 +99,12 @@
   import org.apache.catalina.Service;
   import org.apache.catalina.Store;
   import org.apache.catalina.Valve;
  +import org.apache.catalina.core.StandardEngine;
  +import org.apache.catalina.core.StandardHost;
   import org.apache.catalina.deploy.ApplicationParameter;
   import org.apache.catalina.deploy.NamingResources;
  +import org.apache.catalina.deploy.ContextEjb;
  +import org.apache.catalina.deploy.ContextLocalEjb;
   import org.apache.catalina.deploy.ContextResource;
   import org.apache.catalina.deploy.ContextResourceLink;
   import org.apache.catalina.deploy.ContextEnvironment;
  @@ -115,7 +120,7 @@
    * <code>org.apache.catalina.core.StandardServer</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.16 $ $Date: 2002/05/02 20:08:31 $
  + * @version $Revision: 1.17 $ $Date: 2002/05/02 22:14:45 $
    */
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -485,6 +490,9 @@
                   listeners = new LifecycleListener[0];
               }
               for (int i = 0; i < listeners.length; i++) {
  +                if (listeners[i] instanceof ServerLifecycleListener) {
  +                    continue;
  +                }
                   storeListener(writer, indent + 2, listeners[i]);
               }
           }
  @@ -534,6 +542,9 @@
               LifecycleListener listeners[] =
                   ((Lifecycle) context).findLifecycleListeners();
               for (int i = 0; i < listeners.length; i++) {
  +                if (listeners[i] instanceof ServerLifecycleListener) {
  +                    continue;
  +                }
                   storeListener(writer, indent + 2, listeners[i]);
               }
           }
  @@ -562,17 +573,6 @@
               storeManager(writer, indent + 2, manager);
           }
   
  -        // Store neste <Environment> elements
  -        ContextEnvironment[] envs = context.findEnvironments();
  -        for (int i = 0; i < envs.length; i++) {
  -            for (int j = 0; j < indent + 2; j++) {
  -                writer.print(' ');
  -            }
  -            writer.print("<Environment");
  -            storeAttributes(writer, false, envs[i]);
  -            writer.println("/>");
  -        }
  -        
           // Store nested <Parameter> elements
           ApplicationParameter[] appParams = context.findApplicationParameters();
           for (int i = 0; i < appParams.length; i++) {
  @@ -602,84 +602,163 @@
               storeResources(writer, indent + 2, resources);
           }
   
  -        /*
  -        ContextResource[] resources = context.findResources();
  -        for (int i = 0; i < resources.length; i++) {
  -            for (int j = 0; j < indent + 2; j++) {
  +        // Store nested <Valve> elements
  +        if (context instanceof Pipeline) {
  +            Valve valves[] = ((Pipeline) context).getValves();
  +            for (int i = 0; i < valves.length; i++) {
  +                storeValve(writer, indent + 2, valves[i]);
  +            }
  +        }
  +
  +        // Store nested <WrapperLifecycle> elements
  +        String wLifecycles[] = context.findWrapperLifecycles();
  +        for (int i = 0; i < wLifecycles.length; i++) {
  +            for (int j = 0; j < indent; 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 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>");
  +            writer.print("<WrapperLifecycle>");
  +            writer.print(wLifecycles[i]);
  +            writer.println("</WrapperLifecycle>");
  +        }
  +
  +        // Store nested <WrapperListener> elements
  +        String wListeners[] = context.findWrapperListeners();
  +        for (int i = 0; i < wListeners.length; i++) {
  +            for (int j = 0; j < indent; j++) {
  +                writer.print(' ');
  +            }
  +            writer.print("<WrapperListener>");
  +            writer.print(wListeners[i]);
  +            writer.println("</WrapperListener>");
  +        }
  +
  +        // Store nested naming resources elements
  +        NamingResources nresources = context.getNamingResources();
  +        if (nresources != null) {
  +            storeNamingResources(writer, indent + 2, nresources);
  +        }
  +
  +        // Store the ending of this element
  +        for (int i = 0; i < indent; i++) {
  +            writer.print(' ');
  +        }
  +        writer.println("</Context>");
  +
  +    }
  +
  +
  +    /**
  +     * Store the specified DefaultContext properties.
  +     *
  +     * @param writer PrintWriter to which we are storing
  +     * @param indent Number of spaces to indent this element
  +     * @param dcontext  Object whose properties are being stored
  +     *
  +     * @exception Exception if an exception occurs while storing
  +     */
  +    private void storeDefaultContext(PrintWriter writer, int indent,
  +                                     DefaultContext dcontext)
  +        throws Exception {
  +
  +        // Store the beginning of this element
  +        for (int i = 0; i < indent; i++) {
  +            writer.print(' ');
  +        }
  +        writer.print("<DefaultContext");
  +        storeAttributes(writer, dcontext);
  +        writer.println(">");
  +
  +        // Store nested <InstanceListener> elements
  +        String iListeners[] = dcontext.findInstanceListeners();
  +        for (int i = 0; i < iListeners.length; i++) {
  +            for (int j = 0; j < indent; j++) {
  +                writer.print(' ');
  +            }
  +            writer.print("<InstanceListener>");
  +            writer.print(iListeners[i]);
  +            writer.println("</InstanceListener>");
  +        }
  +
  +        // Store nested <Listener> elements
  +        if (dcontext instanceof Lifecycle) {
  +            LifecycleListener listeners[] =
  +                ((Lifecycle) dcontext).findLifecycleListeners();
  +            for (int i = 0; i < listeners.length; i++) {
  +                if (listeners[i] instanceof ServerLifecycleListener) {
  +                    continue;
                   }
  +                storeListener(writer, indent + 2, listeners[i]);
  +            }
  +        }
  +
  +        // Store nested <Loader> element
  +        Loader loader = dcontext.getLoader();
  +        if (loader != null) {
  +            storeLoader(writer, indent + 2, loader);
  +        }
  +
  +        // Store nested <Logger> element
  +        /* Nested logger not currently supported on DefaultContext
  +        Logger logger = dcontext.getLogger();
  +        if (logger != null) {
  +            Logger parentLogger = null;
  +            if (dcontext.getParent() != null) {
  +                parentLogger = dcontext.getParent().getLogger();
  +            }
  +            if (logger != parentLogger) {
  +                storeLogger(writer, indent + 2, logger);
               }
           }
           */
  -        
  -        
  -        // Store nested <ResourceLink> elements
  -        ContextResourceLink[] resourceLinks = context.findResourceLinks();
  -        for (int i = 0; i < resourceLinks.length; i++) {
  +
  +        // Store nested <Manager> element
  +        Manager manager = dcontext.getManager();
  +        if (manager != null) {
  +            storeManager(writer, indent + 2, manager);
  +        }
  +
  +        // Store nested <Parameter> elements
  +        ApplicationParameter[] appParams =
  +            dcontext.findApplicationParameters();
  +        for (int i = 0; i < appParams.length; i++) {
               for (int j = 0; j < indent + 2; j++) {
                   writer.print(' ');
               }
  -            writer.print("<ResourceLink");
  -            storeAttributes(writer, false, resourceLinks[i]);
  +            writer.print("<Parameter");
  +            storeAttributes(writer, false, appParams[i]);
               writer.println("/>");
  -        }       
  +        }
  +
  +        // Store nested <Realm> element
  +        /* Nested realm not currently supported on DefaultContext
  +        Realm realm = dcontext.getRealm();
  +        if (realm != null) {
  +            Realm parentRealm = null;
  +            if (dcontext.getParent() != null) {
  +                parentRealm = dcontext.getParent().getRealm();
  +            }
  +            if (realm != parentRealm) {
  +                storeRealm(writer, indent + 2, realm);
  +            }
  +        }
  +        */
  +        
  +        // Store nested <Resources> element
  +        DirContext resources = dcontext.getResources();
  +        if (resources != null) {
  +            storeResources(writer, indent + 2, resources);
  +        }
   
           // Store nested <Valve> elements
  -        if (context instanceof Pipeline) {
  -            Valve valves[] = ((Pipeline) context).getValves();
  +        if (dcontext instanceof Pipeline) {
  +            Valve valves[] = ((Pipeline) dcontext).getValves();
               for (int i = 0; i < valves.length; i++) {
                   storeValve(writer, indent + 2, valves[i]);
               }
           }
   
           // Store nested <WrapperLifecycle> elements
  -        String wLifecycles[] = context.findWrapperLifecycles();
  +        String wLifecycles[] = dcontext.findWrapperLifecycles();
           for (int i = 0; i < wLifecycles.length; i++) {
               for (int j = 0; j < indent; j++) {
                   writer.print(' ');
  @@ -690,7 +769,7 @@
           }
   
           // Store nested <WrapperListener> elements
  -        String wListeners[] = context.findWrapperListeners();
  +        String wListeners[] = dcontext.findWrapperListeners();
           for (int i = 0; i < wListeners.length; i++) {
               for (int j = 0; j < indent; j++) {
                   writer.print(' ');
  @@ -704,7 +783,7 @@
           for (int i = 0; i < indent; i++) {
               writer.print(' ');
           }
  -        writer.println("</Context>");
  +        writer.println("</DefaultContext>");
   
       }
   
  @@ -729,11 +808,14 @@
           storeAttributes(writer, engine);
           writer.println(">");
   
  -        // Store nested <Default> element
  -        ; // FIXME
  -
           // Store nested <DefaultContext> element
  -        ; // FIXME
  +        if (engine instanceof StandardEngine) {
  +            DefaultContext dcontext =
  +                ((StandardEngine) engine).getDefaultContext();
  +            if (dcontext != null) {
  +                storeDefaultContext(writer, indent + 2, dcontext);
  +            }
  +        }
   
           // Store nested <Host> elements (or other relevant containers)
           Container children[] = engine.findChildren();
  @@ -752,6 +834,9 @@
               LifecycleListener listeners[] =
                   ((Lifecycle) engine).findLifecycleListeners();
               for (int i = 0; i < listeners.length; i++) {
  +                if (listeners[i] instanceof ServerLifecycleListener) {
  +                    continue;
  +                }
                   storeListener(writer, indent + 2, listeners[i]);
               }
           }
  @@ -820,102 +905,6 @@
   
       
       /**
  -     * Store the specified GlobalNamingResources properties.
  -     *
  -     * @param writer PrintWriter to which we are storing
  -     * @param indent Number of spaces to indent this element
  -     * @param resources Object whose properties are being stored
  -     *
  -     * @exception Exception if an exception occurs while storing
  -     */
  -    private void storeGlobalNamingResources(PrintWriter writer, int indent,
  -                              NamingResources globalNamingResources) throws Exception {
  -       
  -        for (int i = 0; i < indent; i++) {
  -            writer.print(' ');
  -        }
  -        writer.println("<GlobalNamingResources>");
  -        
  -        for (int i = 0; i < indent + 2; i++) {
  -            writer.print(' ');
  -        }        
  -        // Store nested <Environment> elements
  -        ContextEnvironment[] envs = globalNamingResources.findEnvironments();
  -        if (envs.length > 0) {
  -            writer.print("<Environment");
  -        }
  -        for (int i = 0; i < envs.length; i++) {
  -            storeAttributes(writer, false, envs[i]);
  -        }
  -        writer.println("/>");
  -                
  -        // Store nested <Resource> elements
  -        ContextResource[] resources = globalNamingResources.findResources();
  -        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 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>");
  -                }
  -            }
  -        }
  -        
  -        // Store the ending of this element
  -        for (int i = 0; i < indent; i++) {
  -            writer.print(' ');
  -        }          
  -        writer.println("</GlobalNamingResources>");                           
  -                                  
  -    }
  -    
  -    
  -    /**
        * Store the specified Host properties.
        *
        * @param writer PrintWriter to which we are storing
  @@ -961,17 +950,31 @@
               }
           }
   
  -        // Store nested <Default> element
  -        ; // FIXME
  -
           // Store nested <DefaultContext> element
  -        ; // FIXME
  +        if (host instanceof StandardHost) {
  +            DefaultContext dcontext =
  +                ((StandardHost) host).getDefaultContext();
  +            if (dcontext != null) {
  +                Container parent = host.getParent();
  +                if ((parent != null) &&
  +                    (parent instanceof StandardEngine)) {
  +                    DefaultContext pcontext =
  +                        ((StandardEngine) parent).getDefaultContext();
  +                    if (dcontext != pcontext) {
  +                        storeDefaultContext(writer, indent + 2, dcontext);
  +                    }
  +                }
  +            }
  +        }
   
           // Store nested <Listener> elements
           if (host instanceof Lifecycle) {
               LifecycleListener listeners[] =
                   ((Lifecycle) host).findLifecycleListeners();
               for (int i = 0; i < listeners.length; i++) {
  +                if (listeners[i] instanceof ServerLifecycleListener) {
  +                    continue;
  +                }
                   storeListener(writer, indent + 2, listeners[i]);
               }
           }
  @@ -1125,6 +1128,124 @@
   
   
       /**
  +     * Store the specified NamingResources properties.
  +     *
  +     * @param writer PrintWriter to which we are storing
  +     * @param indent Number of spaces to indent this element
  +     * @param resources Object whose properties are being stored
  +     *
  +     * @exception Exception if an exception occurs while storing
  +     */
  +    private void storeNamingResources(PrintWriter writer, int indent,
  +                                      NamingResources resources)
  +        throws Exception {
  +       
  +        // Store nested <Ejb> elements
  +        ContextEjb[] ejbs = resources.findEjbs();
  +        if (ejbs.length > 0) {
  +            for (int i = 0; i < ejbs.length; i++) {
  +                for (int j = 0; j < indent; j++) {
  +                    writer.print(' ');
  +                }
  +                writer.print("<Ejb");
  +                storeAttributes(writer, false, ejbs[i]);
  +                writer.println("/>");
  +            }
  +        }
  +                
  +        // Store nested <Environment> elements
  +        ContextEnvironment[] envs = resources.findEnvironments();
  +        if (envs.length > 0) {
  +            for (int i = 0; i < envs.length; i++) {
  +                for (int j = 0; j < indent; j++) {
  +                    writer.print(' ');
  +                }
  +                writer.print("<Environment");
  +                storeAttributes(writer, false, envs[i]);
  +                writer.println("/>");
  +            }
  +        }
  +                
  +        // Store nested <LocalEjb> elements
  +        ContextLocalEjb[] lejbs = resources.findLocalEjbs();
  +        if (lejbs.length > 0) {
  +            for (int i = 0; i < lejbs.length; i++) {
  +                for (int j = 0; j < indent; j++) {
  +                    writer.print(' ');
  +                }
  +                writer.print("<LocalEjb");
  +                storeAttributes(writer, false, lejbs[i]);
  +                writer.println("/>");
  +            }
  +        }
  +                
  +        // Store nested <Resource> elements
  +        ContextResource[] dresources = resources.findResources();
  +        for (int i = 0; i < dresources.length; i++) {
  +            for (int j = 0; j < indent; j++) {
  +                writer.print(' ');
  +            }
  +            writer.print("<Resource");
  +            storeAttributes(writer, false, dresources[i]);
  +            writer.println("/>");
  +        }
  +
  +        // Store nested <ResourceParams> elements
  +        ResourceParams[] params = resources.findResourceParams();
  +        for (int i = 0; i < params.length; i++) {
  +            for (int j = 0; j < indent; j++) {
  +                writer.print(' ');
  +            }
  +            writer.print("<ResourceParams");
  +            storeAttributes(writer, false, params[i]);
  +            writer.println(">");
  +            Hashtable resourceParams = params[i].getParameters();
  +            Enumeration nameEnum = resourceParams.keys();
  +            while (nameEnum.hasMoreElements()) {
  +                String name = (String) nameEnum.nextElement();
  +                String value = (String) resourceParams.get(name);
  +                for (int j = 0; j < indent + 2; j++) {
  +                    writer.print(' ');
  +                }
  +                writer.println("<parameter>");
  +                for (int j = 0; j < indent + 4; j++) {
  +                    writer.print(' ');
  +                }
  +                writer.print("<name>");
  +                writer.print(name);
  +                writer.println("</name>");
  +                for (int j = 0; j < indent + 4; j++) {
  +                    writer.print(' ');
  +                }
  +                writer.print("<value>");
  +                writer.print(value);
  +                writer.println("</value>");
  +                for (int j = 0; j < indent + 2; j++) {
  +                    writer.print(' ');
  +                }
  +                writer.println("</parameter>");
  +            }
  +            for (int j = 0; j < indent; j++) {
  +                writer.print(' ');
  +            }
  +            writer.println("</ResourceParams>");
  +        }
  +
  +        // Store nested <ResourceLink> elements
  +        ContextResourceLink[] resourceLinks = resources.findResourceLinks();
  +        for (int i = 0; i < resourceLinks.length; i++) {
  +            for (int j = 0; j < indent; j++) {
  +                writer.print(' ');
  +            }
  +            writer.print("<ResourceLink");
  +            storeAttributes(writer, false, resourceLinks[i]);
  +            writer.println("/>");
  +        }       
  +
  +    }
  +    
  +    
  +    /**
        * Store the specified Realm properties.
        *
        * @param writer PrintWriter to which we are storing
  @@ -1161,6 +1282,9 @@
           if (resources instanceof org.apache.naming.resources.FileDirContext) {
               return;
           }
  +        if (resources instanceof org.apache.naming.resources.ProxyDirContext) {
  +            return;
  +        }
           if (resources instanceof org.apache.naming.resources.WARDirContext) {
               return;
           }
  @@ -1205,9 +1329,18 @@
           }
   
           // Store nested <GlobalNamingResources> element
  -        NamingResources globalNamingResources = server.getGlobalNamingResources();
  +        NamingResources globalNamingResources =
  +            server.getGlobalNamingResources();
           if (globalNamingResources != null) {
  -            storeGlobalNamingResources(writer, indent + 2, globalNamingResources);
  +            for (int i = 0; i < indent + 2; i++) {
  +                writer.print(' ');
  +            }
  +            writer.println("<GlobalNamingResources>");
  +            storeNamingResources(writer, indent + 4, globalNamingResources);
  +            for (int i = 0; i < indent + 2; i++) {
  +                writer.print(' ');
  +            }
  +            writer.println("</GlobalNamingResources>");
           }
           
           // Store nested <Service> elements
  @@ -1268,6 +1401,9 @@
               LifecycleListener listeners[] =
                   ((Lifecycle) service).findLifecycleListeners();
               for (int i = 0; i < listeners.length; i++) {
  +                if (listeners[i] instanceof ServerLifecycleListener) {
  +                    continue;
  +                }
                   storeListener(writer, indent + 2, listeners[i]);
               }
           }
  
  
  
  1.2       +9 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/NamingRuleSet.java
  
  Index: NamingRuleSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/NamingRuleSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NamingRuleSet.java	7 Nov 2001 05:25:34 -0000	1.1
  +++ NamingRuleSet.java	2 May 2002 22:14:45 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/NamingRuleSet.java,v
1.1 2001/11/07 05:25:34 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/11/07 05:25:34 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/NamingRuleSet.java,v
1.2 2002/05/02 22:14:45 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/05/02 22:14:45 $
    *
    * ====================================================================
    *
  @@ -82,7 +82,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.1 $ $Date: 2001/11/07 05:25:34 $
  + * @version $Revision: 1.2 $ $Date: 2002/05/02 22:14:45 $
    */
   
   public class NamingRuleSet extends RuleSetBase {
  @@ -155,8 +155,12 @@
                               "addEnvironment",
                               "org.apache.catalina.deploy.ContextEnvironment");
   
  -        digester.addCallMethod(prefix + "InstanceListener",
  -                               "addInstanceListener", 0);
  +        digester.addObjectCreate(prefix + "LocalEjb",
  +                                 "org.apache.catalina.deploy.ContextLocalEjb");
  +        digester.addSetProperties(prefix + "LocalEjb");
  +        digester.addSetNext(prefix + "LocalEjb",
  +                            "addLocalEjb",
  +                            "org.apache.catalina.deploy.ContextLocalEjb");
   
           digester.addObjectCreate(prefix + "Resource",
                                    "org.apache.catalina.deploy.ContextResource");
  
  
  

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