View Javadoc

1   package org.saf.struts.util;
2   
3   import org.saf.struts.config.StrutsAuthorizationConfig;
4   import org.saf.struts.manager.AuthorizationManagerInterface;
5   
6   
7   /***
8    * SafContext controll the flow of a Saf application.
9    *
10   * @author Wim Tobback
11   * @version 1.0
12   *
13   * @since 1.0
14   */
15  public class SafContext {
16      private static SafContext context;
17      private AuthorizationManagerInterface authorizationManagerInterface;
18      private StrutsAuthorizationConfig config;
19  
20      private SafContext() {
21      }
22  
23      /***
24       * @param authorizationManagerInterface The authorizationManagerInterface
25       *        to set.
26       */
27      public void setAuthorizationManagerInterface(
28          AuthorizationManagerInterface authorizationManagerInterface) {
29          this.authorizationManagerInterface = authorizationManagerInterface;
30      }
31  
32      /***
33       * @return Returns the authorizationManagerInterface.
34       */
35      public AuthorizationManagerInterface getAuthorizationManagerInterface() {
36          return authorizationManagerInterface;
37      }
38  
39      /***
40       * Return one single instance of the SafContext.
41       *
42       * @return SafContext One single instance of the SafContext.
43       */
44      public static SafContext getInstance() {
45          if (context == null) {
46              context = new SafContext();
47          }
48  
49          return context;
50      }
51  
52      /***
53       * @param config The config to set.
54       */
55      public void setConfig(StrutsAuthorizationConfig config) {
56          this.config = config;
57      }
58  
59      /***
60       * @return Returns the config.
61       */
62      public StrutsAuthorizationConfig getConfig() {
63          return config;
64      }
65  }