1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package tools.gsf.controller;
17
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 import COM.FutureTense.Interfaces.DependenciesAwareModelAndView;
22 import com.fatwire.assetapi.data.BaseController;
23 import tools.gsf.config.Factory;
24 import tools.gsf.config.FactoryLocator;
25 import tools.gsf.config.inject.Injector;
26 import tools.gsf.time.Stopwatch;
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 public class InjectingController extends BaseController {
43
44 private static final Logger LOG = LoggerFactory.getLogger(InjectingController.class);
45
46 public DependenciesAwareModelAndView handleRequest() {
47
48 if (LOG.isDebugEnabled()) {
49 LOG.debug("These are all the vars available inside InjectingController for the current ICS:");
50 java.util.Enumeration allVars = ics.GetVars();
51 while (allVars.hasMoreElements()) {
52 String varName = (String) allVars.nextElement();
53 LOG.debug("ICS variable " + varName + " = " + ics.GetVar(varName));
54 }
55 }
56
57 Factory factory = FactoryLocator.locateFactory(ics);
58
59 Stopwatch stopwatch = factory.getObject("stopwatch", Stopwatch.class);
60 stopwatch.start();
61
62 Injector injector = factory.getObject("compositeInjector", Injector.class);
63 injector.inject(this);
64 stopwatch.split("InjectingController: injecting into controller {}", this.getClass().getSimpleName());
65
66 DependenciesAwareModelAndView result = super.handleRequest();
67 stopwatch.elapsed("Executed controller {}", this.getClass().getSimpleName());
68
69 return result;
70 }
71 }