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.kim.config;
017    
018    import org.kuali.rice.core.api.config.module.RunMode;
019    import org.kuali.rice.core.framework.config.module.ModuleConfigurer;
020    import org.kuali.rice.core.framework.config.module.WebModuleConfiguration;
021    import org.kuali.rice.kim.api.KimApiConstants;
022    
023    import java.util.ArrayList;
024    import java.util.Arrays;
025    import java.util.List;
026    
027    /**
028     * This class handles the Spring based KIM configuration that is part of the Rice Configurer that must 
029     * exist in all Rice based systems and clients. 
030     * 
031     * @author Kuali Rice Team (rice.collab@kuali.org)
032     */
033    public class KIMConfigurer extends ModuleConfigurer {
034    
035            private static final String KIM_UI_SPRING_BEANS_PATH = "classpath:org/kuali/rice/kim/impl/config/KimWebSpringBeans.xml";
036    
037        public KIMConfigurer() {
038            super(KimApiConstants.Namespaces.MODULE_NAME);
039            setValidRunModes(Arrays.asList(RunMode.THIN, RunMode.REMOTE, RunMode.EMBEDDED, RunMode.LOCAL));
040        }
041    
042        @Override
043        protected String getDefaultConfigPackagePath() {
044            return "classpath:org/kuali/rice/kim/impl/config/";
045        }
046    
047        @Override
048            public List<String> getPrimarySpringFiles() {
049            List<String> springFileLocations = new ArrayList<String>();
050            if (RunMode.THIN == getRunMode()) {
051                springFileLocations.add(getDefaultConfigPackagePath() + "KimThinSpringBeans.xml");
052            } else if (RunMode.REMOTE == getRunMode()) {
053                springFileLocations.add(getDefaultConfigPackagePath() + "KimRemoteSpringBeans.xml");
054            } else if (RunMode.EMBEDDED == getRunMode()) {
055                springFileLocations.add(getDefaultConfigPackagePath() + "KimEmbeddedSpringBeans.xml");
056            } else if (RunMode.LOCAL == getRunMode()) {
057                springFileLocations.add(getDefaultConfigPackagePath() + "KimLocalSpringBeans.xml");
058            }
059                    return springFileLocations;
060            }
061    
062        @Override
063        public boolean hasWebInterface() {
064            return true;
065        }
066    
067        @Override
068        protected WebModuleConfiguration loadWebModule() {
069            WebModuleConfiguration configuration = super.loadWebModule();
070            configuration.setWebSpringFiles(Arrays.asList(KIM_UI_SPRING_BEANS_PATH));
071            return configuration;
072        }
073    }