01: /**
02: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
03: *
04: * Permission is hereby granted, free of charge, to any person obtaining a copy
05: * of this software and associated documentation files (the "Software"), to deal
06: * in the Software without restriction, including without limitation the rights
07: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
08: * copies of the Software, and to permit persons to whom the Software is
09: * furnished to do so, subject to the following conditions:
10: *
11: * The above copyright notice and this permission notice shall be included in
12: * all copies or substantial portions of the Software.
13: *
14: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20: * SOFTWARE.
21: */package com.liferay.portal.deploy.auto;
22:
23: import com.liferay.portal.deploy.DeployUtil;
24: import com.liferay.portal.kernel.deploy.auto.AutoDeployException;
25: import com.liferay.portal.kernel.plugin.PluginPackage;
26:
27: import java.io.File;
28:
29: import java.util.HashMap;
30: import java.util.Map;
31:
32: /**
33: * <a href="PHPPortletAutoDeployer.java.html"><b><i>View Source</i></b></a>
34: *
35: * @author Jorge Ferrer
36: *
37: */
38: public class PHPPortletAutoDeployer extends PortletAutoDeployer {
39:
40: protected PHPPortletAutoDeployer() throws AutoDeployException {
41: try {
42: String[] phpJars = new String[] { "quercus.jar",
43: "resin-util.jar", "script-10.jar" };
44:
45: for (int i = 0; i < phpJars.length; i++) {
46: String phpJar = phpJars[i];
47:
48: jars.add(downloadJar(phpJar));
49: }
50:
51: jars.add(DeployUtil.getResourcePath("portals-bridges.jar"));
52: } catch (Exception e) {
53: throw new AutoDeployException(e);
54: }
55: }
56:
57: protected void copyXmls(File srcFile, String displayName,
58: PluginPackage pluginPackage) throws Exception {
59:
60: super .copyXmls(srcFile, displayName, pluginPackage);
61:
62: Map filterMap = new HashMap();
63:
64: String pluginName = displayName;
65:
66: if (pluginPackage != null) {
67: pluginName = pluginPackage.getName();
68: }
69:
70: filterMap.put("portlet_class",
71: "com.liferay.util.bridges.php.PHPPortlet");
72: filterMap.put("portlet_name", pluginName);
73: filterMap.put("portlet_title", pluginName);
74: filterMap.put("restore_current_view", "false");
75: filterMap.put("friendly_url_mapper_class", "");
76: filterMap.put("init_param_name_0", "view-uri");
77: filterMap.put("init_param_value_0", "/index.php");
78: filterMap.put("init_param_name_1", "add-portlet-params");
79: filterMap.put("init_param_value_1", "true");
80:
81: copyDependencyXml("liferay-display.xml", srcFile + "/WEB-INF",
82: filterMap);
83: copyDependencyXml("liferay-portlet.xml", srcFile + "/WEB-INF",
84: filterMap);
85: copyDependencyXml("portlet.xml", srcFile + "/WEB-INF",
86: filterMap);
87: }
88:
89: }
|