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="HookAutoDeployListener.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class HookAutoDeployListener extends BaseAutoDeployListener {
30  
31      public HookAutoDeployListener() {
32          _deployer = new HookAutoDeployer();
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          if (!isHookPlugin(file)) {
41              return;
42          }
43  
44          if (_log.isInfoEnabled()) {
45              _log.info("Copying web plugin for " + file.getPath());
46          }
47  
48          _deployer.autoDeploy(file.getName());
49  
50          if (_log.isInfoEnabled()) {
51              _log.info(
52                  "Hook for " +  file.getPath() + " copied successfully. " +
53                      "Deployment will start in a few seconds.");
54          }
55      }
56  
57      private static Log _log = LogFactoryUtil.getLog(
58          HookAutoDeployListener.class);
59  
60      private AutoDeployer _deployer;
61  
62  }