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.AutoDeployer;
019 import com.liferay.portal.kernel.deploy.auto.BaseAutoDeployListener;
020 import com.liferay.portal.kernel.deploy.auto.context.AutoDeploymentContext;
021 import com.liferay.portal.kernel.log.Log;
022 import com.liferay.portal.kernel.log.LogFactoryUtil;
023
024 import java.io.File;
025
026
029 public class ExtAutoDeployListener extends BaseAutoDeployListener {
030
031 public ExtAutoDeployListener() {
032 _autoDeployer = new ThreadSafeAutoDeployer(new ExtAutoDeployer());
033 }
034
035 @Override
036 public int 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 (!isExtPlugin(file)) {
046 return AutoDeployer.CODE_NOT_APPLICABLE;
047 }
048
049 if (_log.isInfoEnabled()) {
050 _log.info(
051 "Copying extension environment plugin for " + file.getPath());
052 }
053
054 int code = _autoDeployer.autoDeploy(autoDeploymentContext);
055
056 if ((code == AutoDeployer.CODE_DEFAULT) && _log.isInfoEnabled()) {
057 _log.info(
058 "Extension environment for " + file.getPath() +
059 " copied successfully. Deployment will start in a few " +
060 "seconds.");
061 }
062
063 return code;
064 }
065
066 private static Log _log = LogFactoryUtil.getLog(
067 ExtAutoDeployListener.class);
068
069 private AutoDeployer _autoDeployer;
070
071 }