01: /*
02: * Created on Sep 23, 2005
03: */
04: package uk.org.ponder.rsf.templateresolver;
05:
06: import org.springframework.beans.factory.FactoryBean;
07:
08: import uk.org.ponder.rsf.view.ViewTemplate;
09: import uk.org.ponder.rsf.viewstate.ViewParameters;
10:
11: /** A utility bean to enable template loading to proceed by RSAC autowiring.
12: * It's unclear whether this has improved the code structure significantly, but
13: * is an interesting experiment. This is a FactoryBean since RSACBeanGetter
14: * has not yet support for "factory-method".
15: * @author Antranig Basman (antranig@caret.cam.ac.uk)
16: *
17: */
18:
19: public class TemplateLoaderBean implements FactoryBean {
20: private ViewParameters viewparams;
21: private TemplateResolver resolver;
22:
23: public void setViewParameters(ViewParameters viewparams) {
24: this .viewparams = viewparams;
25: }
26:
27: public void setTemplateResolver(TemplateResolver resolver) {
28: this .resolver = resolver;
29: }
30:
31: public Object getObject() throws Exception {
32: return resolver.locateTemplate(viewparams);
33: }
34:
35: public Class getObjectType() {
36: return ViewTemplate.class;
37: }
38:
39: public boolean isSingleton() {
40: return true;
41: }
42:
43: }
|