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: private FolderControllerFactory() {
23: super ();
24: }
25:
26: public FolderControllerFactory(AuthProfile auth,
27: ConnectionProfile profile, ConnectionMetaHandler handler) {
28: this .auth = auth;
29: this .profile = profile;
30: this .handler = handler;
31: }
32:
33: public FolderController getFolderController() {
34: if (profile.getProtocol().equals(Constants.POP3)) {
35: return new DbFolderControllerImpl(auth, profile, handler);
36: } else {
37: return new ImapFolderControllerImpl(auth, profile, handler);
38: }
39: }
40:
41: }
|