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.deploy.auto;
16  
17  import com.liferay.portal.kernel.plugin.PluginPackage;
18  
19  import java.io.File;
20  
21  import java.util.HashMap;
22  import java.util.Map;
23  
24  /**
25   * <a href="MVCPortletAutoDeployer.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class MVCPortletAutoDeployer extends PortletAutoDeployer {
30  
31      protected void copyXmls(
32              File srcFile, String displayName, PluginPackage pluginPackage)
33          throws Exception {
34  
35          super.copyXmls(srcFile, displayName, pluginPackage);
36  
37          Map<String, String> filterMap = new HashMap<String, String>();
38  
39          String pluginName = displayName;
40  
41          if (pluginPackage != null) {
42              pluginName = pluginPackage.getName();
43          }
44  
45          filterMap.put(
46              "portlet_class", "com.liferay.util.bridges.mvc.MVCPortlet");
47          filterMap.put("portlet_name", pluginName);
48          filterMap.put("portlet_title", pluginName);
49          filterMap.put("restore_current_view", "false");
50          filterMap.put("friendly_url_mapper_class", "");
51          filterMap.put("init_param_name_0", "view-jsp");
52          filterMap.put("init_param_value_0", "/index_mvc.jsp");
53  
54          copyDependencyXml(
55              "liferay-display.xml", srcFile + "/WEB-INF", filterMap);
56          copyDependencyXml(
57              "liferay-portlet.xml", srcFile + "/WEB-INF", filterMap);
58          copyDependencyXml(
59              "portlet.xml", srcFile + "/WEB-INF", filterMap);
60      }
61  
62  }