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;
16  
17  import com.liferay.portal.util.InitUtil;
18  
19  import java.io.File;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  /**
25   * <a href="ExtDeployer.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class ExtDeployer extends BaseDeployer {
30  
31      public static void main(String[] args) {
32          InitUtil.initWithSpring();
33  
34          List<String> wars = new ArrayList<String>();
35          List<String> jars = new ArrayList<String>();
36  
37          for (String arg : args) {
38              if (arg.endsWith(".war")) {
39                  wars.add(arg);
40              }
41              else if (arg.endsWith(".jar")) {
42                  jars.add(arg);
43              }
44          }
45  
46          new ExtDeployer(wars, jars);
47      }
48  
49      protected ExtDeployer() {
50      }
51  
52      protected ExtDeployer(List<String> wars, List<String> jars) {
53          super(wars, jars);
54      }
55  
56      protected String getExtraContent(
57              double webXmlVersion, File srcFile, String displayName)
58          throws Exception {
59  
60          StringBuilder sb = new StringBuilder();
61  
62          String extraContent = super.getExtraContent(
63              webXmlVersion, srcFile, displayName);
64  
65          sb.append(extraContent);
66  
67          // ExtContextListener
68  
69          sb.append("<listener>");
70          sb.append("<listener-class>");
71          sb.append("com.liferay.portal.kernel.servlet.ExtContextListener");
72          sb.append("</listener-class>");
73          sb.append("</listener>");
74  
75          return sb.toString();
76      }
77  
78  }