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/deploy ContextEjb.java ContextEnvironment.java ContextLocalEjb.java ContextResource.java ContextResourceLink.java NamingResources.java ResourceParams.java
Date Fri, 03 May 2002 00:13:02 GMT
craigmcc    02/05/02 17:13:02

  Modified:    catalina/src/share/org/apache/catalina/deploy
                        ContextEjb.java ContextEnvironment.java
                        ContextLocalEjb.java ContextResource.java
                        ContextResourceLink.java NamingResources.java
                        ResourceParams.java
  Log:
  Add listener registration support to NamingResources, so that we'll be able
  to dynamically create and remove MBeans for global JNDI resources defined
  via the admin tool (or any other dynamic mechanism) while Tomcat is running.
  
  Add cross reference links from each of the resource definition objects so
  that they can find the NamingResources collection with which they are
  associated.  At present, this is only needed to get from a
  ContextResource to the corresponding ResourceParams (and vice versa), but
  it's better to do things consistently across all types.
  
  Revision  Changes    Path
  1.6       +21 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEjb.java
  
  Index: ContextEjb.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEjb.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ContextEjb.java	22 Jul 2001 20:25:10 -0000	1.5
  +++ ContextEjb.java	3 May 2002 00:13:01 -0000	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEjb.java,v
1.5 2001/07/22 20:25:10 pier Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/07/22 20:25:10 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEjb.java,v
1.6 2002/05/03 00:13:01 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/05/03 00:13:01 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
    * deployment descriptor.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/07/22 20:25:10 $
  + * @version $Revision: 1.6 $ $Date: 2002/05/03 00:13:01 $
    */
   
   public final class ContextEjb {
  @@ -198,6 +198,23 @@
           sb.append("]");
           return (sb.toString());
   
  +    }
  +
  +
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * The NamingResources with which we are associated (if any).
  +     */
  +    protected NamingResources resources = null;
  +
  +    public NamingResources getNamingResource() {
  +        return (this.resources);
  +    }
  +
  +    void setNamingResources(NamingResources resources) {
  +        this.resources = resources;
       }
   
   
  
  
  
  1.6       +21 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEnvironment.java
  
  Index: ContextEnvironment.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEnvironment.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ContextEnvironment.java	9 Sep 2001 00:48:11 -0000	1.5
  +++ ContextEnvironment.java	3 May 2002 00:13:01 -0000	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEnvironment.java,v
1.5 2001/09/09 00:48:11 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/09/09 00:48:11 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextEnvironment.java,v
1.6 2002/05/03 00:13:01 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/05/03 00:13:01 $
    *
    * ====================================================================
    *
  @@ -70,7 +70,7 @@
    * an <code>&lt;env-entry&gt;</code> element in the deployment descriptor.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/09/09 00:48:11 $
  + * @version $Revision: 1.6 $ $Date: 2002/05/03 00:13:01 $
    */
   
   public final class ContextEnvironment {
  @@ -177,6 +177,23 @@
           sb.append("]");
           return (sb.toString());
   
  +    }
  +
  +
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * The NamingResources with which we are associated (if any).
  +     */
  +    protected NamingResources resources = null;
  +
  +    public NamingResources getNamingResource() {
  +        return (this.resources);
  +    }
  +
  +    void setNamingResources(NamingResources resources) {
  +        this.resources = resources;
       }
   
   
  
  
  
  1.3       +21 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextLocalEjb.java
  
  Index: ContextLocalEjb.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextLocalEjb.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContextLocalEjb.java	22 Jul 2001 20:25:10 -0000	1.2
  +++ ContextLocalEjb.java	3 May 2002 00:13:01 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextLocalEjb.java,v
1.2 2001/07/22 20:25:10 pier Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/07/22 20:25:10 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextLocalEjb.java,v
1.3 2002/05/03 00:13:01 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/05/03 00:13:01 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
    * deployment descriptor.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2001/07/22 20:25:10 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/03 00:13:01 $
    */
   
   public final class ContextLocalEjb {
  @@ -198,6 +198,23 @@
           sb.append("]");
           return (sb.toString());
   
  +    }
  +
  +
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * The NamingResources with which we are associated (if any).
  +     */
  +    protected NamingResources resources = null;
  +
  +    public NamingResources getNamingResource() {
  +        return (this.resources);
  +    }
  +
  +    void setNamingResources(NamingResources resources) {
  +        this.resources = resources;
       }
   
   
  
  
  
  1.5       +21 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResource.java
  
  Index: ContextResource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContextResource.java	22 Jul 2001 20:25:10 -0000	1.4
  +++ ContextResource.java	3 May 2002 00:13:01 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResource.java,v
