KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > imapserver > mock > MockImapHandlerConfigurationData


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

19
20 package org.apache.james.imapserver.mock;
21
22 import org.apache.james.imapserver.ImapHandlerConfigurationData;
23 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
24 import org.apache.james.services.MailServer;
25 import org.apache.james.services.UsersRepository;
26
27 public class MockImapHandlerConfigurationData implements
28         ImapHandlerConfigurationData
29 {
30
31     public MailServer mailServer;
32     public UsersRepository usersRepository = new MockUsersRepository();
33     public MailboxManagerProvider mailboxManagerProvider;
34
35     public String JavaDoc getHelloName()
36     {
37         return "thats.my.host.org";
38     }
39
40     public int getResetLength()
41     {
42         return 24*1024;
43     }
44
45     public MailServer getMailServer()
46     {
47         if (mailServer==null) {
48             mailServer=new MockMailServer();
49         }
50         return mailServer;
51     }
52
53     public UsersRepository getUsersRepository()
54     {
55         
56         return usersRepository;
57     }
58
59
60     public MailboxManagerProvider getMailboxManagerProvider() {
61         if (mailboxManagerProvider==null) {
62             try {
63                 mailboxManagerProvider=MailboxManagerProviderSingleton.getMailboxManagerProviderInstance();
64             } catch (Exception JavaDoc e) {
65                 throw new RuntimeException JavaDoc(e);
66             }
67         }
68         return mailboxManagerProvider;
69     }
70
71 }
72
Popular Tags