From f062874ab2bb5a305ea872b98295e94bfc8b02fb Mon Sep 17 00:00:00 2001 From: dsyer Date: Fri, 24 Aug 2007 17:07:50 +0000 Subject: [PATCH] Add some Javadocs --- .../execution/bootstrap/JobLauncher.java | 117 ++++++++++++------ .../bootstrap/SimpleJobLauncher.java | 21 +++- 2 files changed, 98 insertions(+), 40 deletions(-) diff --git a/execution/src/main/java/org/springframework/batch/execution/bootstrap/JobLauncher.java b/execution/src/main/java/org/springframework/batch/execution/bootstrap/JobLauncher.java index 333469903..64969212a 100644 --- a/execution/src/main/java/org/springframework/batch/execution/bootstrap/JobLauncher.java +++ b/execution/src/main/java/org/springframework/batch/execution/bootstrap/JobLauncher.java @@ -1,39 +1,78 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.execution.bootstrap; - -import org.springframework.batch.core.configuration.NoSuchJobConfigurationException; -import org.springframework.batch.core.runtime.JobIdentifier; -import org.springframework.batch.repeat.ExitStatus; - -/** - * - * @author Lucas Ward - */ - -public interface JobLauncher { - - public ExitStatus run() throws NoSuchJobConfigurationException; - - public ExitStatus run(String jobName) throws NoSuchJobConfigurationException; - - public ExitStatus run(JobIdentifier jobIdentifier) throws NoSuchJobConfigurationException; - - public void stop(); - - public boolean isRunning(); - -} +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.execution.bootstrap; + +import org.springframework.batch.core.configuration.NoSuchJobConfigurationException; +import org.springframework.batch.core.runtime.JobIdentifier; +import org.springframework.batch.execution.JobExecutorFacade; +import org.springframework.batch.repeat.ExitStatus; + +/** + * Simple interface for controlling a job for a single job configuration, and + * also possibly ad-hoc executions, based on different runtime identifiers. + * Implementations should concentrate on managing jobs and delegate the + * launching to a {@link JobExecutorFacade}. + * + * @author Lucas Ward + * @author Dave Syer + */ + +public interface JobLauncher { + + /** + * Start a job execution with default name and other runtime information + * generated on the fly.
+ * + * @return the exit code from the job if it returns synchronously. + * + */ + public ExitStatus run() throws NoSuchJobConfigurationException; + + /** + * Start a job execution with the given name and other runtime information + * generated on the fly. + * + * @param name + * the name to assign to the job + * @return the exit code from the job if it returns synchronously. + * @throws NoSuchJobConfigurationException + */ + public ExitStatus run(String jobName) + throws NoSuchJobConfigurationException; + + /** + * Start a job execution with the given runtime information. + * + * @return the exit code from the job if it returns synchronously. + * @throws NoSuchJobConfigurationException + */ + public ExitStatus run(JobIdentifier jobIdentifier) + throws NoSuchJobConfigurationException; + + /** + * Stop the current job executions if there are any. If not, no action will + * be taken. + * + * @see org.springframework.context.Lifecycle#stop() + */ + public void stop(); + + /** + * Return whether or not a job execution is currently running. + */ + public boolean isRunning(); + +} diff --git a/execution/src/main/java/org/springframework/batch/execution/bootstrap/SimpleJobLauncher.java b/execution/src/main/java/org/springframework/batch/execution/bootstrap/SimpleJobLauncher.java index a5b8380e7..9537ceb17 100644 --- a/execution/src/main/java/org/springframework/batch/execution/bootstrap/SimpleJobLauncher.java +++ b/execution/src/main/java/org/springframework/batch/execution/bootstrap/SimpleJobLauncher.java @@ -158,15 +158,34 @@ public class SimpleJobLauncher implements JobLauncher { } } + /** + * The facade to which job launching will be delegated. + * + * @param jobExecutorFacade a {@link JobExecutorFacade}. + */ public void setJobExecutorFacade(JobExecutorFacade jobExecutorFacade) { this.jobExecutorFacade = jobExecutorFacade; } - + + /** + * Public setter for injecting {@link JobIdentifierFactory}. When a job is + * launched by name the factory needs to be used to create a new identifier + * for it. Defaults to a {@link ScheduledJobIdentifierFactory}. + * + * @param jobIdentifierFactory + * the {@link JobIdentifierFactory} to use when constructing + * identifiers for jobs. + */ public void setJobIdentifierFactory( JobIdentifierFactory jobIdentifierFactory) { this.jobIdentifierFactory = jobIdentifierFactory; } + /** + * Public setter for the default job configuration name to launch if none is specified. + * + * @param jobConfigurationName the name of a {@link JobConfiguration} in the registry. + */ public void setJobConfigurationName(String jobConfigurationName) { this.jobConfigurationName = jobConfigurationName; }