1.4 2001/07/22 20:25:10 pier Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/07/22 20:25:10 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResource.java,v
1.5 2002/05/03 00:13:01 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/05/03 00:13:01 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
    * deployment descriptor.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2001/07/22 20:25:10 $
  + * @version $Revision: 1.5 $ $Date: 2002/05/03 00:13:01 $
    */
   
   public final class ContextResource {
  @@ -182,6 +182,23 @@
           sb.append("]");
           return (sb.toString());
   
  +    }
  +
  +
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * The NamingResources with which we are associated (if any).
  +     */
  +    protected NamingResources resources = null;
  +
  +    public NamingResources getNamingResource() {
  +        return (this.resources);
  +    }
  +
  +    void setNamingResources(NamingResources resources) {
  +        this.resources = resources;
       }
   
   
  
  
  
  1.2       +21 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResourceLink.java
  
  Index: ContextResourceLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResourceLink.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextResourceLink.java	8 Nov 2001 19:27:12 -0000	1.1
  +++ ContextResourceLink.java	3 May 2002 00:13:01 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResourceLink.java,v
1.1 2001/11/08 19:27:12 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/11/08 19:27:12 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextResourceLink.java,v
1.2 2002/05/03 00:13:01 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/05/03 00:13:01 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
    * server configuration file.
    *
    * @author Remy Maucherat
  - * @version $Revision: 1.1 $ $Date: 2001/11/08 19:27:12 $
  + * @version $Revision: 1.2 $ $Date: 2002/05/03 00:13:01 $
    */
   
   public final class ContextResourceLink {
  @@ -144,6 +144,23 @@
           sb.append("]");
           return (sb.toString());
   
  +    }
  +
  +
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * The NamingResources with which we are associated (if any).
  +     */
  +    protected NamingResources resources = null;
  +
  +    public NamingResources getNamingResource() {
  +        return (this.resources);
  +    }
  +
  +    void setNamingResources(NamingResources resources) {
  +        this.resources = resources;
       }
   
   
  
  
  
  1.4       +93 -11    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/NamingResources.java
  
  Index: NamingResources.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/NamingResources.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NamingResources.java	9 Nov 2001 19:33:35 -0000	1.3
  +++ NamingResources.java	3 May 2002 00:13:01 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/NamingResources.java,v
