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/01/11 06:07:51 UTC

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

costin      2003/01/10 21:07:50

  Modified:    catalina/src/share/org/apache/catalina/core
                        ContainerBase.java
  Log:
  Let ContainerBase know its own name ( and domain )
  
  We can't change the Container interface ( that would break backward
  compat ), but there is no need - all tomcat containers extend
  ContainerBase and external containers can do their own JMX interaction.
  
  Revision  Changes    Path
  1.3       +51 -9     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java
  
  Index: ContainerBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContainerBase.java	5 Nov 2002 21:31:14 -0000	1.2
  +++ ContainerBase.java	11 Jan 2003 05:07:50 -0000	1.3
  @@ -1,8 +1,4 @@
   /*
  - * $Header$
  - * $Revision$
  - * $Date$
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -76,13 +72,16 @@
   import java.util.Iterator;
   import javax.servlet.ServletException;
   import javax.naming.directory.DirContext;
  +import javax.management.ObjectName;
  +import javax.management.MBeanRegistration;
  +import javax.management.MBeanServer;
  +
   import org.apache.naming.resources.ProxyDirContext;
   import org.apache.catalina.Cluster;
   import org.apache.catalina.Container;
   import org.apache.catalina.ContainerEvent;
   import org.apache.catalina.ContainerListener;
   import org.apache.catalina.Lifecycle;
  -import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleException;
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Loader;
  @@ -160,8 +159,10 @@
    */
   
   public abstract class ContainerBase
  -    implements Container, Lifecycle, Pipeline {
  +    implements Container, Lifecycle, Pipeline, MBeanRegistration {
   
  +    private static org.apache.commons.logging.Log log=
  +        org.apache.commons.logging.LogFactory.getLog( ContainerBase.class );
   
       /**
        * Perform addChild with the permissions of this class.
  @@ -1460,7 +1461,48 @@
   
       }
   
  -    private static org.apache.commons.logging.Log log=
  -        org.apache.commons.logging.LogFactory.getLog( ContainerBase.class );
  +    // -------------------- JMX and Registration  --------------------
  +    protected String domain;
  +    protected String suffix;
  +    protected ObjectName oname;
  +    protected MBeanServer mserver;
  +
  +    public ObjectName getObjectName() {
  +        return oname;
  +    }
  +
  +    public String getDomain() {
  +        return domain;
  +    }
  +
  +    public String getJSR77Suffix() {
  +        return suffix;
  +    }
  +
  +    public ObjectName preRegister(MBeanServer server,
  +                                  ObjectName name) throws Exception {
  +        oname=name;
  +        mserver=server;
  +        domain=name.getDomain();
  +        String j2eeApp=name.getKeyProperty("J2EEApplication");
  +        String j2eeServer=name.getKeyProperty("J2EEServer");
  +        if( j2eeApp==null ) {
  +            j2eeApp="none";
  +        }
  +        if( j2eeServer==null ) {
  +            j2eeServer="none";
  +        }
  +        suffix=",J2EEApplication=" + j2eeApp + ",J2EEServer=" + j2eeServer;
  +        return name;
  +    }
  +
  +    public void postRegister(Boolean registrationDone) {
  +    }
  +
  +    public void preDeregister() throws Exception {
  +    }
  +
  +    public void postDeregister() {
  +    }
   }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>