/** * Override these in your subclasses. * * @return true if this stage should be executed. * @throws MetaGlobalException */ protected boolean isEnabled() throws MetaGlobalException { EngineSettings engineSettings = null; try { engineSettings = getEngineSettings(); } catch (Exception e) { Logger.warn( LOG_TAG, "Unable to get engine settings for " + this + ": fetching config failed.", e); // Fall through; null engineSettings will pass below. } // We can be disabled by the server's meta/global record, or malformed in the server's // meta/global record. // We catch the subclasses of MetaGlobalException to trigger various resets and wipes in // execute(). boolean enabledInMetaGlobal = session.engineIsEnabled(this.getEngineName(), engineSettings); if (!enabledInMetaGlobal) { Logger.debug(LOG_TAG, "Stage " + this.getEngineName() + " disabled by server meta/global."); return false; } // We can also be disabled just for this sync. if (session.config.stagesToSync == null) { return true; } boolean enabledThisSync = session.config.stagesToSync.contains( this.getEngineName()); // For ServerSyncStage, stage name == engine name. if (!enabledThisSync) { Logger.debug(LOG_TAG, "Stage " + this.getEngineName() + " disabled just for this sync."); } return enabledThisSync; }
/** * Override these in your subclasses. * * @return true if this stage should be executed. * @throws MetaGlobalException */ protected boolean isEnabled() throws MetaGlobalException { EngineSettings engineSettings = null; try { engineSettings = getEngineSettings(); } catch (Exception e) { Logger.warn( LOG_TAG, "Unable to get engine settings for " + this + ": fetching config failed.", e); // Fall through; null engineSettings will pass below. } // We catch the subclasses of MetaGlobalException to trigger various resets and wipes in // execute(). return session.engineIsEnabled(this.getEngineName(), engineSettings); }