InboxControllerFactory.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 » InboxControllerFactory.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.DbInboxControllerImpl;
import org.claros.mini.controllers.ImapInboxControllerImpl;
import org.claros.mini.controllers.InboxController;

/**
 * @author Umut Gokbayrak
 */
public class InboxControllerFactory {
  private AuthProfile auth;
  private ConnectionProfile profile;
  private ConnectionMetaHandler handler;
  
  /**
   * used to disable default contstructor
   */
  private InboxControllerFactory() {
    super();
  }
  
  public InboxControllerFactory(AuthProfile auth, ConnectionProfile profile, ConnectionMetaHandler handler) {
    this.auth = auth;
    this.profile = profile;
    this.handler = handler; 
  }
  
  public InboxController getInboxController() {
    if (profile.getProtocol().equals(Constants.POP3)) {
      return new DbInboxControllerImpl(auth, profile, handler);
    } else {
      return new ImapInboxControllerImpl(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.