tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardServerMBean.java
Date Thu, 02 May 2002 20:08:31 GMT
craigmcc    02/05/02 13:08:31

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        StandardServerMBean.java
  Log:
  Correctly persist <Store> elements inside <Manager>, and <Resources> elements
  (if non-defaults) inside <Context>.
  
  Revision  Changes    Path
  1.16      +50 -6     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StandardServerMBean.java	2 May 2002 19:32:28 -0000	1.15
  +++ StandardServerMBean.java	2 May 2002 20:08:31 -0000	1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
1.15 2002/05/02 19:32:28 amyroh Exp $
  - * $Revision: 1.15 $
  - * $Date: 2002/05/02 19:32:28 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
1.16 2002/05/02 20:08:31 craigmcc Exp $
  + * $Revision: 1.16 $
  + * $Date: 2002/05/02 20:08:31 $
    *
    * ====================================================================
    *
  @@ -80,6 +80,7 @@
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
   import javax.management.RuntimeOperationsException;
  +import javax.naming.directory.DirContext;
   import org.apache.catalina.Connector;
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
  @@ -104,6 +105,7 @@
   import org.apache.catalina.deploy.ContextEnvironment;
   import org.apache.catalina.deploy.ResourceParams;
   import org.apache.catalina.net.ServerSocketFactory;
  +import org.apache.catalina.session.PersistentManager;
   import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.commons.modeler.BaseModelMBean;
   
  @@ -113,7 +115,7 @@
    * <code>org.apache.catalina.core.StandardServer</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.15 $ $Date: 2002/05/02 19:32:28 $
  + * @version $Revision: 1.16 $ $Date: 2002/05/02 20:08:31 $
    */
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -134,6 +136,7 @@
        */
       private static String exceptions[][] = {
           { "org.apache.catalina.core.StandardContext", "configured" },
  +        { "org.apache.catalina.core.StandardContext", "name" },
           { "org.apache.catalina.core.StandardContext", "publicId" },
           { "org.apache.catalina.core.StandardContext", "workDir" },
           { "org.apache.catalina.session.StandardManager", "distributable" },
  @@ -594,6 +597,12 @@
           }
           
           // Store nested <Resources> element
  +        DirContext resources = context.getResources();
  +        if (resources != null) {
  +            storeResources(writer, indent + 2, resources);
  +        }
  +
  +        /*
           ContextResource[] resources = context.findResources();
           for (int i = 0; i < resources.length; i++) {
               for (int j = 0; j < indent + 2; j++) {
  @@ -647,6 +656,7 @@
                   }
               }
           }
  +        */
           
           
           // Store nested <ResourceLink> elements
  @@ -937,7 +947,7 @@
           }
   
           // Store nested <Cluster> elements
  -        ; // FIXME
  +        ; // FIXME - But it's not supported by any standard Host implementation
   
           // Store nested <Context> elements (or other relevant containers)
           Container children[] = host.findChildren();
  @@ -1098,7 +1108,12 @@
           writer.println(">");
   
           // Store nested <Store> element
  -        ; // FIXME
  +        if (manager instanceof PersistentManager) {
  +            Store store = ((PersistentManager) manager).getStore();
  +            if (store != null) {
  +                storeStore(writer, indent + 2, store);
  +            }
  +        }
   
           // Store the ending of this element
           for (int i = 0; i < indent; i++) {
  @@ -1126,6 +1141,35 @@
           }
           writer.print("<Realm");
           storeAttributes(writer, realm);
  +        writer.println("/>");
  +
  +    }
  +
  +
  +    /**
  +     * Store the specified Resources properties.
  +     *
  +     * @param writer PrintWriter to which we are storing
  +     * @param indent Number of spaces to indent this element
  +     * @param resources Object whose properties are being stored
  +     *
  +     * @exception Exception if an exception occurs while storing
  +     */
  +    private void storeResources(PrintWriter writer, int indent,
  +                                DirContext resources) throws Exception {
  +
  +        if (resources instanceof org.apache.naming.resources.FileDirContext) {
  +            return;
  +        }
  +        if (resources instanceof org.apache.naming.resources.WARDirContext) {
  +            return;
  +        }
  +
  +        for (int i = 0; i < indent; i++) {
  +            writer.print(' ');
  +        }
  +        writer.print("<Resources");
  +        storeAttributes(writer, resources);
           writer.println("/>");
   
       }
  
  
  

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