cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2005-05-15 Thread remm
remm2005/05/15 09:29:24

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Use canonical path.
  
  Revision  ChangesPath
  1.61  +2 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- HostConfig.java   12 May 2005 09:29:54 -  1.60
  +++ HostConfig.java   15 May 2005 16:29:24 -  1.61
  @@ -581,7 +581,7 @@
   docBase = new File(appBase(), context.getDocBase());
   }
   // If external docBase, register .xml as redeploy first
  -if 
(!docBase.getAbsolutePath().startsWith(appBase().getAbsolutePath())) {
  +if 
(!docBase.getCanonicalPath().startsWith(appBase().getAbsolutePath())) {
   isExternal = true;
   deployedApp.redeployResources.put
   (contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java LocalStrings.properties SetContextPropertiesRule.java

2005-05-12 Thread remm
remm2005/05/12 02:29:54

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java LocalStrings.properties
SetContextPropertiesRule.java
  Log:
  - 34840: Found a way to tweak behavior when using an external WAR.
  - Ignore docBase if the context is inside the host appBase, as it is 
duplicated by the context file name. Not doing so creates a mess in some cases.
  
  Revision  ChangesPath
  1.60  +20 -7 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- HostConfig.java   14 Mar 2005 11:52:04 -  1.59
  +++ HostConfig.java   12 May 2005 09:29:54 -  1.60
  @@ -53,7 +53,6 @@
* @author Remy Maucherat
* @version $Revision$ $Date$
*/
  -
   public class HostConfig
   implements LifecycleListener {
   
  @@ -575,15 +574,27 @@
   context.setPath(contextPath);
   // Add the associated docBase to the redeployed list if it's a 
WAR
   boolean isWar = false;
  +boolean isExternal = false;
   if (context.getDocBase() != null) {
   File docBase = new File(context.getDocBase());
   if (!docBase.isAbsolute()) {
   docBase = new File(appBase(), context.getDocBase());
   }
  -deployedApp.redeployResources.put(docBase.getAbsolutePath(),
  +// If external docBase, register .xml as redeploy first
  +if 
(!docBase.getAbsolutePath().startsWith(appBase().getAbsolutePath())) {
  +isExternal = true;
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
   new Long(docBase.lastModified()));
  -if 
(docBase.getAbsolutePath().toLowerCase().endsWith(.war)) {
  -isWar = true;
  +if 
(docBase.getAbsolutePath().toLowerCase().endsWith(.war)) {
  +isWar = true;
  +}
  +} else {
  +
log.warn(sm.getString(hostConfig.deployDescriptor.localDocBaseSpecified,
  + docBase));
  +// Ignore specified docBase
  +context.setDocBase(null);
   }
   }
   host.addChild(context);
  @@ -628,8 +639,10 @@
   addWatchedResources(deployedApp, null, context);
   }
   // Add the context XML to the list of files which should 
trigger a redeployment
  -deployedApp.redeployResources.put
  -(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +if (!isExternal) {
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +}
   }
   } catch (Throwable t) {
   log.error(sm.getString(hostConfig.deployDescriptor.error,
  
  
  
  1.15  +1 -0  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LocalStrings.properties   15 Feb 2005 15:42:58 -  1.14
  +++ LocalStrings.properties   12 May 2005 09:29:54 -  1.15
  @@ -47,6 +47,7 @@
   hostConfig.deploy=Deploying web application directory {0}
   hostConfig.deployDescriptor=Deploying configuration descriptor {0}
   hostConfig.deployDescriptor.error=Error deploying configuration descriptor 
{0}
  +hostConfig.deployDescriptor.localDocBaseSpecified=A docBase {0} inside the 
host appBase has been specified, and will be ignored
   hostConfig.deployDir=Deploying web application directory {0}
   hostConfig.deployDir.error=Error deploying web application directory {0}
   hostConfig.deployJar=Deploying web application archive {0}
  
  
  
  1.2   +1 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/SetContextPropertiesRule.java
  
  Index: SetContextPropertiesRule.java
  ===
  RCS file: 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2005-03-14 Thread remm
remm2005/03/14 03:52:04

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - 34006: If antiResourceLocking was used, the old code considered the path as 
external (bad).
  - Simplify code a lot, as the case where the docBase is an external path is 
handled in the beginning before starting the context.
  
  Revision  ChangesPath
  1.59  +14 -38
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- HostConfig.java   17 Feb 2005 00:46:14 -  1.58
  +++ HostConfig.java   14 Mar 2005 11:52:04 -  1.59
  @@ -614,46 +614,22 @@
   (contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   addWatchedResources(deployedApp, 
expandedDocBase.getAbsolutePath(), context);
   } else {
  -if (context.getDocBase() != null) {
  -// If the context is outside of the Host appBase, 
removing the xml
  -// should remove the webapp
  -boolean external = false;
  -File docBase = new File(context.getDocBase());
  -if (!docBase.isAbsolute()) {
  -docBase = new File(appBase(), context.getDocBase());
  -}
  -try {
  -docBase = docBase.getCanonicalFile();
  -if 
(!docBase.getAbsolutePath().startsWith(appBase().getAbsolutePath())) {
  -external = true;
  -deployedApp.redeployResources.put
  -(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  -}
  -} catch (IOException e) {
  -// Ignore
  -}
  -if (!external) {
  -// Find an existing matching war and expanded folder
  -if (warDocBase.exists()) {
  -
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
  -new Long(warDocBase.lastModified()));
  -}
  -if (expandedDocBase.exists()) {
  -
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
  -new 
Long(expandedDocBase.lastModified()));
  -addWatchedResources(deployedApp, 
  -expandedDocBase.getAbsolutePath(), 
context);
  -}
  -// Add the context XML to the list of files which 
should trigger a redeployment
  -deployedApp.redeployResources.put
  -(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  -}
  +// Find an existing matching war and expanded folder
  +if (warDocBase.exists()) {
  +
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
  +new Long(warDocBase.lastModified()));
  +}
  +if (expandedDocBase.exists()) {
  +
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
  +new Long(expandedDocBase.lastModified()));
  +addWatchedResources(deployedApp, 
  +expandedDocBase.getAbsolutePath(), context);
   } else {
  -// Add the context XML to the list of files which should 
trigger a redeployment
  -deployedApp.redeployResources.put
  -(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   addWatchedResources(deployedApp, null, context);
   }
  +// Add the context XML to the list of files which should 
trigger a redeployment
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   }
   } catch (Throwable t) {
   log.error(sm.getString(hostConfig.deployDescriptor.error,
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2005-02-16 Thread remm
remm2005/02/16 13:14:36

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - The XML should be added last in that case too.
  
  Revision  ChangesPath
  1.57  +4 -4  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- HostConfig.java   15 Feb 2005 16:19:21 -  1.56
  +++ HostConfig.java   16 Feb 2005 21:14:36 -  1.57
  @@ -638,15 +638,15 @@
   
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
   new Long(warDocBase.lastModified()));
   }
  -// Add the context XML to the list of files which 
should trigger a redeployment
  -deployedApp.redeployResources.put
  -(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   if (expandedDocBase.exists()) {
   
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
   new 
Long(expandedDocBase.lastModified()));
   addWatchedResources(deployedApp, 
   expandedDocBase.getAbsolutePath(), 
context);
   }
  +// Add the context XML to the list of files which 
should trigger a redeployment
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   }
   } else {
   // Add the context XML to the list of files which should 
trigger a redeployment
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2005-02-16 Thread remm
remm2005/02/16 16:46:14

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Deleting expanded folder doesn't have too many benefits overall.
  
  Revision  ChangesPath
  1.58  +3 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- HostConfig.java   16 Feb 2005 21:14:36 -  1.57
  +++ HostConfig.java   17 Feb 2005 00:46:14 -  1.58
  @@ -608,10 +608,10 @@
   // Add the eventual unpacked WAR and all the resources which 
will be
   // watched inside it
   if (isWar  unpackWARs) {
  -deployedApp.redeployResources.put
  -(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
   new Long(expandedDocBase.lastModified()));
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   addWatchedResources(deployedApp, 
expandedDocBase.getAbsolutePath(), context);
   } else {
   if (context.getDocBase() != null) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2005-02-15 Thread remm
remm2005/02/15 08:19:21

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Handle similar cases for compressed WAR deployment and descriptor 
deployments.
  
  Revision  ChangesPath
  1.56  +12 -8 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- HostConfig.java   15 Feb 2005 15:42:58 -  1.55
  +++ HostConfig.java   15 Feb 2005 16:19:21 -  1.56
  @@ -608,6 +608,8 @@
   // Add the eventual unpacked WAR and all the resources which 
will be
   // watched inside it
   if (isWar  unpackWARs) {
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
   new Long(expandedDocBase.lastModified()));
   addWatchedResources(deployedApp, 
expandedDocBase.getAbsolutePath(), context);
  @@ -636,15 +638,15 @@
   
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
   new Long(warDocBase.lastModified()));
   }
  +// Add the context XML to the list of files which 
should trigger a redeployment
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   if (expandedDocBase.exists()) {
   
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
   new 
Long(expandedDocBase.lastModified()));
   addWatchedResources(deployedApp, 
   expandedDocBase.getAbsolutePath(), 
context);
   }
  -// Add the context XML to the list of files which 
should trigger a redeployment
  -deployedApp.redeployResources.put
  -(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   }
   } else {
   // Add the context XML to the list of files which should 
trigger a redeployment
  @@ -787,6 +789,11 @@
   // Deploy the application in this WAR file
   if(log.isInfoEnabled()) 
   log.info(sm.getString(hostConfig.deployJar, file));
  +
  +// Populate redeploy resources with the WAR file
  +deployedApp.redeployResources.put
  +(dir.getAbsolutePath(), new Long(dir.lastModified()));
  +
   try {
   Context context = (Context) 
Class.forName(contextClass).newInstance();
   if (context instanceof Lifecycle) {
  @@ -799,7 +806,7 @@
   context.setDocBase(file);
   if (xml.exists()) {
   context.setConfigFile(xml.getAbsolutePath());
  -deployedApp.reloadResources.put
  +deployedApp.redeployResources.put
   (xml.getAbsolutePath(), new Long(xml.lastModified()));
   }
   host.addChild(context);
  @@ -831,9 +838,6 @@
   log.error(sm.getString(hostConfig.deployJar.error, file), t);
   }
   
  -// Populate redeploy resources with the WAR file
  -deployedApp.redeployResources.put
  -(dir.getAbsolutePath(), new Long(dir.lastModified()));
   deployed.put(contextPath, deployedApp);
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2005-01-29 Thread pero
pero2005/01/29 11:45:55

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  Add some log.isXXXEnabled
  
  Revision  ChangesPath
  1.54  +5 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- HostConfig.java   26 Jan 2005 14:58:50 -  1.53
  +++ HostConfig.java   29 Jan 2005 19:45:55 -  1.54
  @@ -553,7 +553,8 @@
   return;
   
   // Assume this is a configuration descriptor and deploy it
  -log.debug(sm.getString(hostConfig.deployDescriptor, file));
  +if(log.isDebugEnabled())
  +log.debug(sm.getString(hostConfig.deployDescriptor, file));
   Context context = null;
   try {
   synchronized (digester) {
  @@ -781,7 +782,8 @@
   DeployedApplication deployedApp = new 
DeployedApplication(contextPath);
   
   // Deploy the application in this WAR file
  -log.info(sm.getString(hostConfig.deployJar, file));
  +if(log.isInfoEnabled()) 
  +log.info(sm.getString(hostConfig.deployJar, file));
   try {
   Context context = (Context) 
Class.forName(contextClass).newInstance();
   if (context instanceof Lifecycle) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2005-01-26 Thread remm
remm2005/01/26 06:58:50

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Add back use of deployOnStartup, as I cannot use exclusively the autoDeploy 
flag to support all cases.
  
  Revision  ChangesPath
  1.53  +4 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- HostConfig.java   3 Jan 2005 16:10:19 -   1.52
  +++ HostConfig.java   26 Jan 2005 14:58:50 -  1.53
  @@ -1102,8 +1102,9 @@
   } catch (Exception e) {
   log.error(sm.getString(hostConfig.jmx.register, oname), e);
   }
  -
  -deployApps();
  +
  +if (host.getDeployOnStartup())
  +deployApps();
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java LocalStrings.properties

2005-01-03 Thread remm
remm2005/01/03 08:10:19

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java LocalStrings.properties
  Log:
  - 32771: Cannot undeploy/deploy misconfigured app after tomcat startup.
  - Submitted by Gabriele Garuglieri.
  
  Revision  ChangesPath
  1.52  +5 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- HostConfig.java   1 Dec 2004 11:06:22 -   1.51
  +++ HostConfig.java   3 Jan 2005 16:10:19 -   1.52
  @@ -554,8 +554,8 @@
   
   // Assume this is a configuration descriptor and deploy it
   log.debug(sm.getString(hostConfig.deployDescriptor, file));
  +Context context = null;
   try {
  -Context context = null;
   synchronized (digester) {
   try {
   context = (Context) digester.parse(contextXml);
  @@ -654,7 +654,9 @@
  file), t);
   }
   
  -deployed.put(contextPath, deployedApp);
  +if (context != null  host.findChild(context.getName()) != null) {
  +deployed.put(contextPath, deployedApp);
  +}
   }
   
   
  
  
  
  1.11  +4 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LocalStrings.properties   1 Dec 2004 11:06:22 -   1.10
  +++ LocalStrings.properties   3 Jan 2005 16:10:19 -   1.11
  @@ -16,6 +16,8 @@
   contextConfig.defaultMissing=Missing default web.xml, using application 
web.xml only
   contextConfig.defaultParse=Parse error in default web.xml
   contextConfig.defaultPosition=Occurred at line {0} column {1}
  +contextConfig.fixDocBase=Exception fixing docBase: {0} 
  +contextConfig.init=ContextConfig: Initializing
   contextConfig.missingRealm=No Realm has been configured to authenticate 
against
   contextConfig.role.auth=WARNING: Security role name {0} used in an 
auth-constraint without being defined in a security-role
   contextConfig.role.link=WARNING: Security role name {0} used in a 
role-link without being defined in a security-role
  @@ -57,7 +59,8 @@
   hostConfig.reload=Reloading context [{0}]
   hostConfig.removeXML=Context [{0}] is undeployed
   hostConfig.removeDIR=Directory {0} is undeployed
  -hostConfig.removeWAR=War {0} is undeployedhostConfig.start=HostConfig: 
Processing START
  +hostConfig.removeWAR=War {0} is undeployed
  +hostConfig.start=HostConfig: Processing START
   hostConfig.stop=HostConfig: Processing STOP
   hostConfig.undeploy=Undeploying web application at context path {0}
   hostConfig.undeploy.error=Error undeploying web application at context path 
{0}
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java LocalStrings.properties

2004-11-17 Thread remm
remm2004/11/17 15:21:13

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java LocalStrings.properties
  Log:
  - Add info log when reloading a context.
  
  Revision  ChangesPath
  1.50  +2 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- HostConfig.java   12 Nov 2004 00:48:41 -  1.49
  +++ HostConfig.java   17 Nov 2004 23:21:13 -  1.50
  @@ -1055,6 +1055,7 @@
   if ((!resource.exists()  lastModified != 0L) 
   || (resource.lastModified() != lastModified)) {
   // Reload application
  +log.info(sm.getString(hostConfig.reload, app.name));
   Container context = host.findChild(app.name);
   try {
   ((Lifecycle) context).stop();
  
  
  
  1.9   +1 -0  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LocalStrings.properties   23 Oct 2004 16:54:23 -  1.8
  +++ LocalStrings.properties   17 Nov 2004 23:21:13 -  1.9
  @@ -49,6 +49,7 @@
   hostConfig.expand=Expanding web application archive {0}
   hostConfig.expand.error=Exception while expanding web application archive {0}
   hostConfig.expanding=Expanding discovered web application archives
  +hostConfig.reload=Reloading context [{0}]
   hostConfig.context.restart=Error during context {0} restart
   hostConfig.removeXML=Context {0} is undeployed
   hostConfig.removeDIR=Directory {0} is undeployed
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2004-11-11 Thread remm
remm2004/11/11 16:48:41

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Fix an issue reported on tomcat-user. When a war includes a 
/META-INF/context.xml, the autodeployer doesn't handle it correctly.
The cause of the issue is simply that the war and expanded folders were not 
properly registered.
  
  Revision  ChangesPath
  1.49  +41 -20
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- HostConfig.java   5 Oct 2004 17:12:49 -   1.48
  +++ HostConfig.java   12 Nov 2004 00:48:41 -  1.49
  @@ -588,29 +588,35 @@
   }
   }
   host.addChild(context);
  +// Get paths for WAR and expanded WAR in appBase
  +String name = null;
  +String path = context.getPath();
  +if (path.equals()) {
  +name = ROOT;
  +} else {
  +if (path.startsWith(/)) {
  +name = path.substring(1);
  +} else {
  +name = path;
  +}
  +}
  +File expandedDocBase = new File(name);
  +File warDocBase = new File(name + .war);
  +if (!expandedDocBase.isAbsolute()) {
  +expandedDocBase = new File(appBase(), name);
  +warDocBase = new File(appBase(), name + .war);
  +}
   // Add the eventual unpacked WAR and all the resources which 
will be
   // watched inside it
   if (isWar  unpackWARs) {
  -String name = null;
  -String path = context.getPath();
  -if (path.equals()) {
  -name = ROOT;
  -} else {
  -if (path.startsWith(/)) {
  -name = path.substring(1);
  -} else {
  -name = path;
  -}
  -}
  -File docBase = new File(name);
  -if (!docBase.isAbsolute()) {
  -docBase = new File(appBase(), name);
  -}
  -deployedApp.redeployResources.put(docBase.getAbsolutePath(),
  -new Long(docBase.lastModified()));
  -addWatchedResources(deployedApp, docBase.getAbsolutePath(), 
context);
  +
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
  +new Long(expandedDocBase.lastModified()));
  +addWatchedResources(deployedApp, 
expandedDocBase.getAbsolutePath(), context);
   } else {
   if (context.getDocBase() != null) {
  +// If the context is outside of the Host appBase, 
removing the xml
  +// should remove the webapp
  +boolean external = false;
   File docBase = new File(context.getDocBase());
   if (!docBase.isAbsolute()) {
   docBase = new File(appBase(), context.getDocBase());
  @@ -618,6 +624,7 @@
   try {
   docBase = docBase.getCanonicalFile();
   if 
(!docBase.getAbsolutePath().startsWith(appBase().getAbsolutePath())) {
  +external = true;
   deployedApp.redeployResources.put
   (contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
   
deployedApp.reloadResources.remove(contextXml.getAbsolutePath());
  @@ -625,8 +632,22 @@
   } catch (IOException e) {
   // Ignore
   }
  +if (!external) {
  +// Find an existing matching war and expanded folder
  +if (warDocBase.exists()) {
  +
deployedApp.redeployResources.put(warDocBase.getAbsolutePath(),
  +new Long(warDocBase.lastModified()));
  +}
  +if (expandedDocBase.exists()) {
  +
deployedApp.redeployResources.put(expandedDocBase.getAbsolutePath(),
  +new 
Long(expandedDocBase.lastModified()));
  +addWatchedResources(deployedApp, 
  +expandedDocBase.getAbsolutePath(), 
context);
  +}
  +}
  +  

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2004-09-02 Thread remm
remm2004/09/02 03:15:53

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Also check if the webapp has been statically defined somewhere. In that case, the 
auto deployer should ignore it (at least until it's
removed from the host).
  
  Revision  ChangesPath
  1.44  +17 -5 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- HostConfig.java   4 Aug 2004 06:48:07 -   1.43
  +++ HostConfig.java   2 Sep 2004 10:15:53 -   1.44
  @@ -549,7 +549,7 @@
   protected void deployDescriptor(String contextPath, File contextXml, String 
file) {
   DeployedApplication deployedApp = new DeployedApplication(contextPath);
   
  -if (deployed.containsKey(contextPath))
  +if (deploymentExists(contextPath))
   return;
   
   // Assume this is a configuration descriptor and deploy it
  @@ -680,9 +680,11 @@
* @param file
*/
   protected void deployWAR(String contextPath, File dir, String file) {
  -if (deployed.containsKey(contextPath))
  +
  +if (deploymentExists(contextPath))
   return;
  -   // Checking for a nested /META-INF/context.xml
  +
  +// Checking for a nested /META-INF/context.xml
   JarFile jar = null;
   JarEntry entry = null;
   InputStream istream = null;
  @@ -857,7 +859,7 @@
   protected void deployDirectory(String contextPath, File dir, String file) {
   DeployedApplication deployedApp = new DeployedApplication(contextPath);
   
  -if (deployed.containsKey(contextPath))
  +if (deploymentExists(contextPath))
   return;
   
   // Deploy the application in this directory
  @@ -888,6 +890,16 @@
   deployed.put(contextPath, deployedApp);
   }
   
  +
  +/**
  + * Check if a webapp is already deployed in this host.
  + * 
  + * @param contextPath of the context which will be checked
  + */
  +protected boolean deploymentExists(String contextPath) {
  +return (deployed.containsKey(contextPath) || (host.findChild(contextPath) 
!= null));
  +}
  +
   
   /**
* Add watched resources to the specified Context.
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java Constants.java

2004-09-02 Thread remm
remm2004/09/02 03:28:00

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java Constants.java
  Log:
  - Put context.xml filename in the constants list.
  
  Revision  ChangesPath
  1.45  +3 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- HostConfig.java   2 Sep 2004 10:15:53 -   1.44
  +++ HostConfig.java   2 Sep 2004 10:28:00 -   1.45
  @@ -694,7 +694,7 @@
   if (deployXML  !xml.exists()) {
   try {
   jar = new JarFile(dir);
  -entry = jar.getJarEntry(META-INF/context.xml);
  +entry = jar.getJarEntry(Constants.ApplicationContextXml);
   if (entry != null) {
   istream = jar.getInputStream(entry);
   
  @@ -877,7 +877,7 @@
   context.setDocBase(file);
   if (deployXML) {
   context.setConfigFile
  -((new File(dir, META-INF/context.xml)).getAbsolutePath());
  +((new File(dir, 
Constants.ApplicationContextXml)).getAbsolutePath());
   }
   host.addChild(context);
   deployedApp.redeployResources.put(dir.getAbsolutePath(),
  
  
  
  1.9   +2 -1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Constants.java
  
  Index: Constants.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Constants.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Constants.java1 Sep 2004 22:55:48 -   1.8
  +++ Constants.java2 Sep 2004 10:28:00 -   1.9
  @@ -30,6 +30,7 @@
   
   public static final String Package = org.apache.catalina.startup;
   
  +public static final String ApplicationContextXml = META-INF/context.xml;
   public static final String ApplicationWebXml = /WEB-INF/web.xml;
   public static final String DefaultContextXml = conf/context.xml;
   public static final String DefaultWebXml = conf/web.xml;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread billbarker
billbarker2004/08/03 23:48:07

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java mbeans-descriptors.xml
  Log:
  Adding methods for JMX managed Contexts.
  
  -- Adding method to get the configBase via JMX
  -- Adding methods to add and remove apps with minimal dependancy checks.  This is 
for use with JMX apps (like the admin) that control the Context themselves.
  
  Revision  ChangesPath
  1.43  +74 -3 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- HostConfig.java   28 Jul 2004 10:30:10 -  1.42
  +++ HostConfig.java   4 Aug 2004 06:48:07 -   1.43
  @@ -422,6 +422,13 @@
   
   }
   
  +/**
  + * Get the name of the configBase.
  + * For use with JMX management.
  + */
  +public String getConfigBaseName() {
  +return configBase().getAbsolutePath();
  +}
   
   /**
* Given a context path, get the config file name.
  @@ -1133,8 +1140,72 @@
   deployApps(name);
   }
   }
  -
  -
  +
  +/**
  + * Add a new Context to be managed by us.
  + * Entry point for the admin webapp, and other JMX Context controlers.
  + */
  +public void manageApp(Context context)  {
  +
  +String contextPath = context.getPath();
  +
  +if (deployed.containsKey(contextPath))
  +return;
  +
  +DeployedApplication deployedApp = new DeployedApplication(contextPath);
  +
  +// Add the associated docBase to the redeployed list if it's a WAR
  +boolean isWar = false;
  +if (context.getDocBase() != null) {
  +File docBase = new File(context.getDocBase());
  +if (!docBase.isAbsolute()) {
  +docBase = new File(appBase(), context.getDocBase());
  +}
  +deployedApp.redeployResources.put(docBase.getAbsolutePath(),
  +  new Long(docBase.lastModified()));
  +if (docBase.getAbsolutePath().toLowerCase().endsWith(.war)) {
  +isWar = true;
  +}
  +}
  +host.addChild(context);
  +// Add the eventual unpacked WAR and all the resources which will be
  +// watched inside it
  +if (isWar  unpackWARs) {
  +String name = null;
  +String path = context.getPath();
  +if (path.equals()) {
  +name = ROOT;
  +} else {
  +if (path.startsWith(/)) {
  +name = path.substring(1);
  +} else {
  +name = path;
  +}
  +}
  +File docBase = new File(name);
  +if (!docBase.isAbsolute()) {
  +docBase = new File(appBase(), name);
  +}
  +deployedApp.redeployResources.put(docBase.getAbsolutePath(),
  +new Long(docBase.lastModified()));
  +addWatchedResources(deployedApp, docBase.getAbsolutePath(), context);
  +} else {
  +addWatchedResources(deployedApp, null, context);
  +}
  +deployed.put(contextPath, deployedApp);
  +}
  +
  +/**
  + * Remove a webapp from our control.
  + * Entry point for the admin webapp, and other JMX Context controlers.
  + */
  +public void unmanageApp(String contextPath) {
  +if(isServiced(contextPath)) {
  +deployed.remove(contextPath);
  +host.removeChild(host.findChild(contextPath));
  +}
  +}
  +
   // - Instance Variables
   
   
  
  
  
  1.4   +23 -0 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/mbeans-descriptors.xml
  
  Index: mbeans-descriptors.xml
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/mbeans-descriptors.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mbeans-descriptors.xml27 Jul 2004 07:17:21 -  1.3
  +++ mbeans-descriptors.xml4 Aug 2004 06:48:07 -   1.4
  @@ -39,6 +39,11 @@
  type=java.lang.String
  writeable=false/
   
  +attribute name=configBaseName
  +   description=The base directory for Context configuration files
  +   type=java.lang.String
  +   writeable=false /
  +
   attribute name=configClass
  description=The Java class name of the 

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread penpower
This email [EMAIL PROTECTED] is no longer available due to heavy spamming. Please 
visit our website http://www.alestron.com for contact info.

Thank you!





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread penpower
This email [EMAIL PROTECTED] is no longer available due to heavy spamming. Please 
visit our website http://www.alestron.com for contact info.

Thank you!





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
billbarker2004/08/03 23:48:07
 Modified:catalina/src/share/org/apache/catalina/startup
   HostConfig.java mbeans-descriptors.xml
 Log:
 Adding methods for JMX managed Contexts.
 
 -- Adding method to get the configBase via JMX
 -- Adding methods to add and remove apps with minimal dependancy checks.  This is for use with JMX apps (like the admin) that control the Context themselves.


I don't quite see how this is any different from check(String name).
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread Bill Barker
On add, there isn't a context.xml file (yet), and there is no particular
relationship between the Context path and the docBase.

On remove, it's not conditional on changing watched resources.


- Original Message - 
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 2:40 AM
Subject: Re: cvs commit:
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup
HostConfig.java mbeans-descriptors.xml


[EMAIL PROTECTED] wrote:

billbarker2004/08/03 23:48:07

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java mbeans-descriptors.xml
  Log:
  Adding methods for JMX managed Contexts.

  -- Adding method to get the configBase via JMX
  -- Adding methods to add and remove apps with minimal dependancy checks.
This is for use with JMX apps (like the admin) that control the Context
themselves.


I don't quite see how this is any different from check(String name).

Rémy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread Bill Barker

Remy Maucherat [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:

 billbarker2004/08/03 23:48:07
 
   Modified:catalina/src/share/org/apache/catalina/startup
 HostConfig.java mbeans-descriptors.xml
   Log:
   Adding methods for JMX managed Contexts.
 
   -- Adding method to get the configBase via JMX
   -- Adding methods to add and remove apps with minimal dependancy
checks.  This is for use with JMX apps (like the admin) that control the
Context themselves.
 
 
 I don't quite see how this is any different from check(String name).


Well, for 'add', there isn't necessarily any context.xml file, and there
isn't necessarily any relationship between the Context path and docBase.
For 'remove', the remove is unconditional and doesn't require touching
resources that may have never existed.

One alternative would be to have the admin webapp alway create context.xml
for the Create Context action, and delete it for the Remove Context
action.  However, this creates way more problems then it will ever solve (at
least with the config as it is now).



 Rémy




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread Remy Maucherat
Bill Barker wrote:
Remy Maucherat [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

[EMAIL PROTECTED] wrote:
   

billbarker2004/08/03 23:48:07
Modified:catalina/src/share/org/apache/catalina/startup
  HostConfig.java mbeans-descriptors.xml
Log:
Adding methods for JMX managed Contexts.
-- Adding method to get the configBase via JMX
-- Adding methods to add and remove apps with minimal dependancy
 

checks.  This is for use with JMX apps (like the admin) that control the
Context themselves.
 

 

I don't quite see how this is any different from check(String name).
   

Well, for 'add', there isn't necessarily any context.xml file, and there
isn't necessarily any relationship between the Context path and docBase.
For 'remove', the remove is unconditional and doesn't require touching
resources that may have never existed.
One alternative would be to have the admin webapp alway create context.xml
for the Create Context action, and delete it for the Remove Context
action.  However, this creates way more problems then it will ever solve (at
least with the config as it is now).
 

Yes, why not.
To be perfectly honest, I envisioned that these manager/admin/etc would 
indeed create the needed context.xml file (or the folder or war in the 
docBase; you get the idea). The most important thing is that all 
deployment operations are fully handled by one component (otherwise, we 
fall back in the previous situation where the auto deployer doesn't talk 
to the deployer, which doesn't know about the manager webapp). The new 
methods don't change this, so it's not a problem.

Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread Bill Barker

- Original Message -
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 12:19 PM
Subject: Re: cvs commit:
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup
HostConfig.java mbeans-descriptors.xml


Bill Barker wrote:

Remy Maucherat [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


[EMAIL PROTECTED] wrote:



billbarker2004/08/03 23:48:07

 Modified:catalina/src/share/org/apache/catalina/startup
   HostConfig.java mbeans-descriptors.xml
 Log:
 Adding methods for JMX managed Contexts.

 -- Adding method to get the configBase via JMX
 -- Adding methods to add and remove apps with minimal dependancy


checks.  This is for use with JMX apps (like the admin) that control the
Context themselves.




I don't quite see how this is any different from check(String name).




Well, for 'add', there isn't necessarily any context.xml file, and there
isn't necessarily any relationship between the Context path and docBase.
For 'remove', the remove is unconditional and doesn't require touching
resources that may have never existed.

One alternative would be to have the admin webapp alway create context.xml
for the Create Context action, and delete it for the Remove Context
action.  However, this creates way more problems then it will ever solve
(at
least with the config as it is now).


Yes, why not.

To be perfectly honest, I envisioned that these manager/admin/etc would
indeed create the needed context.xml file (or the folder or war in the
docBase; you get the idea). The most important thing is that all
deployment operations are fully handled by one component (otherwise, we
fall back in the previous situation where the auto deployer doesn't talk
to the deployer, which doesn't know about the manager webapp). The new
methods don't change this, so it's not a problem.


The way that the admin works at the moment, any change you make only affects
the currently running instance of Tomcat unless you hit the Commit Changes
button.  With my patch, that doesn't change.  If I create the context.xml
file when you do a Create Context action, then you will still have that
Context defined next time Tomcat is started, even if you didn't do a Commit
Changes.  Even worse is that if I delete the context.xml file when you do a
Delete Context action, then your Context is still gone the next time
Tomcat is started.

That being said, I'm +-0 on the issue as a whole (the admin is one of the
first things I remove when installing Tomcat :).  I can change the admin to
use check(String) if people think that admin should work like manager.
However, I'm going to be without computer access through the weekend, so it
will have to wait until next week.

Rémy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java mbeans-descriptors.xml

2004-08-04 Thread Remy Maucherat
Bill Barker wrote:
The way that the admin works at the moment, any change you make only affects
the currently running instance of Tomcat unless you hit the Commit Changes
button.  With my patch, that doesn't change.  If I create the context.xml
file when you do a Create Context action, then you will still have that
Context defined next time Tomcat is started, even if you didn't do a Commit
Changes.  Even worse is that if I delete the context.xml file when you do a
Delete Context action, then your Context is still gone the next time
Tomcat is started.
That being said, I'm +-0 on the issue as a whole (the admin is one of the
first things I remove when installing Tomcat :).  I can change the admin to
use check(String) if people think that admin should work like manager.
However, I'm going to be without computer access through the weekend, so it
will have to wait until next week.
 

No, don't change it, it looks ok.
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2004-07-28 Thread remm
remm2004/07/28 03:30:10

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Add a filter to only remove .xml files from configBase (the default config is there
as well).
  - I think I'll rework this and add a third hashmap, containing the resources which 
are
actually controlled by Tomcat (it's a slightly different set than the resources 
which
should cause a redeployment).
  
  Revision  ChangesPath
  1.42  +3 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- HostConfig.java   27 Jul 2004 17:53:15 -  1.41
  +++ HostConfig.java   28 Jul 2004 10:30:10 -  1.42
  @@ -987,7 +987,8 @@
   File current = new File(resources2[j]);
   current = current.getCanonicalFile();
   if 
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
  -|| 
(current.getAbsolutePath().startsWith(configBase().getAbsolutePath( {
  +|| 
((current.getAbsolutePath().startsWith(configBase().getAbsolutePath())
  +  (current.getAbsolutePath().endsWith(.xml) 
{
   if (log.isDebugEnabled())
   log.debug(Delete  + current);
   ExpandWar.delete(current);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java ContextConfig.java

2004-07-27 Thread remm
remm2004/07/27 03:04:39

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java ContextConfig.java
  Log:
  - Add support for override flag in ContextConfig: none of the default context files 
will be parsed. This flag will only be used if the context
has a config file with override=true in conf/engine/host, because the one in 
/META-INF/context.xml will be parsed later on.
  - Improve support for resource watching.
  - Add the default context files to the monitor list for all contexts.
  
  Revision  ChangesPath
  1.39  +19 -5 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- HostConfig.java   27 Jul 2004 07:17:21 -  1.38
  +++ HostConfig.java   27 Jul 2004 10:04:39 -  1.39
  @@ -600,6 +600,8 @@
   deployedApp.redeployResources.put(docBase.getAbsolutePath(),
   new Long(docBase.lastModified()));
   addWatchedResources(deployedApp, docBase.getAbsolutePath(), 
context);
  +} else {
  +addWatchedResources(deployedApp, null, context);
   }
   } catch (Throwable t) {
   log.error(sm.getString(hostConfig.deployDescriptor.error,
  @@ -767,6 +769,8 @@
   deployedApp.redeployResources.put(docBase.getAbsolutePath(),
   new Long(docBase.lastModified()));
   addWatchedResources(deployedApp, docBase.getAbsolutePath(), 
context);
  +} else {
  +addWatchedResources(deployedApp, null, context);
   }
   } catch (Throwable t) {
   log.error(sm.getString(hostConfig.deployJar.error, file), t);
  @@ -871,13 +875,23 @@
   protected void addWatchedResources(DeployedApplication app, String docBase, 
Context context) {
   // FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*, 
WEB-INF/*.xml), where
   //we would only check if at least one resource is newer than 
app.timestamp
  -File docBaseFile = new File(docBase);
  -if (!docBaseFile.isAbsolute()) {
  -docBaseFile = new File(appBase(), docBase);
  +File docBaseFile = null;
  +if (docBase != null) {
  +docBaseFile = new File(docBase);
  +if (!docBaseFile.isAbsolute()) {
  +docBaseFile = new File(appBase(), docBase);
  +}
   }
   String[] watchedResources = context.findWatchedResources();
   for (int i = 0; i  watchedResources.length; i++) {
  -File resource = new File(docBaseFile, watchedResources[i]);
  +File resource = new File(watchedResources[i]);
  +if (!resource.isAbsolute()) {
  +if (docBase != null) {
  +resource = new File(docBaseFile, watchedResources[i]);
  +} else {
  +continue;
  +}
  +}
   app.reloadResources.put(resource.getAbsolutePath(), 
   new Long(resource.lastModified()));
   }
  
  
  
  1.51  +11 -8 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- ContextConfig.java26 Jul 2004 15:54:38 -  1.50
  +++ ContextConfig.java27 Jul 2004 10:04:39 -  1.51
  @@ -589,8 +589,10 @@
   protected void contextConfig() {
   
   // FIXME: Externalize default context.xml path the same way as web.xml
  -processContextConfig(new File(getBaseDir(), conf/context.xml));
  -processContextConfig(new File(getConfigBase(), context.xml.default));
  +if (!context.getOverride()) {
  +processContextConfig(new File(getBaseDir(), conf/context.xml));
  +processContextConfig(new File(getConfigBase(), context.xml.default));
  +}
   if (context.getConfigFile() != null)
   processContextConfig(new File(context.getConfigFile()));
   
  @@ -601,8 +603,14 @@
* Process a context.xml.
*/
   protected void processContextConfig(File file) {
  +
   if (log.isDebugEnabled())
   log.debug(Processing context [ + context.getName() + ] configuration 
file  + file);
  +
  +// Add as watched resource so 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2004-07-27 Thread remm
remm2004/07/27 04:22:54

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Address two fixmes regarding undeployment.
  
  Revision  ChangesPath
  1.40  +47 -6 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- HostConfig.java   27 Jul 2004 10:04:39 -  1.39
  +++ HostConfig.java   27 Jul 2004 11:22:53 -  1.40
  @@ -561,8 +561,6 @@
   context.setConfigFile(contextXml.getAbsolutePath());
   context.setPath(contextPath);
   // Add the context XML to the list of watched files
  -// FIXME: Special case of a xml which points to a WAR without unpackWAR 
or
  -//a directory outside of appBase - the .xml should be a 
redeployResource
   deployedApp.reloadResources.put
   (contextXml.getAbsolutePath(), new Long(contextXml.lastModified()));
   // Add the associated docBase to the redeployed list if it's a WAR
  @@ -601,6 +599,22 @@
   new Long(docBase.lastModified()));
   addWatchedResources(deployedApp, docBase.getAbsolutePath(), 
context);
   } else {
  +if (context.getDocBase() != null) {
  +File docBase = new File(context.getDocBase());
  +if (!docBase.isAbsolute()) {
  +docBase = new File(appBase(), context.getDocBase());
  +}
  +try {
  +docBase = docBase.getCanonicalFile();
  +if 
(!docBase.getAbsolutePath().startsWith(appBase().getAbsolutePath())) {
  +deployedApp.redeployResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +
deployedApp.reloadResources.remove(contextXml.getAbsolutePath());
  +}
  +} catch (IOException e) {
  +// Ignore
  +}
  +}
   addWatchedResources(deployedApp, null, context);
   }
   } catch (Throwable t) {
  @@ -924,7 +938,16 @@
   // Delete other redeploy resources
   for (int j = 0; j  resources.length; j++) {
   if (j != i) {
  -ExpandWar.delete(new File(resources[j]));
  +try {
  +File current = new File(resources[j]);
  +current = current.getCanonicalFile();
  +if 
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
  +|| 
(current.getAbsolutePath().startsWith(configBase().getAbsolutePath(
  +ExpandWar.delete(current);
  +} catch (IOException e) {
  +log.warn(sm.getString
  +(hostConfig.canonicalizing, app.name), e);
  +}
   }
   }
   deployed.remove(app.name);
  @@ -942,12 +965,30 @@
   }
   // Delete all redeploy resources
   for (int j = 0; j  resources.length; j++) {
  -ExpandWar.delete(new File(resources[j]));
  +try {
  +File current = new File(resources[j]);
  +current = current.getCanonicalFile();
  +if 
((current.getAbsolutePath().startsWith(appBase().getAbsolutePath()))
  +|| 
(current.getAbsolutePath().startsWith(configBase().getAbsolutePath(
  +ExpandWar.delete(current);
  +} catch (IOException e) {
  +log.warn(sm.getString
  +(hostConfig.canonicalizing, app.name), e);
  +}
   }
   // Delete reload resources as well (to remove any remaining .xml 
descriptor)
   String[] resources2 = (String[]) 
app.reloadResources.keySet().toArray(new String[0]);
   for (int j = 0; j  resources2.length; j++) {
  -ExpandWar.delete(new File(resources2[j]));
  +try {
  +File current = new File(resources2[j]);
  +current = 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java ContextConfig.java ExpandWar.java

2004-07-25 Thread remm
remm2004/07/25 16:35:37

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java ContextConfig.java ExpandWar.java
  Log:
  - Implement a significant amount of reload/redeployment.
  - Since I'm a happy (?) user of MickeyMouse(TM) OS (aka Windows), I can't really 
test stuff without the anti-locking code
which I haven't implemented yet. I'll do that tomorrow (this seems simple).
  - I used some ideas from Peter, and managed to notice code I could remove. Thanks.
  - Please don't file bugs on this until I've at least tested a bit :)
  - I need to add one extra method and refactor a bit to allow usage through the 
manager webapp (the manager webapp
will want synced operation, I think, so the background thread won't do it in that 
case - although it would do the job
eventually).
  - I'll also add the new extra configuration items tomorrow, such as the 
watchedfile feature (that's simple).
  
  Revision  ChangesPath
  1.35  +230 -159  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- HostConfig.java   23 Jul 2004 22:57:34 -  1.34
  +++ HostConfig.java   25 Jul 2004 23:35:37 -  1.35
  @@ -23,7 +23,6 @@
   import java.io.FileOutputStream;
   import java.io.IOException;
   import java.io.InputStream;
  -import java.net.URL;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.jar.JarEntry;
  @@ -36,6 +35,7 @@
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleListener;
  +import org.apache.catalina.core.ContainerBase;
   import org.apache.catalina.core.StandardHost;
   import org.apache.catalina.util.StringManager;
   import org.apache.tomcat.util.digester.Digester;
  @@ -422,14 +422,13 @@
   
   File appBase = appBase();
   File configBase = configBase();
  -do {
  -// Deploy XML descriptors from configBase
  -deployDescriptors(configBase, configBase.list());
  -// Deploy expanded folders
  -deployDirectories(appBase, appBase.list());
  -// Deploy WARs, and loop if additional descriptors are found
  -} while (deployWARs(appBase, appBase.list()));
  -
  +// Deploy XML descriptors from configBase
  +deployDescriptors(configBase, configBase.list());
  +// Deploy WARs, and loop if additional descriptors are found
  +deployWARs(appBase, appBase.list());
  +// Deploy expanded folders
  +deployDirectories(appBase, appBase.list());
  +
   }
   
   
  @@ -460,6 +459,8 @@
   if (deployed.containsKey(contextPath))
   continue;
   
  +DeployedApplication deployedApp = new 
DeployedApplication(contextPath);
  +
   // Assume this is a configuration descriptor and deploy it
   log.debug(sm.getString(hostConfig.deployDescriptor, files[i]));
   try {
  @@ -475,15 +476,45 @@
   }
   newContext.setConfigFile(contextXml.getAbsolutePath());
   newContext.setPath(contextPath);
  +// Add the context XML to the list of watched files
  +deployedApp.reloadResources.put
  +(contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +// Add the associated docBase to the redeployed list if it's a 
WAR
  +boolean isWar = false;
  +if (newContext.getDocBase() != null) {
  +File docBase = new File(newContext.getDocBase());
  +if (!docBase.isAbsolute()) {
  +docBase = new File(new File(host.getAppBase()), 
  +newContext.getDocBase());
  +}
  +deployedApp.redeployResources.put(docBase.getAbsolutePath(),
  +new Long(docBase.lastModified()));
  +if 
(docBase.getAbsolutePath().toLowerCase().endsWith(.war)) {
  +isWar = true;
  +}
  +}
   host.addChild(newContext);
  +// Add the eventual unpacked WAR and all the resources which 
will be
  +// watched inside it
  +if (isWar  unpackWARs  (newContext.getDocBase() != null)) {
  +File docBase = new File(newContext.getDocBase());
  +   

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2004-04-10 Thread remm
remm2004/04/10 07:56:31

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Bug 28262: Fix redeployment after removal of a war.
  - Submitted by Peter Rossbach.
  
  Revision  ChangesPath
  1.30  +39 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HostConfig.java   27 Feb 2004 14:58:49 -  1.29
  +++ HostConfig.java   10 Apr 2004 14:56:31 -  1.30
  @@ -26,6 +26,8 @@
   import java.net.URL;
   import java.util.ArrayList;
   import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.List;
   import java.util.jar.JarEntry;
   import java.util.jar.JarFile;
   
  @@ -572,6 +574,7 @@
   }
   istream = null;
   }
  +} finally {
   entry = null;
   if (jar != null) {
   try {
  @@ -1017,11 +1020,46 @@
   
   
   /**
  + *  Check remove wars, dir and context xml's
  + */
  +protected void checkRemoveApps() {
  +File appBase = appBase();
  +File configBase = configBase();
  +List currentDeployed = (List) deployed.clone();
  +Iterator iter = currentDeployed.iterator();
  +while (iter.hasNext()) {
  +String filename = (String) iter.next();
  +if (filename.toLowerCase().endsWith(.xml)) {
  +File file = new File(configBase, filename);
  +if (!file.exists()) {
  +log.debug(sm.getString(hostConfig.removeXML, filename));
  +deployed.remove(filename);
  +}
  +continue;
  +}
  +File file = new File(appBase, filename);
  +if (!file.exists()) {
  +if (log.isDebugEnabled() ) {
  +if (filename.toLowerCase().endsWith(.war))
  +log.debug(sm.getString(hostConfig.removeDIR, 
  +   filename));
  +else
  +log.debug(sm.getString(hostConfig.removeWAR,
  +   filename));
  +}
  +deployed.remove(filename);
  +}
  +}
  +}
  +
  +
  +/**
* Deploy webapps.
*/
   protected void check() {
   
   if (host.getAutoDeploy()) {
  +checkRemoveApps();
   // Deploy apps if the Host allows auto deploying
   deployApps();
   // Check for web.xml modification
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2004-01-23 Thread remm
remm2004/01/23 15:04:09

  Modified:catalina/src/share/org/apache/catalina/core
StandardContext.java
   catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Bug 26010: '_' was an inappropriate character to replace the path separator,
since it's a common character in HTTP. Experiment with using '#' instead,
which is client side only.
  
  Revision  ChangesPath
  1.110 +2 -2  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- StandardContext.java  20 Jan 2004 23:07:36 -  1.109
  +++ StandardContext.java  23 Jan 2004 23:04:09 -  1.110
  @@ -4797,7 +4797,7 @@
   if (path.equals()) {
   basename = ROOT;
   } else {
  -basename = path.substring(1).replace('/', '_');
  +basename = path.substring(1).replace('/', '#');
   }
   return (basename + .xml);
   }
  
  
  
  1.28  +5 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- HostConfig.java   13 Jan 2004 16:57:16 -  1.27
  +++ HostConfig.java   23 Jan 2004 23:04:09 -  1.28
  @@ -502,7 +502,7 @@
   
   // Calculate the context path and make sure it is unique
   String file = files[i].substring(0, files[i].length() - 4);
  -String contextPath = / + file.replace('_', '/');
  +String contextPath = / + file.replace('#', '/');
   if (file.equals(ROOT)) {
   contextPath = ;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java LocalStrings.properties

2004-01-13 Thread remm
remm2004/01/13 08:31:35

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java LocalStrings.properties
  Log:
  - Small cleanup of the class.
  - Add some i18n.
  - Use reload with a standard context (it might do stuff once again someday).
  - Init deployer on startup to avoid possible CL issues when embedded.
  
  Revision  ChangesPath
  1.26  +34 -28
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- HostConfig.java   23 Sep 2003 06:35:52 -  1.25
  +++ HostConfig.java   13 Jan 2004 16:31:35 -  1.26
  @@ -88,6 +88,7 @@
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Logger;
  +import org.apache.catalina.core.StandardContext;
   import org.apache.catalina.core.StandardHost;
   import org.apache.catalina.util.StringManager;
   import org.apache.naming.resources.ResourceAttributes;
  @@ -459,6 +460,9 @@
   if (!(host instanceof Deployer))
   return;
   
  +// Initialize the deployer
  +((Deployer) host).findDeployedApps();
  +
   File appBase = appBase();
   if (!appBase.exists() || !appBase.isDirectory())
   return;
  @@ -888,31 +892,33 @@
   boolean result = true;
   log.info(restartContext( + context.getName() + ));
   
  -/*
  -try {
  -StandardContext sctx=(StandardContext)context;
  -sctx.reload();
  -} catch( Exception ex ) {
  -log.warn(Erorr stopping context  + context.getName()  ++
  -ex.toString());
  -}
  -*/
  -try {
  -((Lifecycle) context).stop();
  -} catch( Exception ex ) {
  -log.warn(Erorr stopping context  + context.getName()  ++
  -ex.toString());
  -}
  -// if the context was not started ( for example an error in web.xml)
  -// we'll still get to try to start
  -try {
  -((Lifecycle) context).start();
  -} catch (Exception e) {
  -log.warn(Error restarting context  + context.getName() +   +
  -e.toString());
  -result = false;
  +if (context instanceof StandardContext) {
  +try {
  +StandardContext sctx = (StandardContext)context;
  +sctx.reload();
  +} catch( Exception e ) {
  +log.warn(sm.getString
  + (hostConfig.context.restart, context.getName()), e);
  +result = false;
  +}
  +} else {
  +try {
  +((Lifecycle) context).stop();
  +} catch( Exception ex ) {
  +log.warn(sm.getString
  + (hostConfig.context.restart, context.getName()), e);
  +}
  +// If the context was not started (for example an error 
  +// in web.xml) we'll still get to try to start
  +try {
  +((Lifecycle) context).start();
  +} catch (Exception e) {
  +log.warn(sm.getString
  + (hostConfig.context.restart, context.getName()), e);
  +result = false;
  +}
   }
  -
  +
   return result;
   }
   
  
  
  
  1.4   +1 -0  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LocalStrings.properties   16 Jan 2003 21:45:25 -  1.3
  +++ LocalStrings.properties   13 Jan 2004 16:31:35 -  1.4
  @@ -47,6 +47,7 @@
   hostConfig.expand=Expanding web application archive {0}
   hostConfig.expand.error=Exception while expanding web application archive {0}
   hostConfig.expanding=Expanding discovered web application archives
  +hostConfig.context.restart=Error during context {0} restart
   hostConfig.start=HostConfig: Processing START
   hostConfig.stop=HostConfig: Processing STOP
   hostConfig.undeploy=Undeploying web application at context path {0}
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2004-01-13 Thread remm
remm2004/01/13 08:57:16

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Oops.
  
  Revision  ChangesPath
  1.27  +6 -6  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- HostConfig.java   13 Jan 2004 16:31:35 -  1.26
  +++ HostConfig.java   13 Jan 2004 16:57:16 -  1.27
  @@ -896,7 +896,7 @@
   try {
   StandardContext sctx = (StandardContext)context;
   sctx.reload();
  -} catch( Exception e ) {
  +} catch (Exception e) {
   log.warn(sm.getString
(hostConfig.context.restart, context.getName()), e);
   result = false;
  @@ -904,7 +904,7 @@
   } else {
   try {
   ((Lifecycle) context).stop();
  -} catch( Exception ex ) {
  +} catch (Exception e) {
   log.warn(sm.getString
(hostConfig.context.restart, context.getName()), e);
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-09-23 Thread remm
remm2003/09/22 23:35:52

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Fix a problem rebuilding the context path given the context file name.
  
  Revision  ChangesPath
  1.25  +5 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- HostConfig.java   2 Sep 2003 21:22:00 -   1.24
  +++ HostConfig.java   23 Sep 2003 06:35:52 -  1.25
  @@ -498,7 +498,7 @@
   
   // Calculate the context path and make sure it is unique
   String file = files[i].substring(0, files[i].length() - 4);
  -String contextPath = / + file;
  +String contextPath = / + file.replace('_', '/');
   if (file.equals(ROOT)) {
   contextPath = ;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-09-02 Thread remm
remm2003/09/02 11:47:54

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Deploy descriptors even if deployOnStartup is false, as they should be considered
as if they were part of server.xml (IMO).
  
  Revision  ChangesPath
  1.23  +12 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- HostConfig.java   17 Aug 2003 08:32:53 -  1.22
  +++ HostConfig.java   2 Sep 2003 18:47:54 -   1.23
  @@ -1006,6 +1006,14 @@
   
   if (host.getDeployOnStartup()) {
   deployApps();
  +} else {
  +// Deploy descriptors anyway (it should be equivalent to being
  +// part of server.xml)
  +File configBase = configBase();
  +if (configBase.exists()  configBase.isDirectory()) {
  +String configFiles[] = configBase.list();
  +deployDescriptors(configBase, configFiles);
  +}
   }
   
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-08-17 Thread remm
remm2003/08/17 01:32:53

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Found a way to avoid the extra restart caused by the web.xml tracker, when
the webapp was deployed by an outside source, such as the manager
servlet.
  
  Revision  ChangesPath
  1.22  +15 -6 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- HostConfig.java   4 Aug 2003 19:02:30 -   1.21
  +++ HostConfig.java   17 Aug 2003 08:32:53 -  1.22
  @@ -771,15 +771,24 @@
   ResourceAttributes webXmlAttributes = 
   (ResourceAttributes) 
   resources.getAttributes(/WEB-INF/web.xml);
  +ResourceAttributes webInfAttributes = 
  +(ResourceAttributes) 
  +resources.getAttributes(/WEB-INF);
   long newLastModified = webXmlAttributes.getLastModified();
  +long webInfLastModified = webInfAttributes.getLastModified();
   Long lastModified = (Long) webXmlLastModified.get(contextName);
   if (lastModified == null) {
   webXmlLastModified.put
   (contextName, new Long(newLastModified));
   } else {
   if (lastModified.longValue() != newLastModified) {
  -webXmlLastModified.remove(contextName);
  -restartContext(context);
  +if (newLastModified  (webInfLastModified + 5000)) {
  +webXmlLastModified.remove(contextName);
  +restartContext(context);
  +} else {
  +webXmlLastModified.put
  +(contextName, new Long(newLastModified));
  +}
   }
   }
   } catch (NamingException e) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-08-04 Thread remm
remm2003/08/04 12:02:30

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Allow putting a /META-INF/context.xml inside any WAR file deployed
by the HostConfig.
  
  Revision  ChangesPath
  1.21  +74 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- HostConfig.java   26 Jul 2003 14:24:52 -  1.20
  +++ HostConfig.java   4 Aug 2003 19:02:30 -   1.21
  @@ -436,6 +436,10 @@
*/
   protected File configBase() {
   
  +if (configBase != null) {
  +return configBase;
  +}
  +
   File file = new File(System.getProperty(catalina.base), conf);
   Container parent = host.getParent();
   if ((parent != null)  (parent instanceof Engine)) {
  @@ -562,6 +566,72 @@
   contextPath = ;
   if (host.findChild(contextPath) != null)
   continue;
  +
  +// Checking for a nested /META-INF/context.xml
  +JarFile jar = null;
  +JarEntry entry = null;
  +InputStream istream = null;
  +BufferedOutputStream ostream = null;
  +File xml = new File
  +(configBase, files[i].substring
  + (0, files[i].lastIndexOf(.)) + .xml);
  +if (!xml.exists()) {
  +try {
  +jar = new JarFile(dir);
  +entry = jar.getJarEntry(META-INF/context.xml);
  +if (entry != null) {
  +istream = jar.getInputStream(entry);
  +ostream =
  +new BufferedOutputStream
  +(new FileOutputStream(xml), 1024);
  +byte buffer[] = new byte[1024];
  +while (true) {
  +int n = istream.read(buffer);
  +if (n  0) {
  +break;
  +}
  +ostream.write(buffer, 0, n);
  +}
  +ostream.flush();
  +ostream.close();
  +ostream = null;
  +istream.close();
  +istream = null;
  +entry = null;
  +jar.close();
  +jar = null;
  +deployDescriptors(configBase(), configBase.list());
  +return;
  +}
  +} catch (Exception e) {
  +// Ignore and continue
  +if (ostream != null) {
  +try {
  +ostream.close();
  +} catch (Throwable t) {
  +;
  +}
  +ostream = null;
  +}
  +if (istream != null) {
  +try {
  +istream.close();
  +} catch (Throwable t) {
  +;
  +}
  +istream = null;
  +}
  +entry = null;
  +if (jar != null) {
  +try {
  +jar.close();
  +} catch (Throwable t) {
  +;
  +}
  +jar = null;
  +}
  +}
  +}
   
   if (isUnpackWARs()) {
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-07-25 Thread remm
remm2003/07/25 06:57:30

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Fix problems when updating a WAR which had an associated context file.
  
  Revision  ChangesPath
  1.18  +33 -5 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- HostConfig.java   24 Jun 2003 23:42:34 -  1.17
  +++ HostConfig.java   25 Jul 2003 13:57:30 -  1.18
  @@ -775,10 +775,13 @@
   contextPath = ;
   if (dirLastModified  expanded.lastModified()) {
   try {
  +// Undeploy current application
   deployed.remove(files[i]);
  +deployed.remove(expandedDir + .xml);
   if (host.findChild(contextPath) != null) {
   ((Deployer) host).remove(contextPath, 
  - true);
  + false);
  +deleteDir(expanded);
   }
   } catch (Throwable t) {
   log.error(sm.getString
  @@ -832,6 +835,31 @@
   }
   
   return result;
  +}
  +
  +
  +/**
  + * Delete the specified directory, including all of its contents and
  + * subdirectories recursively.
  + *
  + * @param dir File object representing the directory to be deleted
  + */
  +protected void deleteDir(File dir) {
  +
  +String files[] = dir.list();
  +if (files == null) {
  +files = new String[0];
  +}
  +for (int i = 0; i  files.length; i++) {
  +File file = new File(dir, files[i]);
  +if (file.isDirectory()) {
  +deleteDir(file);
  +} else {
  +file.delete();
  +}
  +}
  +dir.delete();
  +
   }
   
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-07-25 Thread remm
remm2003/07/25 09:43:12

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Don't redeploy when a context file is added, and the context wasn't deployed
with the auto deployer.
  
  Revision  ChangesPath
  1.19  +14 -8 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- HostConfig.java   25 Jul 2003 13:57:30 -  1.18
  +++ HostConfig.java   25 Jul 2003 16:43:12 -  1.19
  @@ -509,10 +509,16 @@
   log.debug(sm.getString(hostConfig.deployDescriptor, files[i]));
   try {
   if (host.findChild(contextPath) != null) {
  -// If this is a newly added context file and 
  -// it overrides a context with a simple path, 
  -// undeploy the context
  -((Deployer) host).remove(contextPath);
  +if ((deployed.contains(file))
  +|| (deployed.contains(file + .war))) {
  +// If this is a newly added context file and 
  +// it overrides a context with a simple path, 
  +// that was previously deployed by the auto
  +// deployer, undeploy the context
  +((Deployer) host).remove(contextPath);
  +} else {
  +continue;
  +}
   }
   URL config =
   new URL(file, null, dir.getCanonicalPath());
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-06-24 Thread remm
remm2003/06/24 16:42:34

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Refactor configBase and appBase lookup.
  - Properly remove a context when its context file is updated, so that redeployment
succeeds.
  - Don't do anything for config files outside of the configBase (at least for now).
  
  Revision  ChangesPath
  1.17  +50 -21
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- HostConfig.java   24 Jun 2003 22:37:05 -  1.16
  +++ HostConfig.java   24 Jun 2003 23:42:34 -  1.17
  @@ -118,6 +118,18 @@
   
   
   /**
  + * App base.
  + */
  +private File appBase = null;
  +
  +
  +/**
  + * Config base.
  + */
  +private File configBase = null;
  +
  +
  +/**
* The Java class name of the Context configuration class we should use.
*/
   protected String configClass = org.apache.catalina.startup.ContextConfig;
  @@ -400,11 +412,20 @@
*/
   protected File appBase() {
   
  +if (appBase != null) {
  +return appBase;
  +}
  +
   File file = new File(host.getAppBase());
   if (!file.isAbsolute())
   file = new File(System.getProperty(catalina.base),
   host.getAppBase());
  -return (file);
  +try {
  +appBase = file.getCanonicalFile();
  +} catch (IOException e) {
  +appBase = file;
  +}
  +return (appBase);
   
   }
   
  @@ -421,7 +442,12 @@
   file = new File(file, parent.getName());
   }
   file = new File(file, host.getName());
  -return (file);
  +try {
  +configBase = file.getCanonicalFile();
  +} catch (IOException e) {
  +configBase = file;
  +}
  +return (configBase);
   
   }
   
  @@ -685,6 +711,7 @@
   }
   
   Long lastModified = (Long) contextXmlLastModified.get(contextName);
  +String configBase = configBase().getPath();
   String configFileName = context.getConfigFile();
   if (configFileName != null) {
   File configFile = new File(configFileName);
  @@ -699,23 +726,22 @@
   } else {
   if (lastModified.longValue() != newLastModified) {
   contextXmlLastModified.remove(contextName);
  -String fileName = contextName;
  -if (fileName.equals()) {
  -fileName = ROOT.xml;
  -} else {
  -fileName = fileName + .war;
  -}
  -try {
  -deployed.remove(fileName);
  -if (host.findChild(contextName) != null) {
  -((Deployer) host).remove(contextName);
  +String fileName = configFileName;
  +if (fileName.startsWith(configBase)) {
  +fileName = 
  +fileName.substring(configBase.length() + 1);
  +try {
  +deployed.remove(fileName);
  +if (host.findChild(contextName) != null) {
  +((Deployer) host).remove(contextName);
  +}
  +} catch (Throwable t) {
  +log.error(sm.getString
  +  (hostConfig.undeployJar.error,
  +   fileName), t);
   }
  -} catch (Throwable t) {
  -log.error(sm.getString
  -  (hostConfig.undeployJar.error,
  -   fileName), t);
  +deployApps();
   }
  -deployApps();
   }
   }
   }
  @@ -906,6 +932,9 @@
   log.debug(sm.getString(hostConfig.stop));
   
   undeployApps();
  +
  +appBase = null;
  +configBase = null;
   
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-06-15 Thread remm
remm2003/06/15 00:41:56

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Better handling for webapps which have been undeployed through the
manager.
  
  Revision  ChangesPath
  1.13  +11 -7 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- HostConfig.java   10 Jun 2003 20:15:35 -  1.12
  +++ HostConfig.java   15 Jun 2003 07:41:56 -  1.13
  @@ -706,10 +706,11 @@
   if (files[i].endsWith(.war)) {
   File dir = new File(appBase, files[i]);
   Long lastModified = (Long) warLastModified.get(files[i]);
  +long dirLastModified = dir.lastModified();
   if (lastModified == null) {
   warLastModified.put
   (files[i], new Long(dir.lastModified()));
  -} else if (dir.lastModified()  lastModified.longValue()) {
  +} else if (dirLastModified  lastModified.longValue()) {
   // The WAR has been modified: redeploy
   String expandedDir = files[i];
   int period = expandedDir.lastIndexOf(.);
  @@ -719,10 +720,13 @@
   String contextPath = / + expandedDir;
   if (contextPath.equals(/ROOT))
   contextPath = ;
  -if (dir.lastModified()  expanded.lastModified()) {
  +if (dirLastModified  expanded.lastModified()) {
   try {
  -((Deployer) host).remove(contextPath, true);
   deployed.remove(files[i]);
  +if (host.findChild(contextPath) != null) {
  +((Deployer) host).remove(contextPath, 
  + true);
  +}
   } catch (Throwable t) {
   
log.error(sm.getString(hostConfig.undeployJar.error,
  files[i]), t);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-06-15 Thread remm
remm2003/06/15 06:11:25

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Update the host properties, as discussed earlier:
- liveDeploy - autoDeploy: dynamic deployement of webapps put in the host
  appBase
- autoDeploy - deployOnStartup: Deploy webapps from appBase on startup
  - Neither of these have a good reason to be false by default (IMO).
  - Move context descriptors to
$CATALINA_BASE/conf/engine name/host name, as proposed by Glenn.
  - This should make the feature secure, and I think there's no justification
anymore for the deployXML flag.
  - Note: The manager webapp may need a few updates, which are in progress.
  
  Revision  ChangesPath
  1.14  +32 -39
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HostConfig.java   15 Jun 2003 07:41:56 -  1.13
  +++ HostConfig.java   15 Jun 2003 13:11:25 -  1.14
  @@ -84,8 +84,10 @@
   import javax.naming.NamingException;
   import javax.naming.directory.DirContext;
   import org.apache.naming.resources.ResourceAttributes;
  +import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Deployer;
  +import org.apache.catalina.Engine;
   import org.apache.catalina.Host;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
  @@ -160,13 +162,6 @@
   
   
   /**
  - * Should we monitor the codeappBase/code directory for new
  - * applications and automatically deploy them?
  - */
  -private boolean liveDeploy = false;
  -
  -
  -/**
* Should we unpack WAR files when auto-deploying applications in the
* codeappBase/code directory?
*/
  @@ -297,28 +292,6 @@
   
   
   /**
  - * Return the live deploy flag for this component.
  - */
  -public boolean isLiveDeploy() {
  -
  -return (this.liveDeploy);
  -
  -}
  -
  -
  -/**
  - * Set the live deploy flag for this component.
  - *
  - * @param liveDeploy The new live deploy flag
  - */
  -public void setLiveDeploy(boolean liveDeploy) {
  -
  -this.liveDeploy = liveDeploy;
  -
  -}
  -
  -
  -/**
* Return the unpack WARs flag.
*/
   public boolean isUnpackWARs() {
  @@ -400,7 +373,6 @@
   this.debug = hostDebug;
   }
   setDeployXML(((StandardHost) host).isDeployXML());
  -setLiveDeploy(((StandardHost) host).getLiveDeploy());
   setUnpackWARs(((StandardHost) host).isUnpackWARs());
   setXmlNamespaceAware(((StandardHost) host).getXmlNamespaceAware());
   setXmlValidation(((StandardHost) host).getXmlValidation());
  @@ -438,6 +410,23 @@
   
   
   /**
  + * Return a File object representing the configuration root directory
  + * for our associated Host.
  + */
  +protected File configBase() {
  +
  +File file = new File(System.getProperty(catalina.base), conf);
  +Container parent = host.getParent();
  +if ((parent != null)  (parent instanceof Engine)) {
  +file = new File(file, parent.getName());
  +}
  +file = new File(file, host.getName());
  +return (file);
  +
  +}
  +
  +
  +/**
* Deploy applications for any directories or WAR files that are found
* in our application root directory.
*/
  @@ -449,9 +438,13 @@
   File appBase = appBase();
   if (!appBase.exists() || !appBase.isDirectory())
   return;
  -String files[] = appBase.list();
  +File configBase = configBase();
  +if (configBase.exists()  configBase.isDirectory()) {
  +String configFiles[] = configBase.list();
  +deployDescriptors(configBase, configFiles);
  +}
   
  -deployDescriptors(appBase, files);
  +String files[] = appBase.list();
   deployWARs(appBase, files);
   deployDirectories(appBase, files);
   
  @@ -461,7 +454,7 @@
   /**
* Deploy XML context descriptors.
*/
  -protected void deployDescriptors(File appBase, String[] files) {
  +protected void deployDescriptors(File configBase, String[] files) {
   
   if (!deployXML)
  return;
  @@ -474,7 +467,7 @@
   continue;
   if (deployed.contains(files[i]))
   continue;
  -File dir = new File(appBase, files[i]);
  +File dir = new File(configBase, files[i]);
   if 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-06-10 Thread remm
remm2003/06/10 13:01:31

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Small deployer refactorings, as discussed previsouly.
  - Track WARs for changes when unpacking WARs. If WAR gets updated,
redeploy webapp.
  
  Revision  ChangesPath
  1.11  +53 -10
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- HostConfig.java   22 May 2003 23:05:36 -  1.10
  +++ HostConfig.java   10 Jun 2003 20:01:31 -  1.11
  @@ -188,6 +188,12 @@
   
   
   /**
  + * Last modified dates of the source WAR files, keyed by WAR name.
  + */
  +private HashMap warLastModified = new HashMap();
  +
  +
  +/**
* Attribute value used to turn on/off XML validation
*/
   private boolean xmlValidation = false;
  @@ -689,16 +695,50 @@
   
   }
   
  +// Check for WAR modification
  +if (isUnpackWARs()) {
  +File appBase = appBase();
  +if (!appBase.exists() || !appBase.isDirectory())
  +return;
  +String files[] = appBase.list();
  +
  +for (int i = 0; i  files.length; i++) {
  +if (files[i].endsWith(.war)) {
  +File dir = new File(appBase, files[i]);
  +Long lastModified = (Long) warLastModified.get(files[i]);
  +if (lastModified == null) {
  +warLastModified.put
  +(files[i], new Long(dir.lastModified()));
  +} else if (dir.lastModified()  lastModified.longValue()) {
  +// The WAR has been modified: redeploy
  +String expandedDir = files[i];
  +int period = expandedDir.lastIndexOf(.);
  +if (period = 0)
  +expandedDir = expandedDir.substring(0, period);
  +String contextPath = / + expandedDir;
  +if (contextPath.equals(/ROOT))
  +contextPath = ;
  +try {
  +((Deployer) host).remove(contextPath, true);
  +deployed.remove(files[i]);
  +} catch (Throwable t) {
  +log.error(sm.getString(hostConfig.undeployJar.error,
  +   files[i]), t);
  +}
  +webXmlLastModified.remove(contextPath);
  +warLastModified.put
  +(files[i], new Long(dir.lastModified()));
  +deployApps();
  +}
  +}
  +}
  +}
  +
   }
   
   
   protected boolean restartContext(Context context) {
   boolean result = true;
  -if( context.getReloadable() == false ) {
  -log.info(restartContext( + context.getName() + ): not reloadable);
  -return false;
  -}
  -
   log.info(restartContext( + context.getName() + ));
   
   /*
  @@ -853,13 +893,16 @@
   }
   }
   
  +webXmlLastModified.clear();
  +deployed.clear();
  +
   }
   
   
   /**
* Deploy webapps.
*/
  -public void check() {
  +protected void check() {
   
   if (host.getAutoDeploy()) {
   // Deploy apps if the Host allows auto deploying
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-06-10 Thread remm
remm2003/06/10 13:15:35

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Small deployer refactorings, as discussed previsouly.
  - Add extra check for the case where the WAR is deployed by an outside
process such as the manager.
  
  Revision  ChangesPath
  1.12  +14 -11
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- HostConfig.java   10 Jun 2003 20:01:31 -  1.11
  +++ HostConfig.java   10 Jun 2003 20:15:35 -  1.12
  @@ -715,20 +715,23 @@
   int period = expandedDir.lastIndexOf(.);
   if (period = 0)
   expandedDir = expandedDir.substring(0, period);
  +File expanded = new File(appBase, expandedDir);
   String contextPath = / + expandedDir;
   if (contextPath.equals(/ROOT))
   contextPath = ;
  -try {
  -((Deployer) host).remove(contextPath, true);
  -deployed.remove(files[i]);
  -} catch (Throwable t) {
  -log.error(sm.getString(hostConfig.undeployJar.error,
  -   files[i]), t);
  +if (dir.lastModified()  expanded.lastModified()) {
  +try {
  +((Deployer) host).remove(contextPath, true);
  +deployed.remove(files[i]);
  +} catch (Throwable t) {
  +
log.error(sm.getString(hostConfig.undeployJar.error,
  +   files[i]), t);
  +}
  +deployApps();
   }
   webXmlLastModified.remove(contextPath);
   warLastModified.put
   (files[i], new Long(dir.lastModified()));
  -deployApps();
   }
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-04-04 Thread costin
costin  2003/04/04 20:02:08

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  If a restart stops ( for example bad web.xml ), it should be possible to
  fix the error and have the context load again. So errors in stop() should
  be ignored.
  
  Revision  ChangesPath
  1.8   +15 -8 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HostConfig.java   25 Mar 2003 17:57:54 -  1.7
  +++ HostConfig.java   5 Apr 2003 04:02:08 -   1.8
  @@ -93,6 +93,7 @@
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Logger;
   import org.apache.catalina.core.StandardHost;
  +import org.apache.catalina.core.StandardContext;
   import org.apache.catalina.util.StringManager;
   
   
  @@ -716,11 +717,17 @@
   boolean result = true;
   try {
   ((Lifecycle) context).stop();
  -// Note: If the context was already stopped, a 
  -// Lifecycle exception will be thrown, and the context
  -// won't be restarted
  +} catch( Exception ex ) {
  +log.warn(Erorr stopping context  + context.getName()  ++
  +ex.toString());
  +}
  +// if the context was not started ( for example an error in web.xml)
  +// we'll still get to try to start
  +try {
   ((Lifecycle) context).start();
  -} catch (LifecycleException e) {
  +} catch (Exception e) {
  +log.warn(Error restarting context  + context.getName() +   +
  +e.toString());
   result = false;
   }
   return result;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2003-03-25 Thread costin
costin  2003/03/25 09:57:54

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  Remove the annoying periodical message.
  
  Revision  ChangesPath
  1.7   +6 -8  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HostConfig.java   15 Jan 2003 03:40:43 -  1.6
  +++ HostConfig.java   25 Mar 2003 17:57:54 -  1.7
  @@ -458,8 +458,6 @@
   
   if (!(host instanceof Deployer))
   return;
  -if (log.isDebugEnabled())
  -log.debug(sm.getString(hostConfig.deploying));
   
   File appBase = appBase();
   if (!appBase.exists() || !appBase.isDirectory())
  @@ -805,7 +803,7 @@
   /**
* Process a start event for this Host.
*/
  -protected void start() {
  +public void start() {
   
   if (log.isDebugEnabled())
   log.debug(sm.getString(hostConfig.start));
  @@ -824,7 +822,7 @@
   /**
* Process a stop event for this Host.
*/
  -protected void stop() {
  +public void stop() {
   
   if (log.isDebugEnabled())
   log.debug(sm.getString(hostConfig.stop));
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2002-11-29 Thread remm
remm2002/11/29 06:46:02

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  - Add reloading for the context XML files.
  - I plan to port the last two patches to the 4.1 branch. Please let me know
if it's not ok.
  
  Revision  ChangesPath
  1.5   +52 -15
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HostConfig.java   11 Sep 2002 13:08:19 -  1.4
  +++ HostConfig.java   29 Nov 2002 14:46:02 -  1.5
  @@ -202,16 +202,24 @@
*/
   private HashMap webXmlLastModified = new HashMap();
   
  +
  +/**
  + * Last modified dates of the Context xml files of the contexts, keyed by
  + * context name.
  + */
  +private HashMap contextXmlLastModified = new HashMap();
  +
  +
   /**
* Attribute value used to turn on/off XML validation
*/
  - private boolean xmlValidation = false;
  +private boolean xmlValidation = false;
   
   
   /**
* Attribute value used to turn on/off XML namespace awarenes.
*/
  - private boolean xmlNamespaceAware = false;
  +private boolean xmlNamespaceAware = false;
   
   
   // - Properties
  @@ -638,7 +646,7 @@
   /**
* Check deployment descriptors last modified date.
*/
  -protected void checkWebXmlLastModified() {
  +protected void checkContextLastModified() {
   
   if (!(host instanceof Deployer))
   return;
  @@ -673,24 +681,53 @@
   } else {
   if (lastModified.longValue() != newLastModified) {
   webXmlLastModified.remove(contextName);
  -((Lifecycle) context).stop();
  -// Note: If the context was already stopped, a 
  -// Lifecycle exception will be thrown, and the context
  -// won't be restarted
  -((Lifecycle) context).start();
  +restartContext(context);
   }
   }
  -} catch (LifecycleException e) {
  -; // Ignore
   } catch (NamingException e) {
   ; // Ignore
   }
   
  +Long lastModified = (Long) contextXmlLastModified.get(contextName);
  +String configFileName = context.getConfigFile();
  +if (configFileName != null) {
  +File configFile = new File(configFileName);
  +if (!configFile.isAbsolute()) {
  +configFile = new File(System.getProperty(catalina.base),
  +  configFile.getPath());
  +}
  +long newLastModified = configFile.lastModified();
  +if (lastModified == null) {
  +contextXmlLastModified.put
  +(contextName, new Long(newLastModified));
  +} else {
  +if (lastModified.longValue() != newLastModified) {
  +contextXmlLastModified.remove(contextName);
  +restartContext(context);
  +}
  +}
  +}
  +
   }
   
   }
   
   
  +protected boolean restartContext(Context context) {
  +log.info(restartContext( + context.getName() + ));
  +boolean result = true;
  +try {
  +((Lifecycle) context).stop();
  +// Note: If the context was already stopped, a 
  +// Lifecycle exception will be thrown, and the context
  +// won't be restarted
  +((Lifecycle) context).start();
  +} catch (LifecycleException e) {
  +result = false;
  +}
  +return result;
  +}
  +
   
   /**
* Expand the WAR file found at the specified URL into an unpacked
  @@ -1063,7 +1100,7 @@
   deployApps();
   
   // Check for web.xml modification
  -checkWebXmlLastModified();
  +checkContextLastModified();
   
   }
   
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2002-08-21 Thread patrickl

patrickl2002/08/21 15:10:35

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  Make XML schema validation off by default and allow it to be turned on via 
attributes in the Host element in server.xml.
  Submitted by: Jean-Francois Arcand ([EMAIL PROTECTED])
  
  Revision  ChangesPath
  1.3   +54 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HostConfig.java   21 Aug 2002 03:29:31 -  1.2
  +++ HostConfig.java   21 Aug 2002 22:10:34 -  1.3
  @@ -202,6 +202,17 @@
*/
   private HashMap webXmlLastModified = new HashMap();
   
  +/**
  + * Attribute value used to turn on/off XML validation
  + */
  + private boolean xmlValidation = false;
  +
  +
  +/**
  + * Attribute value used to turn on/off XML namespace awarenes.
  + */
  + private boolean xmlNamespaceAware = false;
  +
   
   // - Properties
   
  @@ -336,7 +347,44 @@
   this.unpackWARs = unpackWARs;
   
   }
  +
  +
  + /**
  + * Set the validation feature of the XML parser used when
  + * parsing xml instances.
  + * @param xmlValidation true to enable xml instance validation
  + */
  +public void setXmlValidation(boolean xmlValidation){
  +this.xmlValidation = xmlValidation;
  +}
  +
  +/**
  + * Get the server.xml host attribute's xmlValidation.
  + * @return true if validation is enabled.
  + *
  + */
  +public boolean getXmlValidation(){
  +return xmlValidation;
  +}
   
  +/**
  + * Get the server.xml host attribute's xmlNamespaceAware.
  + * @return true if namespace awarenes is enabled.
  + *
  + */
  +public boolean getXmlNamespaceAware(){
  +return xmlNamespaceAware;
  +}
  +
  +
  +/**
  + * Set the namespace aware feature of the XML parser used when
  + * parsing xml instances.
  + * @param xmlNamespaceAware true to enable namespace awareness
  + */
  +public void setXmlNamespaceAware(boolean xmlNamespaceAware){
  +this.xmlNamespaceAware=xmlNamespaceAware;
  +}
   
   // - Public Methods
   
  @@ -359,6 +407,8 @@
   setDeployXML(((StandardHost) host).isDeployXML());
   setLiveDeploy(((StandardHost) host).getLiveDeploy());
   setUnpackWARs(((StandardHost) host).isUnpackWARs());
  +setXmlNamespaceAware(((StandardHost) host).getXmlNamespaceAware());
  +setXmlValidation(((StandardHost) host).getXmlValidation());
   }
   } catch (ClassCastException e) {
   log.error(sm.getString(hostConfig.cce, event.getLifecycle()), e);
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2002-08-21 Thread Ed Borkmann

remove


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup HostConfig.java

2002-08-20 Thread costin

costin  2002/08/20 20:29:31

  Modified:catalina/src/share/org/apache/catalina/startup
HostConfig.java
  Log:
  Switch to commons-logging.
  Added some time logging ( it shouldn't display in most cases, only for very
  large .wars )
  
  Revision  ChangesPath
  1.2   +59 -58
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HostConfig.java   18 Jul 2002 16:47:49 -  1.1
  +++ HostConfig.java   21 Aug 2002 03:29:31 -  1.2
  @@ -107,7 +107,9 @@
   
   public class HostConfig
   implements LifecycleListener, Runnable {
  -
  +
  +private static org.apache.commons.logging.Log log=
  + org.apache.commons.logging.LogFactory.getLog( HostConfig.class );
   
   // - Instance Variables
   
  @@ -359,7 +361,7 @@
   setUnpackWARs(((StandardHost) host).isUnpackWARs());
   }
   } catch (ClassCastException e) {
  -log(sm.getString(hostConfig.cce, event.getLifecycle()), e);
  +log.error(sm.getString(hostConfig.cce, event.getLifecycle()), e);
   return;
   }
   
  @@ -398,8 +400,8 @@
   
   if (!(host instanceof Deployer))
   return;
  -if (debug = 1)
  -log(sm.getString(hostConfig.deploying));
  +if (log.isDebugEnabled())
  +log.debug(sm.getString(hostConfig.deploying));
   
   File appBase = appBase();
   if (!appBase.exists() || !appBase.isDirectory())
  @@ -445,14 +447,14 @@
   }
   
   // Assume this is a configuration descriptor and deploy it
  -log(sm.getString(hostConfig.deployDescriptor, files[i]));
  +log.info(sm.getString(hostConfig.deployDescriptor, files[i]));
   try {
   URL config =
   new URL(file, null, dir.getCanonicalPath());
   ((Deployer) host).install(config, null);
   } catch (Throwable t) {
  -log(sm.getString(hostConfig.deployDescriptor.error,
  - files[i]), t);
  +log.error(sm.getString(hostConfig.deployDescriptor.error,
  +   files[i]), t);
   }
   
   }
  @@ -493,7 +495,7 @@
   if (isUnpackWARs()) {
   
   // Expand and deploy this application as a directory
  -log(sm.getString(hostConfig.expand, files[i]));
  +log.info(sm.getString(hostConfig.expand, files[i]));
   try {
   URL url = new URL(jar:file: +
 dir.getCanonicalPath() + !/);
  @@ -501,21 +503,21 @@
   url = new URL(file: + path);
   ((Deployer) host).install(contextPath, url);
   } catch (Throwable t) {
  -log(sm.getString(hostConfig.expand.error, files[i]),
  +log.error(sm.getString(hostConfig.expand.error, files[i]),
   t);
   }
   
   } else {
   
   // Deploy the application in this WAR file
  -log(sm.getString(hostConfig.deployJar, files[i]));
  +log.info(sm.getString(hostConfig.deployJar, files[i]));
   try {
   URL url = new URL(file, null,
 dir.getCanonicalPath());
   url = new URL(jar: + url.toString() + !/);
   ((Deployer) host).install(contextPath, url);
   } catch (Throwable t) {
  -log(sm.getString(hostConfig.deployJar.error,
  +log.error(sm.getString(hostConfig.deployJar.error,
files[i]), t);
   }
   
  @@ -563,15 +565,19 @@
   continue;
   
   // Deploy the application in this directory
  -log(sm.getString(hostConfig.deployDir, files[i]));
  +if( log.isDebugEnabled() ) 
  +log.debug(sm.getString(hostConfig.deployDir, files[i]));
  +long t1=System.currentTimeMillis();
   try {
   URL url = new URL(file, null, dir.getCanonicalPath());
   ((Deployer) host).install(contextPath, url);