View Javadoc

1   /*
2    * Copyright 2006-2013 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.core.explore.support;
18  
19  import org.springframework.batch.core.explore.JobExplorer;
20  import org.springframework.batch.core.repository.dao.ExecutionContextDao;
21  import org.springframework.batch.core.repository.dao.JobExecutionDao;
22  import org.springframework.batch.core.repository.dao.JobInstanceDao;
23  import org.springframework.batch.core.repository.dao.StepExecutionDao;
24  import org.springframework.beans.factory.FactoryBean;
25  
26  /**
27   * A {@link FactoryBean} that automates the creation of a
28   * {@link SimpleJobExplorer}. Declares abstract methods for providing DAO
29   * object implementations.
30   *
31   * @see JobExplorerFactoryBean
32   * @see MapJobExplorerFactoryBean
33   *
34   * @author Dave Syer
35   * @since 2.0
36   */
37  @SuppressWarnings("rawtypes")
38  public abstract class AbstractJobExplorerFactoryBean implements FactoryBean {
39  
40  	/**
41  	 * @return fully configured {@link JobInstanceDao} implementation.
42  	 */
43  	protected abstract JobInstanceDao createJobInstanceDao() throws Exception;
44  
45  	/**
46  	 * @return fully configured {@link JobExecutionDao} implementation.
47  	 */
48  	protected abstract JobExecutionDao createJobExecutionDao() throws Exception;
49  
50  	protected abstract StepExecutionDao createStepExecutionDao() throws Exception;
51  
52  	protected abstract ExecutionContextDao createExecutionContextDao() throws Exception;
53  
54  	/**
55  	 * The type of object to be returned from {@link #getObject()}.
56  	 *
57  	 * @return JobExplorer.class
58  	 * @see org.springframework.beans.factory.FactoryBean#getObjectType()
59  	 */
60  	@Override
61  	public Class<JobExplorer> getObjectType() {
62  		return JobExplorer.class;
63  	}
64  
65  	@Override
66  	public boolean isSingleton() {
67  		return true;
68  	}
69  
70  }