001    /**
002     * Copyright (c) 2000-2012 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            @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("portlet.xml", srcFile + "/WEB-INF", filterMap);
060            }
061    
062    }