Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 28349 invoked from network); 20 Aug 2002 23:09:30 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 20 Aug 2002 23:09:30 -0000 Received: (qmail 24189 invoked by uid 97); 20 Aug 2002 23:09:58 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 24172 invoked by uid 97); 20 Aug 2002 23:09:57 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 24161 invoked by uid 97); 20 Aug 2002 23:09:57 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 20 Aug 2002 23:09:18 -0000 Message-ID: <20020820230918.28309.qmail@icarus.apache.org> From: amyroh@apache.org To: jakarta-tomcat-catalina-cvs@apache.org Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java StandardServer.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N amyroh 2002/08/20 16:09:18 Modified: catalina/src/share/org/apache/catalina/core StandardHostDeployer.java StandardServer.java Log: Change install(String contextPath, URL war, String configFile) method to actually save context info to the configuration file you specify. Revision Changes Path 1.4 +11 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- StandardHostDeployer.java 2 Aug 2002 01:37:43 -0000 1.3 +++ StandardHostDeployer.java 20 Aug 2002 23:09:18 -0000 1.4 @@ -75,10 +75,12 @@ import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Deployer; +import org.apache.catalina.Engine; import org.apache.catalina.Globals; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; +import org.apache.catalina.core.StandardServer; import org.apache.catalina.startup.ContextRuleSet; import org.apache.catalina.startup.NamingRuleSet; import org.apache.catalina.util.StringManager; @@ -344,6 +346,11 @@ host.fireContainerEvent(PRE_INSTALL_EVENT, context); host.addChild(context); host.fireContainerEvent(INSTALL_EVENT, context); + + // save context info into configFile + Engine engine = (Engine)host.getParent(); + StandardServer server = (StandardServer) engine.getService().getServer(); + server.storeContext(context); } catch (Exception e) { host.log(sm.getString("standardHost.installError", contextPath), e); 1.5 +61 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java Index: StandardServer.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StandardServer.java 14 Aug 2002 19:36:17 -0000 1.4 +++ StandardServer.java 20 Aug 2002 23:09:18 -0000 1.5 @@ -803,6 +803,63 @@ } + /** + * Write the configuration information for Context + * out to the specified configuration file. + * + * @exception InstanceNotFoundException if the managed resource object + * cannot be found + * @exception MBeanException if the initializer of the object throws + * an exception, or persistence is not supported + * @exception RuntimeOperationsException if an exception is reported + * by the persistence mechanism + */ + public synchronized void storeContext(Context context) throws Exception { + + String configFile = context.getConfigFile(); + + if (configFile != null) { + File config = new File(configFile); + if (!config.isAbsolute()) { + config = new File(System.getProperty("catalina.base"), + configFile); + } + + // Open an output writer for the new configuration file + PrintWriter writer = null; + try { + writer = new PrintWriter(new FileWriter(config)); + } catch (IOException e) { + if (writer != null) { + try { + writer.close(); + } catch (Throwable t) { + ; + } + } + throw (e); + } + + writer.print(""); + + // Flush and close the output file + try { + writer.flush(); + } catch (Exception e) { + throw (e); + } + try { + writer.close(); + } catch (Exception e) { + throw (e); + } + } + + } + + // -------------------------------------------------------- Private Methods -- To unsubscribe, e-mail: For additional commands, e-mail: