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.location.impl.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.location.api.LocationConstants;
21  
22  import java.util.ArrayList;
23  import java.util.Arrays;
24  import java.util.List;
25  
26  /**
27   * Allows for configuring a client to the "location" module in Kuali Rice.
28   *
29   * <p>The LocationConfigurer supports two run modes:
30   * <ol>
31   * <li>REMOTE - loads the client which interacts remotely with the location services</li>
32   * <li>LOCAL - loads the location service implementations and web components locally</li>
33   * </ol>
34   * </p>
35   *
36   * <p>Client applications should generally only use "remote" run mode (which is the default).</p>
37   *
38   * @author Kuali Rice Team (rice.collab@kuali.org)
39   */
40  public class LocationConfigurer extends ModuleConfigurer {
41  
42      public LocationConfigurer() {
43          super(LocationConstants.Namespaces.MODULE_NAME);
44          setValidRunModes(Arrays.asList(RunMode.REMOTE, RunMode.LOCAL));
45      }
46  
47      @Override
48      public List<String> getPrimarySpringFiles() {
49          LOG.info("LocationConfigurer:getPrimarySpringFiles: getRunMode => " + getRunMode());
50          List<String> springFileLocations = new ArrayList<String>();
51          if (RunMode.REMOTE == getRunMode()) {
52              springFileLocations.add(getDefaultConfigPackagePath() + "LocationRemoteSpringBeans.xml");
53          } else if (RunMode.LOCAL == getRunMode()) {
54              springFileLocations.add(getDefaultConfigPackagePath() + "LocationLocalSpringBeans.xml");
55          }
56          return springFileLocations;
57      }
58  
59  }