01: package org.osbl;
02:
03: import org.apache.commons.logging.LogFactory;
04: import org.osbl.ObjectLocator;
05:
06: import java.util.Map;
07: import java.util.HashMap;
08:
09: public class ObjectLocators {
10: private static org.apache.commons.logging.Log LOG = LogFactory
11: .getLog(ObjectLocators.class);
12:
13: private final Map<Class, ObjectLocator> queries = new HashMap<Class, ObjectLocator>();
14:
15: public void registerObjectLocator(Class type,
16: ObjectLocator objectLocator) {
17: LOG.info("Register ObjectLocator: "
18: + objectLocator.getClass().getSimpleName() + " for "
19: + type.getSimpleName());
20: queries.put(type, objectLocator);
21: }
22:
23: public ObjectLocator get(Class type) {
24: return queries.get(type);
25: }
26: }
|