View Javadoc

1   /**
2    * Copyright 2011-2013 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.maven.plugins.spring;
17  
18  import java.util.List;
19  
20  import org.apache.maven.plugins.annotations.Execute;
21  import org.apache.maven.plugins.annotations.Mojo;
22  import org.apache.maven.plugins.annotations.Parameter;
23  
24  /**
25   * Load a Spring context from an XML file.
26   */
27  @Mojo(name = MavenConstants.LOAD_XML_MOJO)
28  @Execute(goal = MavenConstants.LOAD_XML_MOJO)
29  public class LoadXmlMojo extends AbstractSpringMojo {
30  
31  	/**
32  	 * Location of a Spring context XML file. This can be a file on the local file system, or any URL Spring's Resource loading framework understands eg <br>
33  	 * If not provided, a context based on ${project.groupId} + ${project.artifactId} is used.<br>
34  	 * Given a groupId of <code>org.kuali.rice</code> and an artifactId of <code>rice-sampleapp</code> this mojo will load
35  	 * <code>classpath:org/kuali/rice/spring/rice-sampleapp-context.xml</code>
36  	 */
37  	@Parameter(property = "spring.location")
38  	String location;
39  
40  	/**
41  	 * This context registers a single <code>PropertySource</code> bean backed by Maven properties
42  	 */
43  	@Parameter(defaultValue = MavenConstants.DEFAULT_PROPERTY_SOURCES_LOCATION)
44  	String propertySourcesLocation = MavenConstants.DEFAULT_PROPERTY_SOURCES_LOCATION;
45  
46  	/**
47  	 * List of additional Spring context XML files to load (if any).
48  	 */
49  	@Parameter
50  	List<String> locations;
51  
52  	public String getLocation() {
53  		return location;
54  	}
55  
56  	public void setLocation(String location) {
57  		this.location = location;
58  	}
59  
60  	public String getPropertySourcesLocation() {
61  		return propertySourcesLocation;
62  	}
63  
64  	public void setPropertySourcesLocation(String propertySourcesLocation) {
65  		this.propertySourcesLocation = propertySourcesLocation;
66  	}
67  
68  	public List<String> getLocations() {
69  		return locations;
70  	}
71  
72  	public void setLocations(List<String> locations) {
73  		this.locations = locations;
74  	}
75  
76  }