001/* 002 * Copyright 2006-2013 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.batch.core.explore.support; 018 019import org.springframework.batch.core.explore.JobExplorer; 020import org.springframework.batch.core.repository.dao.ExecutionContextDao; 021import org.springframework.batch.core.repository.dao.JobExecutionDao; 022import org.springframework.batch.core.repository.dao.JobInstanceDao; 023import org.springframework.batch.core.repository.dao.StepExecutionDao; 024import org.springframework.beans.factory.FactoryBean; 025 026/** 027 * A {@link FactoryBean} that automates the creation of a 028 * {@link SimpleJobExplorer}. Declares abstract methods for providing DAO 029 * object implementations. 030 * 031 * @see JobExplorerFactoryBean 032 * @see MapJobExplorerFactoryBean 033 * 034 * @author Dave Syer 035 * @since 2.0 036 */ 037public abstract class AbstractJobExplorerFactoryBean implements FactoryBean<JobExplorer> { 038 039 /** 040 * @return fully configured {@link JobInstanceDao} implementation. 041 * 042 * @throws Exception thrown if error occurs during JobInstanceDao creation. 043 */ 044 protected abstract JobInstanceDao createJobInstanceDao() throws Exception; 045 046 /** 047 * @return fully configured {@link JobExecutionDao} implementation. 048 * 049 * @throws Exception thrown if error occurs during JobExecutionDao creation. 050 */ 051 protected abstract JobExecutionDao createJobExecutionDao() throws Exception; 052 053 /** 054 * @return fully configured {@link StepExecutionDao} implementation. 055 * 056 * @throws Exception thrown if error occurs during StepExecutionDao creation. 057 */ 058 protected abstract StepExecutionDao createStepExecutionDao() throws Exception; 059 060 /** 061 * @return fully configured {@link ExecutionContextDao} implementation. 062 * 063 * @throws Exception thrown if error occurs during ExecutionContextDao creation. 064 */ 065 protected abstract ExecutionContextDao createExecutionContextDao() throws Exception; 066 067 /** 068 * The type of object to be returned from {@link #getObject()}. 069 * 070 * @return JobExplorer.class 071 * @see org.springframework.beans.factory.FactoryBean#getObjectType() 072 */ 073 @Override 074 public Class<JobExplorer> getObjectType() { 075 return JobExplorer.class; 076 } 077 078 @Override 079 public boolean isSingleton() { 080 return true; 081 } 082 083}