View Javadoc

1   /*
2    *  Copyright 1999-2004 The Apache Software Foundation.
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.apache.struts.flow.core;
17  
18  /***
19   *  Simple static factory for getting interface implementations. Should be
20   *  replaced later by something more pluggable.
21   *
22   *@author    <a href="mailto:davjon@sas.com">David M Johnson</a>
23   */
24  public class Factory {
25      
26      private static Logger logger = new Logger();
27      private static ContinuationsManager continuationsManager = null;
28  
29      /***
30       *  Sets the logger 
31       *
32       *@param  log  The new logger value
33       */
34      public static void setLogger(Logger log) {
35          logger = log;
36      }
37  
38  
39      /***
40       *  Gets the logger
41       *
42       *@return    The logger value
43       */
44      public static Logger getLogger() {
45          return logger;
46      }
47  
48  
49      /***
50       *  Gets the continuationsManager 
51       *
52       *@return    The continuationsManager value
53       */
54      public static ContinuationsManager getContinuationsManager() {
55          if (continuationsManager == null) {
56              try {
57                  continuationsManager = new ContinuationsManagerImpl();
58              } catch (Exception e) {
59                  throw new RuntimeException("ERROR initializing ContinationsManager", e);
60              }
61          }
62          return continuationsManager;
63      }
64      
65  }
66