01: package org.claros.mini.factory;
02:
03: import org.claros.commons.mail.models.ConnectionMetaHandler;
04: import org.claros.commons.mail.models.ConnectionProfile;
05: import org.claros.commons.mail.utility.Constants;
06: import org.claros.commons.models.AuthProfile;
07: import org.claros.mini.controllers.DbInboxControllerImpl;
08: import org.claros.mini.controllers.ImapInboxControllerImpl;
09: import org.claros.mini.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: private InboxControllerFactory() {
23: super ();
24: }
25:
26: public InboxControllerFactory(AuthProfile auth,
27: ConnectionProfile profile, ConnectionMetaHandler handler) {
28: this .auth = auth;
29: this .profile = profile;
30: this .handler = handler;
31: }
32:
33: public InboxController getInboxController() {
34: if (profile.getProtocol().equals(Constants.POP3)) {
35: return new DbInboxControllerImpl(auth, profile, handler);
36: } else {
37: return new ImapInboxControllerImpl(auth, profile, handler);
38: }
39: }
40: }
|