tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java
Date Thu, 08 Nov 2001 21:13:56 GMT
remm        01/11/08 13:13:56

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardServer.java
  Log:
  - Add getter / setter for the global NamingResources.
  - Automatically initialize the listener when naming support is enabled.
  
  Revision  Changes    Path
  1.13      +63 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StandardServer.java	2001/09/04 19:19:48	1.12
  +++ StandardServer.java	2001/11/08 21:13:56	1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
1.12 2001/09/04 19:19:48 craigmcc Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/09/04 19:19:48 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
1.13 2001/11/08 21:13:56 remm Exp $
  + * $Revision: 1.13 $
  + * $Date: 2001/11/08 21:13:56 $
    *
    * ====================================================================
    *
  @@ -79,6 +79,7 @@
   import org.apache.catalina.Server;
   import org.apache.catalina.ServerFactory;
   import org.apache.catalina.Service;
  +import org.apache.catalina.deploy.NamingResources;
   import org.apache.catalina.util.LifecycleSupport;
   import org.apache.catalina.util.StringManager;
   
  @@ -89,7 +90,7 @@
    * (but not required) when deploying and starting Catalina.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.12 $ $Date: 2001/09/04 19:19:48 $
  + * @version $Revision: 1.13 $ $Date: 2001/11/08 21:13:56 $
    */
   
   public final class StandardServer
  @@ -114,6 +115,12 @@
   
   
       /**
  +     * Global naming resources.
  +     */
  +    private NamingResources globalNamingResources = null;
  +
  +
  +    /**
        * Descriptive information about this Server implementation.
        */
       private static final String info =
  @@ -127,6 +134,12 @@
   
   
       /**
  +     * The naming context listener for this web application.
  +     */
  +    private NamingContextListener namingContextListener = null;
  +
  +
  +    /**
        * The port number on which we wait for shutdown commands.
        */
       private int port = 8005;
  @@ -174,6 +187,29 @@
   
   
       /**
  +     * Return the global naming resources.
  +     */
  +    public NamingResources getGlobalNamingResources() {
  +
  +        return (this.globalNamingResources);
  +
  +    }
  +
  +
  +    /**
  +     * Set the global naming resources.
  +     * 
  +     * @param namingResources The new global naming resources
  +     */
  +    public void setGlobalNamingResources
  +        (NamingResources globalNamingResources) {
  +
  +        this.globalNamingResources = globalNamingResources;
  +
  +    }
  +
  +
  +    /**
        * Return descriptive information about this Server implementation and
        * the corresponding version number, in the format
        * <code>&lt;description&gt;/&lt;version&gt;</code>.
  @@ -450,6 +486,21 @@
       }
   
   
  +    /**
  +     * Return true if naming should be used.
  +     */
  +    private boolean isUseNaming() {
  +        boolean useNaming = true;
  +        // Reading the "catalina.useNaming" environment variable
  +        String useNamingProperty = System.getProperty("catalina.useNaming");
  +        if ((useNamingProperty != null)
  +            && (useNamingProperty.equals("false"))) {
  +            useNaming = false;
  +        }
  +        return useNaming;
  +    }
  +
  +
       // ------------------------------------------------------ Lifecycle Methods
   
   
  @@ -494,6 +545,14 @@
           if (started)
               throw new LifecycleException
                   (sm.getString("standardServer.start.started"));
  +
  +        if (isUseNaming()) {
  +            if ((globalNamingResources != null) 
  +                && (namingContextListener == null)) {
  +                namingContextListener = new NamingContextListener();
  +                addLifecycleListener(namingContextListener);
  +            }
  +        }
   
           lifecycle.fireLifecycleEvent(START_EVENT, null);
           started = true;
  
  
  

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