View Javadoc

1   /*
2    * Copyright 2006-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  
17  package org.kuali.rice.shareddata.api.services;
18  
19  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20  import org.kuali.rice.shareddata.api.campus.CampusService;
21  import org.kuali.rice.shareddata.api.country.CountryService;
22  import org.kuali.rice.shareddata.api.county.CountyService;
23  import org.kuali.rice.shareddata.api.postalcode.PostalCodeService;
24  import org.kuali.rice.shareddata.api.state.StateService;
25  
26  public class SharedDataApiServiceLocator {
27      public static final String COUNTRY_SERVICE = "countryService";
28      public static final String CAMPUS_SERVICE = "campusService";
29      public static final String STATE_SERVICE = "stateService";
30      public static final String COUNTY_SERVICE = "countyService";
31      public static final String POSTAL_CODE_SERVICE = "postalCodeService";
32  
33      static <T> T getService(String serviceName) {
34          return GlobalResourceLoader.<T>getService(serviceName);
35      }
36  
37      public static CountryService getCountryService() {
38          return getService(COUNTRY_SERVICE);
39      }
40  
41      public static CampusService getCampusService() {
42          return getService(CAMPUS_SERVICE);
43      }
44  
45      public static StateService getStateService() {
46          return getService(STATE_SERVICE);
47      }
48  
49      public static CountyService getCountyService() {
50          return (CountyService) getService(COUNTY_SERVICE);
51      }
52  
53      public static PostalCodeService getPostalCodeService() {
54          return (PostalCodeService) getService(POSTAL_CODE_SERVICE);
55      }
56  }