View Javadoc
1   /**
2    * Copyright 2005-2015 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  package org.kuali.rice.xml.spring;
17  
18  import static com.google.common.base.Preconditions.checkArgument;
19  import static com.google.common.base.Preconditions.checkNotNull;
20  
21  import org.kuali.common.util.LocationUtils;
22  import org.kuali.common.util.project.ProjectUtils;
23  import org.kuali.common.util.project.model.ProjectResource;
24  import org.kuali.rice.xml.project.XmlProjectConstants;
25  
26  /**
27   * Holds the Rice properties for the workflow XML ingestion process.
28   *
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   */
31  public enum RiceXmlProperties {
32  
33      /**
34       * The database properties for the workflow XML ingestion process.
35       */
36  	DB(ProjectResource.classpath(XmlProjectConstants.ID, "db.properties")),
37  
38      /**
39       * The Rice application properties for the workflow XML ingestion process.
40       */
41  	APP(ProjectResource.classpath(XmlProjectConstants.ID, "application-rice-properties.xml", true));
42  
43      private final ProjectResource resource;
44  
45  	private RiceXmlProperties(ProjectResource resource) {
46  		checkNotNull(resource, "'resource' cannot be null");
47  		this.resource = resource;
48  		String path = ProjectUtils.getPath(resource);
49  		checkArgument(LocationUtils.exists(path), "[%s] does not exist", path);
50  	}
51  
52      /**
53       * Returns the {@link ProjectResource}.
54       *
55       * @return the {@link ProjectResource}
56       */
57  	public ProjectResource getResource() {
58  		return resource;
59  	}
60  
61  }