protected JobKey getIndexationJobKey(SVNConfiguration configuration) { return INDEXATION_JOB.getKey(configuration.getName()); }
protected void scheduleSvnIndexation(SVNConfiguration config) { jobScheduler.schedule( createIndexFromLatestJob(config), Schedule.everyMinutes(config.getIndexationInterval()) ); }
private ApplicationInfo getApplicationInfo(JobStatus status) { JobRunProgress progress = status.getProgress(); if (status.isRunning() && progress != null) { return ApplicationInfo.info(progress.getText()); } else { return null; } } }
@Override public Collection<JobRegistration> getStartingJobs() { return Collections.singleton( JobRegistration.of(this).withSchedule(Schedule.EVERY_DAY) ); }
@Override public void start() { securityService.asAdmin(() -> jobProviders.stream() .flatMap(jobProvider -> jobProvider.getStartingJobs().stream()) .forEach(jobRegistration -> jobScheduler.schedule( jobRegistration.getJob(), jobRegistration.getSchedule() )) ); } }
@Bean public JobProvider jobOrchestratorRegistration() { return () -> Collections.singleton( new JobRegistration( jobOrchestrator(), Schedule.everyMinutes(configProperties.getJobs().getOrchestration()) ) ); }
static JobRunListener logger(Logger logger) { return value -> logger.debug(value.getText()); }
public static JobRunProgress message(String pattern, Object... parameters) { return new JobRunProgress(-1, String.format(pattern, parameters)); }
@Override public BranchTemplateSyncResults sync(ID branchId) { return syncTemplateDefinition(branchId, JobRunListener.logger(logger)); }
protected void unscheduleSvnIndexation(SVNConfiguration config) { jobScheduler.unschedule(getIndexationJobKey(config)); }
@Override public List<ApplicationInfo> getApplicationInfoList() { return (jobScheduler.isPaused()) ? Collections.singletonList( ApplicationInfo.warning( "Execution of background jobs is paused." ) ) : Collections.emptyList(); } }
/** * Indexation from latest */ @Override public Ack indexFromLatest(String name) { SVNConfiguration configuration = configurationService.getConfiguration(name); jobScheduler.fireImmediately(getIndexationJobKey(configuration)); return Ack.OK; }
protected JobKey getSvnBuildSyncJobKey(Branch branch) { return SVN_BUILD_SYNC_JOB.getKey(String.valueOf(branch.getId())); }
protected void scheduleTemplateDefinitionSyncJob(BranchTemplateDefinition btd) { jobScheduler.schedule( createTemplateDefinitionSyncJob(btd), Schedule.everyMinutes(btd.getTemplateDefinition().getInterval()) ); }
static JobRunListener out() { return value -> System.out.println(value.getText()); }
protected JobKey getTemplateDefinitionSyncJobKey(BranchTemplateDefinition btd) { return BRANCH_TEMPLATE_SYNC_JOB.getKey(btd.getBranchId().toString()); }