From ddf2bdb6e808a851cb6223c63f0f8016ef20213d Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 14 Jun 2021 16:07:27 +0200 Subject: [PATCH] [Minor] Added JavaDoc to StrolchJobsHandler --- .../li/strolch/job/StrolchJobsHandler.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/li.strolch.agent/src/main/java/li/strolch/job/StrolchJobsHandler.java b/li.strolch.agent/src/main/java/li/strolch/job/StrolchJobsHandler.java index c96c3b262..9adbfc51a 100644 --- a/li.strolch.agent/src/main/java/li/strolch/job/StrolchJobsHandler.java +++ b/li.strolch.agent/src/main/java/li/strolch/job/StrolchJobsHandler.java @@ -19,6 +19,7 @@ import li.strolch.model.parameter.DateParameter; import li.strolch.model.parameter.IntegerParameter; import li.strolch.persistence.api.StrolchTransaction; import li.strolch.privilege.model.Certificate; +import li.strolch.runtime.StrolchConstants; /** * The {@link StrolchJobsHandler} registers all {@link StrolchJob StrolchJobs} @@ -37,6 +38,12 @@ public class StrolchJobsHandler extends StrolchComponent { super.start(); } + /** + * Reload the jobs from the {@link Resource Resources} of type {@link StrolchConstants#TYPE_STROLCH_JOB} + * + * @throws Exception + * if something goes wrong while instantiating the jobs + */ public void reloadJobs() throws Exception { reloadJobs(false); } @@ -151,6 +158,14 @@ public class StrolchJobsHandler extends StrolchComponent { return strolchJob; } + /** + * Registers the given job as a recurring job, and schedules it for execution + * + * @param strolchJobClass + * the job to instantiate and schedule for execution + * + * @return the instantiated job + */ public StrolchJob registerAndScheduleJob(Class strolchJobClass) { StrolchJob job = instantiateJob(strolchJobClass, strolchJobClass.getSimpleName(), strolchJobClass.getSimpleName(), JobMode.Manual); @@ -158,6 +173,14 @@ public class StrolchJobsHandler extends StrolchComponent { return register(job).schedule(); } + /** + * Registers the given job as a manual job, which can be executed later by a job admin + * + * @param strolchJobClass + * the job to register + * + * @return the instantiated job + */ public StrolchJob register(Class strolchJobClass) { StrolchJob job = instantiateJob(strolchJobClass, strolchJobClass.getSimpleName(), strolchJobClass.getSimpleName(), JobMode.Manual); @@ -165,6 +188,14 @@ public class StrolchJobsHandler extends StrolchComponent { return register(job); } + /** + * Registers the given job, not changing its current schedule or type + * + * @param job + * the job to register + * + * @return the job + */ public StrolchJob register(StrolchJob job) { return internalRegister(job.setConfigureMethod(ConfigureMethod.Programmatic)); } @@ -177,12 +208,34 @@ public class StrolchJobsHandler extends StrolchComponent { return job; } + /** + * Returns the current list of registered jobs + * + * @param cert + * the certificate to assert privilege + * @param source + * the source of the request + * + * @return a list of registered jobs + */ public List getJobs(Certificate cert, String source) { getContainer().getPrivilegeHandler().validate(cert, source) .assertHasPrivilege(StrolchJobsHandler.class.getName()); return new ArrayList<>(this.jobs.values()); } + /** + * Returns the job with the given name + * + * @param cert + * the certificate to assert privilege + * @param source + * the source of the request + * @param jobName + * the name of the job to return + * + * @return the job with the requested name + */ public StrolchJob getJob(Certificate cert, String source, String jobName) { getContainer().getPrivilegeHandler().validate(cert, source) .assertHasPrivilege(StrolchJobsHandler.class.getName());