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.repository.dao.ExecutionContextDao; |
20 | import org.springframework.batch.core.repository.dao.JobExecutionDao; |
21 | import org.springframework.batch.core.repository.dao.JobInstanceDao; |
22 | import org.springframework.batch.core.repository.dao.MapExecutionContextDao; |
23 | import org.springframework.batch.core.repository.dao.MapJobExecutionDao; |
24 | import org.springframework.batch.core.repository.dao.MapJobInstanceDao; |
25 | import org.springframework.batch.core.repository.dao.MapStepExecutionDao; |
26 | import org.springframework.batch.core.repository.dao.StepExecutionDao; |
27 | import org.springframework.beans.factory.FactoryBean; |
28 | |
29 | /** |
30 | * A {@link FactoryBean} that automates the creation of a |
31 | * {@link SimpleJobExplorer} using in-memory DAO implementations. |
32 | * |
33 | * @author Dave Syer |
34 | * @since 2.0 |
35 | */ |
36 | public class MapJobExplorerFactoryBean extends AbstractJobExplorerFactoryBean { |
37 | |
38 | @Override |
39 | protected JobExecutionDao createJobExecutionDao() throws Exception { |
40 | return new MapJobExecutionDao(); |
41 | } |
42 | |
43 | @Override |
44 | protected JobInstanceDao createJobInstanceDao() throws Exception { |
45 | return new MapJobInstanceDao(); |
46 | } |
47 | |
48 | @Override |
49 | protected StepExecutionDao createStepExecutionDao() throws Exception { |
50 | return new MapStepExecutionDao(); |
51 | } |
52 | |
53 | @Override |
54 | protected ExecutionContextDao createExecutionContextDao() throws Exception { |
55 | return new MapExecutionContextDao(); |
56 | } |
57 | |
58 | public Object getObject() throws Exception { |
59 | return new SimpleJobExplorer(createJobInstanceDao(), createJobExecutionDao(), createStepExecutionDao(), |
60 | createExecutionContextDao()); |
61 | } |
62 | |
63 | } |