01: /*
02: * Created on 22 Jul 2006
03: */
04: package uk.org.ponder.rsf.renderer;
05:
06: import java.util.Map;
07:
08: import uk.org.ponder.rsf.content.ContentTypeInfo;
09:
10: /** Resolves the RenderSystem to be in force for the current request.
11: * Actually an application scope bean, but acquires ContentTypeInfo via proxy.
12: *
13: * @author Antranig Basman (antranig@caret.cam.ac.uk)
14: *
15: */
16: public class RenderSystemResolver {
17:
18: public static final String DEFAULT = "DEFAULT";
19:
20: private Map systemmap;
21:
22: private ContentTypeInfo contenttypeinfo;
23:
24: public void setRenderSystemMap(Map systemmap) {
25: this .systemmap = systemmap;
26: }
27:
28: public void setContentTypeInfo(ContentTypeInfo contenttypeinfo) {
29: this .contenttypeinfo = contenttypeinfo;
30: }
31:
32: public RenderSystem getRenderSystem() {
33: RenderSystem togo = (RenderSystem) systemmap
34: .get(contenttypeinfo.get().typename);
35: return (togo == null ? (RenderSystem) systemmap.get(DEFAULT)
36: : togo);
37: }
38:
39: }
|