1
22
23 package com.liferay.portal.deploy.auto;
24
25 import com.liferay.portal.deploy.DeployUtil;
26 import com.liferay.portal.kernel.deploy.auto.AutoDeployException;
27 import com.liferay.portal.kernel.util.ServerDetector;
28 import com.liferay.portal.tools.ThemeDeployer;
29 import com.liferay.portal.util.PrefsPropsUtil;
30 import com.liferay.portal.util.PropsKeys;
31 import com.liferay.portal.util.PropsValues;
32
33 import java.util.ArrayList;
34 import java.util.List;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
39
46 public class ThemeAutoDeployer extends ThemeDeployer implements AutoDeployer {
47
48 public ThemeAutoDeployer() {
49 try {
50 baseDir = PrefsPropsUtil.getString(
51 PropsKeys.AUTO_DEPLOY_DEPLOY_DIR,
52 PropsValues.AUTO_DEPLOY_DEPLOY_DIR);
53 destDir = DeployUtil.getAutoDeployDestDir();
54 appServerType = ServerDetector.getServerId();
55 themeTaglibDTD = DeployUtil.getResourcePath("liferay-theme.tld");
56 utilTaglibDTD = DeployUtil.getResourcePath("liferay-util.tld");
57 unpackWar = PrefsPropsUtil.getBoolean(
58 PropsKeys.AUTO_DEPLOY_UNPACK_WAR,
59 PropsValues.AUTO_DEPLOY_UNPACK_WAR);
60 jbossPrefix = PrefsPropsUtil.getString(
61 PropsKeys.AUTO_DEPLOY_JBOSS_PREFIX,
62 PropsValues.AUTO_DEPLOY_JBOSS_PREFIX);
63 tomcatLibDir = PrefsPropsUtil.getString(
64 PropsKeys.AUTO_DEPLOY_TOMCAT_LIB_DIR,
65 PropsValues.AUTO_DEPLOY_TOMCAT_LIB_DIR);
66
67 List<String> jars = new ArrayList<String>();
68
69 jars.add(DeployUtil.getResourcePath("util-java.jar"));
70 jars.add(DeployUtil.getResourcePath("util-taglib.jar"));
71
72 this.jars = jars;
73
74 checkArguments();
75 }
76 catch (Exception e) {
77 _log.error(e);
78 }
79 }
80
81 public void autoDeploy(String file) throws AutoDeployException {
82 List<String> wars = new ArrayList<String>();
83
84 wars.add(file);
85
86 this.wars = wars;
87
88 try {
89 deploy();
90 }
91 catch (Exception e) {
92 throw new AutoDeployException(e);
93 }
94 }
95
96 private static Log _log = LogFactory.getLog(ThemeAutoDeployer.class);
97
98 }