1 | /* |
2 | * Copyright 2006-2007 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 | public abstract class AbstractJobExplorerFactoryBean implements FactoryBean { |
38 | |
39 | /** |
40 | * @return fully configured {@link JobInstanceDao} implementation. |
41 | */ |
42 | protected abstract JobInstanceDao createJobInstanceDao() throws Exception; |
43 | |
44 | /** |
45 | * @return fully configured {@link JobExecutionDao} implementation. |
46 | */ |
47 | protected abstract JobExecutionDao createJobExecutionDao() throws Exception; |
48 | |
49 | protected abstract StepExecutionDao createStepExecutionDao() throws Exception; |
50 | |
51 | protected abstract ExecutionContextDao createExecutionContextDao() throws Exception; |
52 | |
53 | /** |
54 | * The type of object to be returned from {@link #getObject()}. |
55 | * |
56 | * @return JobExplorer.class |
57 | * @see org.springframework.beans.factory.FactoryBean#getObjectType() |
58 | */ |
59 | public Class<JobExplorer> getObjectType() { |
60 | return JobExplorer.class; |
61 | } |
62 | |
63 | public boolean isSingleton() { |
64 | return true; |
65 | } |
66 | |
67 | } |