View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.surf.support;
20  
21  import org.springframework.context.ApplicationContext;
22  import org.springframework.context.ApplicationContextAware;
23  import org.springframework.extensions.config.WebFrameworkConfigElement;
24  import org.springframework.extensions.surf.WebFrameworkManager;
25  import org.springframework.extensions.surf.WebFrameworkServiceRegistry;
26  import org.springframework.extensions.surf.resource.ResourceService;
27  
28  /**
29   * Foundation for web framework factory objects.
30   * 
31   * @author muzquiano
32   */
33  public abstract class BaseFactory implements ApplicationContextAware
34  {
35      private ApplicationContext applicationContext;
36      private WebFrameworkServiceRegistry webFrameworkServiceRegistry = null;
37      
38      /* (non-Javadoc)
39       * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
40       */
41      public void setApplicationContext(ApplicationContext applicationContext)
42      {
43          this.applicationContext = applicationContext;
44      }
45      
46      /**
47       * Gets the application context.
48       * 
49       * @return the application context
50       */
51      public ApplicationContext getApplicationContext()
52      {
53          return this.applicationContext;
54      }
55      
56      /**
57       * Sets the service registry.
58       * 
59       * @param webFrameworkServiceRegistry the new service registry
60       */
61      public void setServiceRegistry(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
62      {
63          this.webFrameworkServiceRegistry = webFrameworkServiceRegistry;
64      }
65  
66      /**
67       * Gets the service registry.
68       * 
69       * @return the service registry
70       */
71      public WebFrameworkServiceRegistry getServiceRegistry()
72      {
73          return this.webFrameworkServiceRegistry;
74      }
75      
76      /**
77       * Gets the web framework configuration.
78       * 
79       * @return the web framework configuration
80       */
81      public WebFrameworkConfigElement getWebFrameworkConfiguration()
82      {
83          return this.getServiceRegistry().getWebFrameworkConfiguration();
84      }    
85      
86      /**
87       * Gets the web framework manager.
88       * 
89       * @return the web framework manager
90       */
91      public WebFrameworkManager getWebFrameworkManager()
92      {
93          return this.getServiceRegistry().getWebFrameworkManager();
94      }
95      
96      /**
97       * Gets the resource service.
98       * 
99       * @return the resource service
100      */
101     public ResourceService getResourceService()
102     {
103         return this.getServiceRegistry().getResourceService();
104     }    
105     
106 }