amyroh      2002/09/20 14:22:32

  Modified:    catalina/src/share/org/apache/catalina DefaultContext.java
                        Loader.java Manager.java
               catalina/src/share/org/apache/catalina/core
                        StandardDefaultContext.java
               catalina/src/share/org/apache/catalina/loader
                        WebappLoader.java
               catalina/src/share/org/apache/catalina/mbeans
                        MBeanFactory.java MBeanUtils.java
                        ServerLifecycleListener.java
               catalina/src/share/org/apache/catalina/session
                        ManagerBase.java
  Log:
  Port support for Loader and Manager in DefaultContext admin.
  
  Revision  Changes    Path
  1.3       +21 -4     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/DefaultContext.java
  
  Index: DefaultContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/DefaultContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultContext.java       16 Sep 2002 04:45:38 -0000      1.2
  +++ DefaultContext.java       20 Sep 2002 21:22:31 -0000      1.3
  @@ -64,6 +64,7 @@
   
   package org.apache.catalina;
   
  +import java.beans.PropertyChangeListener;
   import javax.naming.directory.DirContext;
   import org.apache.catalina.deploy.ApplicationParameter;
   import org.apache.catalina.deploy.ContextEjb;
  @@ -329,6 +330,14 @@
   
   
       /**
  +     * Add a property change listener to this component.
  +     *
  +     * @param listener The listener to add
  +     */
  +    public void addPropertyChangeListener(PropertyChangeListener listener);
  +
  +
  +    /**
        * Add a resource reference for this web application.
        *
        * @param resource New resource reference
  @@ -562,6 +571,14 @@
        * @param name Name of the parameter to remove
        */
       public void removeParameter(String name);
  +
  +    
  +    /**
  +     * Remove a property change listener from this component.
  +     *
  +     * @param listener The listener to remove
  +     */
  +    public void removePropertyChangeListener(PropertyChangeListener listener);
   
   
       /**
  
  
  
  1.2       +19 -4     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Loader.java
  
  Index: Loader.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Loader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Loader.java       18 Jul 2002 16:47:38 -0000      1.1
  +++ Loader.java       20 Sep 2002 21:22:31 -0000      1.2
  @@ -126,6 +126,21 @@
   
   
       /**
  +     * Return the DefaultContext with which this Manager is associated.
  +     */
  +    public DefaultContext getDefaultContext();
  +
  +
  +    /**
  +     * Set the DefaultContext with which this Manager is associated.
  +     *
  +     * @param defaultContext The newly associated DefaultContext
  +     */
  +    public void setDefaultContext(DefaultContext defaultContext);
  +    
  +        
  +    
  +    /**
        * Return the "follow standard delegation model" flag used to configure
        * our ClassLoader.
        */
  
  
  
  1.2       +18 -4     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Manager.java      18 Jul 2002 16:47:38 -0000      1.1
  +++ Manager.java      20 Sep 2002 21:22:31 -0000      1.2
  @@ -110,6 +110,20 @@
   
   
       /**
  +     * Return the DefaultContext with which this Manager is associated.
  +     */
  +    public DefaultContext getDefaultContext();
  +
  +
  +    /**
  +     * Set the DefaultContext with which this Manager is associated.
  +     *
  +     * @param defaultContext The newly associated DefaultContext
  +     */
  +    public void setDefaultContext(DefaultContext defaultContext);
  +
  +
  +    /**
        * Return the distributable flag for the sessions supported by
        * this Manager.
        */
  
  
  
  1.2       +28 -4     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java
  
  Index: StandardDefaultContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StandardDefaultContext.java       18 Jul 2002 16:48:11 -0000      1.1
  +++ StandardDefaultContext.java       20 Sep 2002 21:22:31 -0000      1.2
  @@ -632,6 +632,18 @@
   
   
       /**
  +     * Add a property change listener to this component.
  +     *
  +     * @param listener The listener to add
  +     */
  +    public void addPropertyChangeListener(PropertyChangeListener listener) {
  +
  +        support.addPropertyChangeListener(listener);
  +
  +    }
  +    
  +    
  +    /**
        * Add a resource reference for this web application.
        *
        * @param resource New resource reference
  @@ -1080,6 +1092,18 @@
       }
   
   
  +    /**
  +     * Remove a property change listener from this component.
  +     *
  +     * @param listener The listener to remove
  +     */
  +    public void removePropertyChangeListener(PropertyChangeListener listener) {
  +
  +        support.removePropertyChangeListener(listener);
  +
  +    }
  +    
  +    
       /**
        * Remove any resource reference with the specified name.
        *
  
  
  
  1.4       +35 -6     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WebappLoader.java 24 Aug 2002 02:27:27 -0000      1.3
  +++ WebappLoader.java 20 Sep 2002 21:22:31 -0000      1.4
  @@ -93,6 +93,7 @@
   import org.apache.naming.resources.DirContextURLStreamHandlerFactory;
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
  +import org.apache.catalina.DefaultContext;
   import org.apache.catalina.Globals;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
  @@ -181,6 +182,12 @@
   
   
       /**
  +     * The DefaultContext with which this Loader is associated.
  +     */
  +    protected DefaultContext defaultContext = null;
  +    
  +    
  +    /**
        * The "follow standard delegation model" flag that will be used to
        * configure our ClassLoader.
        */
  @@ -339,6 +346,30 @@
   
   
       /**
  +     * Return the DefaultContext with which this Loader is associated.
  +     */
  +    public DefaultContext getDefaultContext() {
  +
  +        return (this.defaultContext);
  +
  +    }
  +
  +
  +    /**
  +     * Set the DefaultContext with which this Loader is associated.
  +     *
  +     * @param defaultContext The newly associated DefaultContext
  +     */
  +    public void setDefaultContext(DefaultContext defaultContext) {
  +
  +        DefaultContext oldDefaultContext = this.defaultContext;
  +        this.defaultContext = defaultContext;
  +        support.firePropertyChange("defaultContext", oldDefaultContext, 
this.defaultContext);
  +
  +    }
  +
  +
  +    /**
        * Return the debugging detail level for this component.
        */
       public int getDebug() {
  @@ -1349,5 +1380,3 @@
       private static org.apache.commons.logging.Log log=
           org.apache.commons.logging.LogFactory.getLog( WebappLoader.class );
   }
  -
  -
  
  
  
  1.6       +89 -29    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
  
  Index: MBeanFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MBeanFactory.java 18 Sep 2002 10:14:21 -0000      1.5
  +++ MBeanFactory.java 20 Sep 2002 21:22:31 -0000      1.6
  @@ -946,12 +946,28 @@
           // Add the new instance to its parent component
           ObjectName pname = new ObjectName(parent);
           Server server = ServerFactory.getServer();
  +        String type = pname.getKeyProperty("type");
           Service service = server.findService(pname.getKeyProperty("service"));
           Engine engine = (Engine) service.getContainer();
  -        Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -        String pathStr = getPathStr(pname.getKeyProperty("path"));
  -        Context context = (Context) host.findChild(pathStr);
  -        context.setManager(manager);
  +        if ((type != null) && (type.equals("Context"))) {
  +            Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  +            String pathStr = getPathStr(pname.getKeyProperty("path"));
  +            Context context = (Context) host.findChild(pathStr);
  +            context.setManager(manager);
  +        } else if ((type != null) && (type.equals("DefaultContext"))) {
  +            String hostName = pname.getKeyProperty("host");
  +            DefaultContext defaultContext = null;
  +            if (hostName == null) {
  +                defaultContext = engine.getDefaultContext();
  +            } else {
  +                Host host = (Host)engine.findChild(hostName);
  +                defaultContext = host.getDefaultContext();
  +            }
  +            if (defaultContext != null ){
  +                manager.setDefaultContext(defaultContext);
  +                defaultContext.setManager(manager);
  +            }
  +        }
   
           // Return the corresponding MBean name
           ManagedBean managed = registry.findManagedBean("StandardManager");
  @@ -1128,12 +1144,28 @@
           // Add the new instance to its parent component
           ObjectName pname = new ObjectName(parent);
           Server server = ServerFactory.getServer();
  +        String type = pname.getKeyProperty("type");
           Service service = server.findService(pname.getKeyProperty("service"));
           Engine engine = (Engine) service.getContainer();
  -        Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -        String pathStr = getPathStr(pname.getKeyProperty("path"));
  -        Context context = (Context) host.findChild(pathStr);
  -        context.setLoader(loader);
  +        if ((type != null) && (type.equals("Context"))) {
  +            Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  +            String pathStr = getPathStr(pname.getKeyProperty("path"));
  +            Context context = (Context) host.findChild(pathStr);
  +            context.setLoader(loader);
  +        } else if ((type != null) && (type.equals("DefaultContext"))) {
  +            String hostName = pname.getKeyProperty("host");
  +            DefaultContext defaultContext = null;
  +            if (hostName == null) {
  +                defaultContext = engine.getDefaultContext();
  +            } else {
  +                Host host = (Host)engine.findChild(hostName);
  +                defaultContext = host.getDefaultContext();
  +            }
  +            if (defaultContext != null ){
  +                loader.setDefaultContext(defaultContext);
  +                defaultContext.setLoader(loader);
  +            }
  +        }
   
           // Return the corresponding MBean name
           ManagedBean managed = registry.findManagedBean("WebappLoader");
  @@ -1316,18 +1348,32 @@
   
           // Acquire a reference to the component to be removed
           ObjectName oname = new ObjectName(name);
  +        String type = oname.getKeyProperty("type");
           String serviceName = oname.getKeyProperty("service");
  -        String hostName = oname.getKeyProperty("host");
  -        String contextName = getPathStr(oname.getKeyProperty("path"));
           Server server = ServerFactory.getServer();
           Service service = server.findService(serviceName);
  -        Engine engine = (Engine) service.getContainer();
  -        Host host = (Host) engine.findChild(hostName);
  -        Context context = (Context) host.findChild(contextName);
  -
  -        // Remove this component from its parent component
  -        context.setLoader(null);
  -
  +        Engine engine = (Engine) service.getContainer();  
  +        String hostName = oname.getKeyProperty("host");
  +        if ((type != null) && (type.equals("Loader"))) {      
  +            String contextName = getPathStr(oname.getKeyProperty("path"));
  +            Host host = (Host) engine.findChild(hostName);
  +            Context context = (Context) host.findChild(contextName);
  +            // Remove this component from its parent component
  +            context.setLoader(null);
  +        } else if ((type != null) && (type.equals("DefaultLoader"))) {
  +            DefaultContext defaultContext = null;
  +            if (hostName == null) {    
  +                defaultContext = engine.getDefaultContext();
  +            } else {
  +                Host host = (Host) engine.findChild(hostName);
  +                defaultContext = host.getDefaultContext();
  +            }
  +            if (defaultContext != null) {
  +                // Remove this component from its parent component
  +                defaultContext.setLoader(null);
  +            }
  +        }
  +    
       }
   
   
  @@ -1342,17 +1388,31 @@
   
           // Acquire a reference to the component to be removed
           ObjectName oname = new ObjectName(name);
  +        String type = oname.getKeyProperty("type");
           String serviceName = oname.getKeyProperty("service");
  -        String hostName = oname.getKeyProperty("host");
  -        String contextName = getPathStr(oname.getKeyProperty("path"));
           Server server = ServerFactory.getServer();
           Service service = server.findService(serviceName);
  -        Engine engine = (Engine) service.getContainer();
  -        Host host = (Host) engine.findChild(hostName);
  -        Context context = (Context) host.findChild(contextName);
  -
  -        // Remove this component from its parent component
  -        context.setManager(null);
  +        Engine engine = (Engine) service.getContainer();  
  +        String hostName = oname.getKeyProperty("host");
  +        if ((type != null) && (type.equals("Manager"))) {      
  +            String contextName = getPathStr(oname.getKeyProperty("path"));
  +            Host host = (Host) engine.findChild(hostName);
  +            Context context = (Context) host.findChild(contextName);
  +            // Remove this component from its parent component
  +            context.setManager(null);
  +        } else if ((type != null) && (type.equals("DefaultManager"))) {
  +            DefaultContext defaultContext = null;
  +            if (hostName == null) {    
  +                defaultContext = engine.getDefaultContext();
  +            } else {
  +                Host host = (Host) engine.findChild(hostName);
  +                defaultContext = host.getDefaultContext();
  +            }
  +            if (defaultContext != null) {
  +                // Remove this component from its parent component
  +                defaultContext.setManager(null);
  +            }
  +        }
   
       }
   
  
  
  
  1.5       +42 -12    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java
  
  Index: MBeanUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MBeanUtils.java   16 Sep 2002 04:45:38 -0000      1.4
  +++ MBeanUtils.java   20 Sep 2002 21:22:31 -0000      1.5
  @@ -895,14 +895,14 @@
                   Host host = (Host) container;
                   Service service = ((Engine)host.getParent()).getService();
                   name = new ObjectName(domain + ":type=Environment" + 
  -                        ",resourcetype=DefaultContext,host=" + host.getName() +
  +                        ",resourcetype=HostDefaultContext,host=" + host.getName() +
                           ",service=" + service.getName() +
                           ",name=" + environment.getName());
               } else if (container instanceof Engine) {
                   Engine engine = (Engine) container;
                   Service service = engine.getService();
                   name = new ObjectName(domain + ":type=Environment" + 
  -                        ",resourcetype=DefaultContext,service=" + 
  +                        ",resourcetype=ServiceDefaultContext,service=" + 
                           service.getName() + ",name=" + environment.getName());
               }
           }
  @@ -952,7 +952,7 @@
                   Host host = (Host) container;
                   Service service = ((Engine)host.getParent()).getService();
                   name = new ObjectName(domain + ":type=Resource" + 
  -                        ",resourcetype=DefaultContext,host=" + host.getName() +
  +                        ",resourcetype=HostDefaultContext,host=" + host.getName() +
                           ",service=" + service.getName() +
                           ",class=" + resource.getType() + 
                           ",name=" + encodedResourceName);
  @@ -960,7 +960,7 @@
                   Engine engine = (Engine) container;
                   Service service = engine.getService();
                   name = new ObjectName(domain + ":type=Resource" + 
  -                        ",resourcetype=DefaultContext,service=" + service.getName() 
+
  +                        ",resourcetype=ServiceDefaultContext,service=" + 
service.getName() +
                           ",class=" + resource.getType() + 
                           ",name=" + encodedResourceName);
               }
  @@ -1011,7 +1011,7 @@
                   Host host = (Host) container;
                   Service service = ((Engine)host.getParent()).getService();
                   name = new ObjectName(domain + ":type=ResourceLink" + 
  -                        ",resourcetype=DefaultContext,host=" + host.getName() +
  +                        ",resourcetype=HostDefaultContext,host=" + host.getName() +
                           ",service=" + service.getName() +
                           ",class=" + resourceLink.getType() + 
                           ",name=" + encodedResourceLinkName);
  @@ -1019,7 +1019,7 @@
                   Engine engine = (Engine) container;
                   Service service = engine.getService();
                   name = new ObjectName(domain + ":type=ResourceLink" + 
  -                        ",resourcetype=DefaultContext,service=" + service.getName() 
+
  +                        ",resourcetype=ServiceDefaultContext,service=" + 
service.getName() +
                           ",class=" + resourceLink.getType() + 
                           ",name=" + encodedResourceLinkName);
               }
  @@ -1166,6 +1166,21 @@
               name = new ObjectName(domain + ":type=Loader,path=" + path +
                                 ",host=" + host.getName() + ",service=" +
                                 service.getName());
  +        } else if (container == null) {
  +            DefaultContext defaultContext = loader.getDefaultContext();
  +            if (defaultContext != null) {
  +                Container parent = defaultContext.getParent();
  +                if (parent instanceof Engine) {
  +                    Service service = ((Engine)parent).getService();
  +                    name = new ObjectName(domain + ":type=DefaultLoader,service=" +
  +                            service.getName());
  +                } else if (parent instanceof Host) {
  +                    Engine engine = (Engine) parent.getParent();
  +                    Service service = engine.getService();
  +                    name = new ObjectName(domain + ":type=DefaultLoader,host=" +
  +                            parent.getName() + ",service=" + service.getName());
  +                }
  +            }
           }
   
           return (name);
  @@ -1254,6 +1269,21 @@
               name = new ObjectName(domain + ":type=Manager,path=" + path +
                                 ",host=" + host.getName() + ",service=" +
                                 service.getName());
  +        } else if (container == null) {
  +            DefaultContext defaultContext = manager.getDefaultContext();
  +            if (defaultContext != null) {
  +                Container parent = defaultContext.getParent();
  +                if (parent instanceof Engine) {
  +                    Service service = ((Engine)parent).getService();
  +                    name = new ObjectName(domain + ":type=DefaultManager,service=" +
  +                            service.getName());
  +                } else if (parent instanceof Host) {
  +                    Engine engine = (Engine) parent.getParent();
  +                    Service service = engine.getService();
  +                    name = new ObjectName(domain + ":type=DefaultManager,host=" +
  +                            parent.getName() + ",service=" + service.getName());
  +                }
  +            }
           }
   
           return (name);
  @@ -1296,13 +1326,13 @@
                   Host host = (Host) container;
                   Service service = ((Engine)host.getParent()).getService();
                   name = new ObjectName(domain + ":type=NamingResources" + 
  -                        ",resourcetype=DefaultContext,host=" + host.getName() +
  +                        ",resourcetype=HostDefaultContext,host=" + host.getName() +
                           ",service=" + service.getName());
               } else if (container instanceof Engine) {
                   Engine engine = (Engine) container;
                   Service service = engine.getService();
                   name = new ObjectName(domain + ":type=NamingResources" + 
  -                        ",resourcetype=DefaultContext" +
  +                        ",resourcetype=ServiceDefaultContext" +
                           ",service=" + service.getName());
               }
           }
  
  
  
  1.3       +104 -5    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java
  
  Index: ServerLifecycleListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ServerLifecycleListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerLifecycleListener.java      16 Sep 2002 04:45:38 -0000      1.2
  +++ ServerLifecycleListener.java      20 Sep 2002 21:22:31 -0000      1.3
  @@ -265,6 +265,16 @@
               } catch (Exception e) {
                   log("Exception handling Container property change", e);
               }
  +        } else if (event.getSource() instanceof DefaultContext) {
  +            try {
  +                processDefaultContextPropertyChange
  +                    ((DefaultContext) event.getSource(),
  +                     event.getPropertyName(),
  +                     event.getOldValue(),
  +                     event.getNewValue());
  +            } catch (Exception e) {
  +                log("Exception handling DefaultContext property change", e);
  +            }
           } else if (event.getSource() instanceof NamingResources) {
               try {
                   processNamingResourcesPropertyChange
  @@ -508,6 +518,8 @@
               log("Creating MBean for DefaultContext " + dcontext);
           MBeanUtils.createMBean(dcontext);
      
  +        dcontext.addPropertyChangeListener(this);
  +        
           // Create the MBeans for the associated nested components
           Loader dLoader = dcontext.getLoader();
           if (dLoader != null) {
  @@ -981,6 +993,7 @@
           if (debug >= 4)
               log("Destroying MBean for Context " + dcontext);
           MBeanUtils.destroyMBean(dcontext);
  +        dcontext.removePropertyChangeListener(this);
   
       }        
   
  @@ -1176,7 +1189,7 @@
        *
        * @param service Service for which to destroy MBeans
        *
  -o     * @exception Exception if an exception is thrown during MBean destruction
  +     * @exception Exception if an exception is thrown during MBean destruction
        */
       protected void destroyMBeans(Service service) throws Exception {
   
  @@ -1322,6 +1335,92 @@
                   createMBeans((DefaultContext) newValue);
               }
           } else if ("loader".equals(propertyName)) {
  +            if (oldValue != null) {
  +                if (debug >= 5) {
  +                    log("Removing MBean for Loader " + oldValue);
  +                }
  +                MBeanUtils.destroyMBean((Loader) oldValue);
  +            }
  +            if (newValue != null) {
  +                if (debug >= 5) {
  +                    log("Creating MBean for Loader " + newValue);
  +                }
  +                MBeanUtils.createMBean((Loader) newValue);
  +            }
  +        } else if ("logger".equals(propertyName)) {
  +            if (oldValue != null) {
  +                if (debug >= 5) {
  +                    log("Removing MBean for Logger " + oldValue);
  +                }
  +                MBeanUtils.destroyMBean((Logger) oldValue);
  +            }
  +            if (newValue != null) {
  +                if (debug >= 5) {
  +                    log("Creating MBean for Logger " + newValue);
  +                }
  +                MBeanUtils.createMBean((Logger) newValue);
  +            }
  +        } else if ("manager".equals(propertyName)) {
  +            if (oldValue != null) {
  +                if (debug >= 5) {
  +                    log("Removing MBean for Manager " + oldValue);
  +                }
  +                MBeanUtils.destroyMBean((Manager) oldValue);
  +            }
  +            if (newValue != null) {
  +                if (debug >= 5) {
  +                    log("Creating MBean for Manager " + newValue);
  +                }
  +                MBeanUtils.createMBean((Manager) newValue);
  +            }
  +        } else if ("realm".equals(propertyName)) {
  +            if (oldValue != null) {
  +                if (debug >= 5) {
  +                    log("Removing MBean for Realm " + oldValue);
  +                }
  +                MBeanUtils.destroyMBean((Realm) oldValue);
  +            }
  +            if (newValue != null) {
  +                if (debug >= 5) {
  +                    log("Creating MBean for Realm " + newValue);
  +                }
  +                MBeanUtils.createMBean((Realm) newValue);
  +            }
  +        } else if ("service".equals(propertyName)) {
  +            if (oldValue != null) {
  +                destroyMBeans((Service) oldValue);
  +            }
  +            if (newValue != null) {
  +                createMBeans((Service) newValue);
  +            }
  +        }
  +
  +    }
  +    
  +    
  +    /**
  +     * Process a property change event on a DefaultContext.
  +     *
  +     * @param defaultContext The DefaultContext on which this event occurred
  +     * @param propertyName The name of the property that changed
  +     * @param oldValue The previous value (may be <code>null</code>)
  +     * @param newValue The new value (may be <code>null</code>)
  +     *
  +     * @exception Exception if an exception is thrown
  +     */
  +    protected void processDefaultContextPropertyChange(DefaultContext 
defaultContext,
  +                                                  String propertyName,
  +                                                  Object oldValue,
  +                                                  Object newValue)
  +        throws Exception {
  +
  +        if (debug >= 6) {
  +            log("propertyChange[defaultContext=" + defaultContext +
  +                ",propertyName=" + propertyName +
  +                ",oldValue=" + oldValue +
  +                ",newValue=" + newValue + "]");
  +        }
  +        if ("loader".equals(propertyName)) {
               if (oldValue != null) {
                   if (debug >= 5) {
                       log("Removing MBean for Loader " + oldValue);
  
  
  
  1.2       +35 -5     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/ManagerBase.java
  
  Index: ManagerBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ManagerBase.java  18 Jul 2002 16:47:53 -0000      1.1
  +++ ManagerBase.java  20 Sep 2002 21:22:31 -0000      1.2
  @@ -74,6 +74,7 @@
   import java.util.HashMap;
   import java.util.Random;
   import org.apache.catalina.Container;
  +import org.apache.catalina.DefaultContext;
   import org.apache.catalina.Engine;
   import org.apache.catalina.Logger;
   import org.apache.catalina.Manager;
  @@ -131,6 +132,12 @@
   
   
       /**
  +     * The DefaultContext with which this Manager is associated.
  +     */
  +    protected DefaultContext defaultContext = null;
  +    
  +    
  +    /**
        * Return the MessageDigest implementation to be used when
        * creating session identifiers.
        */
  @@ -262,6 +269,30 @@
   
   
       /**
  +     * Return the DefaultContext with which this Manager is associated.
  +     */
  +    public DefaultContext getDefaultContext() {
  +
  +        return (this.defaultContext);
  +
  +    }
  +
  +
  +    /**
  +     * Set the DefaultContext with which this Manager is associated.
  +     *
  +     * @param defaultContext The newly associated DefaultContext
  +     */
  +    public void setDefaultContext(DefaultContext defaultContext) {
  +
  +        DefaultContext oldDefaultContext = this.defaultContext;
  +        this.defaultContext = defaultContext;
  +        support.firePropertyChange("defaultContext", oldDefaultContext, 
this.defaultContext);
  +
  +    }
  +    
  +    
  +    /**
        * Return the debugging detail level for this component.
        */
       public int getDebug() {
  @@ -762,4 +793,3 @@
   
   
   }
  -
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to