001    /*
002     * Copyright (C) The Apache Software Foundation. All rights reserved.
003     *
004     * This software is published under the terms of the Apache Software License
005     * version 1.1, a copy of which has been included with this distribution in
006     * the LICENSE file.
007     * 
008     * $Id: MessengerListenerSupport.java 155459 2005-02-26 13:24:44Z dirkv $
009     */
010    package org.apache.commons.messenger;
011    
012    
013    /** 
014     * <p><code>MessengerListenerSupport</code> is an abstract base
015     * class for a MessengerListener objects which is useful for
016     * implementation inheritence.
017     * This object has a messenger property which can be used to send replies
018     * to incoming messages or to send other messages using the same Messenger
019     * (JMS connection).</p>
020     *
021     * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
022     * @version $Revision: 155459 $
023     */
024    public abstract class MessengerListenerSupport implements MessengerListener {
025    
026        private Messenger messenger;
027        
028        /** 
029         * Called whenever this MessageListener is added to a 
030         * Messenger via the addListener() method to associate
031         * this MessageListener with a Messenger instance..
032         */
033        public void setMessenger(Messenger messenger) {
034            this.messenger = messenger;
035        }
036        
037        /** 
038         * Returns the Messenger that this MessageListener is associated with
039         * making it easy to send replies or other messages using
040         * the same Messenger instance that this object is listening to.
041         */
042        public Messenger getMessenger() {
043            return messenger;
044        }
045    }
046