001
014
015 package com.liferay.portal.tools.deploy;
016
017 import com.liferay.portal.kernel.plugin.PluginPackage;
018 import com.liferay.portal.kernel.util.ServerDetector;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.model.Plugin;
021 import com.liferay.portal.util.InitUtil;
022
023 import java.io.File;
024
025 import java.util.ArrayList;
026 import java.util.List;
027
028
031 public class WebDeployer extends BaseDeployer {
032
033 public static void main(String[] args) {
034 InitUtil.initWithSpring();
035
036 List<String> wars = new ArrayList<String>();
037 List<String> jars = new ArrayList<String>();
038
039 for (String arg : args) {
040 if (arg.endsWith(".war")) {
041 wars.add(arg);
042 }
043 else if (arg.endsWith(".jar")) {
044 jars.add(arg);
045 }
046 }
047
048 new WebDeployer(wars, jars);
049 }
050
051 public WebDeployer() {
052 }
053
054 public WebDeployer(List<String> wars, List<String> jars) {
055 super(wars, jars);
056 }
057
058 @Override
059 public void copyXmls(
060 File srcFile, String displayName, PluginPackage pluginPackage)
061 throws Exception {
062
063 super.copyXmls(srcFile, displayName, pluginPackage);
064
065 if (appServerType.equals(ServerDetector.TOMCAT_ID)) {
066 copyDependencyXml("context.xml", srcFile + "/META-INF");
067 }
068 }
069
070 @Override
071 public String getExtraContent(
072 double webXmlVersion, File srcFile, String displayName)
073 throws Exception {
074
075 StringBundler sb = new StringBundler(6);
076
077 String extraContent = super.getExtraContent(
078 webXmlVersion, srcFile, displayName);
079
080 sb.append(extraContent);
081
082
083
084 sb.append("<listener>");
085 sb.append("<listener-class>");
086 sb.append("com.liferay.portal.kernel.servlet.WebContextListener");
087 sb.append("</listener-class>");
088 sb.append("</listener>");
089
090 return sb.toString();
091 }
092
093 @Override
094 public String getPluginType() {
095 return Plugin.TYPE_WEB;
096 }
097
098 }