01: /*
02: * Created on Dec 9, 2004
03: */
04: package uk.org.ponder.servletutil;
05:
06: import java.util.HashMap;
07: import java.util.List;
08:
09: import uk.org.ponder.hashutil.IDGenerator;
10: import uk.org.ponder.saxalizer.mapping.MappableXMLProvider;
11: import uk.org.ponder.webapputil.ErrorObject;
12:
13: /**
14: * @author Antranig Basman (antranig@caret.cam.ac.uk)
15: *
16: */
17: public class InformationHandlerRoot {
18: private HashMap handlermap = new HashMap();
19: private MappableXMLProvider xmlprovider;
20: private IDGenerator idgenerator;
21:
22: public void setHandlers(List handlers) {
23: for (int i = 0; i < handlers.size(); ++i) {
24: InformationHandler handler = (InformationHandler) handlers
25: .get(i);
26: handlermap.put(handler.getName(), handler);
27: }
28: }
29:
30: public InformationHandler getHandler(String name) {
31: return (InformationHandler) handlermap.get(name);
32: }
33:
34: public void setXMLProvider(MappableXMLProvider xmlprovider) {
35: this .xmlprovider = xmlprovider;
36: xmlprovider.registerClass("errorobject", ErrorObject.class);
37: }
38:
39: public MappableXMLProvider getXMLProvider() {
40: return xmlprovider;
41: }
42:
43: public void setIDGenerator(IDGenerator idgenerator) {
44: this .idgenerator = idgenerator;
45: }
46:
47: public IDGenerator getIDGenerator() {
48: return idgenerator;
49: }
50: }
|