1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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="LayoutTemplateExplodedTomcatListener.java.html"><b><i>View Source
25   * </i></b></a>
26   *
27   * @author Olaf Fricke
28   * @author Brian Wing Shun Chan
29   */
30  public class LayoutTemplateExplodedTomcatListener
31      extends BaseExplodedTomcatListener {
32  
33      public LayoutTemplateExplodedTomcatListener() {
34          _deployer = new LayoutTemplateExplodedTomcatDeployer();
35      }
36  
37      public void deploy(File file) throws AutoDeployException {
38          if (_log.isDebugEnabled()) {
39              _log.debug("Invoking deploy for " + file.getPath());
40          }
41  
42          File docBaseDir = getDocBaseDir(
43              file, "WEB-INF/liferay-layout-templates.xml");
44  
45          if (docBaseDir == null) {
46              return;
47          }
48  
49          if (_log.isInfoEnabled()) {
50              _log.info("Modifying layout templates for " + file.getPath());
51          }
52  
53          _deployer.explodedTomcatDeploy(file, docBaseDir, null);
54  
55          if (_log.isInfoEnabled()) {
56              _log.info(
57                  "Layout templates for " + file.getPath() +
58                      " modified successfully");
59          }
60  
61          copyContextFile(file);
62      }
63  
64      private static Log _log = LogFactoryUtil.getLog(
65          LayoutTemplateExplodedTomcatListener.class);
66  
67      private ExplodedTomcatDeployer _deployer;
68  
69  }