Add some Javadocs

This commit is contained in:
dsyer
2007-08-24 17:07:50 +00:00
parent e60c1c3ca1
commit f062874ab2
2 changed files with 98 additions and 40 deletions

View File

@@ -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.<br/>
*
* @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();
}

View File

@@ -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;
}