Skip to content

Connector Manager Class

mikeconley edited this page Oct 19, 2012 · 4 revisions

To be used by externals for Connector class registration and to manage Connector instances..

class {
  /**
   * Register a connector class with Ensemble. This makes the class available for instantiation.
   *
   * @param aConnectorClass - defined below.
   */
  registerConnectorClass: function(aConnectorClass);

  /**
   * Unregister a connector class with Ensemble.
   *
   * @param aConnectorClass - defined below.
   */
  unregisterConnectorClass: function(aConnectorClass);

  /**
   * A getter that returns a collection of Connector Classes, sorted alphabetically by their serviceName.
   *
   * @param aConnectorClass - defined below.
   */
  get connectorClasses;

  /**
   * A getter that returns a collection of all instantiated Connectors, sorted alphabetically
   * by their displayName.
   */
  get connectors;

  /**
   * Returns the instantiated Connector with the accountKey aAccountKey.
   *
   * @param aAccountKey the accountKey associated with a particular Connector.
   * @returns the Connector instance associated with aAccountKey.
   */
  getConnector(aAccountKey)

  /**
   * Instantiates and returns a new Connector with its params set with aParams. Adds it
   * to the pool of Connectors feeding records into Ensemble.
   *
   * @param aServiceID the service ID of the Connector Class you'd like to instantiate.
   * @param aParams the parameters to feed into the instances' preferences branch.
   * @returns the newly created Connector instance.
   */
  createNewConnector(aServiceID, aParams);

  /**
   * Removes a Connector from the pool of Connectors feeding records into Ensemble.
   * Clears its preferences branch, and deletes the instance.
   *
   * @param aConnector the Connector instance to remove.
   */
  removeConnector(aConnector);
}