001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.location.api.services;
017
018import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
019import org.kuali.rice.location.api.campus.CampusService;
020import org.kuali.rice.location.api.country.CountryService;
021import org.kuali.rice.location.api.county.CountyService;
022import org.kuali.rice.location.api.postalcode.PostalCodeService;
023import org.kuali.rice.location.api.state.StateService;
024
025/**
026 * <p>LocationApiServiceLocator class.</p>
027 *
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030public class LocationApiServiceLocator {
031
032    public static final String COUNTRY_SERVICE = "countryService";
033
034    public static final String CAMPUS_SERVICE = "campusService";
035
036    public static final String STATE_SERVICE = "stateService";
037
038    public static final String COUNTY_SERVICE = "countyService";
039
040    public static final String POSTAL_CODE_SERVICE = "postalCodeService";
041
042    static <T> T getService(String serviceName) {
043        return GlobalResourceLoader.<T>getService(serviceName);
044    }
045
046    public static CountryService getCountryService() {
047        return getService(COUNTRY_SERVICE);
048    }
049
050    public static CampusService getCampusService() {
051        return getService(CAMPUS_SERVICE);
052    }
053
054    public static StateService getStateService() {
055        return getService(STATE_SERVICE);
056    }
057
058    public static CountyService getCountyService() {
059        return (CountyService) getService(COUNTY_SERVICE);
060    }
061
062    public static PostalCodeService getPostalCodeService() {
063        return (PostalCodeService) getService(POSTAL_CODE_SERVICE);
064    }
065    
066}