tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardEngine.java StandardHost.java
Date Fri, 21 Mar 2003 07:34:40 GMT
costin      2003/03/20 23:34:40

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardContext.java StandardEngine.java
                        StandardHost.java
  Log:
  Various fixes.
  
  Both embed and standalone are working again.
  
  Revision  Changes    Path
  1.31      +5 -2      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- StandardContext.java	21 Mar 2003 06:38:47 -0000	1.30
  +++ StandardContext.java	21 Mar 2003 07:34:39 -0000	1.31
  @@ -3761,7 +3761,7 @@
                   throw new LifecycleException("Error initializaing ", ex);
               }
           }
  -
  +        
           String logName="tomcat." + getParent().getName() + "." +
                   ("".equals(getName()) ? "ROOT" : getName()) + ".Context";
           log=org.apache.commons.logging.LogFactory.getLog(logName);
  @@ -4783,6 +4783,9 @@
               }
               ContextConfig config = new ContextConfig();
               this.addLifecycleListener(config);
  +
  +            mserver.invoke(parentName, "addChild", new Object[] { this },
  +                    new String[] {"org.apache.catalina.Container"});
           }            
           super.init();
       }
  
  
  
  1.8       +31 -19    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java
  
  Index: StandardEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardEngine.java	19 Mar 2003 07:23:57 -0000	1.7
  +++ StandardEngine.java	21 Mar 2003 07:34:39 -0000	1.8
  @@ -71,6 +71,7 @@
   import javax.servlet.http.HttpServletResponse;
   import javax.management.ObjectName;
   import javax.management.MBeanServer;
  +import javax.management.MalformedObjectNameException;
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.DefaultContext;
  @@ -391,7 +392,25 @@
           }
   
           if( service==null ) {
  -            // for consistency...
  +            try {
  +                ObjectName serviceName=getParentName();        
  +                if( mserver.isRegistered( serviceName )) {
  +                    log.info("Registering with the service ");
  +                    try {
  +                        mserver.invoke( serviceName, "setContainer",
  +                                new Object[] { this },
  +                                new String[] { "org.apache.catalina.Container" } );
  +                    } catch( Exception ex ) {
  +                        ex.printStackTrace();
  +                    }
  +                }
  +            } catch( Exception ex ) {
  +                log.error("Error registering with service ");
  +            }
  +        }
  +        
  +        if( service==null ) {
  +            // for consistency...: we are probably in embeded mode
               try {
                   service=new StandardService();
                   service.initialize();
  @@ -466,24 +485,17 @@
       {
           super.preRegister(server,name);
   
  -        // Register with the Service. XXX Do we really need a Service ??
  -        // BTW - the connector can go directly here.
  -        ObjectName serviceName=new ObjectName(domain +
  -                ":type=Service,name=Tomcat-Standalone");
  -        if( server.isRegistered( serviceName )) {
  -            log.info("Registering with the service ");
  -            try {
  -                server.invoke( serviceName, "setContainer",
  -                        new Object[] { this },
  -                    new String[] { "org.apache.catalina.Container" } );
  -            } catch( Exception ex ) {
  -                ex.printStackTrace();
  -            }
  -        }
  +        this.setName( name.getDomain());
   
           return name;
       }
   
  +    public ObjectName getParentName() throws MalformedObjectNameException {
  +        ObjectName serviceName=new ObjectName(domain +
  +                        ":type=Service");
  +        return serviceName;                
  +    }
  +    
       public ObjectName createObjectName(String domain, ObjectName parent)
           throws Exception
       {
  
  
  
  1.8       +11 -1     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardHost.java	20 Mar 2003 18:28:28 -0000	1.7
  +++ StandardHost.java	21 Mar 2003 07:34:39 -0000	1.8
  @@ -1049,12 +1049,22 @@
           }
       }
   
  +    public ObjectName preRegister(MBeanServer server, ObjectName oname ) 
  +        throws Exception
  +    {
  +        ObjectName res=super.preRegister(server, oname);
  +        String name=oname.getKeyProperty("host");
  +        if( name != null )
  +            setName( name );
  +        return res;        
  +    }
  +    
       public ObjectName createObjectName(String domain, ObjectName parent)
           throws Exception
       {
           if( log.isDebugEnabled())
               log.debug("Create ObjectName " + domain + " " + parent );
  -        return new ObjectName( domain + ":type=Host,name=" + getName());
  +        return new ObjectName( domain + ":type=Host,host=" + getName());
       }
   
   }
  
  
  

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


Mime
View raw message