01: /*
02: * $Id: BeanFactoryResourceLocator.java 525 2005-09-20 15:48:12Z hengels $
03: * (c) Copyright 2004 con:cern development team.
04: *
05: * This file is part of con:cern (http://concern.org).
06: *
07: * con:cern is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU Lesser General Public License
09: * as published by the Free Software Foundation; either version 2.1
10: * of the License, or (at your option) any later version.
11: *
12: * Please see COPYING for the complete licence.
13: */
14: package org.concern.controller.spring;
15:
16: import org.concern.controller.ResourceLocator;
17:
18: import org.concern.controller.Controller;
19: import org.springframework.beans.factory.BeanFactory;
20:
21: public class BeanFactoryResourceLocator implements ResourceLocator {
22: private BeanFactory beanFactory;
23:
24: public BeanFactoryResourceLocator() {
25: }
26:
27: public BeanFactoryResourceLocator(BeanFactory beanFactory) {
28: this .beanFactory = beanFactory;
29: }
30:
31: public Object lookup(String name) {
32: if ("beanFactory".equals(name))
33: return beanFactory;
34: return beanFactory.getBean(name);
35: }
36:
37: public void setController(Controller controller) {
38: }
39: }
|