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="HookExplodedTomcatListener.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Gregory Amerson
27   */
28  public class HookExplodedTomcatListener extends BaseExplodedTomcatListener {
29  
30      public HookExplodedTomcatListener() {
31          _deployer = new HookExplodedTomcatDeployer();
32      }
33  
34      public void deploy(File file) throws AutoDeployException {
35          if (_log.isDebugEnabled()) {
36              _log.debug("Invoking deploy for " + file.getPath());
37          }
38  
39          File docBaseDir = getDocBaseDir(file, "WEB-INF/liferay-hook.xml");
40  
41          if (docBaseDir == null) {
42              return;
43          }
44  
45          if (_log.isInfoEnabled()) {
46              _log.info("Modifying hook for " + file.getPath());
47          }
48  
49          _deployer.explodedTomcatDeploy(file, docBaseDir, null);
50  
51          if (_log.isInfoEnabled()) {
52              _log.info("Hook for " + file.getPath() + " modified successfully");
53          }
54  
55          copyContextFile(file);
56      }
57  
58      private static Log _log = LogFactoryUtil.getLog(
59          HookExplodedTomcatListener.class);
60  
61      private ExplodedTomcatDeployer _deployer;
62  
63  }