// Path: javagit/src/main/java/edu/nyu/cs/javagit/client/cli/CliClient.java
// public class CliClient implements IClient {
// 
//   public IGitAdd getGitAddInstance() {
//     return new CliGitAdd();
//   }
// 
//   public IGitCommit getGitCommitInstance() {
//     return new CliGitCommit();
//   }
// 
//   public IGitDiff getGitDiffInstance() {
//     return new CliGitDiff();
//   }
// 
//   public IGitGrep getGitGrepInstance() {
//     return new CliGitGrep();
//   }
// 
//   public IGitLog getGitLogInstance() {
//     return new CliGitLog();
//   }
// 
//   public IGitMv getGitMvInstance() {
//     return new CliGitMv();
//   }
// 
//   public IGitReset getGitResetInstance() {
//     return new CliGitReset();
//   }
// 
//   public IGitRevert getGitRevertInstance() {
//     return new CliGitRevert();
//   }
// 
//   public IGitRm getGitRmInstance() {
//     return new CliGitRm();
//   }
// 
//   public IGitShow getGitShowInstance() {
//     return new CliGitShow();
//   }
// 
//   public IGitStatus getGitStatusInstance() {
//     return new CliGitStatus();
//   }
// 
//   public IGitBranch getGitBranchInstance() {
//     return new CliGitBranch();
//   }
// 
//   public IGitCheckout getGitCheckoutInstance() {
//     return new CliGitCheckout();
//   }
// 
//   public IGitInit getGitInitInstance() {
//   	return new CliGitInit();
//   }
// 
//   public IGitClone getGitCloneInstance() {
//     return new CliGitClone();
//   }
// 
// }


import java.util.HashMap;
import java.util.Map;
import edu.nyu.cs.javagit.client.cli.CliClient;
/*
 * ====================================================================
 * Copyright (c) 2008 JavaGit Project.  All rights reserved.
 *
 * This software is licensed using the GNU LGPL v2.1 license.  A copy
 * of the license is included with the distribution of this source
 * code in the LICENSE.txt file.  The text of the license can also
 * be obtained at:
 *
 *   http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 *
 * For more information on the JavaGit project, see:
 *
 *   http://www.javagit.com
 * ====================================================================
 */
package edu.nyu.cs.javagit.client;



/**
 * This class manages the <code>IClient</code> instances of the various <code>ClientType</code>s.
 * It contains factory type functionality (the <code>getClientType()</code> method) but manages
 * much more than just creating <code>IClient</code> instances.
 */
public class ClientManager {

  // An enumeration of the available client types.
  public static enum ClientType {
    CLI
  };

  // The singleton instance of the class <code>ClientManager</code>.
  private static ClientManager INSTANCE = new ClientManager();

  /**
   * Gets the singleton instance.
   * 
   * @return The singleton instance.
   */
  public static ClientManager getInstance() {
    return INSTANCE;
  }

  // The preferred client type.
  private ClientType preferredClientType = ClientType.CLI;

  /**
   * A <code>Map</code> to hold <code>IClient</code> instances for the ClientTypes by
   * <code>ClientType</code>.
   */
  private Map<ClientType, IClient> clientImpls = new HashMap<ClientType, IClient>();

  /**
   * Private to make this class a singleton.
   */
  private ClientManager() {
  }

  /**
   * Gets an instance of the specified client type.
   * 
   * @param clientType
   *          The type of client to get.
   * @return An instance of the specified client type.
   */
  public IClient getClientInstance(ClientType clientType) {
    IClient clientInstance = clientImpls.get(clientType);
    if (null == clientInstance) {
      if (ClientType.CLI == clientType) {
// Path: javagit/src/main/java/edu/nyu/cs/javagit/client/cli/CliClient.java
// public class CliClient implements IClient {
// 
//   public IGitAdd getGitAddInstance() {
//     return new CliGitAdd();
//   }
// 
//   public IGitCommit getGitCommitInstance() {
//     return new CliGitCommit();
//   }
// 
//   public IGitDiff getGitDiffInstance() {
//     return new CliGitDiff();
//   }
// 
//   public IGitGrep getGitGrepInstance() {
//     return new CliGitGrep();
//   }
// 
//   public IGitLog getGitLogInstance() {
//     return new CliGitLog();
//   }
// 
//   public IGitMv getGitMvInstance() {
//     return new CliGitMv();
//   }
// 
//   public IGitReset getGitResetInstance() {
//     return new CliGitReset();
//   }
// 
//   public IGitRevert getGitRevertInstance() {
//     return new CliGitRevert();
//   }
// 
//   public IGitRm getGitRmInstance() {
//     return new CliGitRm();
//   }
// 
//   public IGitShow getGitShowInstance() {
//     return new CliGitShow();
//   }
// 
//   public IGitStatus getGitStatusInstance() {
//     return new CliGitStatus();
//   }
// 
//   public IGitBranch getGitBranchInstance() {
//     return new CliGitBranch();
//   }
// 
//   public IGitCheckout getGitCheckoutInstance() {
//     return new CliGitCheckout();
//   }
// 
//   public IGitInit getGitInitInstance() {
//   	return new CliGitInit();
//   }
// 
//   public IGitClone getGitCloneInstance() {
//     return new CliGitClone();
//   }
// 
// }


// Path: javagit/src/main/java/edu/nyu/cs/javagit/client/ClientManager.java
import java.util.HashMap;
import java.util.Map;
import edu.nyu.cs.javagit.client.cli.CliClient;

/*
 * ====================================================================
 * Copyright (c) 2008 JavaGit Project.  All rights reserved.
 *
 * This software is licensed using the GNU LGPL v2.1 license.  A copy
 * of the license is included with the distribution of this source
 * code in the LICENSE.txt file.  The text of the license can also
 * be obtained at:
 *
 *   http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 *
 * For more information on the JavaGit project, see:
 *
 *   http://www.javagit.com
 * ====================================================================
 */
package edu.nyu.cs.javagit.client;



/**
 * This class manages the <code>IClient</code> instances of the various <code>ClientType</code>s.
 * It contains factory type functionality (the <code>getClientType()</code> method) but manages
 * much more than just creating <code>IClient</code> instances.
 */
public class ClientManager {

  // An enumeration of the available client types.
  public static enum ClientType {
    CLI
  };

  // The singleton instance of the class <code>ClientManager</code>.
  private static ClientManager INSTANCE = new ClientManager();

  /**
   * Gets the singleton instance.
   * 
   * @return The singleton instance.
   */
  public static ClientManager getInstance() {
    return INSTANCE;
  }

  // The preferred client type.
  private ClientType preferredClientType = ClientType.CLI;

  /**
   * A <code>Map</code> to hold <code>IClient</code> instances for the ClientTypes by
   * <code>ClientType</code>.
   */
  private Map<ClientType, IClient> clientImpls = new HashMap<ClientType, IClient>();

  /**
   * Private to make this class a singleton.
   */
  private ClientManager() {
  }

  /**
   * Gets an instance of the specified client type.
   * 
   * @param clientType
   *          The type of client to get.
   * @return An instance of the specified client type.
   */
  public IClient getClientInstance(ClientType clientType) {
    IClient clientInstance = clientImpls.get(clientType);
    if (null == clientInstance) {
      if (ClientType.CLI == clientType) {
        clientInstance = new CliClient();