Esempio n. 1
0
  public GlobalSession(
      SyncConfiguration config,
      BaseGlobalSessionCallback callback,
      Context context,
      Bundle extras,
      ClientsDataDelegate clientsDelegate,
      NodeAssignmentCallback nodeAssignmentCallback)
      throws SyncConfigurationException, IllegalArgumentException, IOException, ParseException,
          NonObjectJSONException {

    if (callback == null) {
      throw new IllegalArgumentException("Must provide a callback to GlobalSession constructor.");
    }

    Logger.debug(LOG_TAG, "GlobalSession initialized with bundle " + extras);

    this.callback = callback;
    this.context = context;
    this.clientsDelegate = clientsDelegate;
    this.nodeAssignmentCallback = nodeAssignmentCallback;

    this.config = config;
    registerCommands();
    prepareStages();

    Collection<String> knownStageNames = SyncConfiguration.validEngineNames();
    config.stagesToSync = Utils.getStagesToSyncFromBundle(knownStageNames, extras);

    // TODO: data-driven plan for the sync, referring to prepareStages.
  }