[Jboss-cvs] JBossAS SVN: r55915 - in branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat: security/config tc5

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 14 16:21:51 EDT 2006


Author: anil.saldhana at jboss.com
Date: 2006-08-14 16:21:50 -0400 (Mon, 14 Aug 2006)
New Revision: 55915

Modified:
   branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/security/config/JBossContextConfig.java
   branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/Tomcat5.java
Log:
JBAS-3358: Do not delete work dir on context destroy.  This is configurable at the tomcat service level

Modified: branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/security/config/JBossContextConfig.java
===================================================================
--- branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/security/config/JBossContextConfig.java	2006-08-14 20:17:15 UTC (rev 55914)
+++ branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/security/config/JBossContextConfig.java	2006-08-14 20:21:50 UTC (rev 55915)
@@ -52,6 +52,8 @@
    
    private boolean isTrace = log.isTraceEnabled();
    
+   private boolean DELEGATE_TO_PARENT = false; 
+   
    /**
     * Create a new JBossContextConfig.
     */
@@ -63,13 +65,28 @@
          Map authMap = this.getAuthenticators();
          if(authMap.size() > 0)
             customAuthenticators = authMap; 
+         this.DELEGATE_TO_PARENT = getDeleteWorkDir();
       }catch(Exception e)
       {
          log.error("Failed to customize authenticators::",e); 
       } 
-   } 
-   
+   }   
+    
    /**
+    * Process a "destroy" event for this Context.
+    */
+   protected synchronized void destroy()
+   { 
+      if(log.isTraceEnabled())
+         log.trace("destroy called with DELEGATE_TO_PARENT="
+               + DELEGATE_TO_PARENT);
+      if(DELEGATE_TO_PARENT)
+        super.destroy();
+   }
+
+
+
+   /**
     * Map of Authenticators
     * @return
     * @throws Exception
@@ -112,4 +129,19 @@
                        "Authenticators"); 
       return props; 
    }
+   
+   /**
+    * Get the flag that sets whether the work directory corresponding
+    * to the context needs to be deleted (delegate to parent) or not
+    * @return
+    * @throws JMException
+    */
+   private boolean getDeleteWorkDir() throws JMException
+   {
+      Boolean flag = Boolean.FALSE;
+      MBeanServer server = MBeanServerLocator.locateJBoss();
+      flag = (Boolean)server.getAttribute(new ObjectName("jboss.web:service=WebServer"),
+                       "DeleteWorkDirOnContextDestroy"); 
+      return flag.booleanValue(); 
+   }
 }

Modified: branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/Tomcat5.java
===================================================================
--- branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/Tomcat5.java	2006-08-14 20:17:15 UTC (rev 55914)
+++ branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/Tomcat5.java	2006-08-14 20:21:50 UTC (rev 55915)
@@ -137,6 +137,11 @@
    private boolean useJBossWebLoader = true;
 
    /**
+    * JBAS-3358: Work directory shouldn't be deleted on Context Destroy
+    */
+   private boolean deleteWorkDirOnContextDestroy = false;
+   
+   /**
     * The server xml configuration file name
     */
    private String serverConfigFile = "server.xml";
@@ -294,8 +299,18 @@
    public void setUseJK(boolean useJK)
    {
       this.useJK = useJK;
+   } 
+
+   public boolean getDeleteWorkDirOnContextDestroy()
+   {
+      return deleteWorkDirOnContextDestroy;
    }
 
+   public void setDeleteWorkDirOnContextDestroy(boolean deleteFlag)
+   {
+      this.deleteWorkDirOnContextDestroy = deleteFlag;
+   }
+
    /**
     * The SessionIdAlphabet is the set of characters used to create a session Id
     */




More information about the jboss-cvs-commits mailing list