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.DbFolderControllerImpl;
08: import org.claros.intouch.webmail.controllers.FolderController;
09: import org.claros.intouch.webmail.controllers.ImapFolderControllerImpl;
10:
11: /**
12: * @author Umut Gokbayrak
13: */
14: public class FolderControllerFactory {
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 FolderControllerFactory() {
24: super ();
25: }
26:
27: public FolderControllerFactory(AuthProfile auth,
28: ConnectionProfile profile, ConnectionMetaHandler handler) {
29: this .auth = auth;
30: this .profile = profile;
31: this .handler = handler;
32: }
33:
34: public FolderController getFolderController() {
35: if (profile.getProtocol().equals(Constants.POP3)) {
36: return new DbFolderControllerImpl(auth, profile, handler);
37: } else {
38: return new ImapFolderControllerImpl(auth, profile, handler);
39: }
40: }
41:
42: }
|