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.xml.spring;
017
018import static com.google.common.base.Preconditions.checkArgument;
019import static com.google.common.base.Preconditions.checkNotNull;
020
021import org.kuali.common.util.LocationUtils;
022import org.kuali.common.util.project.ProjectUtils;
023import org.kuali.common.util.project.model.ProjectResource;
024import org.kuali.rice.xml.project.XmlProjectConstants;
025
026/**
027 * Holds the Rice properties for the workflow XML ingestion process.
028 *
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031public enum RiceXmlProperties {
032
033    /**
034     * The database properties for the workflow XML ingestion process.
035     */
036        DB(ProjectResource.classpath(XmlProjectConstants.ID, "db.properties")),
037
038    /**
039     * The Rice application properties for the workflow XML ingestion process.
040     */
041        APP(ProjectResource.classpath(XmlProjectConstants.ID, "application-rice-properties.xml", true));
042
043    private final ProjectResource resource;
044
045        private RiceXmlProperties(ProjectResource resource) {
046                checkNotNull(resource, "'resource' cannot be null");
047                this.resource = resource;
048                String path = ProjectUtils.getPath(resource);
049                checkArgument(LocationUtils.exists(path), "[%s] does not exist", path);
050        }
051
052    /**
053     * Returns the {@link ProjectResource}.
054     *
055     * @return the {@link ProjectResource}
056     */
057        public ProjectResource getResource() {
058                return resource;
059        }
060
061}