001
014
015 package com.liferay.portal.deploy.auto;
016
017 import com.liferay.portal.kernel.deploy.auto.AutoDeployException;
018 import com.liferay.portal.kernel.deploy.auto.BaseAutoDeployListener;
019 import com.liferay.portal.kernel.deploy.auto.context.AutoDeploymentContext;
020 import com.liferay.portal.kernel.log.Log;
021 import com.liferay.portal.kernel.log.LogFactoryUtil;
022
023 import java.io.File;
024
025
029 public class LayoutTemplateAutoDeployListener extends BaseAutoDeployListener {
030
031 public LayoutTemplateAutoDeployListener() {
032 _autoDeployer = new ThreadSafeAutoDeployer(
033 new LayoutTemplateAutoDeployer());
034 }
035
036 public void deploy(AutoDeploymentContext autoDeploymentContext)
037 throws AutoDeployException {
038
039 File file = autoDeploymentContext.getFile();
040
041 if (_log.isDebugEnabled()) {
042 _log.debug("Invoking deploy for " + file.getPath());
043 }
044
045 if (!isMatchingFile(file, "WEB-INF/liferay-layout-templates.xml")) {
046 return;
047 }
048
049 if (_log.isInfoEnabled()) {
050 _log.info("Copying layout templates for " + file.getPath());
051 }
052
053 int code = _autoDeployer.autoDeploy(autoDeploymentContext);
054
055 if ((code == AutoDeployer.CODE_DEFAULT) && _log.isInfoEnabled()) {
056 _log.info(
057 "Layout templates for " + file.getPath() +
058 " copied successfully. Deployment will start in a few " +
059 "seconds.");
060 }
061 }
062
063 private static Log _log = LogFactoryUtil.getLog(
064 LayoutTemplateAutoDeployListener.class);
065
066 private AutoDeployer _autoDeployer;
067
068 }