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: @SuppressWarnings("unused")
24: private MailControllerFactory() {
25: super ();
26: }
27:
28: public MailControllerFactory(AuthProfile auth,
29: ConnectionProfile profile, ConnectionMetaHandler handler,
30: String folder) {
31: this .auth = auth;
32: this .profile = profile;
33: this .handler = handler;
34: this .folder = folder;
35: }
36:
37: public MailController getMailController() {
38: if (profile.getProtocol().equals(Constants.POP3)) {
39: return new DbMailControllerImpl(auth, profile, handler,
40: folder);
41: } else {
42: return new ImapMailControllerImpl(auth, profile, handler,
43: folder);
44: }
45: }
46:
47: }
|