1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.tools.deploy;
16  
17  import com.liferay.portal.kernel.util.StringBundler;
18  import com.liferay.portal.util.InitUtil;
19  
20  import java.io.File;
21  
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  /**
26   * <a href="ExtDeployer.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   */
30  public class ExtDeployer extends BaseDeployer {
31  
32      public static void main(String[] args) {
33          InitUtil.initWithSpring();
34  
35          List<String> wars = new ArrayList<String>();
36          List<String> jars = new ArrayList<String>();
37  
38          for (String arg : args) {
39              if (arg.endsWith(".war")) {
40                  wars.add(arg);
41              }
42              else if (arg.endsWith(".jar")) {
43                  jars.add(arg);
44              }
45          }
46  
47          new ExtDeployer(wars, jars);
48      }
49  
50      protected ExtDeployer() {
51      }
52  
53      protected ExtDeployer(List<String> wars, List<String> jars) {
54          super(wars, jars);
55      }
56  
57      protected String getExtraContent(
58              double webXmlVersion, File srcFile, String displayName)
59          throws Exception {
60  
61          StringBundler sb = new StringBundler(6);
62  
63          String extraContent = super.getExtraContent(
64              webXmlVersion, srcFile, displayName);
65  
66          sb.append(extraContent);
67  
68          // ExtContextListener
69  
70          sb.append("<listener>");
71          sb.append("<listener-class>");
72          sb.append("com.liferay.portal.kernel.servlet.ExtContextListener");
73          sb.append("</listener-class>");
74          sb.append("</listener>");
75  
76          return sb.toString();
77      }
78  
79  }