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=943579&r1=943578&r2=943579&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 Wed May 12 16:50:26 2010 @@ -71,16 +71,19 @@ public abstract class StoreMailboxManage private final Authenticator authenticator; private final Subscriber subscriber; private final char delimiter; + + private UidConsumer<Id> consumer; - public StoreMailboxManager(final Authenticator authenticator, final Subscriber subscriber) { - this(authenticator, subscriber, '.'); + public StoreMailboxManager(final Authenticator authenticator, final Subscriber subscriber, final UidConsumer<Id> consumer) { + this(authenticator, subscriber, consumer, '.'); } - public StoreMailboxManager(final Authenticator authenticator, final Subscriber subscriber, final char delimiter) { + public StoreMailboxManager(final Authenticator authenticator, final Subscriber subscriber, final UidConsumer<Id> consumer, final char delimiter) { this.authenticator = authenticator; this.subscriber = subscriber; this.delimiter = delimiter; + this.consumer = consumer; } /** @@ -89,7 +92,7 @@ public abstract class StoreMailboxManage * @param mailboxRow * @return storeMailbox */ - protected abstract StoreMailbox<Id> createMailbox(MailboxEventDispatcher dispatcher, Mailbox<Id> mailboxRow, MailboxSession session) throws MailboxException; + protected abstract StoreMailbox<Id> createMailbox(MailboxEventDispatcher dispatcher, UidConsumer<Id> consumer, Mailbox<Id> mailboxRow, MailboxSession session) throws MailboxException; /** * Create the MailboxMapper @@ -135,7 +138,7 @@ public abstract class StoreMailboxManage } else { getLog().debug("Loaded mailbox " + mailboxName); - StoreMailbox<Id> result = createMailbox(dispatcher, mailboxRow, session); + StoreMailbox<Id> result = createMailbox(dispatcher, consumer, mailboxRow, session); result.addListener(delegatingListener); return result; }
Added: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/UidConsumer.java URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/UidConsumer.java?rev=943579&view=auto ============================================================================== --- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/UidConsumer.java (added) +++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/UidConsumer.java Wed May 12 16:50:26 2010 @@ -0,0 +1,35 @@ +/**************************************************************** + * 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.store; + +import org.apache.james.imap.mailbox.MailboxException; +import org.apache.james.imap.mailbox.MailboxSession; +import org.apache.james.imap.store.mail.model.Mailbox; + +public interface UidConsumer<Id> { + + /** + * Reserve the next uid for the given {...@link Mailbox}. The uid reserve process + * must be thread-safe for mailboxes with the same id + * + * @param mailbox + * @return uid + */ + public long reserveNextUid(Mailbox<Id> mailbox, MailboxSession session)throws MailboxException; +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
