@SimpleFunction( description = "Enable clear db backup schedule task with sepcified period in seconds") public void ScheduleClearBackup(int period) { this.scheduleClearbackupEnabled = true; this.clearbackup_period = period; Schedule clearbackupPeriod = new Schedule.BasicSchedule( BigDecimal.valueOf(this.clearbackup_period), BigDecimal.ZERO, false, false); mBoundFunfManager.registerPipelineAction(mPipeline, ACTION_CLEAR_BACKUP, clearbackupPeriod); mPipeline.setClearBackPeriod(period); mPipeline.setScheduleClearbackupEnabled(true); }
@SimpleFunction(description = "Enable export db schedule task with specified period in seconds") public void ScheduleExport(int period) { this.scheduleExportEnabled = true; this.export_period = period; // register pipeline action with bound FunfManger Schedule exportPeriod = new Schedule.BasicSchedule( BigDecimal.valueOf(this.export_period), BigDecimal.ZERO, false, false); mBoundFunfManager.registerPipelineAction(mPipeline, ACTION_EXPORT_DATA, exportPeriod); mPipeline.setExportPeriod(period); mPipeline.setScheduleExportEnabled(true); }
/** @param period The time interval between each execution of the task */ @SimpleFunction(description = "Enable archive schedule task with specified period in seconds") public void ScheduleArchive(int period) { this.scheduleArchiveEnabled = true; this.archive_period = period; // set Pipeline's variables for scheduleArchiveEnabled and archive_period as // well // register pipeline action with bound FunfManger Schedule archivePeriod = new Schedule.BasicSchedule( BigDecimal.valueOf(this.archive_period), BigDecimal.ZERO, false, false); // because we have the Pipeline handle, so we pass it to the FunfManager mBoundFunfManager.registerPipelineAction(mPipeline, ACTION_ARCHIVE_DATA, archivePeriod); mPipeline.setArchivePeriod(period); mPipeline.setScheduleArchiveEnabled(true); }
@Override public void onCreate(FunfManager manager) { if (archive == null) { archive = new DefaultArchive(manager, name); } if (uploader == null) { uploader = new UploadService(manager); uploader.start(); } this.manager = manager; reloadDbHelper(manager); HandlerThread thread = new HandlerThread(getClass().getName()); thread.start(); this.looper = thread.getLooper(); this.handler = new Handler(looper, callback); enabled = true; for (JsonElement dataRequest : data) { manager.requestData(this, dataRequest); } for (Map.Entry<String, Schedule> schedule : schedules.entrySet()) { manager.registerPipelineAction(this, schedule.getKey(), schedule.getValue()); } }