1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.groovy.spring;
18
19 import javax.servlet.ServletContext;
20
21 import org.springframework.web.context.support.WebApplicationObjectSupport;
22
23 import COM.FutureTense.Interfaces.ICS;
24
25 import com.fatwire.gst.foundation.groovy.DiskGroovyLoader;
26 import com.fatwire.gst.foundation.groovy.GroovyLoader;
27
28
29
30
31
32
33
34
35
36
37
38 public class SpringDiskGroovyLoader extends WebApplicationObjectSupport implements GroovyLoader {
39 private DiskGroovyLoader groovyLoader;
40 private String configPath;
41 private int minimumRecompilationInterval = 0;
42
43 public SpringDiskGroovyLoader() {
44 super();
45
46 }
47
48
49
50
51
52
53
54 @Override
55 protected void initServletContext(ServletContext servletContext) {
56 groovyLoader = new DiskGroovyLoader();
57 groovyLoader.setConfigPath(configPath);
58 groovyLoader.setMinimumRecompilationInterval(minimumRecompilationInterval);
59 groovyLoader.bootEngine(getConfigPath());
60
61 }
62
63
64
65
66
67
68
69
70 @Override
71 public Object load(ICS ics,String name) throws Exception {
72
73 return groovyLoader.load(ics,name);
74 }
75
76
77
78
79 public String getConfigPath() {
80 return configPath;
81 }
82
83
84
85
86 public void setConfigPath(String configPath) {
87 this.configPath = configPath;
88 }
89
90
91
92
93 public int getMinimumRecompilationInterval() {
94 return minimumRecompilationInterval;
95 }
96
97
98
99
100
101
102
103
104 public void setMinimumRecompilationInterval(int minimumRecompilationInterval) {
105 this.minimumRecompilationInterval = minimumRecompilationInterval;
106
107 if (groovyLoader != null) {
108 groovyLoader.setMinimumRecompilationInterval(minimumRecompilationInterval);
109 }
110 }
111
112 }