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.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.WebDeployer;
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 Jorge Ferrer
032     */
033    public class WebAutoDeployer extends WebDeployer implements AutoDeployer {
034    
035            public WebAutoDeployer() {
036                    try {
037                            baseDir = PrefsPropsUtil.getString(
038                                    PropsKeys.AUTO_DEPLOY_DEPLOY_DIR,
039                                    PropsValues.AUTO_DEPLOY_DEPLOY_DIR);
040                            destDir = DeployUtil.getAutoDeployDestDir();
041                            appServerType = ServerDetector.getServerId();
042                            unpackWar = PrefsPropsUtil.getBoolean(
043                                    PropsKeys.AUTO_DEPLOY_UNPACK_WAR,
044                                    PropsValues.AUTO_DEPLOY_UNPACK_WAR);
045                            filePattern = StringPool.BLANK;
046                            jbossPrefix = PrefsPropsUtil.getString(
047                                    PropsKeys.AUTO_DEPLOY_JBOSS_PREFIX,
048                                    PropsValues.AUTO_DEPLOY_JBOSS_PREFIX);
049                            tomcatLibDir = PrefsPropsUtil.getString(
050                                    PropsKeys.AUTO_DEPLOY_TOMCAT_LIB_DIR,
051                                    PropsValues.AUTO_DEPLOY_TOMCAT_LIB_DIR);
052    
053                            List<String> jars = new ArrayList<String>();
054    
055                            addExtJar(jars, "ext-util-java.jar");
056                            addRequiredJar(jars, "util-java.jar");
057    
058                            this.jars = jars;
059    
060                            checkArguments();
061                    }
062                    catch (Exception e) {
063                            _log.error(e);
064                    }
065            }
066    
067            private static Log _log = LogFactoryUtil.getLog(WebAutoDeployer.class);
068    
069    }