Beispiel #1
0
 public static void doSyncSourceByName(String strSrcName, boolean bShowStatus) {
   if (bShowStatus && (m_statusListener != null)) {
     m_statusListener.createStatusPopup(RhoAppAdapter.getMessageText("syncronizing_data"));
   }
   getInstance()
       .addQueueCommand(new SyncCommand(SyncThread.scSyncOne, strSrcName, (int) 0, bShowStatus));
 }
Beispiel #2
0
  public void reportSyncStatus(String status, int error, String strDetails) {
    synchronized (m_mxSyncNotifications) {
      if (m_syncStatusListener != null
          && (isReportingEnabled() || error == RhoAppAdapter.ERR_SYNCVERSION)) {

        if (error == RhoAppAdapter.ERR_SYNCVERSION) status = RhoAppAdapter.getErrorText(error);
        else {
          if (strDetails.length() == 0) strDetails = RhoAppAdapter.getErrorText(error);
          status +=
              (strDetails.length() > 0 ? RhoAppAdapter.getMessageText("details") + strDetails : "");
        }

        LOG.INFO("Status: " + status);

        m_syncStatusListener.reportStatus(status, error);
      }
    }
  }
Beispiel #3
0
  void fireSyncNotification(SyncSource src, boolean bFinish, int nErrCode, String strMessage) {
    if (getSync().getState() == SyncEngine.esExit) return;

    if (strMessage.length() > 0 || nErrCode != RhoAppAdapter.ERR_NONE) {
      if (!getSync().isSearch()) {
        if (src != null && (strMessage == null || strMessage.length() == 0))
          strMessage = RhoAppAdapter.getMessageText("sync_failed_for") + src.getName() + ".";

        reportSyncStatus(strMessage, nErrCode, src != null ? src.m_strError : "");
      }
    }

    doFireSyncNotification(src, bFinish, nErrCode, "", "", "");
  }
Beispiel #4
0
  protected boolean checkRhoExtensions(String application, String model) {
    if (application.equalsIgnoreCase("AppManager")) {
      // TODO: AppManager
      respondOK();
      return true;
    } else if (application.equalsIgnoreCase("system")) {
      if (model.equalsIgnoreCase("geolocation")) {
        showGeoLocation();
        return true;
      } else if (model.equalsIgnoreCase("loadserversources")) {
        RhoAppAdapter.loadServerSources(postData.toString());
        return true;
      } else if (model.equalsIgnoreCase("loadallsyncsources")) {
        RhoAppAdapter.loadAllSyncSources();
        return true;
      } else if (model.equalsIgnoreCase("resetDBOnSyncUserChanged")) {
        RhoAppAdapter.resetDBOnSyncUserChanged();
        return true;
      }

    } else if (application.equalsIgnoreCase("shared")) return false;

    return false;
  }
Beispiel #5
0
  void fireBulkSyncNotification(boolean bFinish, String status, String partition, int nErrCode) {
    if (getSync().getState() == SyncEngine.esExit) return;

    if (nErrCode != RhoAppAdapter.ERR_NONE) {
      String strMessage = RhoAppAdapter.getMessageText("sync_failed_for") + "bulk.";
      reportSyncStatus(strMessage, nErrCode, "");
    }

    String strParams = "";
    strParams += "partition=" + partition;
    strParams += "&bulk_status=" + status;
    strParams += "&sync_type=bulk";

    doFireSyncNotification(null, bFinish, nErrCode, "", strParams, "");
  }
Beispiel #6
0
  void fireAllSyncNotifications(
      boolean bFinish, int nErrCode, String strError, String strServerError) {
    if (getSync().getState() == SyncEngine.esExit) return;

    if (nErrCode != RhoAppAdapter.ERR_NONE) {
      if (!getSync().isSearch()) {
        String strMessage = RhoAppAdapter.getMessageText("sync_failed_for") + "all.";

        reportSyncStatus(strMessage, nErrCode, strError);
      }
    }

    synchronized (m_mxSyncNotifications) {
      SyncNotification pSN = getSyncNotifyBySrc(null);
      if (pSN != null)
        doFireSyncNotification(null, bFinish, nErrCode, strError, "", strServerError);
    }
  }
Beispiel #7
0
 void checkShowStatus(SyncCommand oSyncCmd) {
   boolean bShowStatus = oSyncCmd.m_bShowStatus && !this.isNoThreadedMode();
   m_oSyncEngine.getNotify().enableReporting(bShowStatus);
   if (m_oSyncEngine.getNotify().isReportingEnabled())
     m_statusListener.createStatusPopup(RhoAppAdapter.getMessageText("syncronizing_data"));
 }