FolderControllerFactory.java :  » Chat » claros-chat-1.0 » org » claros » mini » factory » Java Open Source

Java Open Source » Chat » claros chat 1.0 
claros chat 1.0 » org » claros » mini » factory » FolderControllerFactory.java
package org.claros.mini.factory;

import org.claros.commons.mail.models.ConnectionMetaHandler;
import org.claros.commons.mail.models.ConnectionProfile;
import org.claros.commons.mail.utility.Constants;
import org.claros.commons.models.AuthProfile;
import org.claros.mini.controllers.DbFolderControllerImpl;
import org.claros.mini.controllers.FolderController;
import org.claros.mini.controllers.ImapFolderControllerImpl;

/**
 * @author Umut Gokbayrak
 */
public class FolderControllerFactory {
  private AuthProfile auth;
  private ConnectionProfile profile;
  private ConnectionMetaHandler handler;
  
  /**
   * used to disable default contstructor
   */
  private FolderControllerFactory() {
    super();
  }
  
  public FolderControllerFactory(AuthProfile auth, ConnectionProfile profile, ConnectionMetaHandler handler) {
    this.auth = auth;
    this.profile = profile;
    this.handler = handler; 
  }
  
  public FolderController getFolderController() {
    if (profile.getProtocol().equals(Constants.POP3)) {
      return new DbFolderControllerImpl(auth);
    } else {
      return new ImapFolderControllerImpl(auth, profile, handler);
    }
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.