001/**
002 * Copyright 2005-2018 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.sql.spring;
017
018import java.util.List;
019
020import org.kuali.common.deploy.resources.RiceDeployProperties;
021import org.kuali.common.util.properties.Location;
022import org.kuali.common.util.properties.PropertiesLocationService;
023import org.kuali.common.util.properties.spring.PropertiesLocationServiceConfig;
024import org.springframework.beans.factory.annotation.Autowired;
025import org.springframework.context.annotation.Bean;
026import org.springframework.context.annotation.Configuration;
027import org.springframework.context.annotation.Import;
028
029import com.google.common.collect.ImmutableList;
030import com.google.common.collect.Lists;
031
032/**
033 * Defines the property locations for the database reset process.
034 *
035 * @author Kuali Rice Team (rice.collab@kuali.org)
036 */
037@Configuration
038@Import({ PropertiesLocationServiceConfig.class })
039public class SourceSqlPropertyLocationsConfig {
040
041    /**
042     * The property file locator.
043     */
044        @Autowired
045        PropertiesLocationService service;
046
047    /**
048     * Returns a list of locations of Rice properties to run the database reset process.
049     *
050     * @return a list of locations of Rice properties to run the database reset process
051     */
052        @Bean
053        public ImmutableList<Location> riceSourceSqlPropertyLocations() {
054                List<Location> locations = Lists.newArrayList();
055
056                locations.add(service.getLocation(RiceDeployProperties.DB.getResource()));
057                locations.add(service.getLocation(RiceDeployProperties.INIT_SOURCE_DB.getResource()));
058
059                return ImmutableList.copyOf(locations);
060        }
061
062}