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="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  }