Package org.apache.james.mailbox

Examples of org.apache.james.mailbox.MailboxListener


        try {
         
            final MailboxManager mailboxManager = getMailboxManager();
            final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
            final SelectedMailbox sm = session.getSelected();
            final MailboxListener idleListener;
            if (sm != null) {
                idleListener = new IdleMailboxListener(session, responder);
                mailboxManager.addListener(sm.getPath(), idleListener , mailboxSession);
            } else {
                idleListener = null;
View Full Code Here


            if (mListeners != null && mListeners.isEmpty() == false) {
                List<MailboxListener> closedListener = new ArrayList<MailboxListener>();
               
                int sz = mListeners.size();
                for (int i = 0; i < sz; i++) {
                    MailboxListener l = mListeners.get(i);
                    if (l.isClosed()) {
                        closedListener.add(l);
                    } else {
                        l.event(event);
                    }
                }
               
                if (event instanceof MailboxDeletion) {
                    // remove listeners if the mailbox was deleted
                    listeners.remove(path);
                } else if (event instanceof MailboxRenamed) {
                    // handle rename events
                    MailboxRenamed renamed = (MailboxRenamed) event;
                    List<MailboxListener> l = listeners.remove(path);
                    if (l != null) {
                        listeners.put(renamed.getNewPath(), l);
                    }
                }
                if (closedListener.isEmpty() == false) {
                    mListeners.removeAll(closedListener);
                    if (mListeners.isEmpty()) {
                        listeners.remove(path);
                    }
                }
            } 
           
        }
       
       
        List<MailboxListener> globalListeners = getGlobalListeners();
        synchronized (globalListeners) {
            if (globalListeners != null && globalListeners.isEmpty() == false) {
                List<MailboxListener> closedListener = new ArrayList<MailboxListener>();
               
                int sz = globalListeners.size();
                for (int i = 0; i < sz; i++) {
                    MailboxListener l = globalListeners.get(i);
                    if (l.isClosed()) {
                        closedListener.add(l);
                    } else {
                        l.event(event);
                    }
                }
               
             
                if (closedListener.isEmpty() == false) {
View Full Code Here

     * .MailboxListener.Event)
     */
    public void event(Event event) {
        List<MailboxListener> closed = new ArrayList<MailboxListener>();
        for (Iterator<MailboxListener> iter = listeners.iterator(); iter.hasNext();) {
            MailboxListener mailboxListener = iter.next();
            if (mailboxListener.isClosed() == false) {
                mailboxListener.event(event);
            } else {
                closed.add(mailboxListener);
            }
        }
        for (int i = 0; i < closed.size(); i++)
View Full Code Here

            List<MailboxListener> mListeners = listeners.get(path);
            if (mListeners != null && mListeners.isEmpty() == false) {
               
                int sz = mListeners.size();
                for (int i = 0; i < sz; i++) {
                    MailboxListener l = mListeners.get(i);
                    l.event(event);
                   
                }
               
                if (event instanceof MailboxDeletion) {
                    // remove listeners if the mailbox was deleted
                    listeners.remove(path);
                } else if (event instanceof MailboxRenamed) {
                    // handle rename events
                    MailboxRenamed renamed = (MailboxRenamed) event;
                    List<MailboxListener> l = listeners.remove(path);
                    if (l != null) {
                        listeners.put(renamed.getNewPath(), l);
                    }
                }
               
            } 
           
        }
       
       
        List<MailboxListener> globalListeners = getGlobalListeners();
        if (globalListeners != null) {
            synchronized (globalListeners) {
                if (globalListeners.isEmpty() == false) {
                    List<MailboxListener> closedListener = new ArrayList<MailboxListener>();
                   
                    int sz = globalListeners.size();
                    for (int i = 0; i < sz; i++) {
                        MailboxListener l = globalListeners.get(i);
                        l.event(event);
                       
                    }
                   
                 
                    if (closedListener.isEmpty() == false) {
View Full Code Here

     * .MailboxListener.Event)
     */
    public void event(Event event) {
        List<MailboxListener> closed = new ArrayList<MailboxListener>();
        for (Iterator<MailboxListener> iter = listeners.iterator(); iter.hasNext();) {
            MailboxListener mailboxListener = iter.next();
            if (mailboxListener.isClosed() == false) {
                mailboxListener.event(event);
            } else {
                closed.add(mailboxListener);
            }
        }
        for (int i = 0; i < closed.size(); i++)
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.MailboxListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.