KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > imapserver > store > ImapStore


1 /***********************************************************************
2  * Copyright (c) 2000-2004 The Apache Software Foundation. *
3  * All rights reserved. *
4  * ------------------------------------------------------------------- *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you *
6  * may not use this file except in compliance with the License. You *
7  * may obtain a copy of the License at: *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
14  * implied. See the License for the specific language governing *
15  * permissions and limitations under the License. *
16  ***********************************************************************/

17
18 package org.apache.james.imapserver.store;
19
20 import java.util.Collection JavaDoc;
21
22 /**
23  * Represents the complete mail store for an IMAP server, providing access to
24  * and manipulation of all {@link org.apache.james.imapserver.store.ImapMailbox Mailboxes} stored on this server.
25  *
26  *
27  * @version $Revision: 1.1.2.3 $
28  */

29 public interface ImapStore
30 {
31     /**
32      * Retrieves a mailbox based on a fully qualified name.
33      * @param qualifiedMailboxName
34      * @return The mailbox if present, or <code>null</code> if not.
35      */

36     ImapMailbox getMailbox( String JavaDoc qualifiedMailboxName );
37
38     /**
39      * Looks up a child mailbox of the supplied parent with the name given.
40      * @param parent The parent mailbox
41      * @param mailboxName The name of the child to lookup
42      * @return The child mailbox, or <code>null</code> if not found.
43      */

44     ImapMailbox getMailbox( ImapMailbox parent, String JavaDoc mailboxName );
45
46     /**
47      * @param parent A mailbox from this store.
48      * @return A read-only collection of {@link ImapMailbox} instances, which
49      * are the children of the supplied parent.
50      */

51     Collection JavaDoc getChildren( ImapMailbox parent );
52
53     /**
54      * Creates a mailbox under the supplied parent with the given name.
55      * If specified, the mailbox created will be made selectable (able to store messages).
56      * @param parent A mailbox from this store.
57      * @param mailboxName The name of the mailbox to create.
58      * @param selectable If <code>true</code>, the mailbox will be created to store messages.
59      * @return The created mailbox
60      * @throws MailboxException If the mailbox couldn't be created.
61      */

62     ImapMailbox createMailbox( ImapMailbox parent,
63                                String JavaDoc mailboxName,
64                                boolean selectable )
65             throws MailboxException;
66
67     /**
68      * Tells the store to make the supplied mailbox selectable or not (able to store
69      * messages). The returned mailbox may be a new instance, and the supplied mailbox
70      * may no longer be valid.
71      * @param mailbox The mailbox to modify.
72      * @param selectable Whether this mailbox should be able to store messages.
73      * @return The modified mailbox
74      */

75     ImapMailbox setSelectable( ImapMailbox mailbox, boolean selectable );
76
77     /**
78      * Deletes the supplied mailbox from the store. To be deleted, mailboxes
79      * must be empty of messages, and not have any children.
80      * @param mailbox A mailbox from this store.
81      * @throws MailboxException If the mailbox couldn't be deleted.
82      */

83     void deleteMailbox( ImapMailbox mailbox ) throws MailboxException;
84
85     /**
86      * Renames the mailbox with the new name.
87      * @param existingMailbox A mailbox from this store.
88      * @param newName The new name for the mailbox.
89      * @throws MailboxException If the mailbox couldn't be renamed
90      */

91     void renameMailbox( ImapMailbox existingMailbox, String JavaDoc newName )
92             throws MailboxException;
93
94     /**
95      * Lists all of the mailboxes in the store which have a name
96      * matching the supplied search pattern.
97      * <pre>
98      * Valid wildcards are:
99      * '*' - matches any number of characters, including the hierarchy delimiter
100      * '%' - matches any number of characters, but not the hierarchy delimiter
101      *
102      * @param searchPattern The pattern to match mailboxes
103      * @return A read-only collection of mailboxes which match this pattern
104      * @throws MailboxException If the list operation failed
105      */

106     Collection JavaDoc listMailboxes( String JavaDoc searchPattern ) throws MailboxException;
107
108 }
109
Popular Tags