01: package org.claros.intouch.webmail.factory;
02:
03: import org.claros.commons.auth.models.AuthProfile;
04: import org.claros.commons.mail.models.ConnectionMetaHandler;
05: import org.claros.commons.mail.models.ConnectionProfile;
06: import org.claros.commons.mail.utility.Constants;
07: import org.claros.intouch.webmail.controllers.DbMailControllerImpl;
08: import org.claros.intouch.webmail.controllers.ImapMailControllerImpl;
09: import org.claros.intouch.webmail.controllers.MailController;
10:
11: /**
12: * @author Umut Gokbayrak
13: */
14: public class MailControllerFactory {
15: private AuthProfile auth;
16: private ConnectionProfile profile;
17: private ConnectionMetaHandler handler;
18: private String folder;
19:
20: /**
21: * used to disable default contstructor
22: */
23: private MailControllerFactory() {
24: super ();
25: }
26:
27: public MailControllerFactory(AuthProfile auth,
28: ConnectionProfile profile, ConnectionMetaHandler handler,
29: String folder) {
30: this .auth = auth;
31: this .profile = profile;
32: this .handler = handler;
33: this .folder = folder;
34: }
35:
36: public MailController getMailController() {
37: if (profile.getProtocol().equals(Constants.POP3)) {
38: return new DbMailControllerImpl(auth, profile, handler,
39: folder);
40: } else {
41: return new ImapMailControllerImpl(auth, profile, handler,
42: folder);
43: }
44: }
45:
46: }
|