001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
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.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    
022    import java.io.File;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     */
027    public class ExtAutoDeployListener extends BaseAutoDeployListener {
028    
029            public ExtAutoDeployListener() {
030                    _autoDeployer = new ExtAutoDeployer();
031            }
032    
033            public void deploy(File file, String context) throws AutoDeployException {
034                    if (_log.isDebugEnabled()) {
035                            _log.debug("Invoking deploy for " + file.getPath());
036                    }
037    
038                    if (!isExtPlugin(file)) {
039                            return;
040                    }
041    
042                    if (_log.isInfoEnabled()) {
043                            _log.info(
044                                    "Copying extension environment plugin for " + file.getPath());
045                    }
046    
047                    _autoDeployer.autoDeploy(file, context);
048    
049                    if (_log.isInfoEnabled()) {
050                            _log.info(
051                                    "Extension environment for " +  file.getPath() +
052                                            " copied successfully. Deployment will start in a few " +
053                                                    "seconds.");
054                    }
055            }
056    
057            private static Log _log = LogFactoryUtil.getLog(
058                    ExtAutoDeployListener.class);
059    
060            private AutoDeployer _autoDeployer;
061    
062    }