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;
16  
17  import com.liferay.portal.kernel.deploy.auto.AutoDeployException;
18  import com.liferay.portal.kernel.deploy.auto.BaseAutoDeployListener;
19  import com.liferay.portal.kernel.log.Log;
20  import com.liferay.portal.kernel.log.LogFactoryUtil;
21  
22  import java.io.File;
23  
24  /**
25   * <a href="LayoutTemplateAutoDeployListener.java.html"><b><i>View Source</i>
26   * </b></a>
27   *
28   * @author Ivica Cardic
29   * @author Brian Wing Shun Chan
30   */
31  public class LayoutTemplateAutoDeployListener extends BaseAutoDeployListener {
32  
33      public LayoutTemplateAutoDeployListener() {
34          _deployer = new LayoutTemplateAutoDeployer();
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          if (!isMatchingFile(file, "WEB-INF/liferay-layout-templates.xml")) {
43              return;
44          }
45  
46          if (_log.isInfoEnabled()) {
47              _log.info("Copying layout templates for " + file.getPath());
48          }
49  
50          _deployer.autoDeploy(file.getName());
51  
52          if (_log.isInfoEnabled()) {
53              _log.info(
54                  "Layout templates for " + file.getPath() +
55                      " copied successfully. Deployment will start in a few " +
56                          "seconds.");
57          }
58      }
59  
60      private static Log _log = LogFactoryUtil.getLog(
61          LayoutTemplateAutoDeployListener.class);
62  
63      private AutoDeployer _deployer;
64  
65  }