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.location.api.services;
17  
18  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19  import org.kuali.rice.location.api.campus.CampusService;
20  import org.kuali.rice.location.api.country.CountryService;
21  import org.kuali.rice.location.api.county.CountyService;
22  import org.kuali.rice.location.api.postalcode.PostalCodeService;
23  import org.kuali.rice.location.api.state.StateService;
24  
25  /**
26   * <p>LocationApiServiceLocator class.</p>
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class LocationApiServiceLocator {
31      /** Constant <code>COUNTRY_SERVICE="countryService"</code> */
32      public static final String COUNTRY_SERVICE = "countryService";
33      /** Constant <code>CAMPUS_SERVICE="campusService"</code> */
34      public static final String CAMPUS_SERVICE = "campusService";
35      /** Constant <code>STATE_SERVICE="stateService"</code> */
36      public static final String STATE_SERVICE = "stateService";
37      /** Constant <code>COUNTY_SERVICE="countyService"</code> */
38      public static final String COUNTY_SERVICE = "countyService";
39      /** Constant <code>POSTAL_CODE_SERVICE="postalCodeService"</code> */
40      public static final String POSTAL_CODE_SERVICE = "postalCodeService";
41  
42      static <T> T getService(String serviceName) {
43          return GlobalResourceLoader.<T>getService(serviceName);
44      }
45  
46      /**
47       * <p>getCountryService.</p>
48       */
49      public static CountryService getCountryService() {
50          return getService(COUNTRY_SERVICE);
51      }
52  
53      /**
54       * <p>getCampusService.</p>
55       */
56      public static CampusService getCampusService() {
57          return getService(CAMPUS_SERVICE);
58      }
59  
60      /**
61       * <p>getStateService.</p>
62       */
63      public static StateService getStateService() {
64          return getService(STATE_SERVICE);
65      }
66  
67      /**
68       * <p>getCountyService.</p>
69       */
70      public static CountyService getCountyService() {
71          return (CountyService) getService(COUNTY_SERVICE);
72      }
73  
74      /**
75       * <p>getPostalCodeService.</p>
76       */
77      public static PostalCodeService getPostalCodeService() {
78          return (PostalCodeService) getService(POSTAL_CODE_SERVICE);
79      }
80  }