001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }