tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java
Date Fri, 03 May 2002 00:27:17 GMT
amyroh      02/05/02 17:27:17

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        MBeanFactory.java
  Log:
  Check "/" when looking for root context.
  
  Revision  Changes    Path
  1.30      +65 -30    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
  
  Index: MBeanFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- MBeanFactory.java	2 May 2002 02:03:15 -0000	1.29
  +++ MBeanFactory.java	3 May 2002 00:27:17 -0000	1.30
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
1.29 2002/05/02 02:03:15 amyroh Exp $
  - * $Revision: 1.29 $
  - * $Date: 2002/05/02 02:03:15 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
1.30 2002/05/03 00:27:17 amyroh Exp $
  + * $Revision: 1.30 $
  + * $Date: 2002/05/03 00:27:17 $
    *
    * ====================================================================
    *
  @@ -117,7 +117,7 @@
    * <code>org.apache.catalina.core.StandardServer</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.29 $ $Date: 2002/05/02 02:03:15 $
  + * @version $Revision: 1.30 $ $Date: 2002/05/03 00:27:17 $
    */
   
   public class MBeanFactory extends BaseModelMBean {
  @@ -201,8 +201,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               ((StandardContext)context).addValve(accessLogger);
           } else if (type.equals("Engine")) {
               ((StandardEngine)engine).addValve(accessLogger);
  @@ -339,8 +342,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               context.setLogger(fileLogger);
           } else if (type.equals("Engine")) {
               engine.setLogger(fileLogger);
  @@ -525,8 +531,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               context.setRealm(realm);
           } else if (type.equals("Engine")) {
               engine.setRealm(realm);
  @@ -565,8 +574,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               context.setRealm(realm);
           } else if (type.equals("Engine")) {
               engine.setRealm(realm);
  @@ -605,8 +617,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               context.setRealm(realm);
           } else if (type.equals("Engine")) {
               engine.setRealm(realm);
  @@ -645,8 +660,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               ((StandardContext)context).addValve(valve);
           } else if (type.equals("Engine")) {
               ((StandardEngine)engine).addValve(valve);
  @@ -685,8 +703,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               ((StandardContext)context).addValve(valve);
           } else if (type.equals("Engine")) {
               ((StandardEngine)engine).addValve(valve);
  @@ -725,8 +746,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               ((StandardContext)context).addValve(valve);
           } else if (type.equals("Engine")) {
               ((StandardEngine)engine).addValve(valve);
  @@ -765,8 +789,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               ((StandardContext)context).addValve(valve);
           } else if (type.equals("Engine")) {
               ((StandardEngine)engine).addValve(valve);
  @@ -970,8 +997,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {        
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               context.setLogger(logger);
           } else if (type.equals("Engine")) {
               engine.setLogger(logger);
  @@ -1010,8 +1040,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               context.setLogger(logger);
           } else if (type.equals("Engine")) {
               engine.setLogger(logger);
  @@ -1040,7 +1073,6 @@
   
            // Create a new UserDatabaseRealm instance
           UserDatabaseRealm realm = new UserDatabaseRealm();
  -
           // Add the new instance to its parent component
           ObjectName pname = new ObjectName(parent);
           String type = pname.getKeyProperty("type");
  @@ -1049,8 +1081,11 @@
           Engine engine = (Engine) service.getContainer();
           if (type.equals("Context")) {
               Host host = (Host) engine.findChild(pname.getKeyProperty("host"));
  -            Context context =
  -                    (Context) host.findChild(pname.getKeyProperty("path"));
  +            String pathStr = pname.getKeyProperty("path");
  +            if (pathStr.equals("/")) {
  +                pathStr = "";
  +            }
  +            Context context = (Context) host.findChild(pathStr);
               context.setRealm(realm);
           } else if (type.equals("Engine")) {
               engine.setRealm(realm);
  @@ -1064,7 +1099,7 @@
           ObjectName oname =
               MBeanUtils.createObjectName(managed.getDomain(), realm);
           return (oname.toString());
  -
  +        
       }
   
       
  
  
  

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