EMMA Coverage Report (generated Fri Aug 21 15:59:46 BST 2009)
[all classes][org.springframework.batch.core.job.flow.support.state]

COVERAGE SUMMARY FOR SOURCE FILE [StepState.java]

nameclass, %method, %block, %line, %
StepState.java100% (1/1)80%  (4/5)77%  (23/30)70%  (7/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StepState100% (1/1)80%  (4/5)77%  (23/30)70%  (7/10)
StepState (String, Step): void 0%   (0/1)0%   (0/7)0%   (0/3)
StepState (Step): void 100% (1/1)100% (8/8)100% (3/3)
getStep (): Step 100% (1/1)100% (3/3)100% (1/1)
handle (FlowExecutor): FlowExecutionStatus 100% (1/1)100% (10/10)100% (2/2)
isEndState (): boolean 100% (1/1)100% (2/2)100% (1/1)

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 
17package org.springframework.batch.core.job.flow.support.state;
18 
19import org.springframework.batch.core.Step;
20import org.springframework.batch.core.job.flow.FlowExecutionStatus;
21import org.springframework.batch.core.job.flow.FlowExecutor;
22import org.springframework.batch.core.job.flow.State;
23import org.springframework.batch.core.step.StepHolder;
24 
25/**
26 * {@link State} implementation that delegates to a {@link FlowExecutor} to
27 * execute the specified {@link Step}.
28 * 
29 * @author Dave Syer
30 * @since 2.0
31 */
32public class StepState extends AbstractState implements StepHolder {
33 
34        private final Step step;
35 
36        /**
37         * @param step the step that will be executed
38         */
39        public StepState(Step step) {
40                super(step.getName());
41                this.step = step;
42        }
43 
44        /**
45         * @param name for the step that will be executed
46         * @param step the step that will be executed
47         */
48        public StepState(String name, Step step) {
49                super(name);
50                this.step = step;
51        }
52 
53        @Override
54        public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
55                /*
56                 * On starting a new step, possibly upgrade the last execution to make
57                 * sure it is abandoned on restart if it failed.
58                 */
59                executor.abandonStepExecution();
60                return new FlowExecutionStatus(executor.executeStep(step));
61        }
62 
63        /**
64         * @return the step
65         */
66        public Step getStep() {
67                return step;
68        }
69        
70        /* (non-Javadoc)
71         * @see org.springframework.batch.core.job.flow.State#isEndState()
72         */
73        public boolean isEndState() {
74                return false;
75        }
76 
77}

[all classes][org.springframework.batch.core.job.flow.support.state]
EMMA 2.0.5312 (C) Vladimir Roubtsov