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)); }
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, "", "", ""); }
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, ""); }
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); } }
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); } } }
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")); }