001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.deploy.auto;
016    
017    import com.liferay.portal.kernel.plugin.PluginPackage;
018    
019    import java.io.File;
020    
021    import java.util.HashMap;
022    import java.util.Map;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     */
027    public class MVCPortletAutoDeployer extends PortletAutoDeployer {
028    
029            protected void copyXmls(
030                            File srcFile, String displayName, PluginPackage pluginPackage)
031                    throws Exception {
032    
033                    super.copyXmls(srcFile, displayName, pluginPackage);
034    
035                    Map<String, String> filterMap = new HashMap<String, String>();
036    
037                    String pluginName = displayName;
038    
039                    if (pluginPackage != null) {
040                            pluginName = pluginPackage.getName();
041                    }
042    
043                    filterMap.put(
044                            "portlet_class", "com.liferay.util.bridges.mvc.MVCPortlet");
045                    filterMap.put("portlet_name", pluginName);
046                    filterMap.put("portlet_title", pluginName);
047                    filterMap.put("restore_current_view", "false");
048                    filterMap.put("friendly_url_mapper_class", "");
049                    filterMap.put("init_param_name_0", "view-jsp");
050                    filterMap.put("init_param_value_0", "/index_mvc.jsp");
051    
052                    copyDependencyXml(
053                            "liferay-display.xml", srcFile + "/WEB-INF", filterMap);
054                    copyDependencyXml(
055                            "liferay-portlet.xml", srcFile + "/WEB-INF", filterMap);
056                    copyDependencyXml(
057                            "portlet.xml", srcFile + "/WEB-INF", filterMap);
058            }
059    
060    }