View Javadoc

1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.edl.impl.config;
17  
18  import org.kuali.rice.core.api.config.module.RunMode;
19  import org.kuali.rice.core.framework.config.module.ModuleConfigurer;
20  
21  import javax.sql.DataSource;
22  import java.util.ArrayList;
23  import java.util.Arrays;
24  import java.util.List;
25  
26  
27  /**
28   * Configures the EDocLite module. 
29   *
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class EDLConfigurer extends ModuleConfigurer {
33  
34  	//public static final String EDL_DATASOURCE_OBJ = "edl.datasource";
35      public static final String EDL_LOCAL_SPRING_FILE = "classpath:org/kuali/rice/edl/impl/config/EDLLocalSpringBeans.xml";
36  	private DataSource dataSource;
37  
38      public EDLConfigurer() {
39          super("edl");
40          setValidRunModes(Arrays.asList(RunMode.LOCAL));
41      }
42  
43  	@Override
44  	public List<String> getPrimarySpringFiles() {
45  		final List<String> springFileLocations = new ArrayList<String>();
46  		if (RunMode.LOCAL.equals(getRunMode())) {
47  			springFileLocations.add(EDL_LOCAL_SPRING_FILE);
48  		}
49  
50  		return springFileLocations;
51  	}
52  	
53      /*private List<String> getEmbeddedSpringFileLocation(){
54      	final List<String> springFileLocations = new ArrayList<String>();
55      	springFileLocations.add("classpath:org/kuali/rice/edl/impl/config/EDLSpringBeans.xml");
56        	springFileLocations.add("classpath:org/kuali/rice/edl/impl/config/EDLOJBSpringBeans.xml");
57      	return springFileLocations;
58      }*/
59  
60  	/*@Override
61  	public void addAdditonalToConfig() {
62  		configureDataSource();
63  	}*/
64  
65  	/*private void configureDataSource() {
66  		if (getDataSource() != null) {
67  			ConfigContext.getCurrentContextConfig().putObject(KEW_DATASOURCE_OBJ, getDataSource());
68  		}
69  	}*/
70  
71  	/*
72  	@Override
73  	public Collection<ResourceLoader> getResourceLoadersToRegister() throws Exception {
74  		// create the plugin registry
75  		PluginRegistry registry = null;
76  		String pluginRegistryEnabled = ConfigContext.getCurrentContextConfig().getProperty("plugin.registry.enabled");
77  		if (!StringUtils.isBlank(pluginRegistryEnabled) && Boolean.valueOf(pluginRegistryEnabled).booleanValue()) {
78  			registry = new PluginRegistryFactory().createPluginRegistry();
79  		}
80  
81  		final Collection<ResourceLoader> rls = new ArrayList<ResourceLoader>();
82  		for (ResourceLoader rl : RiceResourceLoaderFactory.getSpringResourceLoaders()) {
83  			CoreResourceLoader coreResourceLoader =
84  				new CoreResourceLoader(rl, registry);
85  			coreResourceLoader.start();
86  
87  			//wait until core resource loader is started to attach to GRL;  this is so startup
88  			//code can depend on other things hooked into GRL without incomplete KEW resources
89  			//messing things up.
90  
91  			GlobalResourceLoader.addResourceLoader(coreResourceLoader);
92  
93  			// now start the plugin registry if there is one
94  			if (registry != null) {
95  				registry.start();
96  				// the registry resourceloader is now being handled by the CoreResourceLoader
97  				//GlobalResourceLoader.addResourceLoader(registry);
98  			}
99  			rls.add(coreResourceLoader);
100 		}
101 
102 		return rls;
103 	}
104 
105 	private ClientProtocol getClientProtocol() {
106 		return ClientProtocol.valueOf(ConfigContext.getCurrentContextConfig().getProperty("client.protocol"));
107 	}
108 
109 	public DataSource getDataSource() {
110 		return dataSource;
111 	}
112 
113 	public void setDataSource(DataSource dataSource) {
114 		this.dataSource = dataSource;
115 	}
116 	*/
117 }