001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.deploy.hot.messaging;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.messaging.BaseMessageListener;
020    import com.liferay.portal.kernel.messaging.Message;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     * @author Eduardo Lundgren
025     */
026    public class HotDeployMessageListener extends BaseMessageListener {
027    
028            @Override
029            protected void doReceive(Message message) throws Exception {
030                    String command = message.getString("command");
031                    String servletContextName = message.getString("servletContextName");
032    
033                    if (_log.isDebugEnabled()) {
034                            if (command.equals("deploy")) {
035                                    _log.debug(servletContextName + " was deployed");
036                            }
037                            else if (command.equals("undeploy")) {
038                                    _log.debug(servletContextName + " was undeployed");
039                            }
040                    }
041            }
042    
043            private static Log _log = LogFactoryUtil.getLog(
044                    HotDeployMessageListener.class);
045    
046    }