001    /**
002     * Copyright (c) 2000-2011 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            @Override
030            public void copyXmls(
031                            File srcFile, String displayName, PluginPackage pluginPackage)
032                    throws Exception {
033    
034                    super.copyXmls(srcFile, displayName, pluginPackage);
035    
036                    Map<String, String> filterMap = new HashMap<String, String>();
037    
038                    String pluginName = displayName;
039    
040                    if (pluginPackage != null) {
041                            pluginName = pluginPackage.getName();
042                    }
043    
044                    filterMap.put(
045                            "portlet_class", "com.liferay.util.bridges.mvc.MVCPortlet");
046                    filterMap.put("portlet_name", pluginName);
047                    filterMap.put("portlet_title", pluginName);
048                    filterMap.put("restore_current_view", "false");
049                    filterMap.put("friendly_url_mapper_class", "");
050                    filterMap.put("friendly_url_mapping", "");
051                    filterMap.put("friendly_url_routes", "");
052                    filterMap.put("init_param_name_0", "view-jsp");
053                    filterMap.put("init_param_value_0", "/index_mvc.jsp");
054    
055                    copyDependencyXml(
056                            "liferay-display.xml", srcFile + "/WEB-INF", filterMap);
057                    copyDependencyXml(
058                            "liferay-portlet.xml", srcFile + "/WEB-INF", filterMap);
059                    copyDependencyXml(
060                            "portlet.xml", srcFile + "/WEB-INF", filterMap);
061            }
062    
063    }