001    /**
002     * Copyright (c) 2000-2011 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 Olaf Fricke
025     * @author Brian Wing Shun Chan
026     */
027    public class ThemeExplodedTomcatListener extends BaseExplodedTomcatListener {
028    
029            public ThemeExplodedTomcatListener() {
030                    _deployer = new ThemeExplodedTomcatDeployer();
031            }
032    
033            @Override
034            protected void deploy(File file) throws AutoDeployException {
035                    if (_log.isDebugEnabled()) {
036                            _log.debug("Invoking deploy for " + file.getPath());
037                    }
038    
039                    File docBaseDir = getDocBaseDir(
040                            file, "WEB-INF/liferay-look-and-feel.xml");
041    
042                    if (docBaseDir == null) {
043                            return;
044                    }
045    
046                    if (_log.isInfoEnabled()) {
047                            _log.info("Modifying themes for " + file.getPath());
048                    }
049    
050                    _deployer.explodedTomcatDeploy(file, docBaseDir, null);
051    
052                    if (_log.isInfoEnabled()) {
053                            _log.info(
054                                    "Themes for " + file.getPath() + " modified successfully");
055                    }
056    
057                    copyContextFile(file);
058            }
059    
060            private static Log _log = LogFactoryUtil.getLog(
061                    ThemeExplodedTomcatListener.class);
062    
063            private ExplodedTomcatDeployer _deployer;
064    
065    }