KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > execution > repository > support > AbstractFlowExecutionRepository


1 /*
2  * Copyright 2002-2006 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 package org.springframework.webflow.execution.repository.support;
17
18 import org.springframework.util.Assert;
19 import org.springframework.webflow.execution.FlowExecution;
20 import org.springframework.webflow.execution.FlowExecutionFactory;
21 import org.springframework.webflow.execution.repository.FlowExecutionRepository;
22
23 /**
24  * Abstract base class for flow execution repository implementations. Does not
25  * make any assumptions about the storage medium used to store active flow
26  * executions. Mandates the use of a {@link FlowExecutionStateRestorer}, used
27  * to rehydrate a flow execution after it has been obtained from storage
28  * from resume.
29  * <p>
30  * The configured {@link FlowExecutionStateRestorer} should be compatible
31  * with the chosen {@link FlowExecution} implementation and is configuration
32  * as done by a {@link FlowExecutionFactory} (listeners, execution attributes, ...).
33  *
34  * @author Erwin Vervaet
35  */

36 public abstract class AbstractFlowExecutionRepository implements FlowExecutionRepository {
37
38     /**
39      * The strategy for restoring transient flow execution state after
40      * obtaining it from storage.
41      */

42     private FlowExecutionStateRestorer executionStateRestorer;
43     
44     /**
45      * Constructor for use in subclasses.
46      * @param executionStateRestorer the transient flow execution state restorer
47      */

48     protected AbstractFlowExecutionRepository(FlowExecutionStateRestorer executionStateRestorer) {
49         setExecutionStateRestorer(executionStateRestorer);
50     }
51
52     /**
53      * Returns the strategy for restoring transient flow execution state after
54      * obtaining it from storage.
55      * @return the transient flow execution state restorer
56      */

57     protected FlowExecutionStateRestorer getExecutionStateRestorer() {
58         return executionStateRestorer;
59     }
60     
61     /**
62      * Sets the strategy for restoring transient flow execution state after
63      * obtaining it from storage.
64      * @param executionStateRestorer the transient flow execution state restorer,
65      * may not be null
66      */

67     private void setExecutionStateRestorer(
68             FlowExecutionStateRestorer executionStateRestorer) {
69         Assert.notNull(executionStateRestorer, "The flow execution state restorer is required");
70         this.executionStateRestorer = executionStateRestorer;
71     }
72
73 }
74
Popular Tags