User: starksm 
  Date: 01/11/12 11:21:19

  Modified:    catalina/src/main/org/jboss/web/catalina Tag: Branch_2_4
                        EmbeddedCatalinaServiceSX.java
                        EmbeddedCatalinaServiceSXMBean.java
  Added:       catalina/src/main/org/jboss/web/catalina Tag: Branch_2_4
                        ConfigHandler.java
  Log:
  Add support for setting the catalina Engine class and additional
  Connectors using the new mbean/config element
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +44 -8     
contrib/catalina/src/main/org/jboss/web/catalina/EmbeddedCatalinaServiceSX.java
  
  Index: EmbeddedCatalinaServiceSX.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/catalina/src/main/org/jboss/web/catalina/EmbeddedCatalinaServiceSX.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- EmbeddedCatalinaServiceSX.java    2001/11/11 08:10:48     1.2.2.1
  +++ EmbeddedCatalinaServiceSX.java    2001/11/12 19:21:18     1.2.2.2
  @@ -65,7 +65,7 @@
    @see org.apache.catalina.startup.Embedded
    
    @author [EMAIL PROTECTED]
  - @version $Revision: 1.2.2.1 $
  + @version $Revision: 1.2.2.2 $
    */
   public class EmbeddedCatalinaServiceSX extends AbstractWebContainer implements 
EmbeddedCatalinaServiceSXMBean
   {
  @@ -76,10 +76,10 @@
      private Embedded catalina;
      /** The catalina host container */
      private Host catalinaHost;
  +   /** The name of the Engine implementation class */
  +   private String engineClassName;
      /** The catalina debug level */
      private int debugLevel;
  -   /** The path for the appbase for the root context */
  -   private String webAppsRoot = "webapps/ROOT";
      /** The port the web server listens on */
      private int port = 8080;
      /** The interface to bind to. This is useful for multi-homed hosts
  @@ -95,6 +95,10 @@
      private int maxProcessors = 20;
      /** The JNDI name of the SecurityDomain implementation binding */
      private String securityDomain;
  +   /** Any extended configuration information specified via a config
  +    element in the mbean definition.
  +    */
  +   private Element extendedConfig;
   
      public EmbeddedCatalinaServiceSX()
      {
  @@ -129,13 +133,19 @@
            bindAddress = InetAddress.getByName(host);
      }
   
  -   public String getWebAppsRoot()
  +   public String getEngineClass()
      {
  -      return webAppsRoot;
  +      return engineClassName;
      }
  -   public void setWebAppsRoot(String webAppsRoot)
  +   public void setEngineClass(String className) throws ClassNotFoundException
      {
  -      this.webAppsRoot = webAppsRoot;
  +      this.engineClassName = className;
  +      if( engineClassName != null )
  +      {
  +         // Check that the class is accessible
  +         ClassLoader loader = Thread.currentThread().getContextClassLoader();
  +         loader.loadClass(engineClassName);
  +      }
      }
   
      public int getMinProcessors()
  @@ -183,6 +193,15 @@
          this.securityDomain = securityDomain;
       }
   
  +    /** This method is invoked to import an arbitrary XML configuration tree.
  +     Subclasses should override this method if they support such a configuration
  +     capability. This implementation does nothing.
  +     */
  +    public void importXml(Element config)
  +    {
  +       this.extendedConfig = config;
  +    }
  +
      public void startService() throws Exception
      {
         category.info("Starting " + NAME + "....");
  @@ -292,7 +311,18 @@
         String hostname = "localhost";
         if( bindAddress != null )
            hostname = bindAddress.getHostName();
  -      Engine engine = catalina.createEngine();
  +      Engine engine = null;
  +      if( engineClassName != null )
  +      {
  +         Class engineClass = parent.loadClass(engineClassName);
  +         engine = (Engine) engineClass.newInstance();
  +         engine.setLogger(jbossLog);
  +         engine.setRealm(jbossRealm);
  +      }
  +      else
  +      {
  +         engine = catalina.createEngine();
  +      }
         engine.setDefaultHost(hostname);
   
         catalinaHost = catalina.createHost(hostname, "");
  @@ -320,6 +350,9 @@
         }
         catalina.addConnector(connector);
   
  +      // Apply any extended configuration
  +      ConfigHandler handler = new ConfigHandler();
  +      handler.applyHostConfig(extendedConfig, catalina, debugLevel > 0);
      }
   
      private WebApplication createWebContext(String ctxPath, URL warUrl,
  @@ -389,6 +422,9 @@
                     auth.setCache(false);
                  }
               }
  +
  +            // Apply any extended configuration to the context
  +
               // Get the web-app.xml and jboss-web.xml deployment descriptors 
               DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
               DocumentBuilder parser = factory.newDocumentBuilder();
  
  
  
  1.1.2.1   +67 -64    
