Author: norman Date: Mon Sep 6 10:50:35 2010 New Revision: 992992 URL: http://svn.apache.org/viewvc?rev=992992&view=rev Log: Cleanup + javadocs
Added: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/RequestAware.java Removed: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/package.html james/imap/trunk/mailbox/src/main/resources/org/ Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageManager.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageRange.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/SubscriptionManager.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxSessionMapperFactory.java james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultHeader.java james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultIterator.java james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxConstants.java Mon Sep 6 10:50:35 2010 @@ -20,10 +20,6 @@ package org.apache.james.imap.mailbox; public interface MailboxConstants { - - public final long UID_INFINITY = -1; - - public final int MSN_INFINITY = -1; /** * The namespace used for store user inboxes Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxManager.java Mon Sep 6 10:50:35 2010 @@ -58,7 +58,7 @@ import org.apache.james.imap.api.Mailbox * </p> */ -public interface MailboxManager { +public interface MailboxManager extends RequestAware { /** * Return the delimter to use for folders @@ -210,17 +210,4 @@ public interface MailboxManager { */ void addListener(MailboxPath mailboxPath, MailboxListener listener, MailboxSession session) throws MailboxException; - /** - * Start the processing of a request for the given MailboxSession. If the user is not logged in already then the MailboxSession will be null - * - * @param session - */ - void startProcessingRequest(MailboxSession session); - - /** - * End the processing of a request for the given MailboxSession. If the user is not logged in already then the MailboxSession will be null - * - * @param session - */ - void endProcessingRequest(MailboxSession session); } Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxMetaData.java Mon Sep 6 10:50:35 2010 @@ -69,10 +69,17 @@ public interface MailboxMetaData { */ public Selectability getSelectability(); + /** + * Return the delimiter + * + * @return delimiter + */ String getHierarchyDelimiter(); /** - * @return full mailbox path + * Return the MailboxPath + * + * @return path */ MailboxPath getPath(); } Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MailboxSession.java Mon Sep 6 10:50:35 2010 @@ -30,7 +30,7 @@ import org.apache.commons.logging.Log; * Mailbox session. */ public interface MailboxSession { - + /** * Gets the session ID. * Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageManager.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageManager.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageManager.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageManager.java Mon Sep 6 10:50:35 2010 @@ -38,8 +38,6 @@ import org.apache.james.imap.mailbox.Mes */ public interface MessageManager { - public static final long ANONYMOUS_SESSION = 0; - /** * Return the count * Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageRange.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageRange.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageRange.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/MessageRange.java Mon Sep 6 10:50:35 2010 @@ -117,6 +117,35 @@ public class MessageRange { return uidTo; } + + /** + * Return true if the uid is within the range + * + * @param uid + * @return withinRange + */ + public boolean includes(long uid) { + switch (type) { + case ALL: + return true; + case FROM: + if (uid > getUidFrom()) { + return true; + } + case RANGE: + if (uid >= getUidFrom() && uid <= getUidTo()) { + return true; + } + case ONE: + if (getUidFrom() == uid) { + return true; + } + default: + break; + } + return false; + } + public String toString() { return "TYPE: " + type + " UID: " + uidFrom + ":" + uidTo; } Added: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/RequestAware.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/RequestAware.java?rev=992992&view=auto ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/RequestAware.java (added) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/RequestAware.java Mon Sep 6 10:50:35 2010 @@ -0,0 +1,42 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ +package org.apache.james.imap.mailbox; + +/** + * Implementations of this interface are aware of processing requests + * + * + */ +public interface RequestAware { + + + /** + * Start the processing of a request for the given MailboxSession. If the user is not logged in already then the MailboxSession will be null + * + * @param session + */ + public void startProcessingRequest(MailboxSession session); + + /** + * End the processing of a request for the given MailboxSession. If the user is not logged in already then the MailboxSession will be null + * + * @param session + */ + public void endProcessingRequest(MailboxSession session); +} Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/SubscriptionManager.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/SubscriptionManager.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/SubscriptionManager.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/SubscriptionManager.java Mon Sep 6 10:50:35 2010 @@ -25,7 +25,7 @@ import java.util.Collection; /** * Subscribes users. */ -public interface SubscriptionManager{ +public interface SubscriptionManager extends RequestAware{ /** * Subscribes the user in the session to the given mailbox. @@ -52,18 +52,5 @@ public interface SubscriptionManager{ */ public void unsubscribe(MailboxSession session, String mailbox) throws SubscriptionException; - - /** - * Start the processing of a request for the given MailboxSession. If the user is not logged in already then the MailboxSession will be null - * - * @param session - */ - public void startProcessingRequest(MailboxSession session); - - /** - * End the processing of a request for the given MailboxSession. If the user is not logged in already then the MailboxSession will be null - * - * @param session - */ - public void endProcessingRequest(MailboxSession session); + } Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MailboxEventDispatcher.java Mon Sep 6 10:50:35 2010 @@ -32,10 +32,18 @@ import javax.mail.Flags.Flag; import org.apache.james.imap.api.MailboxPath; import org.apache.james.imap.mailbox.MailboxListener; +/** + * Helper class to dispatch {...@link Event}'s to registerend MailboxListener + * + * + */ public class MailboxEventDispatcher implements MailboxListener { private final Set<MailboxListener> listeners = new CopyOnWriteArraySet<MailboxListener>(); + /** + * Remove all closed MailboxListener + */ private void pruneClosed() { final Collection<MailboxListener> closedListeners = new ArrayList<MailboxListener>(); for (MailboxListener listener:listeners) { @@ -48,22 +56,50 @@ public class MailboxEventDispatcher impl } } + /** + * Add a MailboxListener to this dispatcher + * + * @param mailboxListener + */ public void addMailboxListener(MailboxListener mailboxListener) { pruneClosed(); listeners.add(mailboxListener); } + /** + * Should get called when a new message was added to a Mailbox. All registered MailboxListener will get triggered then + * + * @param uid + * @param sessionId + * @param path + */ public void added(long uid, long sessionId, MailboxPath path) { pruneClosed(); final AddedImpl added = new AddedImpl(sessionId, path, uid); event(added); } + /** + * Should get called when a message was expunged from a Mailbox. All registered MailboxListener will get triggered then + + * @param uid + * @param sessionId + * @param path + */ public void expunged(final long uid, long sessionId, MailboxPath path) { final ExpungedImpl expunged = new ExpungedImpl(sessionId, path, uid); event(expunged); } + /** + * Should get called when the message flags were update in a Mailbox. All registered MailboxListener will get triggered then + * + * @param uid + * @param sessionId + * @param path + * @param original + * @param updated + */ public void flagsUpdated(final long uid, long sessionId, final MailboxPath path, final Flags original, final Flags updated) { final FlagsUpdatedImpl flags = new FlagsUpdatedImpl(sessionId, path, uid, @@ -82,10 +118,22 @@ public class MailboxEventDispatcher impl } } - public int size() { + /** + * Return the the count of all registered MailboxListener + * + * @return count + */ + public int count() { return listeners.size(); } + /** + * Should get called when a Mailbox was renamed. All registered MailboxListener will get triggered then + * + * @param from + * @param to + * @param sessionId + */ public void mailboxRenamed(MailboxPath from, MailboxPath to, long sessionId) { event(new MailboxRenamedEventImpl(from, to, sessionId)); } @@ -243,6 +291,14 @@ public class MailboxEventDispatcher impl } } + + /** + * Should get called when a Mailbox was deleted. All registered MailboxListener will get triggered then + + * + * @param sessionId + * @param path + */ public void mailboxDeleted(long sessionId, MailboxPath path) { final MailboxDeletionEventImpl event = new MailboxDeletionEventImpl( sessionId, path); Modified: james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java URL: http://svn.apache.org/viewvc/james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java (original) +++ james/imap/trunk/mailbox/src/main/java/org/apache/james/imap/mailbox/util/MessageResultImpl.java Mon Sep 6 10:50:35 2010 @@ -328,10 +328,6 @@ public class MessageResultImpl implement private int content; - public final int getContent() { - return content; - } - public final Content getBody() { return body; } Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxSessionMapperFactory.java URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxSessionMapperFactory.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxSessionMapperFactory.java (original) +++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxSessionMapperFactory.java Mon Sep 6 10:50:35 2010 @@ -20,16 +20,18 @@ package org.apache.james.imap.store; import org.apache.james.imap.mailbox.MailboxException; import org.apache.james.imap.mailbox.MailboxSession; +import org.apache.james.imap.mailbox.RequestAware; import org.apache.james.imap.mailbox.SubscriptionException; import org.apache.james.imap.store.mail.MailboxMapper; import org.apache.james.imap.store.mail.MessageMapper; +import org.apache.james.imap.store.transaction.Mapper; import org.apache.james.imap.store.user.SubscriptionMapper; /** * Maintain mapper instances by {...@link MailboxSession}. So only one mapper instance is used * in a {...@link MailboxSession} */ -public abstract class MailboxSessionMapperFactory <Id> { +public abstract class MailboxSessionMapperFactory <Id> implements RequestAware{ protected final static String MESSAGEMAPPER ="MESSAGEMAPPER"; protected final static String MAILBOXMAPPER ="MAILBOXMAPPER"; @@ -110,12 +112,12 @@ public abstract class MailboxSessionMapp protected abstract SubscriptionMapper createSubscriptionMapper(MailboxSession session) throws SubscriptionException; /** - * Callback which needs to get called once an IMAP Request was complete. It will take care of getting rid of all Session-scoped stuff + * Call endRequest on {...@link Mapper} instances * * @param session */ @SuppressWarnings("unchecked") - public void endRequest(MailboxSession session) { + public void endProcessingRequest(MailboxSession session) { if (session == null) return; MessageMapper<Id> messageMapper = (MessageMapper) session.getAttributes().get(MESSAGEMAPPER); MailboxMapper<Id> mailboxMapper = (MailboxMapper) session.getAttributes().get(MAILBOXMAPPER); @@ -125,8 +127,17 @@ public abstract class MailboxSessionMapp if (mailboxMapper != null) mailboxMapper.endRequest(); if (subscriptionMapper != null) - subscriptionMapper.endRequest(); + subscriptionMapper.endRequest(); } - + /** + * Do nothing + * + */ + public void startProcessingRequest(MailboxSession session) { + // Do nothing + + } + + } Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultHeader.java URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultHeader.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultHeader.java (original) +++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultHeader.java Mon Sep 6 10:50:35 2010 @@ -26,8 +26,6 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.WritableByteChannel; -import javax.mail.MessagingException; - import org.apache.james.imap.mailbox.Content; import org.apache.james.imap.mailbox.MailboxException; import org.apache.james.imap.mailbox.MessageResult; @@ -50,22 +48,34 @@ public final class ResultHeader implemen size = name.length() + value.length() + 2; } - public Content getContent() throws MessagingException { - return this; - } - + /* + * (non-Javadoc) + * @see org.apache.james.imap.mailbox.MessageResult.Header#getName() + */ public String getName() throws MailboxException { return name; } + /* + * (non-Javadoc) + * @see org.apache.james.imap.mailbox.MessageResult.Header#getValue() + */ public String getValue() throws MailboxException { return value; } + /* + * (non-Javadoc) + * @see org.apache.james.imap.mailbox.Content#size() + */ public long size() { return size; } + /* + * (non-Javadoc) + * @see org.apache.james.imap.mailbox.Content#writeTo(java.nio.channels.WritableByteChannel) + */ public void writeTo(WritableByteChannel channel) throws IOException { writeAll(channel, ResultUtils.US_ASCII.encode(name)); ByteBuffer buffer = ByteBuffer Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultIterator.java URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultIterator.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultIterator.java (original) +++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultIterator.java Mon Sep 6 10:50:35 2010 @@ -34,7 +34,7 @@ import org.apache.james.imap.mailbox.Mes import org.apache.james.imap.store.mail.model.MailboxMembership; /** - * {...@link Iterator} implementations for {...@link MessageResult} + * {...@link Iterator} implementation for {...@link MessageResult} * */ public class ResultIterator<Id> implements Iterator<MessageResult> { @@ -129,10 +129,6 @@ public class ResultIterator<Id> implemen return uid; } - public long getUidValidity() { - return 0; - } - public Iterator<Header> headers() throws MailboxException { throw exception; } Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java (original) +++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailboxManager.java Mon Sep 6 10:50:35 2010 @@ -417,7 +417,7 @@ public abstract class StoreMailboxManage * End processing of Request for session */ public void endProcessingRequest(MailboxSession session) { - mailboxSessionMapperFactory.endRequest(session); + mailboxSessionMapperFactory.endProcessingRequest(session); } /** Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java (original) +++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreSubscriptionManager.java Mon Sep 6 10:50:35 2010 @@ -117,7 +117,7 @@ public abstract class StoreSubscriptionM * @see org.apache.james.imap.mailbox.SubscriptionManager#endProcessingRequest(org.apache.james.imap.mailbox.MailboxSession) */ public void endProcessingRequest(MailboxSession session) { - mapperFactory.endRequest(session); + mapperFactory.endProcessingRequest(session); } /** Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java (original) +++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java Mon Sep 6 10:50:35 2010 @@ -195,7 +195,7 @@ public class TorqueMailbox implements Me save(messageRow); MessageResult messageResult = fillMessageResult(messageRow, FetchGroupImpl.MINIMAL); - getUidChangeTracker().found(messageResult.getUid(), messageResult.getFlags()); + getUidChangeTracker().found(messageResult.getUid(), messageResult.getFlags(), mailboxSession.getSessionId()); return messageResult.getUid(); } catch (Exception e) { e.printStackTrace(); @@ -335,7 +335,7 @@ public class TorqueMailbox implements Me Criteria c = criteriaForMessageSet(set); c.add(MessageFlagsPeer.MAILBOX_ID, getMailboxRow() .getMailboxId()); - return getMessages(fetchGroup, set, c); + return getMessages(fetchGroup, set, c, mailboxSession); } catch (TorqueException e) { throw new MailboxException(HumanReadableText.SEARCH_FAILED, e); } catch (MessagingException e) { @@ -348,7 +348,7 @@ public class TorqueMailbox implements Me @SuppressWarnings("unchecked") private TorqueResultIterator getMessages(FetchGroup result, MessageRange range, - Criteria c) throws TorqueException, MessagingException, + Criteria c, MailboxSession session) throws TorqueException, MessagingException, MailboxException { List<MessageRow> rows = MessageRowPeer.doSelectJoinMessageFlags(c); final Map<Long, Flags> flagsByIndex = new HashMap<Long, Flags>(); @@ -356,7 +356,7 @@ public class TorqueMailbox implements Me flagsByIndex.put(row.getUid(), row.getMessageFlags().createFlags()); } final TorqueResultIterator results = getResults(result, rows); - getUidChangeTracker().found(range, flagsByIndex); + getUidChangeTracker().found(range, flagsByIndex, session.getSessionId()); return results; } @@ -442,7 +442,7 @@ public class TorqueMailbox implements Me MessageResult messageResult = fillMessageResult( (MessageRow) messageRows.get(0), FetchGroupImpl.MINIMAL); if (messageResult != null) { - getUidChangeTracker().found(messageResult.getUid(), messageResult.getFlags()); + getUidChangeTracker().found(messageResult.getUid(), messageResult.getFlags(), mailboxSession.getSessionId()); } return messageResult.getUid(); @@ -786,7 +786,7 @@ public class TorqueMailbox implements Me save(newRow); MessageResult messageResult = fillMessageResult(newRow, FetchGroupImpl.MINIMAL); - getUidChangeTracker().found(messageResult.getUid(), messageResult.getFlags()); + getUidChangeTracker().found(messageResult.getUid(), messageResult.getFlags(), session.getSessionId()); } } } catch (TorqueException e) { @@ -804,8 +804,8 @@ public class TorqueMailbox implements Me tracker.mailboxDeleted(session.getSessionId()); } - public void reportRenamed(String from, MailboxRow mailboxRow) { - tracker.reportRenamed(getMailboxPath(mailboxRow.getName())); + public void reportRenamed(String from, MailboxRow mailboxRow, MailboxSession session) { + tracker.reportRenamed(getMailboxPath(mailboxRow.getName()), session.getSessionId()); this.mailboxRow = mailboxRow; } Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java (original) +++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailboxManager.java Mon Sep 6 10:50:35 2010 @@ -313,7 +313,7 @@ public class TorqueMailboxManager implem mr.setName(to); mr.save(); - changeMailboxName(from, to, mr); + changeMailboxName(from, to, mr, session); // rename submailbox Criteria c = new Criteria(); @@ -327,7 +327,7 @@ public class TorqueMailboxManager implem String subNewName = to + subOrigName.substring(from.length()); sub.setName(subNewName); sub.save(); - changeMailboxName(subOrigName, subNewName, sub); + changeMailboxName(subOrigName, subNewName, sub, session); getLog().info( "renameMailbox sub-mailbox " + subOrigName + " to " + subNewName); @@ -338,10 +338,10 @@ public class TorqueMailboxManager implem } } - private void changeMailboxName(String from, String to, final MailboxRow mr) { + private void changeMailboxName(String from, String to, final MailboxRow mr, MailboxSession session) { TorqueMailbox torqueMailbox = (TorqueMailbox) mailboxes.remove(from); if (torqueMailbox != null) { - torqueMailbox.reportRenamed(from, mr); + torqueMailbox.reportRenamed(from, mr, session); mailboxes.put(to, torqueMailbox); } } Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java?rev=992992&r1=992991&r2=992992&view=diff ============================================================================== --- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java (original) +++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/UidChangeTracker.java Mon Sep 6 10:50:35 2010 @@ -32,7 +32,6 @@ import javax.mail.Flags; import org.apache.james.imap.api.MailboxPath; import org.apache.james.imap.mailbox.MailboxConstants; -import org.apache.james.imap.mailbox.MessageManager; import org.apache.james.imap.mailbox.MailboxListener; import org.apache.james.imap.mailbox.util.MailboxEventDispatcher; import org.apache.james.imap.mailbox.MessageRange; @@ -94,7 +93,7 @@ public class UidChangeTracker implements } } - public synchronized void found(MessageRange range, final Map<Long, Flags> flagsByIndex) { + public synchronized void found(MessageRange range, final Map<Long, Flags> flagsByIndex, long sessionId) { final Set<Long> expectedSet = getSubSet(range); for (Map.Entry<Long, Flags> entry:flagsByIndex.entrySet()) { final Long uid = entry.getKey(); @@ -102,24 +101,24 @@ public class UidChangeTracker implements expectedSet.remove(uid); } final Flags flags = entry.getValue(); - found(uid, flags); + found(uid, flags, sessionId); } for (Iterator<Long> iter = expectedSet.iterator(); iter.hasNext();) { long uid = ((Long) iter.next()).longValue(); - eventDispatcher.expunged(uid, MessageManager.ANONYMOUS_SESSION, path); + eventDispatcher.expunged(uid, sessionId, path); } } - public synchronized void found(final Long uid, final Flags flags) { + public synchronized void found(final Long uid, final Flags flags, long sessionId) { if (flags != null) { final Flags cachedFlags = cache.get(uid); if (cachedFlags == null || !flags.equals(cachedFlags)) { - eventDispatcher.flagsUpdated(uid, MessageManager.ANONYMOUS_SESSION, path, cachedFlags, flags); + eventDispatcher.flagsUpdated(uid, sessionId, path, cachedFlags, flags); } } if (uid > lastUid) { - eventDispatcher.added(uid, MessageManager.ANONYMOUS_SESSION, path); + eventDispatcher.added(uid, sessionId, path); lastUid = uid; } cache.put(uid, flags); @@ -147,8 +146,8 @@ public class UidChangeTracker implements eventDispatcher.mailboxDeleted(sessionId, path); } - public void reportRenamed(MailboxPath to) { - eventDispatcher.mailboxRenamed(path, to, MessageManager.ANONYMOUS_SESSION); + public void reportRenamed(MailboxPath to, long sessionId) { + eventDispatcher.mailboxRenamed(path, to, sessionId); path = to; } } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org