001 /** 002 * Copyright 2005-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.edl.impl.config; 017 018 import org.kuali.rice.core.api.config.module.RunMode; 019 import org.kuali.rice.core.framework.config.module.ModuleConfigurer; 020 021 import javax.sql.DataSource; 022 import java.util.ArrayList; 023 import java.util.Arrays; 024 import java.util.List; 025 026 027 /** 028 * Configures the EDocLite module. 029 * 030 * @author Kuali Rice Team (rice.collab@kuali.org) 031 */ 032 public class EDLConfigurer extends ModuleConfigurer { 033 034 //public static final String EDL_DATASOURCE_OBJ = "edl.datasource"; 035 public static final String EDL_LOCAL_SPRING_FILE = "classpath:org/kuali/rice/edl/impl/config/EDLLocalSpringBeans.xml"; 036 private DataSource dataSource; 037 038 public EDLConfigurer() { 039 super("edl"); 040 setValidRunModes(Arrays.asList(RunMode.LOCAL)); 041 } 042 043 @Override 044 public List<String> getPrimarySpringFiles() { 045 final List<String> springFileLocations = new ArrayList<String>(); 046 if (RunMode.LOCAL.equals(getRunMode())) { 047 springFileLocations.add(EDL_LOCAL_SPRING_FILE); 048 } 049 050 return springFileLocations; 051 } 052 053 /*private List<String> getEmbeddedSpringFileLocation(){ 054 final List<String> springFileLocations = new ArrayList<String>(); 055 springFileLocations.add("classpath:org/kuali/rice/edl/impl/config/EDLSpringBeans.xml"); 056 springFileLocations.add("classpath:org/kuali/rice/edl/impl/config/EDLOJBSpringBeans.xml"); 057 return springFileLocations; 058 }*/ 059 060 /*@Override 061 public void addAdditonalToConfig() { 062 configureDataSource(); 063 }*/ 064 065 /*private void configureDataSource() { 066 if (getDataSource() != null) { 067 ConfigContext.getCurrentContextConfig().putObject(KEW_DATASOURCE_OBJ, getDataSource()); 068 } 069 }*/ 070 071 /* 072 @Override 073 public Collection<ResourceLoader> getResourceLoadersToRegister() throws Exception { 074 // create the plugin registry 075 PluginRegistry registry = null; 076 String pluginRegistryEnabled = ConfigContext.getCurrentContextConfig().getProperty("plugin.registry.enabled"); 077 if (!StringUtils.isBlank(pluginRegistryEnabled) && Boolean.valueOf(pluginRegistryEnabled).booleanValue()) { 078 registry = new PluginRegistryFactory().createPluginRegistry(); 079 } 080 081 final Collection<ResourceLoader> rls = new ArrayList<ResourceLoader>(); 082 for (ResourceLoader rl : RiceResourceLoaderFactory.getSpringResourceLoaders()) { 083 CoreResourceLoader coreResourceLoader = 084 new CoreResourceLoader(rl, registry); 085 coreResourceLoader.start(); 086 087 //wait until core resource loader is started to attach to GRL; this is so startup 088 //code can depend on other things hooked into GRL without incomplete KEW resources 089 //messing things up. 090 091 GlobalResourceLoader.addResourceLoader(coreResourceLoader); 092 093 // now start the plugin registry if there is one 094 if (registry != null) { 095 registry.start(); 096 // the registry resourceloader is now being handled by the CoreResourceLoader 097 //GlobalResourceLoader.addResourceLoader(registry); 098 } 099 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 }