01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.core;
18:
19: import org.apache.commons.lang.StringUtils;
20: import org.kuali.rice.core.Core;
21: import org.kuali.rice.lifecycle.BaseLifecycle;
22: import org.kuali.rice.resourceloader.GlobalResourceLoader;
23:
24: import edu.iu.uis.eden.SpringLoader;
25: import edu.iu.uis.eden.plugin.PluginRegistry;
26: import edu.iu.uis.eden.plugin.PluginRegistryFactory;
27:
28: /**
29: * Start the GlobalResourceLoader from the AppliationInitializeListener. When the KEW webapp starts up
30: *
31: * @author rkirkend
32: *
33: */
34: public class WebApplicationGlobalResourceLifecycle extends
35: BaseLifecycle {
36:
37: public void start() throws Exception {
38:
39: // create the plugin registry
40: PluginRegistry registry = null;
41: String pluginRegistryEnabled = Core.getCurrentContextConfig()
42: .getProperty("plugin.registry.enabled");
43: if (!StringUtils.isBlank(pluginRegistryEnabled)
44: && Boolean.valueOf(pluginRegistryEnabled)) {
45: registry = new PluginRegistryFactory()
46: .createPluginRegistry();
47: }
48:
49: CoreResourceLoader coreResourceLoader = new CoreResourceLoader(
50: SpringLoader.getInstance(), registry);
51: coreResourceLoader.start();
52:
53: //wait until core resource loader is started to attach to GRL; this is so startup
54: //code can depend on other things hooked into GRL without incomplete KEW resources
55: //messing things up.
56:
57: GlobalResourceLoader.addResourceLoaderFirst(coreResourceLoader);
58:
59: // now start the plugin registry if there is one
60: if (registry != null) {
61: registry.start();
62: GlobalResourceLoader.addResourceLoader(registry);
63: }
64:
65: super .start();
66: }
67:
68: public void stop() throws Exception {
69: GlobalResourceLoader.stop();
70: super.stop();
71: }
72: }
|