View Javadoc

1   /*
2    * Copyright (c) 2004-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.mercury.common;
14  
15  import javax.mail.Folder;
16  import javax.mail.MessagingException;
17  import javax.mail.Store;
18  
19  import org.abstracthorizon.mercury.common.exception.UserRejectedException;
20  
21  /**
22   * Storage manager
23   *
24   * @author Daniel Sendula
25   */
26  public interface StorageManager {
27  
28      /**
29       * Returns local store if user is local or <code>null</code> otherwise. In
30       * case that user is to be rejected an exception is thrown.
31       *
32       * @param mailbox user's mailbox
33       * @param domain user's domain
34       * @throws UserRejectedException in case that user is rejected for any reason
35       * @throws MessagingException in case there is a problem accessing user's mailbox
36       */
37      Store  findStore(String mailbox, String domain, char[] password) throws UserRejectedException, MessagingException;
38  
39      /**
40       * Returns local store's inbox if user is local or <code>null</code> otherwise. In
41       * case that user is to be rejected an exception is thrown.
42       *
43       * @param mailbox user's mailbox
44       * @param domain user's domain
45       * @throws UserRejectedException in case that user is rejected for any reason
46       * @throws MessagingException in case there is a problem accessing user's mailbox
47       */
48      Folder findInbox(String mailbox, String domain, char[] password) throws UserRejectedException, MessagingException;
49  
50      /**
51       * Returns <code>true</code> in case supplied domain is local for this
52       * SMTP server. If this method returns <code>true</code> then
53       *
54       * @param domain domain to be queried
55       * @return <code>true</code> in case supplied domain is local for this SMTP server
56       */
57      boolean hasDomain(String domain);
58  
59      /**
60       * Returns a domain this server's session is operating under.
61       *
62       * @return domain name as string
63       */
64      String getMainDomain();
65  
66  }