public ParseQueryController getQueryController() {
   if (this.queryController.get() == null) {
     localObject = new NetworkQueryController(ParsePlugins.get().restClient());
     if (!Parse.isLocalDatastoreEnabled()) {
       break label63;
     }
   }
   label63:
   for (Object localObject =
           new OfflineQueryController(
               Parse.getLocalDatastore(), (ParseQueryController) localObject);
       ;
       localObject = new CacheQueryController((NetworkQueryController) localObject)) {
     this.queryController.compareAndSet(null, localObject);
     return (ParseQueryController) this.queryController.get();
   }
 }
 public ParseCurrentUserController getCurrentUserController() {
   Object localObject;
   if (this.currentUserController.get() == null) {
     localObject =
         new FileObjectStore(
             ParseUser.class,
             new File(Parse.getParseDir(), "currentUser"),
             ParseUserCurrentCoder.get());
     if (!Parse.isLocalDatastoreEnabled()) {
       break label84;
     }
     localObject =
         new OfflineObjectStore(ParseUser.class, "_currentUser", (ParseObjectStore) localObject);
   }
   label84:
   for (; ; ) {
     localObject = new CachedCurrentUserController((ParseObjectStore) localObject);
     this.currentUserController.compareAndSet(null, localObject);
     return (ParseCurrentUserController) this.currentUserController.get();
   }
 }
Пример #3
0
  /**
   * Gets the shared command cache object for all ParseObjects. This command cache is used to
   * locally store save commands created by the ParseObject.saveEventually(). When a new
   * ParseCommandCache is instantiated, it will begin running its run loop, which will start by
   * processing any commands already stored in the on-disk queue.
   */
  /* package */ static ParseEventuallyQueue getEventuallyQueue() {
    Context context = ParsePlugins.Android.get().applicationContext();
    synchronized (MUTEX) {
      boolean isLocalDatastoreEnabled = Parse.isLocalDatastoreEnabled();
      if (eventuallyQueue == null
          || (isLocalDatastoreEnabled && eventuallyQueue instanceof ParseCommandCache)
          || (!isLocalDatastoreEnabled && eventuallyQueue instanceof ParsePinningEventuallyQueue)) {
        checkContext();
        eventuallyQueue =
            isLocalDatastoreEnabled
                ? new ParsePinningEventuallyQueue(context)
                : new ParseCommandCache(context);

        // We still need to clear out the old command cache even if we're using Pinning in case
        // anything is left over when the user upgraded. Checking number of pending and then
        // initializing should be enough.
        if (isLocalDatastoreEnabled && ParseCommandCache.getPendingCount() > 0) {
          new ParseCommandCache(context);
        }
      }
      return eventuallyQueue;
    }
  }
 public ParseCurrentInstallationController getCurrentInstallationController() {
   Object localObject;
   if (this.currentInstallationController.get() == null) {
     localObject =
         new FileObjectStore(
             ParseInstallation.class,
             new File(ParsePlugins.get().getParseDir(), "currentInstallation"),
             ParseObjectCurrentCoder.get());
     if (!Parse.isLocalDatastoreEnabled()) {
       break label93;
     }
     localObject =
         new OfflineObjectStore(
             ParseInstallation.class, "_currentInstallation", (ParseObjectStore) localObject);
   }
   label93:
   for (; ; ) {
     localObject =
         new CachedCurrentInstallationController(
             (ParseObjectStore) localObject, ParsePlugins.get().installationId());
     this.currentInstallationController.compareAndSet(null, localObject);
     return (ParseCurrentInstallationController) this.currentInstallationController.get();
   }
 }