001    /**
002     * Copyright (c) 2000-2013 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.deploy.DeployUtil;
018    import com.liferay.portal.kernel.log.Log;
019    import com.liferay.portal.kernel.log.LogFactoryUtil;
020    import com.liferay.portal.kernel.util.PropsKeys;
021    import com.liferay.portal.kernel.util.ServerDetector;
022    import com.liferay.portal.kernel.util.StringPool;
023    import com.liferay.portal.tools.deploy.PortletDeployer;
024    import com.liferay.portal.util.PrefsPropsUtil;
025    import com.liferay.portal.util.PropsValues;
026    
027    import java.util.ArrayList;
028    import java.util.List;
029    
030    /**
031     * @author Ivica Cardic
032     * @author Brian Wing Shun Chan
033     */
034    public class PortletAutoDeployer
035            extends PortletDeployer implements AutoDeployer {
036    
037            public PortletAutoDeployer() {
038                    try {
039                            baseDir = PrefsPropsUtil.getString(
040                                    PropsKeys.AUTO_DEPLOY_DEPLOY_DIR,
041                                    PropsValues.AUTO_DEPLOY_DEPLOY_DIR);
042                            destDir = DeployUtil.getAutoDeployDestDir();
043                            appServerType = ServerDetector.getServerId();
044                            auiTaglibDTD = DeployUtil.getResourcePath("aui.tld");
045                            portletTaglibDTD = DeployUtil.getResourcePath(
046                                    "liferay-portlet.tld");
047                            portletExtTaglibDTD = DeployUtil.getResourcePath(
048                                    "liferay-portlet-ext.tld");
049                            securityTaglibDTD = DeployUtil.getResourcePath(
050                                    "liferay-security.tld");
051                            themeTaglibDTD = DeployUtil.getResourcePath("liferay-theme.tld");
052                            uiTaglibDTD = DeployUtil.getResourcePath("liferay-ui.tld");
053                            utilTaglibDTD = DeployUtil.getResourcePath("liferay-util.tld");
054                            unpackWar = PrefsPropsUtil.getBoolean(
055                                    PropsKeys.AUTO_DEPLOY_UNPACK_WAR,
056                                    PropsValues.AUTO_DEPLOY_UNPACK_WAR);
057                            filePattern = StringPool.BLANK;
058                            jbossPrefix = PrefsPropsUtil.getString(
059                                    PropsKeys.AUTO_DEPLOY_JBOSS_PREFIX,
060                                    PropsValues.AUTO_DEPLOY_JBOSS_PREFIX);
061                            tomcatLibDir = PrefsPropsUtil.getString(
062                                    PropsKeys.AUTO_DEPLOY_TOMCAT_LIB_DIR,
063                                    PropsValues.AUTO_DEPLOY_TOMCAT_LIB_DIR);
064    
065                            List<String> jars = new ArrayList<String>();
066    
067                            addExtJar(jars, "ext-util-bridges.jar");
068                            addExtJar(jars, "ext-util-java.jar");
069                            addExtJar(jars, "ext-util-taglib.jar");
070                            addRequiredJar(jars, "util-bridges.jar");
071                            addRequiredJar(jars, "util-java.jar");
072                            addRequiredJar(jars, "util-taglib.jar");
073    
074                            this.jars = jars;
075    
076                            checkArguments();
077                    }
078                    catch (Exception e) {
079                            _log.error(e, e);
080                    }
081            }
082    
083            private static Log _log = LogFactoryUtil.getLog(PortletAutoDeployer.class);
084    
085    }