01: /*
02: * Created on 22 Jul 2006
03: */
04: package uk.org.ponder.rsf.state.scope;
05:
06: import org.springframework.context.ApplicationContext;
07: import org.springframework.context.ApplicationContextAware;
08:
09: import uk.org.ponder.beanutil.WriteableBeanLocator;
10: import uk.org.ponder.util.UniversalRuntimeException;
11:
12: /**
13: * A request-scope representative to allow any bean scope to be deleted via EL.
14: *
15: * @author Antranig Basman (antranig@caret.cam.ac.uk)
16: */
17:
18: public class ScopedBeanDestroyer implements WriteableBeanLocator,
19: ApplicationContextAware {
20:
21: private ApplicationContext applicationContext;
22:
23: public boolean remove(String beanname) {
24: try {
25: ScopedBeanManager sbm = (ScopedBeanManager) applicationContext
26: .getBean(beanname);
27: sbm.destroy();
28: } catch (Exception e) {
29: throw UniversalRuntimeException.accumulate(e,
30: "Failed to destroy bean scope named " + beanname);
31: }
32: return true;
33: }
34:
35: public void set(String beanname, Object toset) {
36: }
37:
38: public Object locateBean(String path) {
39: return null;
40: }
41:
42: public void setApplicationContext(
43: ApplicationContext applicationContext) {
44: this.applicationContext = applicationContext;
45: }
46:
47: }
|