001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.deploy.auto.exploded.tomcat;
016    
017    import com.liferay.portal.kernel.deploy.auto.AutoDeployException;
018    import com.liferay.portal.kernel.log.Log;
019    import com.liferay.portal.kernel.log.LogFactoryUtil;
020    
021    import java.io.File;
022    
023    /**
024     * @author Gregory Amerson
025     */
026    public class HookExplodedTomcatListener extends BaseExplodedTomcatListener {
027    
028            public HookExplodedTomcatListener() {
029                    _deployer = new HookExplodedTomcatDeployer();
030            }
031    
032            public void deploy(File file) throws AutoDeployException {
033                    if (_log.isDebugEnabled()) {
034                            _log.debug("Invoking deploy for " + file.getPath());
035                    }
036    
037                    File docBaseDir = getDocBaseDir(file, "WEB-INF/liferay-hook.xml");
038    
039                    if (docBaseDir == null) {
040                            return;
041                    }
042    
043                    if (_log.isInfoEnabled()) {
044                            _log.info("Modifying hook for " + file.getPath());
045                    }
046    
047                    _deployer.explodedTomcatDeploy(file, docBaseDir, null);
048    
049                    if (_log.isInfoEnabled()) {
050                            _log.info("Hook for " + file.getPath() + " modified successfully");
051                    }
052    
053                    copyContextFile(file);
054            }
055    
056            private static Log _log = LogFactoryUtil.getLog(
057                    HookExplodedTomcatListener.class);
058    
059            private ExplodedTomcatDeployer _deployer;
060    
061    }