tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager JMXProxyServlet.java HTMLManagerServlet.java StatusManagerServlet.java ManagerServlet.java
Date Thu, 23 Sep 2004 07:03:28 GMT
remm        2004/09/23 00:03:28

  Modified:    webapps/manager/WEB-INF/classes/org/apache/catalina/manager
                        JMXProxyServlet.java HTMLManagerServlet.java
                        StatusManagerServlet.java ManagerServlet.java
  Log:
  - Fix some deprecation warnings.
  - Fix bug 31264: deploy should now behave correctly. Also move the writing of the WAR inside
the isServiced block, so that if the uploading
    takes time, the auto deployer doesn't try to deploy it.
  - Add any deployment operation inside a try/finally block so that serviced is set back to
false for the management operation, regardless of
    what occurs. There shouldn't be any unexpected exceptions thrown out there, but any problem
would prevent further management of the
    application.
  
  Revision  Changes    Path
  1.7       +2 -6      jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/JMXProxyServlet.java
  
  Index: JMXProxyServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/JMXProxyServlet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JMXProxyServlet.java	27 Feb 2004 14:59:07 -0000	1.6
  +++ JMXProxyServlet.java	23 Sep 2004 07:03:27 -0000	1.7
  @@ -20,12 +20,9 @@
   
   import java.io.IOException;
   import java.io.PrintWriter;
  -import java.util.Enumeration;
   import java.util.Iterator;
   import java.util.Set;
  -import java.util.Vector;
   import javax.management.MBeanServer;
  -import javax.management.ObjectInstance;
   import javax.management.ObjectName;
   import javax.management.MBeanInfo;
   import javax.management.MBeanAttributeInfo;
  @@ -35,7 +32,6 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import org.apache.commons.modeler.Registry;
  -import org.apache.tomcat.util.compat.JdkCompat;
   
   /**
    * This servlet will dump JMX attributes in a simple format
  @@ -59,8 +55,8 @@
        */
       public void init() throws ServletException {
           // Retrieve the MBean server
  -        registry=Registry.getRegistry();
  -        mBeanServer = Registry.getRegistry().getServer();
  +        registry = Registry.getRegistry(null, null);
  +        mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
       }
   
   
  
  
  
  1.16      +8 -4      jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/HTMLManagerServlet.java
  
  Index: HTMLManagerServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/HTMLManagerServlet.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HTMLManagerServlet.java	17 Sep 2004 19:50:20 -0000	1.15
  +++ HTMLManagerServlet.java	23 Sep 2004 07:03:27 -0000	1.16
  @@ -205,9 +205,13 @@
   
                   if (!isServiced(path)) {
                       addServiced(path);
  -                    warUpload.write(file);
  -                    check(path);
  -                    removeServiced(path);
  +                    try {
  +                        warUpload.write(file);
  +                        // Perform new deployment
  +                        check(path);
  +                    } finally {
  +                        removeServiced(path);
  +                    }
                   }
                   break;
               }
  
  
  
  1.15      +2 -2      jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusManagerServlet.java
  
  Index: StatusManagerServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusManagerServlet.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StatusManagerServlet.java	23 Jul 2004 22:46:08 -0000	1.14
  +++ StatusManagerServlet.java	23 Sep 2004 07:03:27 -0000	1.15
  @@ -108,7 +108,7 @@
       public void init() throws ServletException {
   
           // Retrieve the MBean server
  -        mBeanServer = Registry.getServer();
  +        mBeanServer = Registry.getRegistry(null, null).getMBeanServer();
   
           // Set our properties from the initialization parameters
           String value = null;
  
  
  
  1.22      +57 -48    jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/ManagerServlet.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ManagerServlet.java	2 Sep 2004 21:50:49 -0000	1.21
  +++ ManagerServlet.java	23 Sep 2004 07:03:27 -0000	1.22
  @@ -618,30 +618,27 @@
           if (debug >= 2) {
               log("Uploading WAR file to " + localWar);
           }
  -        try {
  -            uploadWar(request, localWar);
  -        } catch (IOException e) {
  -            log("managerServlet.upload[" + displayPath + "]", e);
  -            writer.println(sm.getString("managerServlet.exception",
  -                                        e.toString()));
  -            return;
  -        }
  -
  -        // Copy WAR and XML to the host base
  -        if (tag != null) {
  -            deployedPath = deployed;
  -            File localWarCopy = new File(deployedPath, basename + ".war");
  -            copy(localWar, localWarCopy);
  -            localWar = localWarCopy;
  -        }
   
           // Copy WAR to appBase
           try {
               if (!isServiced(path)) {
                   addServiced(path);
  -                copy(localWar, new File(getAppBase(), basename + ".war"));
  -                check(path);
  -                removeServiced(path);
  +                try {
  +                    // Upload WAR
  +                    uploadWar(request, localWar);
  +                    // Copy WAR and XML to the host app base if needed
  +                    if (tag != null) {
  +                        deployedPath = deployed;
  +                        File localWarCopy = new File(deployedPath, basename + ".war");
  +                        copy(localWar, localWarCopy);
  +                        localWar = localWarCopy;
  +                        copy(localWar, new File(getAppBase(), basename + ".war"));
  +                    }
  +                    // Perform new deployment
  +                    check(path);
  +                } finally {
  +                    removeServiced(path);
  +                }
               }
           } catch (Exception e) {
               log("managerServlet.check[" + displayPath + "]", e);
  @@ -701,9 +698,13 @@
           try {
               if (!isServiced(path)) {
                   addServiced(path);
  -                copy(localWar, new File(getAppBase(), getDocBase(path) + ".war"));
  -                check(path);
  -                removeServiced(path);
  +                try {
  +                    copy(localWar, new File(getAppBase(), getDocBase(path) + ".war"));
  +                    // Perform new deployment
  +                    check(path);
  +                } finally {
  +                    removeServiced(path);
  +                }
               }
           } catch (Exception e) {
               log("managerServlet.check[" + displayPath + "]", e);
  @@ -794,21 +795,25 @@
           try {
               if (!isServiced(path)) {
                   addServiced(path);
  -                if (config != null) {
  -                    copy(new File(config), 
  -                            new File(configBase, getConfigFile(path) + ".xml"));
  -                }
  -                if (war != null) {
  -               	    if (war.endsWith(".war")) {
  -                        copy(new File(war), 
  -                            new File(getAppBase(), getDocBase(path) + ".war"));
  -                    } else {
  -                        copy(new File(war), 
  -                            new File(getAppBase(), getDocBase(path)));
  +                try {
  +                    if (config != null) {
  +                        copy(new File(config), 
  +                                new File(configBase, getConfigFile(path) + ".xml"));
                       }
  +                    if (war != null) {
  +                        if (war.endsWith(".war")) {
  +                            copy(new File(war), 
  +                                    new File(getAppBase(), getDocBase(path) + ".war"));
  +                        } else {
  +                            copy(new File(war), 
  +                                    new File(getAppBase(), getDocBase(path)));
  +                        }
  +                    }
  +                    // Perform new deployment
  +                    check(path);
  +                } finally {
  +                    removeServiced(path);
                   }
  -                check(path);
  -                removeServiced(path);
               }
               writer.println(sm.getString("managerServlet.deployed",
                       displayPath));
  @@ -1312,19 +1317,23 @@
               // Stop the context first to be nicer
               if (!isServiced(path)) {
                   addServiced(path);
  -                ((Lifecycle) context).stop();
  -                File war = new File(getAppBase(), getDocBase(path) + ".war");
  -                File dir = new File(getAppBase(), getDocBase(path));
  -                File xml = new File(configBase, getConfigFile(path) + ".xml");
  -                if (war.exists()) {
  -                    war.delete();
  -                } else if (dir.exists()) {
  -                    undeployDir(dir);
  -                } else {
  -                    xml.delete();
  +                try {
  +                    ((Lifecycle) context).stop();
  +                    File war = new File(getAppBase(), getDocBase(path) + ".war");
  +                    File dir = new File(getAppBase(), getDocBase(path));
  +                    File xml = new File(configBase, getConfigFile(path) + ".xml");
  +                    if (war.exists()) {
  +                        war.delete();
  +                    } else if (dir.exists()) {
  +                        undeployDir(dir);
  +                    } else {
  +                        xml.delete();
  +                    }
  +                    // Perform new deployment
  +                    check(path);
  +                } finally {
  +                    removeServiced(path);
                   }
  -                check(path);
  -                removeServiced(path);
               }
               writer.println(sm.getString("managerServlet.undeployed",
                                           displayPath));
  
  
  

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