+ return (T) model.get(findClass(clss)).get(key);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> List<T> list(Class<T> clss, Object filter) {
+ return new ArrayList<T>((Collection<T>) model.get(findClass(clss))
+ .values());
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Class findClass(Class parent) {
+ if (model.containsKey(parent))
+ return parent;
+
+ for (Class clss : model.keySet()) {
+ if (parent.isAssignableFrom(clss))
+ return clss;// return the first found
+ }
+ throw new ArgeoServerException("No implementing class found for "
+ + parent);
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext)
+ throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+
+ public void setExternalRefs(Map<String, Object> externalRefs) {
+ this.externalRefs = externalRefs;
+ }
+
+ public Map<String, Object> getExternalRefs() {
+ return externalRefs;