View Javadoc

1   /**
2    * Copyright 2005-2011 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.krms.config;
17  
18  import org.kuali.rice.core.api.config.module.RunMode;
19  import org.kuali.rice.core.framework.config.module.ModuleConfigurer;
20  import org.kuali.rice.krms.api.KrmsConstants;
21  
22  import java.util.ArrayList;
23  import java.util.Arrays;
24  import java.util.List;
25  
26  /**
27   * This class handles the Spring based KRMS configuration that is part of the Rice Configurer that must 
28   * exist in all Rice based systems and clients. 
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class KRMSConfigurer extends ModuleConfigurer {
33  
34      private static final String KRMS_SPRING_LOCAL_BEANS_PATH = "classpath:org/kuali/rice/krms/config/KRMSLocalSpringBeans.xml";
35      private static final String KRMS_SPRING_REMOTE_BEANS_PATH = "classpath:org/kuali/rice/krms/config/KRMSRemoteSpringBeans.xml";
36  
37  	public KRMSConfigurer() {
38          super(KrmsConstants.Namespaces.MODULE_NAME);
39          setValidRunModes(Arrays.asList(RunMode.REMOTE, RunMode.LOCAL));
40      }
41  
42      @Override
43  	public List<String> getPrimarySpringFiles() {
44          List<String> springFileLocations = new ArrayList<String>();
45          if (RunMode.REMOTE == getRunMode()) {
46              springFileLocations.add(KRMS_SPRING_REMOTE_BEANS_PATH);
47          } else if (RunMode.LOCAL == getRunMode()) {
48              springFileLocations.add(KRMS_SPRING_LOCAL_BEANS_PATH);
49          }
50  		return springFileLocations;
51  	}
52  }