diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-07 11:36:47 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-07 11:36:47 +0000 |
commit | 2096c75bcf1f1704f61620a575c6dca218287171 (patch) | |
tree | 4123f9bafe362fcd4ee2065638444db5763748f7 /sca-java-2.x/trunk/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca | |
parent | 6d7cf14a011e926040edac3faebd88b5e5ac2c55 (diff) |
Add default domain uri to default context.xml
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@887893 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java b/sca-java-2.x/trunk/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java index e469ed235a..aa2d059300 100644 --- a/sca-java-2.x/trunk/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java +++ b/sca-java-2.x/trunk/distribution/tomcat/tomcat-servlet/src/main/java/org/apache/tuscany/sca/war/Installer.java @@ -115,6 +115,7 @@ public class Installer { } removeServerXml(serverXml); removeHostConfigXml(serverXml); + removeContextXml(); } private boolean doInstall() { @@ -154,9 +155,10 @@ public class Installer { // Add Tuscany HostConfig to Hosts definitions in server.xml updateHostConfigXml(serverXml); - // Add Tuscany specific default web.xml + // Add Tuscany specific default web.xml and context.xml definitions addTuscanyWebXml(); - + addTuscanyContextXml(); + return true; } @@ -188,6 +190,30 @@ public class Installer { writeAll(tuscanyWebXmlFile, newWebXml); } } + + private static final String tuscanyContextXML = + "\r\n\r\n <!-- The Tuscany SCA default domain URI.\r\n" + + " Individual contributions may used different domains by having their \r\n" + + " context.xml files overriding this parameter. -->\r\n" + + " <Parameter name=\"org.apache.tuscany.sca.defaultDomainURI\" value=\"tribes:default\"/>"; + + private void addTuscanyContextXml() { + File contextXmlFile = new File(catalinaBase, "/conf/context.xml"); + if ((contextXmlFile.exists())) { + String contextXML = readAll(contextXmlFile); + String newcontextXml = replace(contextXML, "<Context>", "<Context>" + tuscanyContextXML, "<", "<"); + backup(contextXmlFile); + writeAll(contextXmlFile, newcontextXml); + } + } + private void removeContextXml() { + File contextXmlFile = new File(catalinaBase, "/conf/context.xml"); + if ((contextXmlFile.exists())) { + String contextXML = readAll(contextXmlFile); + String oldContextXml = replace(contextXML, "<Context>" + tuscanyContextXML, "<Context>", "<", "<"); + writeAll(contextXmlFile, oldContextXml); + } + } private File findTuscanyTomcatJar(File tuscanyWAR) { File lib = new File(tuscanyWAR, "/tomcat-lib"); @@ -199,8 +225,7 @@ public class Installer { return null; } - - static final String tuscanyListener = + private static final String tuscanyListener = "\r\n" + " <!-- Tuscany plugin for Tomcat -->\r\n" + " <Listener className=\"org.apache.tuscany.sca.tomcat.TuscanyLifecycleListener\" />"; |