Beispiel #1
0
 public boolean setStatusListener(ISyncStatusListener listener) {
   m_statusListener = listener;
   if (m_oSyncEngine != null) {
     m_oSyncEngine.getNotify().setSyncStatusListener(listener);
     return true;
   }
   return false;
 }
Beispiel #2
0
  public void Destroy() {
    m_oSyncEngine.exitSync();
    stop(SYNC_WAIT_BEFOREKILL_SECONDS);

    if (ClientRegister.getInstance() != null) ClientRegister.getInstance().Destroy();

    DBAdapter.closeAll();

    m_pInstance = null;
  }
Beispiel #3
0
  SyncThread(RhoClassFactory factory) throws Exception {
    super(factory);
    ThreadQueue.setLogCategory(LOG.getLogCategory());

    if (RhoConf.getInstance().isExist("sync_poll_interval"))
      setPollInterval(RhoConf.getInstance().getInt("sync_poll_interval"));

    m_oSyncEngine = new SyncEngine();
    m_oSyncEngine.setFactory(factory);

    m_oSyncEngine.setFactory(factory);

    LOG.INFO("sync_poll_interval: " + RhoConf.getInstance().getInt("sync_poll_interval"));
    LOG.INFO("syncserver: " + RhoConf.getInstance().getString("syncserver"));
    LOG.INFO("bulksync_state: " + RhoConf.getInstance().getInt("bulksync_state"));

    ClientRegister.Create(factory);

    if (RhoConf.getInstance().getString("syncserver").length() > 0) start(epLow);
  }
Beispiel #4
0
  public void processCommand(IQueueCommand pCmd) {
    SyncCommand oSyncCmd = (SyncCommand) pCmd;
    switch (oSyncCmd.m_nCmdCode) {
      case scSyncAll:
        checkShowStatus(oSyncCmd);
        m_oSyncEngine.doSyncAllSources();
        break;
      case scSyncOne:
        {
          checkShowStatus(oSyncCmd);
          m_oSyncEngine.doSyncSource(
              new SyncEngine.SourceID(oSyncCmd.m_nCmdParam, oSyncCmd.m_strCmdParam));
        }
        break;

      case scSearchOne:
        {
          checkShowStatus(oSyncCmd);
          m_oSyncEngine.doSearch(
              ((SyncSearchCommand) oSyncCmd).m_arSources,
              oSyncCmd.m_strCmdParam,
              ((SyncSearchCommand) oSyncCmd).m_strFrom,
              ((SyncSearchCommand) oSyncCmd).m_bSyncChanges,
              oSyncCmd.m_nCmdParam);
        }
        break;

      case scLogin:
        {
          SyncLoginCommand oLoginCmd = (SyncLoginCommand) oSyncCmd;
          checkShowStatus(oSyncCmd);
          m_oSyncEngine.login(oLoginCmd.m_strName, oLoginCmd.m_strPassword, oLoginCmd.m_pNotify);
        }
        break;
    }
  }
Beispiel #5
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"));
 }