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