View Javadoc

1   /*
2    * Wallace IMAP Server
3    * Copyright (C) 2004  Robert Newson
4    *
5    * This program is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU General Public License
7    * as published by the Free Software Foundation; either version 2
8    * of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with this program; if not, write to the Free Software
17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18   */
19  package net.sf.wallace;
20  
21  import java.io.File;
22  import java.util.Properties;
23  
24  import javax.mail.Session;
25  
26  import net.sf.acegisecurity.AuthenticationManager;
27  
28  /***
29   * An object representing the current server configuration.
30   * 
31   * @author rnewson
32   */
33  public final class WallaceServerConfig {
34  
35      private AuthenticationManager authenticationManager;
36  
37      private Session session;
38  
39      private File mailboxRootDirectory;
40  
41      public AuthenticationManager getAuthenticationManager() {
42          assert authenticationManager != null : "AuthenticationManager should not be null.";
43          return authenticationManager;
44      }
45  
46      public void setAuthenticationManager(final AuthenticationManager newAuthenticationManager) {
47          assert newAuthenticationManager != null : "AuthenticationManager cannot be set to null.";
48          authenticationManager = newAuthenticationManager;
49      }
50  
51      public Session getSession() {
52          assert session != null : "Session should not be null.";
53          return session;
54      }
55  
56      public void setJavaMailProperties(final Properties properties) {
57          assert properties != null : "Properties cannot be set to null.";
58          session = Session.getInstance(properties);
59      }
60  
61      public File getMailboxRootDirectory() {
62          assert mailboxRootDirectory != null : "MailboxRootDirectory should not be null.";
63          return mailboxRootDirectory;
64      }
65  
66      public void setMailboxRootDirectory(final File newMailboxRootDirectory) {
67          assert newMailboxRootDirectory != null : "MailboxRootDirectory cannot be set to null.";
68          mailboxRootDirectory = newMailboxRootDirectory;
69      }
70  }