boolean syncOneSource(int i) { SyncSource src = null; boolean bError = false; try{ src = (SyncSource)m_sources.elementAt(i); if (src.getSyncType().compareTo("bulk_sync_only") == 0) { return(true); } if (isSessionExist() && getState() != esStop) { src.sync(); } //getNotify().onSyncSourceEnd(i, m_sources); }catch (Exception exc) { if (src.m_nErrCode == RhoAppAdapter.ERR_NONE) { src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; } setState(esStop); throw exc; }finally{ getNotify().onSyncSourceEnd(i, m_sources); bError = src.m_nErrCode != RhoAppAdapter.ERR_NONE; } return(!bError); }
/* * int getStartSource() * { * for( int i = 0; i < m_sources.size(); i++ ) * { * SyncSource src = (SyncSource)m_sources.elementAt(i); * if ( !src.isEmptyToken() ) * return i; * } * * return -1; * } */ void syncOneSource(int i) { SyncSource src = null; //boolean bError = false; try{ src = (SyncSource)m_sources.elementAt(i); if (src.getSyncType().compareTo("bulk_sync_only") == 0) { return; } if (isSessionExist() && getState() != esStop) { src.sync(); } //getNotify().onSyncSourceEnd(i, m_sources); }catch (Exception exc) { if (src.m_nErrCode == RhoAppAdapter.ERR_NONE) { src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; } //setState(esStop); //throw exc; LOG.ERROR("Sync of source '" + src.getName() + "' failed.", exc); }finally{ getNotify().onSyncSourceEnd(i, m_sources); //bError = src.m_nErrCode != RhoAppAdapter.ERR_NONE; } //return !bError; }
public void doSyncSource(SourceID oSrcID, String strQueryParams) { SyncSource src = null; try { prepareSync(esSyncSource, oSrcID); if (isContinueSync()) { src = findSource(oSrcID); if (src != null) { LOG.INFO("Started synchronization of the data source: " + src.getName()); src.m_strQueryParams = strQueryParams; src.sync(); getNotify().fireSyncNotification(src, true, src.m_nErrCode, src.m_nErrCode == RhoAppAdapter.ERR_NONE ? RhoAppAdapter.getMessageText("sync_completed") : ""); } else { // LOG.ERROR( "Sync one source : Unknown Source " + oSrcID.toString() ); src = new SyncSource(this, getUserDB()); //src.m_strError = "Unknown sync source."; src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; throw new Exception("Sync one source : Unknown Source " + oSrcID.toString()); } } } catch (Exception exc) { LOG.ERROR("Sync source " + oSrcID.toString() + " failed.", exc); if (src != null && src.m_nErrCode == RhoAppAdapter.ERR_NONE) { src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; } getNotify().fireSyncNotification(src, true, src.m_nErrCode, ""); } getNotify().cleanCreateObjectErrors(); if (getState() != esExit) { setState(esNone); } }