1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
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="LayoutTemplateDeployer.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class LayoutTemplateDeployer 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 LayoutTemplateDeployer(wars, jars);
47      }
48  
49      protected LayoutTemplateDeployer() {
50      }
51  
52      protected LayoutTemplateDeployer(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          sb.append("<listener>");
68          sb.append("<listener-class>");
69          sb.append("com.liferay.portal.kernel.servlet.");
70          sb.append("LayoutTemplateContextListener");
71          sb.append("</listener-class>");
72          sb.append("</listener>");
73  
74          return sb.toString();
75      }
76  
77  }