1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.deploy.auto.exploded.tomcat;
16  
17  import com.liferay.portal.kernel.deploy.auto.AutoDeployException;
18  import com.liferay.portal.kernel.log.Log;
19  import com.liferay.portal.kernel.log.LogFactoryUtil;
20  
21  import java.io.File;
22  
23  /**
24   * <a href="ThemeExplodedTomcatListener.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Olaf Fricke
27   * @author Brian Wing Shun Chan
28   */
29  public class ThemeExplodedTomcatListener extends BaseExplodedTomcatListener {
30  
31      public ThemeExplodedTomcatListener() {
32          _deployer = new ThemeExplodedTomcatDeployer();
33      }
34  
35      public void deploy(File file) throws AutoDeployException {
36          if (_log.isDebugEnabled()) {
37              _log.debug("Invoking deploy for " + file.getPath());
38          }
39  
40          File docBaseDir = getDocBaseDir(
41              file, "WEB-INF/liferay-look-and-feel.xml");
42  
43          if (docBaseDir == null) {
44              return;
45          }
46  
47          if (_log.isInfoEnabled()) {
48              _log.info("Modifying themes for " + file.getPath());
49          }
50  
51          _deployer.explodedTomcatDeploy(file, docBaseDir, null);
52  
53          if (_log.isInfoEnabled()) {
54              _log.info(
55                  "Themes for " + file.getPath() + " modified successfully");
56          }
57  
58          copyContextFile(file);
59      }
60  
61      private static Log _log = LogFactoryUtil.getLog(
62          ThemeExplodedTomcatListener.class);
63  
64      private ExplodedTomcatDeployer _deployer;
65  
66  }