| ThemeAutoDeployListener.java |
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;
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="ThemeAutoDeployListener.java.html"><b><i>View Source</i></b></a>
26 *
27 * @author Ivica Cardic
28 * @author Brian Wing Shun Chan
29 */
30 public class ThemeAutoDeployListener extends BaseAutoDeployListener {
31
32 public ThemeAutoDeployListener() {
33 _deployer = new ThemeAutoDeployer();
34 }
35
36 public void deploy(File file) throws AutoDeployException {
37 if (_log.isDebugEnabled()) {
38 _log.debug("Invoking deploy for " + file.getPath());
39 }
40
41 if (!isThemePlugin(file)) {
42 return;
43 }
44
45 if (_log.isInfoEnabled()) {
46 _log.info("Copying themes for " + file.getPath());
47 }
48
49 _deployer.autoDeploy(file.getName());
50
51 if (_log.isInfoEnabled()) {
52 _log.info(
53 "Themes for " + file.getPath() + " copied successfully. " +
54 "Deployment will start in a few seconds.");
55 }
56 }
57
58 private static Log _log = LogFactoryUtil.getLog(
59 ThemeAutoDeployListener.class);
60
61 private AutoDeployer _deployer;
62
63 }