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.DbInboxControllerImpl;
08: import org.claros.intouch.webmail.controllers.ImapInboxControllerImpl;
09: import org.claros.intouch.webmail.controllers.InboxController;
10:
11: /**
12: * @author Umut Gokbayrak
13: */
14: public class InboxControllerFactory {
15: private AuthProfile auth;
16: private ConnectionProfile profile;
17: private ConnectionMetaHandler handler;
18:
19: /**
20: * used to disable default contstructor
21: */
22: @SuppressWarnings("unused")
23: private InboxControllerFactory() {
24: super ();
25: }
26:
27: public InboxControllerFactory(AuthProfile auth,
28: ConnectionProfile profile, ConnectionMetaHandler handler) {
29: this .auth = auth;
30: this .profile = profile;
31: this .handler = handler;
32: }
33:
34: public InboxController getInboxController() {
35: if (profile.getProtocol().equals(Constants.POP3)) {
36: return new DbInboxControllerImpl(auth, profile, handler);
37: } else {
38: return new ImapInboxControllerImpl(auth, profile, handler);
39: }
40: }
41: }
|