contrib/catalina/src/main/org/jboss/web/catalina/EmbeddedCatalinaServiceSXMBean.java
  
  Index: EmbeddedCatalinaServiceSXMBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/catalina/src/main/org/jboss/web/catalina/EmbeddedCatalinaServiceSXMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- EmbeddedCatalinaServiceSXMBean.java       2001/09/26 03:11:30     1.1
  +++ EmbeddedCatalinaServiceSXMBean.java       2001/11/12 19:21:18     1.1.2.1
  @@ -9,27 +9,18 @@
   
   import java.net.UnknownHostException;
   
  +import org.w3c.dom.Element;
  +
   import org.jboss.ejb.DeploymentException;
   import org.jboss.web.AbstractWebContainerMBean;
   
   /** Management interface for the embedded Catalina service.
    *
    * @author [EMAIL PROTECTED]
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.1.2.1 $
    */
   public interface EmbeddedCatalinaServiceSXMBean extends AbstractWebContainerMBean
   {
  -   /** @return the pathname to the document base directory
  -     for the default context web application
  -    */
  -   public String getWebAppsRoot();
  -   /** Set the pathname to the document base directory
  -     for the default context web application
  -    @param docBase Absolute or relative pathname to the document base directory
  -     *  for default context web application
  -    */
  -   public void setWebAppsRoot(String webAppsRoot);
  -
      /** Set the Catalina listening port.
       @param part, the listening port, 0 == Anonymous.
       */
  @@ -38,9 +29,9 @@
       @return the Catalina listening port, 0 == Anonymous.
       */
      public int getPort();
  -   
  +
      /** Get the specific address Catalina listens on.t
  -    @return the interface name or IP address the WebService binds to.
  +    @return the interface name or IP address the EmbeddedCatalinaServiceSX binds to.
       */
      public String getBindAddress();
      /** Set the specific address Catalina listens on.  This can be used on
  @@ -50,57 +41,69 @@
       has zero length, connections on any/all local addresses will be allowed.
       */
      public void setBindAddress(String host) throws UnknownHostException;
  +
  +   /** Get the class name of the server container engine class.
  +    */
  +   public String getEngineClass();
  +   /** Set the class name of the server container engine class.
  +    */
  +   public void setEngineClass(String className) throws ClassNotFoundException;
   
  -    /**@return the accept count for this Connector.
  -     */
  -    public int getAcceptCount();
  -    /**
  -     * Set the accept count for this Connector.
  -     *
  -     * @param count The new accept count
  -     */
  -    public void setAcceptCount(int count);
  -
  -    /**
  -     * Return the minimum number of processors to start at initialization.
  -     */
  -    public int getMinProcessors();
  -    /**
  -     * Set the minimum number of processors to start at initialization.
  -     *
  -     * @param minProcessors The new minimum processors
  -     */
  -    public void setMinProcessors(int minProcessors);
  -
  -    /**
  -     * Return the maximum number of processors allowed, or <0 for unlimited.
  -     */
  -    public int getMaxProcessors();
  -    /**
  -     * Set the maximum number of processors allowed, or <0 for unlimited.
  -     *
  -     * @param maxProcessors The new maximum processors
  -     */
  -    public void setMaxProcessors(int maxProcessors);
  -
  -    /** @return the "enable DNS lookups" flag.
  -     */
  -    public boolean getEnableLookups();
  -    /** Set the "enable DNS lookups" flag.
  -     *
  -     * @param enableLookups The "enable DNS lookups" flag value
  -     */
  -    public void setEnableLookups(boolean enableLookups);
  -
  -    /** @return the JNDI name of the SecurityDomain instance to
  -     use with JSSE.
  -     */
  -    public String getSecurityDomain();
  -    /** Set the JNDI name of the SecurityDomain instance to
  -     use with JSSE.
  -     * @param securityDomain the JNDI name of the SecurityDomain
  -     instance to use with JSSE.
  -     */
  -    public void setSecurityDomain(String securityDomain);
  +   /**@return the accept count for this Connector.
  +    */
  +   public int getAcceptCount();
  +   /**
  +    * Set the accept count for this Connector.
  +    *
  +    * @param count The new accept count
  +    */
  +   public void setAcceptCount(int count);
   
  +   /**
  +    * Return the minimum number of processors to start at initialization.
  +    */
  +   public int getMinProcessors();
  +   /**
  +    * Set the minimum number of processors to start at initialization.
  +    *
  +    * @param minProcessors The new minimum processors
  +    */
  +   public void setMinProcessors(int minProcessors);
  +
  +   /**
  +    * Return the maximum number of processors allowed, or <0 for unlimited.
  +    */
  +   public int getMaxProcessors();
  +   /**
  +    * Set the maximum number of processors allowed, or <0 for unlimited.
  +    *
  +    * @param maxProcessors The new maximum processors
  +    */
  +   public void setMaxProcessors(int maxProcessors);
  +
  +   /** @return the "enable DNS lookups" flag.
  +    */
  +   public boolean getEnableLookups();
  +   /** Set the "enable DNS lookups" flag.
  +    *
  +    * @param enableLookups The "enable DNS lookups" flag value
  +    */
  +   public void setEnableLookups(boolean enableLookups);
  +
  +   /** @return the JNDI name of the SecurityDomain instance to
  +    use with JSSE.
  +    */
  +   public String getSecurityDomain();
  +   /** Set the JNDI name of the SecurityDomain instance to
  +    use with JSSE.
  +    * @param securityDomain the JNDI name of the SecurityDomain
  +    instance to use with JSSE.
  +    */
  +   public void setSecurityDomain(String securityDomain);
  +
  +   /** Override the AbstractWebContainerMBean to provide support for extended
  +    configuration using constructs from the standard server.xml to configure
  +    additional connectors, etc.
  +    */
  +   public void importXml(Element config);
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +80 -0     
contrib/catalina/src/main/org/jboss/web/catalina/Attic/ConfigHandler.java
  
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to