View Javadoc

1   /**
2    * Copyright 2005-2012 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  
32      public static final String COUNTRY_SERVICE = "countryService";
33  
34      public static final String CAMPUS_SERVICE = "campusService";
35  
36      public static final String STATE_SERVICE = "stateService";
37  
38      public static final String COUNTY_SERVICE = "countyService";
39  
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      public static CountryService getCountryService() {
47          return getService(COUNTRY_SERVICE);
48      }
49  
50      public static CampusService getCampusService() {
51          return getService(CAMPUS_SERVICE);
52      }
53  
54      public static StateService getStateService() {
55          return getService(STATE_SERVICE);
56      }
57  
58      public static CountyService getCountyService() {
59          return (CountyService) getService(COUNTY_SERVICE);
60      }
61  
62      public static PostalCodeService getPostalCodeService() {
63          return (PostalCodeService) getService(POSTAL_CODE_SERVICE);
64      }
65      
66  }