View Javadoc

1   /**
2    * $Id: SpringDefaultManagerStrategyImpl.java 17 2006-10-19 15:11:35Z maldito_orco $
3    * $Revision: 17 $
4    * $Date: 2006-10-19 12:11:35 -0300 (Thu, 19 Oct 2006) $
5    *
6    * =========================================================================
7    *
8    * Copyright 2005 Tubo
9    *
10   *  Licensed under the Apache License, Version 2.0 (the "License");
11   *  you may not use this file except in compliance with the License.
12   *  You may obtain a copy of the License at
13   *
14   *     http://www.apache.org/licenses/LICENSE-2.0
15   *
16   *  Unless required by applicable law or agreed to in writing, software
17   *  distributed under the License is distributed on an "AS IS" BASIS,
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   *  See the License for the specific language governing permissions and
20   *  limitations under the License.
21   */
22  package org.tubo.resource.springimpl;
23  
24  //log
25  import org.apache.commons.logging.Log;
26  import org.apache.commons.logging.LogFactory;
27  //tubo
28  import org.tubo.resource.baseimpl.ManagerStrategy;
29  import org.tubo.resource.baseimpl.BaseAbstractManagerStrategyImpl;
30  import org.tubo.resource.Resource;
31  import org.tubo.exception.TuboResourceException;
32  //spring
33  import org.springframework.beans.factory.BeanFactory;
34  import org.springframework.beans.factory.BeanFactoryAware;
35  
36  /**
37   * Created: Jun 28, 2006, 6:23:34 AM
38   * Last Modification Date: $Date: 2006-10-19 12:11:35 -0300 (Thu, 19 Oct 2006) $
39   *
40   * @author jvlio (jvlio@users.sourceforge.net)
41   * @version $Revision: 17 $
42   */
43  public class SpringDefaultManagerStrategyImpl extends BaseAbstractManagerStrategyImpl implements ManagerStrategy, BeanFactoryAware {
44      public static final String RCS_ID = "$Id: SpringDefaultManagerStrategyImpl.java 17 2006-10-19 15:11:35Z maldito_orco $";
45      private static Log log = LogFactory.getLog(SpringDefaultManagerStrategyImpl.class);
46  
47      /**
48       * Spring bean factory
49       */
50      private BeanFactory beanFactory = null;
51  
52      public BeanFactory getBeanFactory() {
53          return beanFactory;
54      }
55  
56      public void setBeanFactory(BeanFactory beanFactory) {
57          this.beanFactory = beanFactory;
58      }
59  
60      /**
61       * Get a Resource from Spring Bean Factory
62       * @return a Resource
63       * @throws TuboResourceException
64       */
65      public Resource get() throws TuboResourceException {
66          return (Resource)beanFactory.getBean(id);
67      }
68  
69      public void restore(Resource resource) throws TuboResourceException {
70      }
71  }