You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2003/04/19 23:16:11 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java StandardHost.java

costin      2003/04/19 14:16:11

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardHostDeployer.java StandardHost.java
  Log:
  A small change - the StandardDeployer won't be loaded automatically on startup.
  but only when needed. It should be possible to also replace it.
  
  Revision  Changes    Path
  1.7       +11 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java
  
  Index: StandardHostDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardHostDeployer.java	27 Jan 2003 23:40:13 -0000	1.6
  +++ StandardHostDeployer.java	19 Apr 2003 21:16:11 -0000	1.7
  @@ -77,6 +77,7 @@
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleException;
   import org.apache.catalina.LifecycleListener;
  +import org.apache.catalina.Host;
   import org.apache.catalina.core.StandardServer;
   import org.apache.catalina.startup.ContextRuleSet;
   import org.apache.catalina.startup.ExpandWar;
  @@ -101,6 +102,8 @@
   
       // ----------------------------------------------------------- Constructors
   
  +    public StandardHostDeployer() {
  +    }
   
       /**
        * Create a new StandardHostDeployer associated with the specified
  @@ -170,6 +173,13 @@
   
       // -------------------------------------------------------- Depoyer Methods
   
  +    public Host getHost() {
  +        return host;
  +    }
  +
  +    public void setHost(Host host) {
  +        this.host = (StandardHost)host;
  +    }
   
       /**
        * Return the name of the Container with which this Deployer is associated.
  
  
  
  1.11      +29 -13    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java
  
  Index: StandardHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StandardHost.java	18 Apr 2003 09:48:27 -0000	1.10
  +++ StandardHost.java	19 Apr 2003 21:16:11 -0000	1.11
  @@ -63,6 +63,7 @@
   
   import java.io.IOException;
   import java.net.URL;
  +import java.lang.reflect.Method;
   import javax.management.ObjectName;
   import javax.management.MBeanServer;
   import javax.management.MalformedObjectNameException;
  @@ -91,7 +92,9 @@
   
   public class StandardHost
       extends ContainerBase
  -    implements Deployer, Host {
  +    implements Deployer, Host  
  + {
  +    /* Why do we implement deployer and delegate to deployer ??? */
   
       private static org.apache.commons.logging.Log log=
           org.apache.commons.logging.LogFactory.getLog( StandardHost.class );
  @@ -831,8 +834,7 @@
        *  during install
        */
       public void install(String contextPath, URL war) throws IOException {
  -
  -        getDelegateDeployer().install(contextPath, war);
  +        getDeployer().install(contextPath, war);
   
       }
   
  @@ -863,7 +865,7 @@
        */
       public synchronized void install(URL config, URL war) throws IOException {
   
  -        getDelegateDeployer().install(config, war);
  +        getDeployer().install(config, war);
   
       }
   
  @@ -877,7 +879,7 @@
        */
       public Context findDeployedApp(String contextPath) {
   
  -        return (getDelegateDeployer().findDeployedApp(contextPath));
  +        return (getDeployer().findDeployedApp(contextPath));
   
       }
   
  @@ -889,7 +891,7 @@
        */
       public String[] findDeployedApps() {
   
  -        return (getDelegateDeployer().findDeployedApps());
  +        return (getDeployer().findDeployedApps());
   
       }
   
  @@ -912,7 +914,7 @@
        */
       public void remove(String contextPath) throws IOException {
   
  -        getDelegateDeployer().remove(contextPath);
  +        getDeployer().remove(contextPath);
   
       }
   
  @@ -937,7 +939,7 @@
        */
       public void remove(String contextPath, boolean undeploy) throws IOException {
   
  -        getDelegateDeployer().remove(contextPath,undeploy);
  +        getDeployer().remove(contextPath,undeploy);
   
       }
   
  @@ -957,7 +959,7 @@
        */
       public void start(String contextPath) throws IOException {
   
  -        getDelegateDeployer().start(contextPath);
  +        getDeployer().start(contextPath);
   
       }
   
  @@ -977,7 +979,7 @@
        */
       public void stop(String contextPath) throws IOException {
   
  -        getDelegateDeployer().stop(contextPath);
  +        getDeployer().stop(contextPath);
   
       }
   
  @@ -997,11 +999,25 @@
   
       }
   
  -    private Deployer getDelegateDeployer() {
  +    static String STANDARD_HOST_DEPLOYER="org.apache.catalina.core.StandardHostDeployer";
  +    
  +    public Deployer getDeployer() {
           if( deployer!= null )
               return deployer;
  -        deployer=new StandardHostDeployer(this);
  +        log.info( "Create Host deployer for direct deployment ( non-jmx ) ");
  +        try {
  +            Class c=Class.forName( STANDARD_HOST_DEPLOYER );
  +            deployer=(Deployer)c.newInstance();
  +            Method m=c.getMethod("setHost", new Class[] {Host.class} );
  +            m.invoke( deployer,  new Object[] { this } );
  +        } catch( Throwable t ) {
  +            log.error( "Error creating deployer ", t);
  +        }
           return deployer;
  +    }
  +    
  +    public void setDeployer(Deployer d) {
  +        this.deployer=d;
       }
   
       // -------------------- JMX  --------------------
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org