1.3 2001/11/09 19:33:35 remm Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/11/09 19:33:35 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/NamingResources.java,v
1.4 2002/05/03 00:13:01 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/03 00:13:01 $
    *
    * ====================================================================
    *
  @@ -65,6 +65,8 @@
   package org.apache.catalina.deploy;
   
   
  +import java.beans.PropertyChangeListener;
  +import java.beans.PropertyChangeSupport;
   import java.util.HashMap;
   
   
  @@ -73,7 +75,7 @@
    * Naming Context and their associated JNDI context.
    *
    * @author Remy Maucherat
  - * @version $Revision: 1.3 $ $Date: 2001/11/09 19:33:35 $
  + * @version $Revision: 1.4 $ $Date: 2002/05/03 00:13:01 $
    */
   
   public final class NamingResources {
  @@ -136,6 +138,12 @@
       private HashMap resourceParams = new HashMap();
   
   
  +    /**
  +     * The property change support for this component.
  +     */
  +    protected PropertyChangeSupport support = new PropertyChangeSupport(this);
  +
  +
       // --------------------------------------------------------------Properties
   
   
  @@ -147,8 +155,10 @@
       public void addEjb(ContextEjb ejb) {
   
           synchronized (ejbs) {
  +            ejb.setNamingResources(this);
               ejbs.put(ejb.getName(), ejb);
           }
  +        support.firePropertyChange("ejb", null, ejb);
   
       }
   
  @@ -161,8 +171,10 @@
       public void addEnvironment(ContextEnvironment environment) {
   
           synchronized (envs) {
  +            environment.setNamingResources(this);
               envs.put(environment.getName(), environment);
           }
  +        support.firePropertyChange("environment", null, environment);
   
       }
   
  @@ -175,9 +187,11 @@
       public void addResourceParams(ResourceParams resourceParameters) {
   
           synchronized (resourceParams) {
  +            resourceParameters.setNamingResources(this);
               resourceParams.put(resourceParameters.getName(),
                                  resourceParameters);
           }
  +        support.firePropertyChange("resourceParams", null, resourceParameters);
   
       }
   
  @@ -190,8 +204,22 @@
       public void addLocalEjb(ContextLocalEjb ejb) {
   
           synchronized (localEjbs) {
  +            ejb.setNamingResources(this);
               localEjbs.put(ejb.getName(), ejb);
           }
  +        support.firePropertyChange("localEjb", null, ejb);
  +
  +    }
  +
  +
  +    /**
  +     * Add a property change listener to this component.
  +     *
  +     * @param listener The listener to add
  +     */
  +    public void addPropertyChangeListener(PropertyChangeListener listener) {
  +
  +        support.addPropertyChangeListener(listener);
   
       }
   
  @@ -204,8 +232,10 @@
       public void addResource(ContextResource resource) {
   
           synchronized (resources) {
  +            resource.setNamingResources(this);
               resources.put(resource.getName(), resource);
           }
  +        support.firePropertyChange("resource", null, resource);
   
       }
   
  @@ -221,6 +251,8 @@
           synchronized (resourceEnvRefs) {
               resourceEnvRefs.put(name, type);
           }
  +        support.firePropertyChange("resourceEnvRef", null,
  +                                   name + ":" + type);
   
       }
   
  @@ -233,8 +265,10 @@
       public void addResourceLink(ContextResourceLink resourceLink) {
   
           synchronized (resourceLinks) {
  +            resourceLink.setNamingResources(this);
               resourceLinks.put(resourceLink.getName(), resourceLink);
           }
  +        support.firePropertyChange("resourceLink", null, resourceLink);
   
       }
   
  @@ -457,8 +491,13 @@
        */
       public void removeEjb(String name) {
   
  +        ContextEjb ejb = null;
           synchronized (ejbs) {
  -            ejbs.remove(name);
  +            ejb = (ContextEjb) ejbs.remove(name);
  +        }
  +        if (ejb != null) {
  +            ejb.setNamingResources(null);
  +            support.firePropertyChange("ejb", ejb, null);
           }
   
       }
  @@ -471,8 +510,13 @@
        */
       public void removeEnvironment(String name) {
   
  +        ContextEnvironment environment = null;
           synchronized (envs) {
  -            envs.remove(name);
  +            environment = (ContextEnvironment) envs.remove(name);
  +        }
  +        if (environment != null) {
  +            environment.setNamingResources(null);
  +            support.firePropertyChange("environment", environment, null);
           }
   
       }
  @@ -485,22 +529,44 @@
        */
       public void removeLocalEjb(String name) {
   
  +        ContextLocalEjb localEjb = null;
           synchronized (localEjbs) {
  -            localEjbs.remove(name);
  +            localEjb = (ContextLocalEjb) ejbs.remove(name);
  +        }
  +        if (localEjb != null) {
  +            localEjb.setNamingResources(null);
  +            support.firePropertyChange("localEjb", localEjb, null);
           }
   
       }
   
   
       /**
  +     * 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.
        *
        * @param name Name of the resource reference to remove
        */
       public void removeResource(String name) {
   
  +        ContextResource resource = null;
           synchronized (resources) {
  -            resources.remove(name);
  +            resource = (ContextResource) resources.remove(name);
  +        }
  +        if (resource != null) {
  +            resource.setNamingResources(null);
  +            support.firePropertyChange("resource", resource, null);
           }
   
       }
  @@ -513,8 +579,13 @@
        */
       public void removeResourceEnvRef(String name) {
   
  +        String type = null;
           synchronized (resourceEnvRefs) {
  -            resourceEnvRefs.remove(name);
  +            type = (String) resourceEnvRefs.remove(name);
  +        }
  +        if (type != null) {
  +            support.firePropertyChange("resourceEnvRef",
  +                                       name + ":" + type, null);
           }
   
       }
  @@ -527,8 +598,13 @@
        */
       public void removeResourceLink(String name) {
   
  +        ContextResourceLink resourceLink = null;
           synchronized (resourceLinks) {
  -            resourceLinks.remove(name);
  +            resourceLink = (ContextResourceLink) resourceLinks.remove(name);
  +        }
  +        if (resourceLink != null) {
  +            resourceLink.setNamingResources(null);
  +            support.firePropertyChange("resourceLink", resourceLink, null);
           }
   
       }
  @@ -541,8 +617,14 @@
        */
       public void removeResourceParams(String name) {
   
  +        ResourceParams resourceParameters = null;
           synchronized (resourceParams) {
  -            resourceParams.remove(name);
  +            resourceParameters = (ResourceParams) resourceParams.remove(name);
  +        }
  +        if (resourceParameters != null) {
  +            resourceParameters.setNamingResources(null);
  +            support.firePropertyChange("resourceParams", resourceParameters,
  +                                       null);
           }
   
       }
  
  
  
  1.3       +21 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ResourceParams.java
  
  Index: ResourceParams.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ResourceParams.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResourceParams.java	22 Jul 2001 20:25:10 -0000	1.2
  +++ ResourceParams.java	3 May 2002 00:13:01 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ResourceParams.java,v
1.2 2001/07/22 20:25:10 pier Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/07/22 20:25:10 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ResourceParams.java,v
1.3 2002/05/03 00:13:01 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/05/03 00:13:01 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
    * external resources defined in the web application deployment descriptor.
    *
    * @author Remy Maucherat
  - * @version $Revision: 1.2 $ $Date: 2001/07/22 20:25:10 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/03 00:13:01 $
    */
   
   public final class ResourceParams {
  @@ -120,6 +120,23 @@
           sb.append("]");
           return (sb.toString());
   
  +    }
  +
  +
  +    // -------------------------------------------------------- Package Methods
  +
  +
  +    /**
  +     * The NamingResources with which we are associated (if any).
  +     */
  +    protected NamingResources resources = null;
  +
  +    public NamingResources getNamingResource() {
  +        return (this.resources);
  +    }
  +
  +    void setNamingResources(NamingResources resources) {
  +        this.resources = resources;
       }
   
   
  
  
  

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